[dev][usb] Remove unused BTI handles from the USB stack
Only the drivers that touch the hardware need BTIs
TEST: USB works on NUC.
Change-Id: I3e9a3efcd56ca824f8ae99af5a41eccd9146ebad
diff --git a/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo b/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
index fc5236f..51765ea 100644
--- a/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
+++ b/system/banjo/ddk-protocol-usb-hci/usb-hci.banjo
@@ -36,8 +36,6 @@
GetMaxTransferSize(uint32 device_id, uint8 ep_address) -> (usize size);
/// Cancels all transactions currently queued on the specified endpoint.
CancelAll(uint32 device_id, uint8 ep_address) -> (zx.status s);
- /// Returns a BTI handle that can be used for DMA.
- GetBti() -> (handle<bti> bti);
/// Returns the size needed for a |usb_request_t|, including private storage needed by the
/// HCI driver.
GetRequestSize() -> (usize size);
diff --git a/system/dev/usb/usb-bus/usb-bus.c b/system/dev/usb/usb-bus/usb-bus.c
index 8f858f8..3a68741 100644
--- a/system/dev/usb/usb-bus/usb-bus.c
+++ b/system/dev/usb/usb-bus/usb-bus.c
@@ -141,7 +141,6 @@
static void usb_bus_release(void* ctx) {
zxlogf(INFO, "usb_bus_release\n");
usb_bus_t* bus = ctx;
- zx_handle_close(bus->bti_handle);
free(bus->devices);
free(bus);
}
@@ -164,8 +163,6 @@
return ZX_ERR_NOT_SUPPORTED;
}
- usb_hci_get_bti(&bus->hci, &bus->bti_handle);
-
bus->hci_zxdev = device;
bus->max_device_count = usb_hci_get_max_device_count(&bus->hci);
bus->devices = calloc(bus->max_device_count, sizeof(usb_device_t *));
diff --git a/system/dev/usb/usb-bus/usb-bus.h b/system/dev/usb/usb-bus/usb-bus.h
index 3737f43..402d118 100644
--- a/system/dev/usb/usb-bus/usb-bus.h
+++ b/system/dev/usb/usb-bus/usb-bus.h
@@ -14,7 +14,6 @@
zx_device_t* zxdev;
zx_device_t* hci_zxdev;
usb_hci_protocol_t hci;
- zx_handle_t bti_handle;
// top-level USB devices, indexed by device_id
usb_device_t** devices;
diff --git a/system/dev/usb/usb-bus/usb-device.c b/system/dev/usb/usb-bus/usb-device.c
index a79ca83..21892e1 100644
--- a/system/dev/usb/usb-bus/usb-device.c
+++ b/system/dev/usb/usb-bus/usb-device.c
@@ -630,14 +630,6 @@
status = device_add(bus->zxdev, &args, &dev->zxdev);
if (status == ZX_OK) {
- *out_device = dev;
- zx_handle_t bti_handle = bus->bti_handle;
- status = device_add_metadata(dev->zxdev, DEVICE_METADATA_PRIVATE, &bti_handle,
- sizeof(bti_handle));
- if (status != ZX_OK) {
- zxlogf(ERROR, "usb_device_add: device_add_metadata failed: %d\n", status);
- return status;
- }
return ZX_OK;
} else {
stop_callback_thread(dev);
diff --git a/system/dev/usb/usb-composite/usb-composite.c b/system/dev/usb/usb-composite/usb-composite.c
index 12323d9..366b63c 100644
--- a/system/dev/usb/usb-composite/usb-composite.c
+++ b/system/dev/usb/usb-composite/usb-composite.c
@@ -373,14 +373,6 @@
}
memcpy(&comp->usb, &usb, sizeof(comp->usb));
- size_t actual;
- status = device_get_metadata(parent, DEVICE_METADATA_PRIVATE, &comp->bti_handle,
- sizeof(comp->bti_handle), &actual);
- if (status != ZX_OK) {
- zxlogf(ERROR, "usb_composite_bind: device_get_metadata failed: %d\n", status);
- return ZX_OK;
- }
-
list_initialize(&comp->children);
mtx_init(&comp->interface_mutex, mtx_plain);
diff --git a/system/dev/usb/usb-composite/usb-composite.h b/system/dev/usb/usb-composite/usb-composite.h
index 8815e3f..916be1d 100644
--- a/system/dev/usb/usb-composite/usb-composite.h
+++ b/system/dev/usb/usb-composite/usb-composite.h
@@ -26,7 +26,6 @@
typedef struct {
zx_device_t* zxdev;
usb_protocol_t usb;
- zx_handle_t bti_handle;
usb_device_descriptor_t device_desc;
usb_configuration_descriptor_t* config_desc;
diff --git a/system/dev/usb/xhci/usb-xhci.cpp b/system/dev/usb/xhci/usb-xhci.cpp
index fd4fa45..2e9cd0a 100644
--- a/system/dev/usb/xhci/usb-xhci.cpp
+++ b/system/dev/usb/xhci/usb-xhci.cpp
@@ -137,12 +137,6 @@
return xhci_cancel_transfers(xhci, device_id, xhci_endpoint_index(ep_address));
}
-static void xhci_get_bti(void* ctx, zx_handle_t* out_handle) {
- auto* xhci = static_cast<xhci_t*>(ctx);
- *out_handle = ZX_HANDLE_INVALID;
- zx_handle_duplicate(xhci->bti_handle, ZX_RIGHT_SAME_RIGHTS, out_handle);
-}
-
//Returns the public request size plus its private context size.
static size_t xhci_get_request_size(void* ctx) {
return sizeof(xhci_usb_request_internal_t) + sizeof(usb_request_t);
@@ -160,7 +154,6 @@
.reset_endpoint = xhci_reset_ep,
.get_max_transfer_size = xhci_get_max_transfer_size,
.cancel_all = xhci_cancel_all,
- .get_bti = xhci_get_bti,
.get_request_size = xhci_get_request_size,
};