Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
io.h File Reference
#include <linux/bug.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/types.h>
#include <asm/addrspace.h>
#include <asm/byteorder.h>
#include <mach/io.h>

Go to the source code of this file.

Macros

#define cached_to_phys(addr)   ((unsigned long)PHYSADDR(addr))
 
#define uncached_to_phys(addr)   ((unsigned long)PHYSADDR(addr))
 
#define phys_to_cached(addr)   ((void *)P1SEGADDR(addr))
 
#define phys_to_uncached(addr)   ((void *)P2SEGADDR(addr))
 
#define __io(p)   ((void *)phys_to_uncached(p))
 
#define SLOW_DOWN_IO   do { } while (0)
 
#define __BUILD_MEMORY_SINGLE(pfx, bwl, type)
 
#define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow)
 
#define __BUILD_MEMORY_PFX(bus, bwl, type)   __BUILD_MEMORY_SINGLE(bus, bwl, type)
 
#define BUILDIO_MEM(bwl, type)
 
#define __BUILD_IOPORT_PFX(bus, bwl, type)
 
#define BUILDIO_IOPORT(bwl, type)
 
#define readb_relaxed   readb
 
#define readw_relaxed   readw
 
#define readl_relaxed   readl
 
#define readb_be   __raw_readb
 
#define readw_be   __raw_readw
 
#define readl_be   __raw_readl
 
#define writeb_be   __raw_writeb
 
#define writew_be   __raw_writew
 
#define writel_be   __raw_writel
 
#define __BUILD_MEMORY_STRING(bwl, type)
 
#define __BUILD_IOPORT_STRING(bwl, type)
 
#define BUILDSTRING(bwl, type)
 
#define ioread8(p)   ((unsigned int)readb(p))
 
#define ioread16(p)   ((unsigned int)readw(p))
 
#define ioread16be(p)   ((unsigned int)__raw_readw(p))
 
#define ioread32(p)   ((unsigned int)readl(p))
 
#define ioread32be(p)   ((unsigned int)__raw_readl(p))
 
#define iowrite8(v, p)   writeb(v, p)
 
#define iowrite16(v, p)   writew(v, p)
 
#define iowrite16be(v, p)   __raw_writew(v, p)
 
#define iowrite32(v, p)   writel(v, p)
 
#define iowrite32be(v, p)   __raw_writel(v, p)
 
#define ioread8_rep(p, d, c)   readsb(p,d,c)
 
#define ioread16_rep(p, d, c)   readsw(p,d,c)
 
#define ioread32_rep(p, d, c)   readsl(p,d,c)
 
#define iowrite8_rep(p, s, c)   writesb(p,s,c)
 
#define iowrite16_rep(p, s, c)   writesw(p,s,c)
 
#define iowrite32_rep(p, s, c)   writesl(p,s,c)
 
#define mmiowb()
 
#define IO_SPACE_LIMIT   0xffffffff
 
#define ioremap(offset, size)   __ioremap((offset), (size), 0)
 
#define ioremap_nocache(offset, size)   __ioremap((offset), (size), 0)
 
#define iounmap(addr)   __iounmap(addr)
 
#define cached(addr)   P1SEGADDR(addr)
 
#define uncached(addr)   P2SEGADDR(addr)
 
#define virt_to_bus   virt_to_phys
 
#define bus_to_virt   phys_to_virt
 
#define page_to_bus   page_to_phys
 
#define bus_to_page   phys_to_page
 
#define ioport_map(port, nr)   ioremap(port, nr)
 
#define ioport_unmap(port)   iounmap(port)
 
#define xlate_dev_mem_ptr(p)   __va(p)
 
#define xlate_dev_kmem_ptr(p)   p
 

Functions

void __raw_writesb (void __iomem *addr, const void *data, int bytelen)
 
void __raw_writesw (void __iomem *addr, const void *data, int wordlen)
 
void __raw_writesl (void __iomem *addr, const void *data, int longlen)
 
void __raw_readsb (const void __iomem *addr, void *data, int bytelen)
 
void __raw_readsw (const void __iomem *addr, void *data, int wordlen)
 
void __raw_readsl (const void __iomem *addr, void *data, int longlen)
 
void __iomem__ioremap (unsigned long offset, size_t size, unsigned long flags)
 
void __iounmap (void __iomem *addr)
 

Macro Definition Documentation

