Add DBGLVL_IO to trace all memory-mapped I/O.
This commit is contained in:
parent
b87904ab20
commit
604c934981
|
@ -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))
|
||||
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) )
|
||||
|
||||
#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 )) 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))
|
||||
|
|
|
@ -144,6 +144,8 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
|
|||
#define DBG_EXTRA ( DBGLVL & DBGLVL_EXTRA )
|
||||
#define DBGLVL_PROFILE 4
|
||||
#define DBG_PROFILE ( DBGLVL & DBGLVL_PROFILE )
|
||||
#define DBGLVL_IO 8
|
||||
#define DBG_IO ( DBGLVL & DBGLVL_IO )
|
||||
|
||||
/**
|
||||
* Print debugging message if we are at a certain debug level
|
||||
|
@ -262,6 +264,15 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
|
|||
#define DBGCP_HDA( ... ) DBGC_HDA_IF ( PROFILE, __VA_ARGS__ )
|
||||
#define DBGCP_HD( ... ) DBGC_HD_IF ( PROFILE, __VA_ARGS__ )
|
||||
|
||||
/* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( IO, ... )*/
|
||||
|
||||
#define DBGIO( ... ) DBG_IF ( IO, __VA_ARGS__ )
|
||||
#define DBGIO_HDA( ... ) DBG_HDA_IF ( IO, __VA_ARGS__ )
|
||||
#define DBGIO_HD( ... ) DBG_HD_IF ( IO, __VA_ARGS__ )
|
||||
#define DBGCIO( ... ) DBGC_IF ( IO, __VA_ARGS__ )
|
||||
#define DBGCIO_HDA( ... ) DBGC_HDA_IF ( IO, __VA_ARGS__ )
|
||||
#define DBGCIO_HD( ... ) DBGC_HD_IF ( IO, __VA_ARGS__ )
|
||||
|
||||
|
||||
#if DEBUG_SYMBOL == 0
|
||||
#define NDEBUG
|
||||
|
|
Reference in New Issue