diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 22:29:49 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 23:16:41 -0500 |
commit | a46fdbfc68520a7da23bc6e87310c4f372f00fd7 (patch) | |
tree | fdb4b4b6aa655eb40c77b15faf98ddde0427752c /src | |
parent | 466615d0c2ae787f66ae1a7255aea40aaabfdbc1 (diff) | |
download | seabios-a46fdbfc68520a7da23bc6e87310c4f372f00fd7.tar.gz |
uhci: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
The uhci controller code will now explicitly set PCI_COMMAND_IO
instead of assuming it has already been enabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/hw/usb-uhci.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/hw/usb-uhci.c b/src/hw/usb-uhci.c index 7a11510c..3b949e43 100644 --- a/src/hw/usb-uhci.c +++ b/src/hw/usb-uhci.c @@ -244,7 +244,10 @@ fail: static void uhci_controller_setup(struct pci_device *pci) { - u16 bdf = pci->bdf; + u16 iobase = pci_enable_iobar(pci, PCI_BASE_ADDRESS_4); + if (!iobase) + return; + struct usb_uhci_s *cntl = malloc_tmphigh(sizeof(*cntl)); if (!cntl) { warn_noalloc(); @@ -253,16 +256,15 @@ uhci_controller_setup(struct pci_device *pci) memset(cntl, 0, sizeof(*cntl)); cntl->usb.pci = pci; cntl->usb.type = USB_TYPE_UHCI; - cntl->iobase = (pci_config_readl(bdf, PCI_BASE_ADDRESS_4) - & PCI_BASE_ADDRESS_IO_MASK); + cntl->iobase = iobase; dprintf(1, "UHCI init on dev %02x:%02x.%x (io=%x)\n" - , pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf) - , pci_bdf_to_fn(bdf), cntl->iobase); + , pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf) + , pci_bdf_to_fn(pci->bdf), cntl->iobase); - pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER); + pci_enable_busmaster(pci); - reset_uhci(cntl, bdf); + reset_uhci(cntl, pci->bdf); run_thread(configure_uhci, cntl); } |