#define __BUILD_IOPORT_PFX (   bus,
  bwl,
  type 
)
Value:
__BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO)

Definition at line 144 of file io.h.

#define __BUILD_IOPORT_SINGLE (   pfx,
  bwl,
  type,
  p,
  slow 
)
Value:
static inline void pfx##out##bwl##p(type val, unsigned long port) \
{ \
volatile type *__addr; \
\
__addr = __io(__swizzle_addr_##bwl(port)); \
__val = pfx##ioswab##bwl(__addr, val); \
BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
\
*__addr = __val; \
slow; \
} \
\
static inline type pfx##in##bwl##p(unsigned long port) \
{ \
volatile type *__addr; \
\
__addr = __io(__swizzle_addr_##bwl(port)); \
BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
\
__val = *__addr; \
slow; \
\
return pfx##ioswab##bwl(__addr, __val); \
}

Definition at line 107 of file io.h.

#define __BUILD_IOPORT_STRING (   bwl,
  type 
)
Value:
static inline void outs##bwl(unsigned long port, const void *data, \
unsigned int count) \
{ \
const type *__data = data; \
\
while (count--) \
__mem_out##bwl(*__data++, port); \
} \
\
static inline void ins##bwl(unsigned long port, void *data, \
unsigned int count) \
{ \
\
while (count--) \
*__data++ = __mem_in##bwl(port); \
}

Definition at line 191 of file io.h.

#define __BUILD_MEMORY_PFX (   bus,
  bwl,
  type 
)    __BUILD_MEMORY_SINGLE(bus, bwl, type)

Definition at line 137 of file io.h.

#define __BUILD_MEMORY_SINGLE (   pfx,
  bwl,
  type 
)
Value:
static inline void \
pfx##write##bwl(type val, volatile void __iomem *addr) \
{ \
volatile type *__addr; \
\
__addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
__val = pfx##ioswab##bwl(__addr, val); \
BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
\
*__addr = __val; \
} \
\
static inline type pfx##read##bwl(const volatile void __iomem *addr) \
{ \
volatile type *__addr; \
\
__addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
\
__val = *__addr; \
return pfx##ioswab##bwl(__addr, __val); \
}

Definition at line 79 of file io.h.

#define __BUILD_MEMORY_STRING (   bwl,
  type 
)
Value:
static inline void writes##bwl(volatile void __iomem *addr, \
const void *data, unsigned int count) \
{ \
const type *__data = data; \
\
while (count--) \
__mem_write##bwl(*__data++, addr); \
} \
\
static inline void reads##bwl(const volatile void __iomem *addr, \
void *data, unsigned int count) \
{ \
\
while (count--) \
*__data++ = __mem_read##bwl(addr); \
}

Definition at line 172 of file io.h.

#define __io (   p)    ((void *)phys_to_uncached(p))

Definition at line 70 of file io.h.

#define BUILDIO_IOPORT (   bwl,
  type 
)
Value:
__BUILD_IOPORT_PFX(__mem_, bwl, type)

Definition at line 148 of file io.h.

#define BUILDIO_MEM (   bwl,
  type 
)
Value:
__BUILD_MEMORY_PFX(__mem_, bwl, type)

Definition at line 140 of file io.h.

#define BUILDSTRING (   bwl,
  type 
)
Value:
__BUILD_IOPORT_STRING(bwl, type)

Definition at line 210 of file io.h.

#define bus_to_page   phys_to_page

Definition at line 300 of file io.h.

#define bus_to_virt   phys_to_virt

Definition at line 298 of file io.h.

#define cached (   addr)    P1SEGADDR(addr)

Definition at line 294 of file io.h.

#define cached_to_phys (   addr)    ((unsigned long)PHYSADDR(addr))

Definition at line 25 of file io.h.

#define IO_SPACE_LIMIT   0xffffffff

Definition at line 269 of file io.h.

#define ioport_map (   port,
  nr 
)    ioremap(port, nr)

Definition at line 307 of file io.h.

#define ioport_unmap (   port)    iounmap(port)

Definition at line 308 of file io.h.

#define ioread16 (   p)    ((unsigned int)readw(p))

Definition at line 225 of file io.h.

#define ioread16_rep (   p,
  d,
  c 
)    readsw(p,d,c)

Definition at line 240 of file io.h.

#define ioread16be (   p)    ((unsigned int)__raw_readw(p))

Definition at line 226 of file io.h.

