[SeaBIOS] [PATCH 05/14] lsi-scsi: Convert to new PCI BAR helper functions

Kevin O'Connor kevin at koconnor.net
Wed Feb 3 05:18:48 CET 2016


Use the pci_enable_x() functions.

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

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

diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c
index ad33528..2629b5f 100644
--- a/src/hw/lsi-scsi.c
+++ b/src/hw/lsi-scsi.c
@@ -172,15 +172,14 @@ lsi_scsi_scan_target(struct pci_device *pci, u32 iobase, u8 target)
 static void
 init_lsi_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;
-
-    pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
+    u32 iobase = pci_enable_iobar(pci, PCI_BASE_ADDRESS_0);
+    if (!iobase)
+        return;
+    pci_enable_busmaster(pci);
 
     dprintf(1, "found lsi53c895a at %02x:%02x.%x, io @ %x\n",
-            pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf),
-            pci_bdf_to_fn(bdf), iobase);
+            pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf),
+            pci_bdf_to_fn(pci->bdf), iobase);
 
     // reset
     outb(LSI_ISTAT0_SRST, iobase + LSI_REG_ISTAT0);
-- 
2.5.0




More information about the SeaBIOS mailing list