aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-02-02 22:29:14 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-02-02 23:16:41 -0500
commit466615d0c2ae787f66ae1a7255aea40aaabfdbc1 (patch)
treec9ca1df219cdf3d455a94079bcb9dc7ee5aab53f
parent706eb8999ddf065f721aba7fee924fb2d4bfaba1 (diff)
downloadseabios-hppa-466615d0c2ae787f66ae1a7255aea40aaabfdbc1.zip
seabios-hppa-466615d0c2ae787f66ae1a7255aea40aaabfdbc1.tar.gz
seabios-hppa-466615d0c2ae787f66ae1a7255aea40aaabfdbc1.tar.bz2
ohci: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/hw/usb-ohci.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index 0c0bf60..3d55d48 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -268,6 +268,10 @@ free:
static void
ohci_controller_setup(struct pci_device *pci)
{
+ struct ohci_regs *regs = pci_enable_membar(pci, PCI_BASE_ADDRESS_0);
+ if (!regs)
+ return;
+
struct usb_ohci_s *cntl = malloc_tmphigh(sizeof(*cntl));
if (!cntl) {
warn_noalloc();
@@ -276,18 +280,13 @@ ohci_controller_setup(struct pci_device *pci)
memset(cntl, 0, sizeof(*cntl));
cntl->usb.pci = pci;
cntl->usb.type = USB_TYPE_OHCI;
-
- u16 bdf = pci->bdf;
- u32 baseaddr = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
- cntl->regs = (void*)(baseaddr & PCI_BASE_ADDRESS_MEM_MASK);
+ cntl->regs = regs;
dprintf(1, "OHCI init on dev %02x:%02x.%x (regs=%p)\n"
- , pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)
- , pci_bdf_to_fn(bdf), cntl->regs);
+ , pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf)
+ , pci_bdf_to_fn(pci->bdf), cntl->regs);
- // Enable bus mastering and memory access.
- pci_config_maskw(bdf, PCI_COMMAND
- , 0, PCI_COMMAND_MASTER|PCI_COMMAND_MEMORY);
+ pci_enable_busmaster(pci);
// XXX - check for and disable SMM control?