#define ioread32 (   p)    ((unsigned int)readl(p))

Definition at line 228 of file io.h.

#define ioread32_rep (   p,
  d,
  c 
)    readsl(p,d,c)

Definition at line 241 of file io.h.

#define ioread32be (   p)    ((unsigned int)__raw_readl(p))

Definition at line 229 of file io.h.

#define ioread8 (   p)    ((unsigned int)readb(p))

Definition at line 223 of file io.h.

#define ioread8_rep (   p,
  d,
  c 
)    readsb(p,d,c)

Definition at line 239 of file io.h.

#define ioremap (   offset,
  size 
)    __ioremap((offset), (size), 0)

Definition at line 285 of file io.h.

#define ioremap_nocache (   offset,
  size 
)    __ioremap((offset), (size), 0)

Definition at line 288 of file io.h.

#define iounmap (   addr)    __iounmap(addr)

Definition at line 291 of file io.h.

#define iowrite16 (   v,
  p 
)    writew(v, p)

Definition at line 233 of file io.h.

#define iowrite16_rep (   p,
  s,
  c 
)    writesw(p,s,c)

Definition at line 244 of file io.h.

#define iowrite16be (   v,
  p 
)    __raw_writew(v, p)

Definition at line 234 of file io.h.

#define iowrite32 (   v,
  p 
)    writel(v, p)

Definition at line 236 of file io.h.

#define iowrite32_rep (   p,
  s,
  c 
)    writesl(p,s,c)

Definition at line 245 of file io.h.

#define iowrite32be (   v,
  p 
)    __raw_writel(v, p)

Definition at line 237 of file io.h.

#define iowrite8 (   v,
  p 
)    writeb(v, p)

Definition at line 231 of file io.h.

#define iowrite8_rep (   p,
  s,
  c 
)    writesb(p,s,c)

Definition at line 243 of file io.h.

#define mmiowb ( )

Definition at line 267 of file io.h.

#define page_to_bus   page_to_phys

Definition at line 299 of file io.h.

#define phys_to_cached (   addr)    ((void *)P1SEGADDR(addr))

Definition at line 27 of file io.h.

#define phys_to_uncached (   addr)    ((void *)P2SEGADDR(addr))

Definition at line 28 of file io.h.

#define readb_be   __raw_readb

Definition at line 164 of file io.h.

#define readb_relaxed   readb

Definition at line 160 of file io.h.

#define readl_be   __raw_readl

Definition at line 166 of file io.h.

#define readl_relaxed   readl

Definition at line 162 of file io.h.

#define readw_be   __raw_readw

Definition at line 165 of file io.h.

#define readw_relaxed   readw

Definition at line 161 of file io.h.

#define SLOW_DOWN_IO   do { } while (0)

Definition at line 77 of file io.h.

#define uncached (   addr)    P2SEGADDR(addr)

Definition at line 295 of file io.h.

#define uncached_to_phys (   addr)    ((unsigned long)PHYSADDR(addr))

Definition at line 26 of file io.h.

#define virt_to_bus   virt_to_phys

Definition at line 297 of file io.h.

#define writeb_be   __raw_writeb

Definition at line 168 of file io.h.

#define writel_be   __raw_writel

Definition at line 170 of file io.h.

#define writew_be   __raw_writew

Definition at line 169 of file io.h.

#define xlate_dev_kmem_ptr (   p)    p

Definition at line 319 of file io.h.

#define xlate_dev_mem_ptr (   p)    __va(p)

Definition at line 314 of file io.h.

Function Documentation

void __iomem* __ioremap ( unsigned long  offset,
size_t  size,
unsigned long  flags 
)

Definition at line 22 of file ioremap.c.

void __iounmap ( void __iomem addr)

Definition at line 76 of file ioremap.c.

void __raw_readsb ( const void __iomem addr,
void data,
int  bytelen 
)
void __raw_readsl ( const void __iomem addr,
void data,
int  longlen 
)

Definition at line 65 of file io.c.

void __raw_readsw ( const void __iomem addr,
void data,
int  wordlen 
)

Definition at line 31 of file io.c.

void __raw_writesb ( void __iomem addr,
const void data,
int  bytelen 
)
void __raw_writesl ( void __iomem addr,
const void data,
int  longlen 
)

Definition at line 79 of file io.c.

void __raw_writesw ( void __iomem addr,
const void data,
int  wordlen 
)

Definition at line 50 of file io.c.