This source file includes following definitions.
- virt_to_bus
- bus_to_virt
- virt_to_phys
- phys_to_virt
- inb_p
- inw_p
- inl_p
- outb_p
- outw_p
- outl_p
1 #ifndef _PPC_IO_H
2 #define _PPC_IO_H
3
4
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
17
18
19
20
21
22 extern inline unsigned long virt_to_bus(volatile void * address)
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)
29 {
30 if (address == 0) return 0;
31 return ((void *)(address - PCI_DRAM_OFFSET + KERNELBASE));
32 }
33
34
35
36
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
49
50
51
52
53 extern inline unsigned long virt_to_phys(volatile void * address)
54 {
55 return (unsigned long) address;
56 }
57
58 extern inline void * phys_to_virt(unsigned long address)
59 {
60 return (void *) address;
61 }
62
63
64
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)); }
75 static inline unsigned short inw_p(int port) {return (inw(port)); }
76 static inline unsigned long inl_p(int port) {return (inl(port)); }
77
78
79
80 static inline unsigned char outb_p(unsigned char val,int port) { return (outb(val,port)); }
81 static inline unsigned short outw_p(unsigned short val,int port) { return (outw(val,port)); }
82 static inline unsigned long outl_p(unsigned long val,int port) { return (outl(val,port)); }
83
84
85
86 #endif