diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 22:23:55 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-02-02 23:16:41 -0500 |
commit | 46561b0844dbdc2c7d4abc70e5fe0df6ef6cb29d (patch) | |
tree | 8c37358551bba2df8b99dc6509319126a8305c36 | |
parent | 03f3b3e46182614d41d36fe49afcc1d18897c2ac (diff) | |
download | seabios-hppa-46561b0844dbdc2c7d4abc70e5fe0df6ef6cb29d.zip seabios-hppa-46561b0844dbdc2c7d4abc70e5fe0df6ef6cb29d.tar.gz seabios-hppa-46561b0844dbdc2c7d4abc70e5fe0df6ef6cb29d.tar.bz2 |
sdcard: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
After this change, the sdcard driver will no longer enable
PCI_COMMAND_IO or PCI_COMMAND_MASTER accesses, as the sdcard driver
doesn't actually use IO BARs or implement DMA.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/hw/sdcard.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index db3bbe1..1524b51 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -7,11 +7,11 @@ #include "block.h" // struct drive_s #include "malloc.h" // malloc_fseg #include "output.h" // znprintf -#include "pci.h" // pci_config_readl +#include "pci.h" // foreachpci #include "pci_ids.h" // PCI_CLASS_SYSTEM_SDHCI #include "pci_regs.h" // PCI_BASE_ADDRESS_0 #include "romfile.h" // romfile_findprefix -#include "stacks.h" // wait_preempt +#include "stacks.h" // yield #include "std/disk.h" // DISK_RET_SUCCESS #include "string.h" // memset #include "util.h" // boot_add_hd @@ -525,14 +525,12 @@ static void sdcard_pci_setup(void *data) { struct pci_device *pci = data; - wait_preempt(); // Avoid pci_config_readl when preempting // XXX - bars dependent on slot index register in pci config space - u32 regs = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0); - regs &= PCI_BASE_ADDRESS_MEM_MASK; - pci_config_maskw(pci->bdf, PCI_COMMAND, 0, - PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); + struct sdhci_s *regs = pci_enable_membar(pci, PCI_BASE_ADDRESS_0); + if (!regs) + return; int prio = bootprio_find_pci_device(pci); - sdcard_controller_setup((void*)regs, prio); + sdcard_controller_setup(regs, prio); } static void |