Also, make sure the pir table is defined with the 16bit code.
# Source files
SRCBOTH=output.c util.c floppy.c ata.c system.c mouse.c kbd.c pci.c \
serial.c clock.c pic.c cdrom.c ps2port.c smpdetect.c resume.c \
- pnpbios.c
+ pnpbios.c pirtable.c
SRC16=$(SRCBOTH) disk.c apm.c pcibios.c vgahooks.c
SRC32=$(SRCBOTH) post.c shadow.c post_menu.c memmap.c coreboot.c boot.c \
- acpi.c pirtable.c smm.c mptable.c smbios.c pciinit.c \
- optionroms.c
+ acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c
TABLESRC=font.c cbt.c floppy_dbt.c
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
u8 checksum;
} PACKED;
-struct pir_header;
-
struct extended_bios_data_area_s {
u8 size;
u8 reserved1[0x21];
// Physical memory available.
u32 ram_size; // Amount of continuous ram under 4Gig
u64 ram_size_over4G; // Amount of continuous ram >4Gig
- struct pir_header *pir_loc;
// ATA Driver data
struct ata_s ata;
struct pir_header *p = pos;
if (p->signature != PIR_SIGNATURE)
return;
- if (GET_EBDA(pir_loc))
+ if (PirOffset)
return;
if (p->size < sizeof(*p))
return;
}
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, (void*)bios_table_cur_addr);
+ PirOffset = bios_table_cur_addr - BUILD_BIOS_ADDR;
bios_table_cur_addr += p->size;
}
* PIR table
****************************************************************/
+extern u16 PirOffset;
+
struct link_info {
u8 link;
u16 bitmap;
static void
handle_1ab10e(struct bregs *regs)
{
- struct pir_header *pirtable_far = GET_EBDA(pir_loc);
- if (! pirtable_far) {
+ struct pir_header *pirtable_g = (void*)(GET_GLOBAL(PirOffset) + 0);
+ if (! pirtable_g) {
set_code_fail(regs, RET_FUNC_NOT_SUPPORTED);
return;
}
// Validate and update size.
u16 size = GET_FARVAR(regs->es, *(u16*)(regs->di+0));
- u16 pirsize = (GET_FARPTR(pirtable_far->size)
+ u16 pirsize = (GET_GLOBAL(pirtable_g->size)
- sizeof(struct pir_header));
SET_FARVAR(regs->es, *(u16*)(regs->di+0), pirsize);
if (size < pirsize) {
u16 destseg = GET_FARVAR(regs->es, *(u16*)(regs->di+4));
// Memcpy pir table slots to dest buffer.
- memcpy_far(MAKE_FARPTR(destseg, d), pirtable_far, pirsize);
+ memcpy_far(MAKE_FARPTR(destseg, d)
+ , MAKE_FARPTR(SEG_BIOS, pirtable_g)
+ , pirsize);
// XXX - bochs bios sets bx to (1 << 9) | (1 << 11)
- regs->bx = GET_FARPTR(pirtable_far->exclusive_irqs);
+ regs->bx = GET_GLOBAL(pirtable_g->exclusive_irqs);
set_code_success(regs);
}
#include "util.h" // checksum
#include "biosvar.h" // SET_EBDA
+u16 PirOffset VAR16;
+
struct pir_table {
struct pir_header pir;
struct pir_slot slots[6];
-} PACKED PIR_TABLE __aligned(16) = {
-#if CONFIG_PIRTABLE
+} PACKED;
+
+extern struct pir_table PIR_TABLE;
+#if CONFIG_PIRTABLE && !CONFIG_COREBOOT
+struct pir_table PIR_TABLE __aligned(16) VAR16 = {
.pir = {
.version = 0x0100,
.size = sizeof(struct pir_table),
.slot_nr = 5,
},
}
-#endif // CONFIG_PIRTABLE
};
+#endif // CONFIG_PIRTABLE && !CONFIG_COREBOOT
void
create_pirtable()
PIR_TABLE.pir.signature = PIR_SIGNATURE;
PIR_TABLE.pir.checksum = -checksum((u8*)&PIR_TABLE, sizeof(PIR_TABLE));
- SET_EBDA(pir_loc, &PIR_TABLE.pir);
+ PirOffset = (u32)&PIR_TABLE.pir - BUILD_BIOS_ADDR;
}