summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include/io.h
diff options
context:
space:
mode:
authorMichael Brown2008-02-21 13:39:00 +0100
committerMichael Brown2008-02-21 13:44:09 +0100
commit604c934981618bb2125318b3aa9cbbbde7707fc5 (patch)
treee54de308223279cc083266c0503746f176d7f88f /src/arch/i386/include/io.h
parentRemove reference to COFF support. I can find no trace of ever having support... (diff)
downloadipxe-604c934981618bb2125318b3aa9cbbbde7707fc5.tar.gz
ipxe-604c934981618bb2125318b3aa9cbbbde7707fc5.tar.xz
ipxe-604c934981618bb2125318b3aa9cbbbde7707fc5.zip
Add DBGLVL_IO to trace all memory-mapped I/O.
Diffstat (limited to 'src/arch/i386/include/io.h')
-rw-r--r--src/arch/i386/include/io.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/src/arch/i386/include/io.h b/src/arch/i386/include/io.h
index 46b8a1fb..c26fdf7e 100644
--- a/src/arch/i386/include/io.h
+++ b/src/arch/i386/include/io.h
@@ -72,13 +72,46 @@ static inline void iounmap(void *virt_addr __unused)
* differently. On the x86 architecture, we just read/write the
* memory location directly.
*/
-#define readb(addr) (*(volatile uint8_t *) (addr))
-#define readw(addr) (*(volatile uint16_t *) (addr))
-#define readl(addr) (*(volatile uint32_t *) (addr))
-
-#define writeb(b,addr) ((*(volatile uint8_t *) (addr)) = (b))
-#define writew(b,addr) ((*(volatile uint16_t *) (addr)) = (b))
-#define writel(b,addr) ((*(volatile uint32_t *) (addr)) = (b))
+static inline __attribute__ (( always_inline )) unsigned long
+_readb ( volatile uint8_t *addr ) {
+ unsigned long data = *addr;
+ DBGIO ( "[%08lx] => %02lx\n", virt_to_phys ( addr ), data );
+ return data;
+}
+static inline __attribute__ (( always_inline )) unsigned long
+_readw ( volatile uint16_t *addr ) {
+ unsigned long data = *addr;
+ DBGIO ( "[%08lx] => %04lx\n", virt_to_phys ( addr ), data );
+ return data;
+}
+static inline __attribute__ (( always_inline )) unsigned long
+_readl ( volatile uint32_t *addr ) {
+ unsigned long data = *addr;
+ DBGIO ( "[%08lx] => %08lx\n", virt_to_phys ( addr ), data );
+ return data;
+}
+#define readb( addr ) _readb ( ( volatile uint8_t * ) (addr) )
+#define readw( addr ) _readw ( ( volatile uint16_t * ) (addr) )
+#define readl( addr ) _readl ( ( volatile uint32_t * ) (addr) )
+
+static inline __attribute__ (( always_inline )) void
+_writeb ( unsigned long data, volatile uint8_t *addr ) {
+ DBGIO ( "[%08lx] <= %02lx\n", virt_to_phys ( addr ), data );
+ *addr = data;
+}
+static inline __attribute__ (( always_inline )) void
+_writew ( unsigned long data, volatile uint16_t *addr ) {
+ DBGIO ( "[%08lx] <= %04lx\n", virt_to_phys ( addr ), data );
+ *addr = data;
+}
+static inline __attribute__ (( always_inline )) void
+_writel ( unsigned long data, volatile uint32_t *addr ) {
+ DBGIO ( "[%08lx] <= %08lx\n", virt_to_phys ( addr ), data );
+ *addr = data;
+}
+#define writeb( b, addr ) _writeb ( (b), ( volatile uint8_t * ) (addr) )
+#define writew( b, addr ) _writew ( (b), ( volatile uint16_t * ) (addr) )
+#define writel( b, addr ) _writel ( (b), ( volatile uint32_t * ) (addr) )
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))