diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 22:19:35 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 23:16:40 -0500 |
commit | 71f484488a8a2191f11a91690cf1e2438f9ff792 (patch) | |
tree | 53682e030cc06e7881ce07de214b3b502a37af79 | |
parent | 5f7f3419bd2c99c745bd9b75d3b1aee436705d96 (diff) | |
download | seabios-71f484488a8a2191f11a91690cf1e2438f9ff792.tar.gz |
megasas: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
After this change, the megasas driver will no longer enable
PCI_COMMAND_MEMORY accesses, as the megasas driver doesn't actually
map any BARs as memory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/hw/megasas.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/hw/megasas.c b/src/hw/megasas.c index cb1a2a65..31426e7a 100644 --- a/src/hw/megasas.c +++ b/src/hw/megasas.c @@ -359,20 +359,18 @@ static int megasas_transition_to_ready(struct pci_device *pci, u32 ioaddr) static void init_megasas(struct pci_device *pci) { - u16 bdf = pci->bdf; - u32 iobase = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_2) - & PCI_BASE_ADDRESS_IO_MASK; - + u32 bar = PCI_BASE_ADDRESS_2; + if (!(pci_config_readl(pci->bdf, bar) & PCI_BASE_ADDRESS_IO_MASK)) + bar = PCI_BASE_ADDRESS_0; + u32 iobase = pci_enable_iobar(pci, bar); if (!iobase) - iobase = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0) - & PCI_BASE_ADDRESS_IO_MASK; + return; + pci_enable_busmaster(pci); dprintf(1, "found MegaRAID SAS 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); - pci_config_maskw(pci->bdf, PCI_COMMAND, 0, - PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); // reset if (megasas_transition_to_ready(pci, iobase) == 0) megasas_scan_target(pci, iobase); |