root/include/asm-ppc/io.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. virt_to_bus
  2. bus_to_virt
  3. virt_to_phys
  4. phys_to_virt
  5. inb_p
  6. inw_p
  7. inl_p
  8. outb_p
  9. outw_p
  10. outl_p

   1 #ifndef _PPC_IO_H
   2 #define _PPC_IO_H
   3 
   4 /* Define the particulars of outb/outw/outl "instructions" */
   5 
   6 #define SLOW_DOWN_IO
   7 
   8 #ifndef PCI_DRAM_OFFSET
   9 #define PCI_DRAM_OFFSET  0x80000000
  10 #endif
  11 #ifndef KERNELBASE
  12 #define KERNELBASE 0x90000000
  13 #endif
  14 
  15 /*
  16  * The PCI bus is inherently Little-Endian.  The PowerPC is being
  17  * run Big-Endian.  Thus all values which cross the [PCI] barrier
  18  * must be endian-adjusted.  Also, the local DRAM has a different
  19  * address from the PCI point of view, thus buffer addresses also
  20  * have to be modified [mapped] appropriately.
  21  */
  22 extern inline unsigned long virt_to_bus(volatile void * address)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24         if (address == (void *)0) return 0;
  25         return ((unsigned long)((long)address - KERNELBASE + PCI_DRAM_OFFSET));
  26 }
  27 
  28 extern inline void * bus_to_virt(unsigned long address)
     /* [previous][next][first][last][top][bottom][index][help] */
  29 {
  30         if (address == 0) return 0;
  31         return ((void *)(address - PCI_DRAM_OFFSET + KERNELBASE));
  32 }
  33 /* #define virt_to_bus(a) ((unsigned long)(((char *)a==(char *) 0) ? ((char *)0) \
  34                         : ((char *)((long)a - KERNELBASE + PCI_DRAM_OFFSET))))
  35 #define bus_to_virt(a) ((void *) (((char *)a==(char *)0) ? ((char *)0) \
  36                         : ((char *)((long)a - PCI_DRAM_OFFSET + KERNELBASE))))
  37 */
  38 
  39 #define readb(addr) (*(volatile unsigned char *) (addr))
  40 #define readw(addr) (*(volatile unsigned short *) (addr))
  41 #define readl(addr) (*(volatile unsigned int *) (addr))
  42 
  43 #define writeb(b,addr) ((*(volatile unsigned char *) (addr)) = (b))
  44 #define writew(b,addr) ((*(volatile unsigned short *) (addr)) = (b))
  45 #define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b))
  46 
  47 /*
  48  * Change virtual addresses to physical addresses and vv.
  49  * These are trivial on the 1:1 Linux/i386 mapping (but if we ever
  50  * make the kernel segment mapped at 0, we need to do translation
  51  * on the i386 as well)
  52  */
  53 extern inline unsigned long virt_to_phys(volatile void * address)
     /* [previous][next][first][last][top][bottom][index][help] */
  54 {
  55         return (unsigned long) address;
  56 }
  57 
  58 extern inline void * phys_to_virt(unsigned long address)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60         return (void *) address;
  61 }
  62 
  63 /* from arch/ppc/kernel/port_io.c
  64  *               -- Cort
  65  */
  66 unsigned char inb(int port);
  67 unsigned short inw(int port);
  68 unsigned long inl(int port);
  69 unsigned char outb(unsigned char val,int port);
  70 unsigned short outw(unsigned short val,int port);
  71 unsigned long outl(unsigned long val,int port);
  72 void outsl(int port, long *ptr, int len);
  73 
  74 static inline unsigned char  inb_p(int port) {return (inb(port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  75 static inline unsigned short inw_p(int port) {return (inw(port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  76 static inline unsigned long  inl_p(int port) {return (inl(port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  77 
  78 
  79 
  80 static inline unsigned char  outb_p(unsigned char val,int port) { return (outb(val,port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  81 static inline unsigned short outw_p(unsigned short val,int port) { return (outw(val,port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  82 static inline unsigned long  outl_p(unsigned long val,int port) { return (outl(val,port)); }
     /* [previous][next][first][last][top][bottom][index][help] */
  83 
  84 
  85 
  86 #endif

/* [previous][next][first][last][top][bottom][index][help] */