Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
ccio-dma.c File Reference
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/pci.h>
#include <linux/reboot.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/scatterlist.h>
#include <linux/iommu-helper.h>
#include <linux/export.h>
#include <asm/byteorder.h>
#include <asm/cache.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/parisc-device.h>
#include <asm/runway.h>
#include "iommu-helpers.h"

Go to the source code of this file.

Data Structures

struct  ioa_registers
 
struct  ioc
 

Macros

#define MODULE_NAME   "ccio"
 
#define DBG_INIT(x...)
 
#define DBG_RUN(x...)
 
#define DBG_RES(x...)
 
#define DBG_RUN_SG(x...)
 
#define CCIO_INLINE   inline
 
#define WRITE_U32(value, addr)   __raw_writel(value, addr)
 
#define READ_U32(addr)   __raw_readl(addr)
 
#define U2_IOA_RUNWAY   0x580
 
#define U2_BC_GSC   0x501
 
#define UTURN_IOA_RUNWAY   0x581
 
#define UTURN_BC_GSC   0x502
 
#define IOA_NORMAL_MODE   0x00020080 /* IO_CONTROL to turn on CCIO */
 
#define CMD_TLB_DIRECT_WRITE   35 /* IO_COMMAND for I/O TLB Writes */
 
#define CMD_TLB_PURGE   33 /* IO_COMMAND to Purge I/O TLB entry */
 
#define IOVP_SIZE   PAGE_SIZE
 
#define IOVP_SHIFT   PAGE_SHIFT
 
#define IOVP_MASK   PAGE_MASK
 
#define CCIO_IOVA(iovp, offset)   ((iovp) | (offset))
 
#define CCIO_IOVP(iova)   ((iova) & IOVP_MASK)
 
#define PDIR_INDEX(iovp)   ((iovp)>>IOVP_SHIFT)
 
#define MKIOVP(pdir_idx)   ((long)(pdir_idx) << IOVP_SHIFT)
 
#define MKIOVA(iovp, offset)   (dma_addr_t)((long)iovp | (long)offset)
 
#define CCIO_SEARCH_LOOP(ioc, res_idx, mask, size)
 
#define CCIO_FIND_FREE_MAPPING(ioa, res_idx, mask, size)
 
#define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size)
 
#define KERNEL_SPACE   0
 
#define IOPDIR_VALID   0x01UL
 
#define HINT_SAFE_DMA   0x02UL /* used for pci_alloc_consistent() pages */
 
#define HINT_STOP_MOST   0x00UL /* only needed for "some EISA devices" */
 
#define HINT_UDPATE_ENB   0x08UL /* not used/supported by U2 */
 
#define HINT_PREFETCH   0x10UL /* for outbound pages which are not SAFE */
 
#define PIDE_FLAG   0x80000000UL
 
#define CUJO_20_STEP   0x10000000 /* inc upper nibble */
 
#define CCIO_CHAINID_SHIFT   8
 
#define CCIO_CHAINID_MASK   0xff
 

Typedefs

typedef unsigned long space_t
 

Functions

voidccio_get_iommu (const struct parisc_device *dev)
 
void ccio_cujo20_fixup (struct parisc_device *cujo, u32 iovp)
 
int ccio_allocate_resource (const struct parisc_device *dev, struct resource *res, unsigned long size, unsigned long min, unsigned long max, unsigned long align)
 
int ccio_request_resource (const struct parisc_device *dev, struct resource *res)
 
void __init ccio_init (void)
 

Macro Definition Documentation

#define CCIO_CHAINID_MASK   0xff

Definition at line 1226 of file ccio-dma.c.

#define CCIO_CHAINID_SHIFT   8

Definition at line 1225 of file ccio-dma.c.

#define CCIO_FIND_FREE_MAPPING (   ioa,
  res_idx,
  mask,
  size 
)
Value:
u##size *res_ptr = (u##size *)&((ioc)->res_map[ioa->res_hint & ~((size >> 3) - 1)]); \
u##size *res_end = (u##size *)&(ioc)->res_map[ioa->res_size]; \
CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
res_ptr = (u##size *)&(ioc)->res_map[0]; \
CCIO_SEARCH_LOOP(ioa, res_idx, mask, size);

Definition at line 309 of file ccio-dma.c.

#define CCIO_FREE_MAPPINGS (   ioc,
  res_idx,
  mask,
  size 
)
Value:
u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
BUG_ON((*res_ptr & mask) != mask); \
*res_ptr &= ~(mask);

Definition at line 417 of file ccio-dma.c.

#define CCIO_INLINE   inline

Definition at line 100 of file ccio-dma.c.

#define CCIO_IOVA (   iovp,
  offset 
)    ((iovp) | (offset))

Definition at line 283 of file ccio-dma.c.

#define CCIO_IOVP (   iova)    ((iova) & IOVP_MASK)

Definition at line 284 of file ccio-dma.c.

