Avoid casting EBDA variables ipl.description and pir_loc.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 8 Nov 2008 18:35:32 +0000 (13:35 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 8 Nov 2008 18:35:32 +0000 (13:35 -0500)
Define them using their native types (pointers).
Also, fix an apparent bug in mptable coreboot processing - it
    incorrectly overwrote the pir_loc variable.

src/biosvar.h
src/boot.c
src/coreboot.c
src/optionroms.c
src/pcibios.c
src/pirtable.c

index 6dfcbc71518e51e0a2380cc60964d89aad89b00f..4571d5d2f5844be5f93071c57b5605e3775ad42d 100644 (file)
@@ -218,7 +218,7 @@ struct ipl_entry_s {
     u16 type;
     u16 flags;
     u32 vector;
-    u32 description;
+    char *description;
 };
 
 struct ipl_s {
@@ -254,6 +254,8 @@ struct fdpt_s {
     u8 checksum;
 } PACKED;
 
+struct pir_header;
+
 struct extended_bios_data_area_s {
     u8 size;
     u8 reserved1[0x21];
@@ -275,7 +277,7 @@ struct extended_bios_data_area_s {
     // Physical memory available.
     u32 ram_size;        // Amount of continuous ram under 4Gig
     u64 ram_size_over4G; // Amount of continuous ram >4Gig
-    u32 pir_loc;
+    struct pir_header *pir_loc;
 
     // ATA Driver data
     struct ata_s   ata;
index 5beca25066adbff34ecb9592437da38aa8308f7e..481554349be7b0f9bafe9a738d5893e688bf7084 100644 (file)
@@ -34,11 +34,11 @@ printf_bootdev(u16 bootdev)
     printf("%s", drivetypes[type]);
 
     /* print product string if BEV */
-    void *far_description = (void*)GET_EBDA(ipl.table[bootdev].description);
+    char *far_description = GET_EBDA(ipl.table[bootdev].description);
     if (type == 4 && far_description != 0) {
         char description[33];
         /* first 32 bytes are significant */
-        memcpy_far(MAKE_FARPTR(GET_SEG(SS), &description), far_description, 32);
+        memcpy_far(MAKE_FARPTR(GET_SEG(SS), description), far_description, 32);
         /* terminate string */
         description[32] = 0;
         printf(" [%.s]", description);
index d92a67fc970457f1f81e5d8cb830479bb6d52d37..0079811e9eba5f1c0197b8616e02b13d9258195e 100644 (file)
@@ -34,7 +34,7 @@ copy_pir(void *pos)
     }
     dprintf(1, "Copying PIR from %p to %x\n", pos, bios_table_cur_addr);
     memcpy((void*)bios_table_cur_addr, pos, p->size);
-    SET_EBDA(pir_loc, bios_table_cur_addr);
+    SET_EBDA(pir_loc, (void*)bios_table_cur_addr);
     bios_table_cur_addr += p->size;
 }
 
@@ -56,7 +56,6 @@ copy_mptable(void *pos)
     }
     dprintf(1, "Copying MPTABLE from %p to %x\n", pos, bios_table_cur_addr);
     memcpy((void*)bios_table_cur_addr, pos, length);
-    SET_EBDA(pir_loc, bios_table_cur_addr);
     bios_table_cur_addr += length;
 }
 
index 45d348f856396a0c0dd0937a1fcc6e8a73283e20..2d8fe11caac8eeec409ab386b0efc0ae34ef437f 100644 (file)
@@ -130,7 +130,7 @@ rom_scan(u32 start, u32 end)
 
         u16 desc = pnp->productname;
         if (desc)
-            ip->description = (u32)MAKE_FARPTR(FARPTR_TO_SEG(rom), desc);
+            ip->description = MAKE_FARPTR(FARPTR_TO_SEG(rom), desc);
 
         ebda->ipl.count++;
     }
index b189f0bf0c4b09ca09837268c2f0ba64d17ffde8..c8281cba0011fb1e0087f019a23e961f5c1a4db9 100644 (file)
@@ -111,7 +111,7 @@ handle_1ab10d(struct bregs *regs)
 static void
 handle_1ab10e(struct bregs *regs)
 {
-    struct pir_header *pirtable_far = (struct pir_header*)GET_EBDA(pir_loc);
+    struct pir_header *pirtable_far = GET_EBDA(pir_loc);
     if (! pirtable_far) {
         set_code_fail(regs, RET_FUNC_NOT_SUPPORTED);
         return;
index c016d6d82124c27312f8a4b51ff011c8e0da4dfd..705cc5032bff75b876b9b1070821a018a135d49b 100644 (file)
@@ -96,5 +96,5 @@ create_pirtable()
 
     PIR_TABLE.pir.signature = PIR_SIGNATURE;
     PIR_TABLE.pir.checksum = -checksum((u8*)&PIR_TABLE, sizeof(PIR_TABLE));
-    SET_EBDA(pir_loc, (u32)&PIR_TABLE);
+    SET_EBDA(pir_loc, &PIR_TABLE.pir);
 }