ia64/xen-unstable

changeset 17694:36d9c5943b46

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 <jean.guyader@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed May 21 11:23:03 2008 +0100 (2008-05-21)
parents b58e95aee14f
children e64c3a8c60e1
files tools/firmware/hvmloader/config.h tools/firmware/hvmloader/hvmloader.c tools/firmware/hvmloader/smbios.c
line diff
     1.1 --- a/tools/firmware/hvmloader/config.h	Wed May 21 11:19:41 2008 +0100
     1.2 +++ b/tools/firmware/hvmloader/config.h	Wed May 21 11:23:03 2008 +0100
     1.3 @@ -23,11 +23,12 @@
     1.4  /* Memory map. */
     1.5  #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
     1.6  #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
     1.7 -#define ETHERBOOT_PHYSICAL_ADDRESS    0x000C8000
     1.8 +#define ETHERBOOT_PHYSICAL_ADDRESS    0x000D0000
     1.9  #define EXTBOOT_PHYSICAL_ADDRESS      0x000DF800
    1.10  #define SMBIOS_PHYSICAL_ADDRESS       0x000E9000
    1.11  #define SMBIOS_MAXIMUM_SIZE           0x00001000
    1.12  #define ACPI_PHYSICAL_ADDRESS         0x000EA000
    1.13  #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
    1.14 +#define SCRATCH_PHYSICAL_ADDRESS      0x00010000
    1.15  
    1.16  #endif /* __HVMLOADER_CONFIG_H__ */
     2.1 --- a/tools/firmware/hvmloader/hvmloader.c	Wed May 21 11:19:41 2008 +0100
     2.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Wed May 21 11:23:03 2008 +0100
     2.3 @@ -103,12 +103,7 @@ void smp_initialise(void);
     2.4  void create_mp_tables(void);
     2.5  int hvm_write_smbios_tables(void);
     2.6  
     2.7 -static int
     2.8 -cirrus_check(void)
     2.9 -{
    2.10 -    outw(0x3C4, 0x9206);
    2.11 -    return inb(0x3C5) == 0x12;
    2.12 -}
    2.13 +static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
    2.14  
    2.15  static void
    2.16  init_hypercalls(void)
    2.17 @@ -165,7 +160,7 @@ static void pci_setup(void)
    2.18      /* Create a list of device BARs in descending order of size. */
    2.19      struct bars {
    2.20          uint32_t devfn, bar_reg, bar_sz;
    2.21 -    } *bars = (struct bars *)0xc0000;
    2.22 +    } *bars = (struct bars *)SCRATCH_PHYSICAL_ADDRESS;
    2.23      unsigned int i, nr_bars = 0;
    2.24  
    2.25      /* Program PCI-ISA bridge with appropriate link routes. */
    2.26 @@ -196,6 +191,12 @@ static void pci_setup(void)
    2.27  
    2.28          switch ( class )
    2.29          {
    2.30 +        case 0x0300:
    2.31 +            if ( (vendor_id == 0x1234) && (device_id == 0x1111) )
    2.32 +                virtual_vga = VGA_std;
    2.33 +            if ( (vendor_id == 0x1013) && (device_id == 0xb8) )
    2.34 +                virtual_vga = VGA_cirrus;
    2.35 +            break;
    2.36          case 0x0680:
    2.37              ASSERT((vendor_id == 0x8086) && (device_id == 0x7113));
    2.38              /*
    2.39 @@ -464,19 +465,23 @@ int main(void)
    2.40      if ( (get_vcpu_nr() > 1) || get_apic_mode() )
    2.41          create_mp_tables();
    2.42  
    2.43 -    if ( cirrus_check() )
    2.44 +    switch ( virtual_vga )
    2.45      {
    2.46 +    case VGA_cirrus:
    2.47          printf("Loading Cirrus VGABIOS ...\n");
    2.48          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
    2.49                 vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
    2.50          vgabios_sz = sizeof(vgabios_cirrusvga);
    2.51 -    }
    2.52 -    else
    2.53 -    {
    2.54 +        break;
    2.55 +    case VGA_std:
    2.56          printf("Loading Standard VGABIOS ...\n");
    2.57          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
    2.58                 vgabios_stdvga, sizeof(vgabios_stdvga));
    2.59          vgabios_sz = sizeof(vgabios_stdvga);
    2.60 +        break;
    2.61 +    default:
    2.62 +        printf("No emulated VGA adaptor ...\n");
    2.63 +        break;
    2.64      }
    2.65  
    2.66      etherboot_sz = scan_etherboot_nic((void*)ETHERBOOT_PHYSICAL_ADDRESS);
     3.1 --- a/tools/firmware/hvmloader/smbios.c	Wed May 21 11:19:41 2008 +0100
     3.2 +++ b/tools/firmware/hvmloader/smbios.c	Wed May 21 11:23:03 2008 +0100
     3.3 @@ -217,15 +217,16 @@ hvm_write_smbios_tables(void)
     3.4  
     3.5      xen_version_str[sizeof(xen_version_str)-1] = '\0';
     3.6  
     3.7 -    /* NB. 0xC0000 is a safe large memory area for scratch. */
     3.8 -    len = write_smbios_tables((void *)0xC0000,
     3.9 +    /* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */
    3.10 +    len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS,
    3.11                                get_vcpu_nr(), get_memsize(),
    3.12                                uuid, xen_version_str,
    3.13                                xen_major_version, xen_minor_version);
    3.14      if ( len > SMBIOS_MAXIMUM_SIZE )
    3.15          goto error_out;
    3.16      /* Okay, not too large: copy out of scratch to final location. */
    3.17 -    memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
    3.18 +    memcpy((void *)SMBIOS_PHYSICAL_ADDRESS,
    3.19 +           (void *)SCRATCH_PHYSICAL_ADDRESS, len);
    3.20  
    3.21      return len;
    3.22