|
@@ -72,13 +72,46 @@ static inline void iounmap(void *virt_addr __unused)
|
72
|
72
|
* differently. On the x86 architecture, we just read/write the
|
73
|
73
|
* memory location directly.
|
74
|
74
|
*/
|
75
|
|
-#define readb(addr) (*(volatile uint8_t *) (addr))
|
76
|
|
-#define readw(addr) (*(volatile uint16_t *) (addr))
|
77
|
|
-#define readl(addr) (*(volatile uint32_t *) (addr))
|
78
|
|
-
|
79
|
|
-#define writeb(b,addr) ((*(volatile uint8_t *) (addr)) = (b))
|
80
|
|
-#define writew(b,addr) ((*(volatile uint16_t *) (addr)) = (b))
|
81
|
|
-#define writel(b,addr) ((*(volatile uint32_t *) (addr)) = (b))
|
|
75
|
+static inline __attribute__ (( always_inline )) unsigned long
|
|
76
|
+_readb ( volatile uint8_t *addr ) {
|
|
77
|
+ unsigned long data = *addr;
|
|
78
|
+ DBGIO ( "[%08lx] => %02lx\n", virt_to_phys ( addr ), data );
|
|
79
|
+ return data;
|
|
80
|
+}
|
|
81
|
+static inline __attribute__ (( always_inline )) unsigned long
|
|
82
|
+_readw ( volatile uint16_t *addr ) {
|
|
83
|
+ unsigned long data = *addr;
|
|
84
|
+ DBGIO ( "[%08lx] => %04lx\n", virt_to_phys ( addr ), data );
|
|
85
|
+ return data;
|
|
86
|
+}
|
|
87
|
+static inline __attribute__ (( always_inline )) unsigned long
|
|
88
|
+_readl ( volatile uint32_t *addr ) {
|
|
89
|
+ unsigned long data = *addr;
|
|
90
|
+ DBGIO ( "[%08lx] => %08lx\n", virt_to_phys ( addr ), data );
|
|
91
|
+ return data;
|
|
92
|
+}
|
|
93
|
+#define readb( addr ) _readb ( ( volatile uint8_t * ) (addr) )
|
|
94
|
+#define readw( addr ) _readw ( ( volatile uint16_t * ) (addr) )
|
|
95
|
+#define readl( addr ) _readl ( ( volatile uint32_t * ) (addr) )
|
|
96
|
+
|
|
97
|
+static inline __attribute__ (( always_inline )) void
|
|
98
|
+_writeb ( unsigned long data, volatile uint8_t *addr ) {
|
|
99
|
+ DBGIO ( "[%08lx] <= %02lx\n", virt_to_phys ( addr ), data );
|
|
100
|
+ *addr = data;
|
|
101
|
+}
|
|
102
|
+static inline __attribute__ (( always_inline )) void
|
|
103
|
+_writew ( unsigned long data, volatile uint16_t *addr ) {
|
|
104
|
+ DBGIO ( "[%08lx] <= %04lx\n", virt_to_phys ( addr ), data );
|
|
105
|
+ *addr = data;
|
|
106
|
+}
|
|
107
|
+static inline __attribute__ (( always_inline )) void
|
|
108
|
+_writel ( unsigned long data, volatile uint32_t *addr ) {
|
|
109
|
+ DBGIO ( "[%08lx] <= %08lx\n", virt_to_phys ( addr ), data );
|
|
110
|
+ *addr = data;
|
|
111
|
+}
|
|
112
|
+#define writeb( b, addr ) _writeb ( (b), ( volatile uint8_t * ) (addr) )
|
|
113
|
+#define writew( b, addr ) _writew ( (b), ( volatile uint16_t * ) (addr) )
|
|
114
|
+#define writel( b, addr ) _writel ( (b), ( volatile uint32_t * ) (addr) )
|
82
|
115
|
|
83
|
116
|
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
|
84
|
117
|
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
|