diff --git a/src/userland/usb/xhci/controller.c b/src/userland/usb/xhci/controller.c index d272bf5..bd6cbf1 100644 --- a/src/userland/usb/xhci/controller.c +++ b/src/userland/usb/xhci/controller.c @@ -145,6 +145,13 @@ } } +void subscribeIRQ(uint8_t interrupt) { + char *eventName = asprintf("irq%i", interrupt); + int pic = getService("pic"); + subscribeEvent(pic, getEvent(pic, eventName), xhciInterrupt); + free(eventName); +} + XHCIController *xhciSetup(uint32_t deviceId, uint32_t bar0, uint32_t interrupt) { XHCIController *controller = initializeController(deviceId, bar0); @@ -159,11 +166,9 @@ setupEventRingSegmentTable(controller); setupRuntime(controller); setupScratchpadBuffers(controller); + subscribeIRQ(interrupt); controller->operational->status |= (1 << 3); - printf("using irq no. %i\n", interrupt); - int pic = getService("pic"); - subscribeEvent(pic, getEvent(pic, "irq11"), xhciInterrupt); controller->operational->command |= (1 << 0) | (1 << 2); sleep(100); diff --git a/src/userland/usb/xhci/controller.c b/src/userland/usb/xhci/controller.c index d272bf5..bd6cbf1 100644 --- a/src/userland/usb/xhci/controller.c +++ b/src/userland/usb/xhci/controller.c @@ -145,6 +145,13 @@ } } +void subscribeIRQ(uint8_t interrupt) { + char *eventName = asprintf("irq%i", interrupt); + int pic = getService("pic"); + subscribeEvent(pic, getEvent(pic, eventName), xhciInterrupt); + free(eventName); +} + XHCIController *xhciSetup(uint32_t deviceId, uint32_t bar0, uint32_t interrupt) { XHCIController *controller = initializeController(deviceId, bar0); @@ -159,11 +166,9 @@ setupEventRingSegmentTable(controller); setupRuntime(controller); setupScratchpadBuffers(controller); + subscribeIRQ(interrupt); controller->operational->status |= (1 << 3); - printf("using irq no. %i\n", interrupt); - int pic = getService("pic"); - subscribeEvent(pic, getEvent(pic, "irq11"), xhciInterrupt); controller->operational->command |= (1 << 0) | (1 << 2); sleep(100); diff --git a/src/userland/usb/xhci/xhci.c b/src/userland/usb/xhci/xhci.c index 8e8fd6c..6d8e48d 100644 --- a/src/userland/usb/xhci/xhci.c +++ b/src/userland/usb/xhci/xhci.c @@ -33,7 +33,6 @@ slot->controller = controller; slot->slotIndex = requestSlotIndex(controller); slot->port = &controller->operational->ports[portIndex - 1]; - printf("port %i: connecting to slot %i\n", portIndex, slot->slotIndex); slot->port->status |= 1 << 4; awaitCode(serviceId, xhciEvent, slot->portIndex << 24); @@ -47,7 +46,6 @@ slot->controller->deviceContextBaseAddressArray[slot->slotIndex] = U32(getPhysicalAddress( (void *)controller->deviceContexts[slot->slotIndex])); - printf("port %i: addressing slot\n", portIndex); addressDevice(slot, true); addressDevice(slot, false); UsbSlot *result = malloc(sizeof(UsbSlot));