memcpy(&gUSBEnqueuedEHCI[gUSBEnqueuedEHCICount++], pci_dev, sizeof(pci_dt_t));gUSBEnqueuedEHCI is hardcoded to a size of MAX_USB_DEVICES * sizeof(pci_dt_t), so if you ever have a machine with more than MAX_USB_DEVICES controllers, you're writing to memory that you shouldn't be. The same goes for the other pci_dt_t array.

I also have an implementation in my branch (http://forge.voodooprojects.org/p/chameleon/source/tree/HEAD/branches/meklort/i386/libsaio/usb.c) for the usb code, and inside of pci_setup.c as well. There is one main bug that I still haven't fixed with it (running the reset on the correct controller, but that's just two lines to fix)