diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/biosvar.h | 3 | ||||
-rw-r--r-- | src/coreboot.c | 4 | ||||
-rw-r--r-- | src/pci.h | 2 | ||||
-rw-r--r-- | src/pcibios.c | 12 | ||||
-rw-r--r-- | src/pirtable.c | 13 |
6 files changed, 22 insertions, 17 deletions
@@ -10,11 +10,10 @@ OUT=out/ # 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 \ diff --git a/src/biosvar.h b/src/biosvar.h index 84c46282..bac978c2 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -255,8 +255,6 @@ struct fdpt_s { u8 checksum; } PACKED; -struct pir_header; - struct extended_bios_data_area_s { u8 size; u8 reserved1[0x21]; @@ -279,7 +277,6 @@ 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 - struct pir_header *pir_loc; // ATA Driver data struct ata_s ata; diff --git a/src/coreboot.c b/src/coreboot.c index 8610d756..ac8cf337 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -21,7 +21,7 @@ copy_pir(void *pos) 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; @@ -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, (void*)bios_table_cur_addr); + PirOffset = bios_table_cur_addr - BUILD_BIOS_ADDR; bios_table_cur_addr += p->size; } @@ -40,6 +40,8 @@ void create_pirtable(); * PIR table ****************************************************************/ +extern u16 PirOffset; + struct link_info { u8 link; u16 bitmap; diff --git a/src/pcibios.c b/src/pcibios.c index e310b189..cdda3474 100644 --- a/src/pcibios.c +++ b/src/pcibios.c @@ -127,15 +127,15 @@ handle_1ab10d(struct bregs *regs) 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) { @@ -148,10 +148,12 @@ handle_1ab10e(struct bregs *regs) 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); } diff --git a/src/pirtable.c b/src/pirtable.c index 8e3c3667..f776ee93 100644 --- a/src/pirtable.c +++ b/src/pirtable.c @@ -9,11 +9,16 @@ #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), @@ -83,8 +88,8 @@ struct pir_table { .slot_nr = 5, }, } -#endif // CONFIG_PIRTABLE }; +#endif // CONFIG_PIRTABLE && !CONFIG_COREBOOT void create_pirtable() @@ -96,5 +101,5 @@ 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; } |