Add xhci_dump_port_status_debug

This commit is contained in:
songyanguang 2024-09-04 17:27:28 +08:00
parent 636d4bf8c8
commit 86e600ba5e
2 changed files with 18 additions and 3 deletions

View File

@ -23,6 +23,7 @@ Modification: rndis uses naive_mmap to assign virtual and physical addresses and
#include "usb_def.h"
#include "usyscall.h"
extern void xhci_dump_port_status_debug(int id); //Debugging function
#define DEV_FORMAT "/usb%d/hub%d"
@ -696,8 +697,9 @@ static void usbh_hub_thread(void *argument)
usb_hc_init(usb->id);
while (1) {
USB_LOG_DBG("wait event of mq@%p \r\n", usb->hub_mq);
ret = usb_osal_mq_recv(usb->hub_mq, (void *)&hub, 0x7fffffff);
ret = usb_osal_mq_recv(usb->hub_mq, (void *)&hub, 10000);
if (ret <= 0) {
xhci_dump_port_status_debug(usb->id);
continue;
}
USB_LOG_DBG("handle event of hub@%p \r\n", hub);

View File

@ -666,8 +666,6 @@ int xhci_probe ( struct xhci_host *xhci, unsigned long baseaddr ) {
port->protocol = xhci_port_protocol ( xhci, i );
}
xhci_dump(xhci);
return error;
err_reset:
@ -1271,6 +1269,8 @@ int xhci_open ( struct xhci_host *xhci ) {
/* Start controller */
xhci_run ( xhci );
xhci_dump(xhci);
return 0;
xhci_stop ( xhci );
@ -3072,6 +3072,19 @@ void xhci_dump(struct xhci_host *xhci){
/* Dump Port status */
void xhci_dump_port_status(uint32_t port, uint32_t portsc) {
USB_LOG_DBG("XHCI port %d portsc %08x\n", port, portsc );
}
//Debugging function
void xhci_dump_port_status_debug(int id) {
uint32_t portsc;
struct usbh_bus *bus = usbh_get_bus_of_index(id);
struct xhci_host *xhci = (struct xhci_host *)bus->priv;
USB_LOG_DBG("xhci_status_debug xhci->op_addr + port1 = %08lx\n", xhci->op_addr + XHCI_OP_PORTSC ( 1 ));
portsc = readl ( xhci->op_addr + XHCI_OP_PORTSC ( 1 ) );
USB_LOG_DBG("xhci_status_debug port=1 portsc=%08x\n", portsc);
portsc = readl ( xhci->op_addr + XHCI_OP_PORTSC ( 2 ) );
USB_LOG_DBG("xhci_status_debug port=2 portsc=%08x\n", portsc);
}
/* Dump input context */