static int construct_bios_info_table(uint8_t *buf)
{
- struct bios_info {
- uint8_t com1_present:1;
- uint8_t com2_present:1;
- uint8_t hpet_present:1;
- uint32_t pci_min, pci_len;
- } *bios_info = (struct bios_info *)buf;
+ struct bios_info *bios_info = (struct bios_info *)buf;
memset(bios_info, 0, sizeof(*bios_info));
bios_info->pci_min = PCI_MEMBASE;
bios_info->pci_len = PCI_MEMSIZE;
+ bios_info->xen_pfiob = 0xdead;
return align16(sizeof(*bios_info));
}
#define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
#define SCRATCH_PHYSICAL_ADDRESS 0x00010000
+/* Xen Platform Device */
+#define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
+
+struct bios_info {
+ uint8_t com1_present:1;
+ uint8_t com2_present:1;
+ uint8_t hpet_present:1;
+ uint32_t pci_min, pci_len;
+ uint16_t xen_pfiob;
+};
+
#endif /* __HVMLOADER_CONFIG_H__ */
cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
}
+static void init_xen_platform_io_base(void)
+{
+ struct bios_info *bios_info = (struct bios_info *)ACPI_PHYSICAL_ADDRESS;
+ uint32_t devfn, bar_data;
+ uint16_t vendor_id, device_id;
+
+ for ( devfn = 0; devfn < 128; devfn++ )
+ {
+ vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+ device_id = pci_readw(devfn, PCI_DEVICE_ID);
+ if ( (vendor_id != 0x5853) || (device_id != 0x0001) )
+ continue;
+ bar_data = pci_readl(devfn, PCI_BASE_ADDRESS_0);
+ bios_info->xen_pfiob = bar_data & PCI_BASE_ADDRESS_IO_MASK;
+ }
+}
+
int main(void)
{
int acpi_sz = 0, vgabios_sz = 0, etherboot_sz = 0, rombios_sz, smbios_sz;
ROMBIOS_PHYSICAL_ADDRESS,
ROMBIOS_PHYSICAL_ADDRESS + rombios_sz - 1);
+ init_xen_platform_io_base();
+
printf("Invoking ROMBIOS ...\n");
return 0;
}
// ROM BIOS for use with Bochs/Plex x86 emulation environment
+#define uint8_t unsigned char
+#define uint16_t unsigned short
+#define uint32_t unsigned long
#include "../hvmloader/config.h"
#define HVMASSIST
base_mem = read_dword(0x9000, 0x2d0 + 8);
write_word(0x40, 0x13, base_mem >> 10);
}
+
+void
+disable_rom_write_access()
+{
+ Bit16u off = (Bit16u)&((struct bios_info *)0)->xen_pfiob;
+ASM_START
+ mov si,.disable_rom_write_access.off[bp]
+ push ds
+ mov ax,#(ACPI_PHYSICAL_ADDRESS >> 4)
+ mov ds,ax
+ mov dx,[si]
+ pop ds
+ mov ax,#PFFLAG_ROM_LOCK
+ out dx,al
+ASM_END
+}
+
#endif /* HVMASSIST */
#if BX_DEBUG_SERIAL
call tcpa_post_part2
#endif
+#ifdef HVMASSIST
+ call _disable_rom_write_access
+#endif
+
;; Start the boot sequence. See the comments in int19_relocated
;; for why we use INT 18h instead of INT 19h here.
int #0x18