]> xenbits.xensource.com Git - seabios.git/commitdiff
Minor - Replace PirOffset with PirAddr.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 9 Jun 2012 17:36:45 +0000 (13:36 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 9 Jun 2012 17:36:45 +0000 (13:36 -0400)
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>
src/biostables.c
src/pci.h
src/pcibios.c
src/pirtable.c

index 0a8c39ad3cf37323adfac680be0407dc1be61346..81cc79b2f87b5037b76c14c6934a309f0195e3ae 100644 (file)
@@ -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
index ebf934c33477403ff2dd32d58366e81e9d4d567b..fe663b82efd46c1b0d1599bf0911be9c74f28dd1 100644 (file)
--- 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
 
 
index d10cdfd2c1d444471357e750d18e3d7448473bd8..e4bd7c0529184593bd5dde602280642b93138f75 100644 (file)
@@ -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;
index 2c328d8bce437ac57bf52ea46f7db72330a59ce2..8eadbf0a03e7e88c0eba8a1140aab35e0134fe13 100644 (file)
@@ -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;
 }