[Bug] [cherryusb] [EHCI] 未刷新SETUP包缓存,导致enumerate fail
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- embedded-iot, operating-systems
Direzione di ricerca
Inizia individuando usbh_submit_urb e il percorso CONFIG_USB_EHCI_DESC_DCACHE_ENABLE, quindi confronta i log di enumerazione EHCI non riuscita e riuscita su N9H30. Verifica che le richieste di configurazione enumerino correttamente il dispositivo con la gestione della cache dati abilitata, senza introdurre regressioni nelle altre trasferte USB.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
RT-Thread Version
v5.2.2
Affected area
Device drivers
Hardware/BSP vendor
Nuvoton
Architecture
ARM / AArch64
Board and hardware details
N9H30
Develop Toolchain
GCC
Describe the bug
未刷新 SETUP 包缓存前
-
LOG
[I/USB] EHCI HCIVERSION:0x0095
[I/USB] EHCI HCSPARAMS:0x000012
[I/USB] EHCI HCCPARAMS:0x0000
[I/USB] EHCI ppc:1, n_ports:2, n_cc:0, n_pcc:0
[I/USB] EHCI uses tt for ls/fs device
[D/usbh_hub] Port change:0x04
[D/usbh_hub] Port change:0x04
[D/usbh_hub] Port 2 change
[D/usbh_hub] port 2, status:0x101, change:0x01
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x503, change:0x02
[I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 2 connected
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/usbh_core] Device rev=0200 cls=09 sub=00 proto=02 size=64
[D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0002, wIndex 0x0000, wLength 0x0000
[W/usbh_core] Control transfer failed, errorcode -9, retrying...
[W/usbh_core] Control transfer failed, errorcode -9, retrying...
[E/usbh_core] Failed to set devaddr,errorcode:-9
[I/usbh_core] Device on Bus 0, Hub 1, Port 2 disconnected
[E/usbh_hub] Port 2 enumerate fail
刷新 SETUP 包缓存后
-
CODE
#if defined(CONFIG_USB_EHCI_DESC_DCACHE_ENABLE) // 刷新 SETUP 包缓存 usb_dcache_flush((uintptr_t)urb->setup, 8); #endifint usbh_submit_urb(struct usbh_urb *urb) { struct ehci_qh_hw *qh = NULL; size_t flags; int ret = 0; struct usbh_hub *hub; struct usbh_hubport *hport; struct usbh_bus *bus; if (!urb || !urb->hport || !urb->ep || !urb->hport->bus) { return -USB_ERR_INVAL; } #ifdef CONFIG_USB_DCACHE_ENABLE USB_ASSERT_MSG(!((uintptr_t)urb->setup % CONFIG_USB_ALIGN_SIZE) && !((uintptr_t)urb->transfer_buffer % CONFIG_USB_ALIGN_SIZE), "urb->setup or urb->transfer_buffer is not aligned %d", CONFIG_USB_ALIGN_SIZE); #endif bus = urb->hport->bus; /* find active hubport in roothub */ hport = urb->hport; hub = urb->hport->parent; while (!hub->is_roothub) { hport = hub->parent; hub = hub->parent->parent; } #ifdef CONFIG_USB_EHCI_WITH_OHCI if (EHCI_HCOR->portsc[hport->port - 1] & EHCI_PORTSC_OWNER) { return ohci_submit_urb(urb); } #endif if (!urb->hport->connected || !(EHCI_HCOR->portsc[hport->port - 1] & EHCI_PORTSC_CCS)) { return -USB_ERR_NOTCONN; } if (urb->errorcode == -USB_ERR_BUSY) { return -USB_ERR_BUSY; } flags = usb_osal_enter_critical_section(); urb->hcpriv = NULL; urb->errorcode = -USB_ERR_BUSY; urb->actual_length = 0; #if defined(CONFIG_USB_EHCI_DESC_DCACHE_ENABLE) // 刷新 SETUP 包缓存 usb_dcache_flush((uintptr_t)urb->setup, 8); #endif usb_osal_leave_critical_section(flags); switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) { case USB_ENDPOINT_TYPE_CONTROL: qh = ehci_control_urb_init(bus, urb, urb->setup, urb->transfer_buffer, urb->transfer_buffer_length); if (qh == NULL) { return -USB_ERR_NOMEM; } break; case USB_ENDPOINT_TYPE_BULK: qh = ehci_bulk_urb_init(bus, urb, urb->transfer_buffer, urb->transfer_buffer_length); if (qh == NULL) { return -USB_ERR_NOMEM; } break; case USB_ENDPOINT_TYPE_INTERRUPT: qh = ehci_intr_urb_init(bus, urb, urb->transfer_buffer, urb->transfer_buffer_length); if (qh == NULL) { return -USB_ERR_NOMEM; } break; case USB_ENDPOINT_TYPE_ISOCHRONOUS: #ifdef CONFIG_USB_EHCI_ISO ret = ehci_iso_urb_init(bus, urb); #endif break; default: break; } if (urb->timeout > 0) { /* wait until timeout or sem give */ ret = usb_osal_sem_take(qh->waitsem, urb->timeout); if (ret < 0) { goto errout_timeout; } urb->timeout = 0; ret = urb->errorcode; /* we can free qh when waitsem is done */ ehci_qh_free(bus, qh); } return ret; errout_timeout: urb->timeout = 0; usbh_kill_urb(urb); return ret; } -
LOG
[I/USB] EHCI HCIVERSION:0x0095
[I/USB] EHCI HCSPARAMS:0x000012
[I/USB] EHCI HCCPARAMS:0x0000
[I/USB] EHCI ppc:1, n_ports:2, n_cc:0, n_pcc:0
[I/USB] EHCI uses tt for ls/fs device
[D/usbh_hub] Port change:0x04
[D/usbh_hub] Port change:0x04
[D/usbh_hub] Port 2 change
[D/usbh_hub] port 2, status:0x101, change:0x01
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x101, change:0x00
[D/usbh_hub] Port 2, status:0x503, change:0x02
[I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 2 connected
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/usbh_core] Device rev=0200 cls=09 sub=00 proto=02 size=64
[D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0002, wIndex 0x0000, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[I/usbh_core] New device found,idVendor:1a86,idProduct:8091,bcdDevice:1310
[I/usbh_core] The device has 1 bNumConfigurations
[D/usbh_core] The device selects config 0
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0200, wIndex 0x0000, wLength 0x0009
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0200, wIndex 0x0000, wLength 0x0029
[I/usbh_core] The device has 1 interfaces
[D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x09, wValue 0x0001, wIndex 0x0000, wLength 0x0000
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading hub class driver on interface 0
[D/usbh_core] Setup: bmRequestType 0xa0, bRequest 0x06, wValue 0x2900, wIndex 0x0000, wLength 0x0009
[D/usbh_hub] Hub Descriptor:
[D/usbh_hub] bLength: 0x09
[D/usbh_hub] bDescriptorType: 0x29
[D/usbh_hub] bNbrPorts: 0x04
[D/usbh_hub] wHubCharacteristics: 0x0020
[D/usbh_hub] bPwrOn2PwrGood: 0x30
[D/usbh_hub] bHubContrCurrent: 0x64
[D/usbh_hub] DeviceRemovable: 0x00
[D/usbh_hub] PortPwrCtrlMask: 0xff
[I/usbh_hub] Ep=81 Attr=03 Mps=1 Interval=12 Mult=00
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x03, wValue 0x0008, wIndex 0x0001, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x03, wValue 0x0008, wIndex 0x0002, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x03, wValue 0x0008, wIndex 0x0003, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x03, wValue 0x0008, wIndex 0x0004, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] port 1, status:0x101, change:0x01
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0002, wLength 0x0004
[D/usbh_hub] port 2, status:0x100, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0003, wLength 0x0004
[D/usbh_hub] port 3, status:0x100, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0004, wLength 0x0004
[D/usbh_hub] port 4, status:0x100, change:0x00
[I/usbh_hub] Register HUB Class:/dev/hub2
[D/usbh_hub] Port change:0x02
[D/usbh_hub] Port 1 change
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] port 1, status:0x101, change:0x01
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x01, wValue 0x0010, wIndex 0x0001, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x101, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x101, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x101, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x101, change:0x00
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x101, change:0x00
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x03, wValue 0x0004, wIndex 0x0001, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0xa3, bRequest 0x00, wValue 0x0000, wIndex 0x0001, wLength 0x0004
[D/usbh_hub] Port 1, status:0x503, change:0x10
[D/usbh_core] Setup: bmRequestType 0x23, bRequest 0x01, wValue 0x0014, wIndex 0x0001, wLength 0x0000
[I/usbh_hub] New high-speed device on Bus 0, Hub 2, Port 1 connected
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/usbh_core] Device rev=0200 cls=00 sub=00 proto=00 size=64
[D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0003, wIndex 0x0000, wLength 0x0000
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[I/usbh_core] New device found,idVendor:0951,idProduct:1665,bcdDevice:0110
[I/usbh_core] The device has 1 bNumConfigurations
[D/usbh_core] The device selects config 0
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0200, wIndex 0x0000, wLength 0x0009
[D/usbh_core] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0200, wIndex 0x0000, wLength 0x0020
[I/usbh_core] The device has 1 interfaces
[D/usbh_core] Setup: bmRequestType 0x00, bRequest 0x09, wValue 0x0001, wIndex 0x0000, wLength 0x0000
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading msc class driver on interface 0
[D/usbh_core] Setup: bmRequestType 0xa1, bRequest 0xfe, wValue 0x0000, wIndex 0x0000, wLength 0x0001
[I/usbh_msc] Get max LUN:1
[I/usbh_msc] Ep=81 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_msc] Ep=02 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_msc] Register MSC Class:/dev/sda
[D/usbh_hub] Port change:0x00
[D/usbh_hub] Port change:0x00
[D/usbh_hub] Port change:0x00
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000000
[D/usbh_msc] flags: 0x00
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x06
[D/usbh_msc] CB:
[D/usbh_msc] 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000024
[D/usbh_msc] flags: 0x80
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x06
[D/usbh_msc] CB:
[D/usbh_msc] 0x12 0x00 0x00 0x00 0x24 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000008
[D/usbh_msc] flags: 0x80
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x0a
[D/usbh_msc] CB:
[D/usbh_msc] 0x25 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
[I/usbh_msc] Capacity info:
[I/usbh_msc] Block num:30277632,block size:512
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000200
[D/usbh_msc] flags: 0x80
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x0a
[D/usbh_msc] CB:
[D/usbh_msc] 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000200
[D/usbh_msc] flags: 0x80
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x0a
[D/usbh_msc] CB:
[D/usbh_msc] 0x28 0x00 0x00 0x00 0x1f 0x80 0x00 0x00
[D/usbh_msc] 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
[D/usbh_msc] CBW:
[D/usbh_msc] signature: 0x43425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] datlen: 0x00000200
[D/usbh_msc] flags: 0x80
[D/usbh_msc] lun: 0x00
[D/usbh_msc] cblen: 0x0a
[D/usbh_msc] CB:
[D/usbh_msc] 0x28 0x00 0x00 0x00 0x1f 0x81 0x00 0x00
[D/usbh_msc] 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[D/usbh_msc] CSW:
[D/usbh_msc] signature: 0x53425355
[D/usbh_msc] tag: 0x00000000
[D/usbh_msc] residue: 0x00000000
[D/usbh_msc] status: 0x00
udisk: /dev/sda mount successfully
Other additional context
No response
- Lingua principale
- C
- Stelle
- 12.2k
- Fork
- 5.4k
- Merge medio
- 4g 12h
- PR unite (30g)
- 40
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RT-Thread/rt-thread
-
BSP BSP: Loongson bug RT-Smart
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Arch: RISC-V BSP BSP: HPMicro bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
in progress
-
[Bug] SDIO 驱动注销失败与节点内存泄漏风险 Apertabug Component component: drivers in progress
Tutte le issue di RT-Thread/rt-thread
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 commento ·