[SeaBIOS] [PATCH 07/14] pvscsi: Convert to new PCI BAR helper functions
Kevin O'Connor
kevin at koconnor.net
Wed Feb 3 05:18:50 CET 2016
Use the pci_enable_x() functions.
The pvscsi controller code will now explicitly set PCI_COMMAND_MEMORY
instead of assuming it has already been enabled.
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/hw/pvscsi.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/hw/pvscsi.c b/src/hw/pvscsi.c
index fa20efe..101a9c5 100644
--- a/src/hw/pvscsi.c
+++ b/src/hw/pvscsi.c
@@ -298,21 +298,20 @@ pvscsi_scan_target(struct pci_device *pci, void *iobase,
static void
init_pvscsi(struct pci_device *pci)
{
- struct pvscsi_ring_dsc_s *ring_dsc = NULL;
- int i;
- u16 bdf = pci->bdf;
- void *iobase = (void*)(pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0)
- & PCI_BASE_ADDRESS_MEM_MASK);
-
- pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
+ void *iobase = pci_enable_membar(pci, PCI_BASE_ADDRESS_0);
+ if (!iobase)
+ return;
+ pci_enable_busmaster(pci);
dprintf(1, "found pvscsi at %02x:%02x.%x, io @ %p\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);
pvscsi_write_cmd_desc(iobase, PVSCSI_CMD_ADAPTER_RESET, NULL, 0);
+ struct pvscsi_ring_dsc_s *ring_dsc = NULL;
pvscsi_init_rings(iobase, &ring_dsc);
+ int i;
for (i = 0; i < 7; i++)
pvscsi_scan_target(pci, iobase, ring_dsc, i);
--
2.5.0
More information about the SeaBIOS
mailing list