Add function xhci_dump

This commit is contained in:
songyanguang 2024-09-03 17:20:16 +08:00
parent 35b70a666c
commit df1a8fac3a
1 changed files with 52 additions and 0 deletions

View File

@ -666,6 +666,8 @@ int xhci_probe ( struct xhci_host *xhci, unsigned long baseaddr ) {
port->protocol = xhci_port_protocol ( xhci, i ); port->protocol = xhci_port_protocol ( xhci, i );
} }
xhci_dump(xhci);
return error; return error;
err_reset: err_reset:
@ -2977,6 +2979,56 @@ void xhci_event_process(struct xhci_host *xhci) {
} }
/* Dump host controller registers */
void xhci_dump(struct xhci_host *xhci){
unsigned int offset;
unsigned int i;
unsigned int interrupter;
for ( offset = 0 ; offset < 0x20 ; offset += 0x10 ) {
printf("%08lx: %08lx: ", xhci->cap_addr + offset, xhci->cap + offset );
for ( i = 0 ; i < 0x10 ; i += 0x04 ) {
printf("%08x ", readl ( xhci->cap_addr + offset + i) );
}
printf("\n");
}
printf("\n");
for ( offset = 0 ; offset < 0x3c ; offset += 0x10 ) {
printf("%08lx: %08lx: ", xhci->op_addr + offset, xhci->op + offset );
for ( i = 0 ; i < 0x10 ; i += 0x04 ) {
printf("%08x ", readl ( xhci->op_addr + offset + i) );
}
printf("\n");
}
for ( offset = XHCI_OP_PORTSC ( 1 ) ; offset <= XHCI_OP_PORTSC ( xhci->ports ) ; offset += 0x10 ) {
printf("%08lx: %08lx: ", xhci->op_addr + offset, xhci->op + offset );
for ( i = 0 ; i < 0x10 ; i += 0x04 ) {
printf("%08x ", readl ( xhci->op_addr + offset + i) );
}
printf("\n");
}
printf("\n");
printf("%08lx: %08lx: ", xhci->run_addr, xhci->run);
printf("%08x ", readl ( xhci->run_addr) );
printf("\n");
interrupter = 1;
for ( offset = 0x20 ; offset < 0x20 + (32 * interrupter) ; offset += 0x10 ) {
printf("%08lx: %08lx: ", xhci->run_addr + offset, xhci->run + offset );
for ( i = 0 ; i < 0x10 ; i += 0x04 ) {
printf("%08x ", readl ( xhci->run_addr + offset + i) );
}
printf("\n");
}
printf("\n");
printf("%08lx: %08lx: ", xhci->db_addr, xhci->db);
printf("%08x ", readl ( xhci->db_addr) );
printf("\n");
printf("\n");
}
/* Dump Port status */ /* Dump Port status */
void xhci_dump_port_status(uint32_t port, uint32_t portsc) { void xhci_dump_port_status(uint32_t port, uint32_t portsc) {
} }