Use the pci_enable_x() functions.

The esp-scsi controller code will now explicitly set PCI_COMMAND_IO
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <ke...@koconnor.net>
---
 src/hw/esp-scsi.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c
index d4e47e3..cf2cc11 100644
--- a/src/hw/esp-scsi.c
+++ b/src/hw/esp-scsi.c
@@ -192,15 +192,14 @@ esp_scsi_scan_target(struct pci_device *pci, u32 iobase, 
u8 target)
 static void
 init_esp_scsi(struct pci_device *pci)
 {
-    u16 bdf = pci->bdf;
-    u32 iobase = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0)
-        & PCI_BASE_ADDRESS_IO_MASK;
+    u32 iobase = pci_enable_iobar(pci, PCI_BASE_ADDRESS_0);
+    if (!iobase)
+        return;
+    pci_enable_busmaster(pci);
 
     dprintf(1, "found esp at %02x:%02x.%x, io @ %x\n",
-            pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf),
-            pci_bdf_to_fn(bdf), iobase);
-
-    pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
+            pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf),
+            pci_bdf_to_fn(pci->bdf), iobase);
 
     // reset
     outb(ESP_CMD_RESET, iobase + ESP_CMD);
-- 
2.5.0


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to