Commit 55734f42 authored by Robert Sprowson's avatar Robert Sprowson

Catch babbling devices, mark as stalled

xhci.c: If a device babbles (sends more bytes than were requested of it) make sure this completion event code is caught, otherwise USB_TransferComplete is called with potentially bad data. From NetBSD revision 1.28.2.19.
glue.c: OS_Memory page numbers are just numbers, not pointers.

Version 0.13. Tagged as 'XHCIDriver-0_13'
parent 5f6dca10
/* (0.12)
/* (0.13)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.12
#define Module_MajorVersion_CMHG 0.13
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 27 Mar 2016
#define Module_Date_CMHG 03 Jun 2016
#define Module_MajorVersion "0.12"
#define Module_Version 12
#define Module_MajorVersion "0.13"
#define Module_Version 13
#define Module_MinorVersion ""
#define Module_Date "27 Mar 2016"
#define Module_Date "03 Jun 2016"
#define Module_ApplicationDate "27-Mar-16"
#define Module_ApplicationDate "03-Jun-16"
#define Module_ComponentName "XHCIDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/XHCIDriver"
#define Module_FullVersion "0.12"
#define Module_HelpVersion "0.12 (27 Mar 2016)"
#define Module_LibraryVersionInfo "0:12"
#define Module_FullVersion "0.13"
#define Module_HelpVersion "0.13 (03 Jun 2016)"
#define Module_LibraryVersionInfo "0:13"
......@@ -448,9 +448,9 @@ int vtophys(void *v)
{
struct
{
void *page;
void *logical;
void *physical;
size_t page;
void *logical;
void *physical;
} block;
block.logical = v;
_swix(OS_Memory, _INR(0,2), (1<<9) + (1<<13), &block, 1);
......
......@@ -1469,6 +1469,10 @@ xhci_handle_event(struct xhci_softc * const sc,
if ((trb_3 & XHCI_TRB_3_ED_BIT) == 0) {
#ifdef BRANCH_NHUSB
/*
* When ED == 0, trb_0 is physical address of the TRB
* that caused this event. (6.4.2.1)
*/
bus_addr_t trbp = xhci_ring_trbp(xr, 0);
/* trb_0 range sanity check */
......@@ -1484,6 +1488,7 @@ xhci_handle_event(struct xhci_softc * const sc,
xx = xr->xr_cookies[(trb_0 - xhci_ring_trbp(xr, 0))/
sizeof(struct xhci_trb)];
} else {
/* When ED != 0, trb_0 is kaddr of struct xhci_xfer. */
xx = (void *)(uintptr_t)(trb_0 & ~0x3);
}
xfer = &xx->xx_xfer;
......@@ -1504,6 +1509,8 @@ xhci_handle_event(struct xhci_softc * const sc,
break;
}
#endif
/* 4.11.5.2 Event Data TRB */
if ((trb_3 & XHCI_TRB_3_ED_BIT) != 0) {
DPRINTFN(14, "transfer event data: "
"0x%016"PRIx64" 0x%08"PRIx32" %02x",
......@@ -1522,8 +1529,13 @@ xhci_handle_event(struct xhci_softc * const sc,
XHCI_TRB_ERROR_SHORT_PKT) {
xfer->actlen = xfer->length - XHCI_TRB_2_REM_GET(trb_2);
err = USBD_NORMAL_COMPLETION;
#ifdef RISCOS
} else if ((XHCI_TRB_2_ERROR_GET(trb_2) == XHCI_TRB_ERROR_STALL) ||
(XHCI_TRB_2_ERROR_GET(trb_2) == XHCI_TRB_ERROR_BABBLE)) {
#else
} else if (XHCI_TRB_2_ERROR_GET(trb_2) ==
XHCI_TRB_ERROR_STALL) {
#endif
err = USBD_STALLED;
xr->is_halted = true;
DPRINTFN(1, "ev: xfer done: err %u slot %u dci %u",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment