[SeaBIOS] [PATCH 10/15] optionroms: Use ioremap() on PCI rom bars to map them to memory
Kevin O'Connor
kevin at koconnor.net
Thu Oct 1 04:04:13 CET 2015
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/memmap.h | 3 +++
src/optionroms.c | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/memmap.h b/src/memmap.h
index 092e2ad..c927ab9 100644
--- a/src/memmap.h
+++ b/src/memmap.h
@@ -13,5 +13,8 @@ static inline u32 virt_to_phys(void *v) {
static inline void *memremap(u32 addr, u32 len) {
return (void*)addr;
}
+static inline void *ioremap(u64 addr, u32 len) {
+ return memremap(addr, len);
+}
#endif // memmap.h
diff --git a/src/optionroms.c b/src/optionroms.c
index c81eff2..0c55765 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -12,14 +12,15 @@
#include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA
#include "hw/pci_regs.h" // PCI_ROM_ADDRESS
#include "malloc.h" // rom_confirm
+#include "memmap.h" // ioremap
#include "output.h" // dprintf
#include "romfile.h" // romfile_loadint
#include "stacks.h" // farcall16big
#include "std/optionrom.h" // struct rom_header
#include "std/pnpbios.h" // PNP_SIGNATURE
#include "string.h" // memset
-#include "util.h" // get_pnp_offset
#include "tcgbios.h" // tpm_*
+#include "util.h" // get_pnp_offset
static int EnforceChecksum, S3ResumeVga, RunPCIroms;
@@ -272,7 +273,7 @@ map_pcirom(struct pci_device *pci)
// Looks like a rom - enable it.
pci_config_writel(bdf, PCI_ROM_ADDRESS, orig | PCI_ROM_ADDRESS_ENABLE);
- struct rom_header *rom = (void*)orig;
+ struct rom_header *rom = ioremap(orig, sz);
for (;;) {
dprintf(5, "Inspecting possible rom at %p (vd=%04x:%04x"
" bdf=%02x:%02x.%x)\n"
--
2.4.3
More information about the SeaBIOS
mailing list