mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Take ownership of all USB controllers before probing for devices. (#167)
When two controllers are attached to a physical port (e.g. in the case of EHCI and its companion controllers, problems can occur if the BIOS still has control of one controller when we try to use the other one. So perform a first pass to scan the PCI bus and take ownership of and reset all the controllers we find, and perform a second pass to initialise the controllers and probe for attached devices. As we don't support hot plugging, split the second pass into two, with the first probing the EHCI controllers and handing over any low and full speed devices to the companion controllers, and the second probing the remaining controller types.
This commit is contained in:
@@ -486,7 +486,7 @@ static const hcd_methods_t methods = {
|
||||
// Public Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
bool ehci_init(int bus, int dev, int func, uintptr_t base_addr, usb_hcd_t *hcd)
|
||||
bool ehci_reset(int bus, int dev, int func, uintptr_t base_addr)
|
||||
{
|
||||
ehci_cap_regs_t *cap_regs = (ehci_cap_regs_t *)base_addr;
|
||||
|
||||
@@ -513,6 +513,15 @@ bool ehci_init(int bus, int dev, int func, uintptr_t base_addr, usb_hcd_t *hcd)
|
||||
if (!halt_host_controller(op_regs)) return false;
|
||||
if (!reset_host_controller(op_regs)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ehci_probe(uintptr_t base_addr, usb_hcd_t *hcd)
|
||||
{
|
||||
ehci_cap_regs_t *cap_regs = (ehci_cap_regs_t *)base_addr;
|
||||
|
||||
ehci_op_regs_t *op_regs = (ehci_op_regs_t *)(base_addr + cap_regs->cap_length);
|
||||
|
||||
// Record the heap state to allow us to free memory.
|
||||
uintptr_t initial_heap_mark = heap_mark(HEAP_TYPE_LM_1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user