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 <kevin@koconnor.net>
struct pir_header *p = pos;
if (p->signature != PIR_SIGNATURE)
return;
- if (PirOffset)
+ if (PirAddr)
return;
if (p->size < sizeof(*p))
return;
}
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
* PIR table
****************************************************************/
-extern u16 PirOffset;
-
struct link_info {
u8 link;
u16 bitmap;
struct pir_slot slots[0];
} PACKED;
+extern struct pir_header *PirAddr;
+
#define PIR_SIGNATURE 0x52495024 // $PIR
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;
#include "config.h" // CONFIG_*
#include "util.h" // checksum
-u16 PirOffset VAR16VISIBLE;
+struct pir_header *PirAddr VAR16VISIBLE;
struct pir_table {
struct pir_header pir;
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;
}