#define CCIO_SEARCH_LOOP (   ioc,
  res_idx,
  mask,
  size 
)
Value:
for(; res_ptr < res_end; ++res_ptr) { \
int ret;\
unsigned int idx;\
idx = (unsigned int)((unsigned long)res_ptr - (unsigned long)ioc->res_map); \
ret = iommu_is_span_boundary(idx << 3, pages_needed, 0, boundary_size);\
if ((0 == (*res_ptr & mask)) && !ret) { \
*res_ptr |= mask; \
res_idx = idx;\
ioc->res_hint = res_idx + (size >> 3); \
goto resource_found; \
} \
}

Definition at line 295 of file ccio-dma.c.

#define CMD_TLB_DIRECT_WRITE   35 /* IO_COMMAND for I/O TLB Writes */

Definition at line 110 of file ccio-dma.c.

#define CMD_TLB_PURGE   33 /* IO_COMMAND to Purge I/O TLB entry */

Definition at line 111 of file ccio-dma.c.

#define CUJO_20_STEP   0x10000000 /* inc upper nibble */

Definition at line 1178 of file ccio-dma.c.

#define DBG_INIT (   x...)

Definition at line 79 of file ccio-dma.c.

#define DBG_RES (   x...)

Definition at line 91 of file ccio-dma.c.

#define DBG_RUN (   x...)

Definition at line 85 of file ccio-dma.c.

#define DBG_RUN_SG (   x...)

Definition at line 97 of file ccio-dma.c.

#define HINT_PREFETCH   0x10UL /* for outbound pages which are not SAFE */

Definition at line 513 of file ccio-dma.c.

#define HINT_SAFE_DMA   0x02UL /* used for pci_alloc_consistent() pages */

Definition at line 506 of file ccio-dma.c.

#define HINT_STOP_MOST   0x00UL /* only needed for "some EISA devices" */

Definition at line 510 of file ccio-dma.c.

#define HINT_UDPATE_ENB   0x08UL /* not used/supported by U2 */

Definition at line 512 of file ccio-dma.c.

#define IOA_NORMAL_MODE   0x00020080 /* IO_CONTROL to turn on CCIO */

Definition at line 109 of file ccio-dma.c.

#define IOPDIR_VALID   0x01UL

Definition at line 505 of file ccio-dma.c.

#define IOVP_MASK   PAGE_MASK

Definition at line 280 of file ccio-dma.c.

#define IOVP_SHIFT   PAGE_SHIFT

Definition at line 279 of file ccio-dma.c.

#define IOVP_SIZE   PAGE_SIZE

Definition at line 278 of file ccio-dma.c.

#define KERNEL_SPACE   0

Definition at line 477 of file ccio-dma.c.

#define MKIOVA (   iovp,
  offset 
)    (dma_addr_t)((long)iovp | (long)offset)

Definition at line 288 of file ccio-dma.c.

#define MKIOVP (   pdir_idx)    ((long)(pdir_idx) << IOVP_SHIFT)

Definition at line 287 of file ccio-dma.c.

#define MODULE_NAME   "ccio"

Definition at line 62 of file ccio-dma.c.

#define PDIR_INDEX (   iovp)    ((iovp)>>IOVP_SHIFT)

Definition at line 286 of file ccio-dma.c.

#define PIDE_FLAG   0x80000000UL

Definition at line 884 of file ccio-dma.c.

#define READ_U32 (   addr)    __raw_readl(addr)

Definition at line 102 of file ccio-dma.c.

#define U2_BC_GSC   0x501

Definition at line 105 of file ccio-dma.c.

#define U2_IOA_RUNWAY   0x580

Definition at line 104 of file ccio-dma.c.

#define UTURN_BC_GSC   0x502

Definition at line 107 of file ccio-dma.c.

#define UTURN_IOA_RUNWAY   0x581

Definition at line 106 of file ccio-dma.c.

#define WRITE_U32 (   value,
  addr 
)    __raw_writel(value, addr)

Definition at line 101 of file ccio-dma.c.

Typedef Documentation

typedef unsigned long space_t

Definition at line 476 of file ccio-dma.c.

Function Documentation

int ccio_allocate_resource ( const struct parisc_device dev,
struct resource res,
unsigned long  size,
unsigned long  min,
unsigned long  max,
unsigned long  align 
)

Definition at line 1468 of file ccio-dma.c.

void ccio_cujo20_fixup ( struct parisc_device cujo,
u32  iovp 
)

Definition at line 1184 of file ccio-dma.c.

void* ccio_get_iommu ( const struct parisc_device dev)

ccio_get_iommu - Find the iommu which controls this device : The parisc device.

This function searches through the registered IOMMU's and returns the appropriate IOMMU for the device based on its hardware path.

Definition at line 1169 of file ccio-dma.c.

void __init ccio_init ( void  )

ccio_init - ccio initialization procedure.

Register this driver.

Definition at line 1591 of file ccio-dma.c.

int ccio_request_resource ( const struct parisc_device dev,
struct resource res 
)

Definition at line 1506 of file ccio-dma.c.