From bfa02cd540e93ad1df46b3a599e121acf7a36c0a Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 9 Jun 2012 13:36:45 -0400 Subject: [PATCH] Minor - Replace PirOffset with PirAddr. Technically, the PIR table could be placed at 0xf0000, which would result in a PirOffset=0, which would confuse the code. So, use an absolute address (PirAddr) instead. This also matches what the ACPI and SMBIOS code does. Signed-off-by: Kevin O'Connor --- src/biostables.c | 4 ++-- src/pci.h | 4 ++-- src/pcibios.c | 5 +++-- src/pirtable.c | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/biostables.c b/src/biostables.c index 0a8c39a..81cc79b 100644 --- a/src/biostables.c +++ b/src/biostables.c @@ -17,7 +17,7 @@ copy_pir(void *pos) struct pir_header *p = pos; if (p->signature != PIR_SIGNATURE) return; - if (PirOffset) + if (PirAddr) return; if (p->size < sizeof(*p)) return; @@ -30,7 +30,7 @@ copy_pir(void *pos) } dprintf(1, "Copying PIR from %p to %p\n", pos, newpos); memcpy(newpos, pos, p->size); - PirOffset = (u32)newpos - BUILD_BIOS_ADDR; + PirAddr = newpos; } static void diff --git a/src/pci.h b/src/pci.h index ebf934c..fe663b8 100644 --- a/src/pci.h +++ b/src/pci.h @@ -125,8 +125,6 @@ void create_pirtable(void); * PIR table ****************************************************************/ -extern u16 PirOffset; - struct link_info { u8 link; u16 bitmap; @@ -154,6 +152,8 @@ struct pir_header { struct pir_slot slots[0]; } PACKED; +extern struct pir_header *PirAddr; + #define PIR_SIGNATURE 0x52495024 // $PIR diff --git a/src/pcibios.c b/src/pcibios.c index d10cdfd..e4bd7c0 100644 --- a/src/pcibios.c +++ b/src/pcibios.c @@ -133,11 +133,12 @@ handle_1ab10d(struct bregs *regs) static void handle_1ab10e(struct bregs *regs) { - struct pir_header *pirtable_g = (void*)(GET_GLOBAL(PirOffset) + 0); - if (! pirtable_g) { + struct pir_header *pirtable_gf = GET_GLOBAL(PirAddr); + if (! pirtable_gf) { set_code_invalid(regs, RET_FUNC_NOT_SUPPORTED); return; } + struct pir_header *pirtable_g = GLOBALFLAT2GLOBAL(pirtable_gf); struct param_s { u16 size; diff --git a/src/pirtable.c b/src/pirtable.c index 2c328d8..8eadbf0 100644 --- a/src/pirtable.c +++ b/src/pirtable.c @@ -9,7 +9,7 @@ #include "config.h" // CONFIG_* #include "util.h" // checksum -u16 PirOffset VAR16VISIBLE; +struct pir_header *PirAddr VAR16VISIBLE; struct pir_table { struct pir_header pir; @@ -101,5 +101,5 @@ create_pirtable(void) PIR_TABLE.pir.signature = PIR_SIGNATURE; PIR_TABLE.pir.checksum -= checksum(&PIR_TABLE, sizeof(PIR_TABLE)); - PirOffset = (u32)&PIR_TABLE.pir - BUILD_BIOS_ADDR; + PirAddr = &PIR_TABLE.pir; } -- 2.39.5