From: Keir Fraser Date: Wed, 21 May 2008 10:23:03 +0000 (+0100) Subject: hvmloader: Lay out memory a bit differently - X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14210^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e6b2e11c9006f7293b163633859b7b81ab2b5676;p=xen.git hvmloader: Lay out memory a bit differently - * Cleanly define a scratch area for temporary storage * Raise Etherboot ROM out of the way of larger VGA BIOSes Also detect virtual VGA adaptors more cleanly. Signed-off-by: Jean Guyader Signed-off-by: Keir Fraser --- diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h index cde2056f80..296c10d767 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -23,11 +23,12 @@ /* Memory map. */ #define HYPERCALL_PHYSICAL_ADDRESS 0x00080000 #define VGABIOS_PHYSICAL_ADDRESS 0x000C0000 -#define ETHERBOOT_PHYSICAL_ADDRESS 0x000C8000 +#define ETHERBOOT_PHYSICAL_ADDRESS 0x000D0000 #define EXTBOOT_PHYSICAL_ADDRESS 0x000DF800 #define SMBIOS_PHYSICAL_ADDRESS 0x000E9000 #define SMBIOS_MAXIMUM_SIZE 0x00001000 #define ACPI_PHYSICAL_ADDRESS 0x000EA000 #define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000 +#define SCRATCH_PHYSICAL_ADDRESS 0x00010000 #endif /* __HVMLOADER_CONFIG_H__ */ diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index b3e075fd8a..74694e31d2 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -103,12 +103,7 @@ void smp_initialise(void); void create_mp_tables(void); int hvm_write_smbios_tables(void); -static int -cirrus_check(void) -{ - outw(0x3C4, 0x9206); - return inb(0x3C5) == 0x12; -} +static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none; static void init_hypercalls(void) @@ -165,7 +160,7 @@ static void pci_setup(void) /* Create a list of device BARs in descending order of size. */ struct bars { uint32_t devfn, bar_reg, bar_sz; - } *bars = (struct bars *)0xc0000; + } *bars = (struct bars *)SCRATCH_PHYSICAL_ADDRESS; unsigned int i, nr_bars = 0; /* Program PCI-ISA bridge with appropriate link routes. */ @@ -196,6 +191,12 @@ static void pci_setup(void) switch ( class ) { + case 0x0300: + if ( (vendor_id == 0x1234) && (device_id == 0x1111) ) + virtual_vga = VGA_std; + if ( (vendor_id == 0x1013) && (device_id == 0xb8) ) + virtual_vga = VGA_cirrus; + break; case 0x0680: ASSERT((vendor_id == 0x8086) && (device_id == 0x7113)); /* @@ -464,19 +465,23 @@ int main(void) if ( (get_vcpu_nr() > 1) || get_apic_mode() ) create_mp_tables(); - if ( cirrus_check() ) + switch ( virtual_vga ) { + case VGA_cirrus: printf("Loading Cirrus VGABIOS ...\n"); memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_cirrusvga, sizeof(vgabios_cirrusvga)); vgabios_sz = sizeof(vgabios_cirrusvga); - } - else - { + break; + case VGA_std: printf("Loading Standard VGABIOS ...\n"); memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_stdvga, sizeof(vgabios_stdvga)); vgabios_sz = sizeof(vgabios_stdvga); + break; + default: + printf("No emulated VGA adaptor ...\n"); + break; } etherboot_sz = scan_etherboot_nic((void*)ETHERBOOT_PHYSICAL_ADDRESS); diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c index f124629925..2ef70ee53c 100644 --- a/tools/firmware/hvmloader/smbios.c +++ b/tools/firmware/hvmloader/smbios.c @@ -217,15 +217,16 @@ hvm_write_smbios_tables(void) xen_version_str[sizeof(xen_version_str)-1] = '\0'; - /* NB. 0xC0000 is a safe large memory area for scratch. */ - len = write_smbios_tables((void *)0xC0000, + /* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */ + len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS, get_vcpu_nr(), get_memsize(), uuid, xen_version_str, xen_major_version, xen_minor_version); if ( len > SMBIOS_MAXIMUM_SIZE ) goto error_out; /* Okay, not too large: copy out of scratch to final location. */ - memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len); + memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, + (void *)SCRATCH_PHYSICAL_ADDRESS, len); return len;