direct-io.hg

changeset 13104:b258c7587d8d

[HVM] Add Etherboot option ROM, for network-booting HVM guests.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Dec 20 11:59:54 2006 +0000 (2006-12-20)
parents e2fcb70bec59
children c75d6f2aad7a
files tools/examples/xmexample.hvm tools/firmware/etherboot/README tools/firmware/etherboot/eb-rtl8139.zrom tools/firmware/hvmloader/Makefile tools/firmware/hvmloader/hvmloader.c
line diff
     1.1 --- a/tools/examples/xmexample.hvm	Wed Dec 20 11:57:53 2006 +0000
     1.2 +++ b/tools/examples/xmexample.hvm	Wed Dec 20 11:59:54 2006 +0000
     1.3 @@ -29,7 +29,7 @@ memory = 128
     1.4  
     1.5  # Shadow pagetable memory for the domain, in MB.
     1.6  # Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
     1.7 -shadow_memory = 8
     1.8 +# shadow_memory = 8
     1.9  
    1.10  # A name for your domain. All domains must have different names.
    1.11  name = "ExampleHVMDomain"
    1.12 @@ -116,7 +116,7 @@ disk = [ 'file:/var/images/min-el3-i386.
    1.13  device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
    1.14  
    1.15  #-----------------------------------------------------------------------------
    1.16 -# boot on floppy (a), hard disk (c) or CD-ROM (d) 
    1.17 +# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d) 
    1.18  # default: hard disk, cd-rom, floppy
    1.19  #boot="cda"
    1.20  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/firmware/etherboot/README	Wed Dec 20 11:59:54 2006 +0000
     2.3 @@ -0,0 +1,7 @@
     2.4 +
     2.5 +This is an Etherboot option ROM for the rtl8139 NIC.  It has a few
     2.6 +non-standard settings, just to do with timeouts and when to give up.
     2.7 +
     2.8 +Rom-o-matic.net will provide this image at the following URL:
     2.9 +
    2.10 +http://rom-o-matic.net/5.4.2/build.php?version=5.4.2&F=ignore&nic=rtl8139%3Artl8139+--+%5B0x10ec%2C0x8139%5D&ofmt=Binary+ROM+Image%28.zrom%29&arch=i386&ASK_BOOT=-1&BOOT_FIRST=BOOT_NIC&BOOT_SECOND=BOOT_NOTHING&BOOT_THIRD=BOOT_NOTHING&BOOT_INDEX=0&STATIC_CLIENT_IP=&STATIC_SUBNET_MASK=&STATIC_SERVER_IP=&STATIC_GATEWAY_IP=&STATIC_BOOTFILE=&EXIT_ON_FILE_LOAD_ERROR=on&DHCP_CLIENT_ID=&DHCP_CLIENT_ID_LEN=&DHCP_CLIENT_ID_TYPE=&DHCP_USER_CLASS=&DHCP_USER_CLASS_LEN=&ALLOW_ONLY_ENCAPSULATED=on&DEFAULT_BOOTFILE=&CONGESTED=on&BACKOFF_LIMIT=7&TIMEOUT=180&TRY_FLOPPY_FIRST=0&EXIT_IF_NO_OFFER=on&TAGGED_IMAGE=on&ELF_IMAGE=on&PXE_IMAGE=on&DOWNLOAD_PROTO_TFTP=on&COMCONSOLE=0x3F8&CONSPEED=9600&COMPARM=0x03&PXE_EXPORT=on&CONFIG_PCI=on&CONFIG_ISA=on&BUILD_ID=&PCBIOS=on&A=Get+ROM
     3.1 Binary file tools/firmware/etherboot/eb-rtl8139.zrom has changed
     4.1 --- a/tools/firmware/hvmloader/Makefile	Wed Dec 20 11:57:53 2006 +0000
     4.2 +++ b/tools/firmware/hvmloader/Makefile	Wed Dec 20 11:59:54 2006 +0000
     4.3 @@ -51,11 +51,12 @@ hvmloader: roms.h acpi/acpi.a $(SRCS)
     4.4  acpi/acpi.a:
     4.5  	$(MAKE) -C acpi
     4.6  
     4.7 -roms.h:	../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin
     4.8 +roms.h:	../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin ../etherboot/eb-rtl8139.zrom
     4.9  	sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
    4.10  	sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
    4.11  	sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
    4.12  	sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h
    4.13 +	sh ./mkhex etherboot ../etherboot/eb-rtl8139.zrom >> roms.h
    4.14  
    4.15  .PHONY: clean
    4.16  clean:
     5.1 --- a/tools/firmware/hvmloader/hvmloader.c	Wed Dec 20 11:57:53 2006 +0000
     5.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Wed Dec 20 11:59:54 2006 +0000
     5.3 @@ -34,6 +34,7 @@
     5.4  /* memory map */
     5.5  #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
     5.6  #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
     5.7 +#define ETHERBOOT_PHYSICAL_ADDRESS    0x000C8000
     5.8  #define VMXASSIST_PHYSICAL_ADDRESS    0x000D0000
     5.9  #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
    5.10  
    5.11 @@ -279,6 +280,27 @@ static void pci_setup(void)
    5.12      }
    5.13  }
    5.14  
    5.15 +static 
    5.16 +int must_load_nic(void) 
    5.17 +{
    5.18 +    /* If the network card is in the boot order, load the Etherboot 
    5.19 +     * option ROM.  Read the boot order bytes from CMOS and check 
    5.20 +     * if any of them are 0x4. */
    5.21 +    uint8_t boot_order;
    5.22 +
    5.23 +    /* Read CMOS register 0x3d (boot choices 0 and 1) */
    5.24 +    outb(0x70, 0x3d);
    5.25 +    boot_order = inb(0x71);
    5.26 +    if ( (boot_order & 0xf) == 0x4 || (boot_order & 0xf0) == 0x40 ) 
    5.27 +        return 1;
    5.28 +    /* Read CMOS register 0x38 (boot choice 2 and FDD test flag) */
    5.29 +    outb(0x70, 0x38);
    5.30 +    boot_order = inb(0x71);
    5.31 +    if ( (boot_order & 0xf0) == 0x40 ) 
    5.32 +        return 1;
    5.33 +    return 0;
    5.34 +}
    5.35 +
    5.36  int main(void)
    5.37  {
    5.38      int acpi_sz;
    5.39 @@ -312,6 +334,13 @@ int main(void)
    5.40                 vgabios_stdvga, sizeof(vgabios_stdvga));
    5.41      }
    5.42  
    5.43 +    if ( must_load_nic() )
    5.44 +    {
    5.45 +        printf("Loading ETHERBOOT ...\n");
    5.46 +        memcpy((void *)ETHERBOOT_PHYSICAL_ADDRESS,
    5.47 +               etherboot, sizeof(etherboot));
    5.48 +    }
    5.49 +
    5.50      if ( get_acpi_enabled() != 0 )
    5.51      {
    5.52          printf("Loading ACPI ...\n");