From 71f484488a8a2191f11a91690cf1e2438f9ff792 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 2 Feb 2016 22:19:35 -0500 Subject: 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 --- src/hw/megasas.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/hw/megasas.c b/src/hw/megasas.c index cb1a2a6..31426e7 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); -- cgit v1.1