xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 05 of 19] tools: hvmloader: pass option ROM end address around as a parameter
Date: Tue, 12 Apr 2011 12:29:04 +0100	[thread overview]
Message-ID: <f3596ba54b29dec182f9.1302607744@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1302607739@localhost.localdomain>

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1302599957 -3600
# Node ID f3596ba54b29dec182f995e052f31ada0efd5f83
# Parent  73653e949dbef093ddd72fa527e00aa3fea854c4
tools: hvmloader: pass option ROM end address around as a parameter.

Reduces the cross talk between ROMBIOS and hvmloader.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r 73653e949dbe -r f3596ba54b29 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 10:14:55 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 10:19:17 2011 +0100
@@ -378,10 +378,11 @@ static void pci_setup(void)
  * Scan the list of Option ROMs at @roms for one which supports 
  * PCI (@vendor_id, @device_id) found at slot @devfn. If one is found,
  * copy it to @dest and return its size rounded up to a multiple 2kB. This
- * function will not copy ROMs beyond address OPTIONROM_PHYSICAL_END.
+ * function will not copy ROMs beyond address option_rom_end.
  */
 #define round_option_rom(x) (((x) + 2047) & ~2047)
 static int scan_option_rom(
+    unsigned int option_rom_end,
     uint8_t devfn, uint16_t vendor_id, uint16_t device_id,
     void *roms, uint32_t dest)
 {
@@ -449,7 +450,7 @@ static int scan_option_rom(
         printf(" - Product name: %s\n",
                (char *)rom + pnph->product_name_offset);
 
-    if ( (dest + rom->rom_size * 512 + 1) > OPTIONROM_PHYSICAL_END )
+    if ( (dest + rom->rom_size * 512 + 1) > option_rom_end )
     {
         printf("Option ROM size %x exceeds available space\n",
                rom->rom_size * 512);
@@ -467,7 +468,8 @@ static int scan_option_rom(
  * the corresponding rom data to *copy_rom_dest. Returns the length of the
  * selected rom, or 0 if no NIC found.
  */
-static int scan_etherboot_nic(uint32_t copy_rom_dest)
+static int scan_etherboot_nic(unsigned int option_rom_end,
+                              uint32_t copy_rom_dest)
 {
     uint16_t class, vendor_id, device_id, devfn;
     int rom_size = 0;
@@ -483,6 +485,7 @@ static int scan_etherboot_nic(uint32_t c
              (device_id != 0xffff) &&
              (class == 0x0200) )
             rom_size = scan_option_rom(
+                option_rom_end,
                 devfn, vendor_id, device_id, etherboot, copy_rom_dest);
     }
 
@@ -493,7 +496,8 @@ static int scan_etherboot_nic(uint32_t c
  * Scan the PCI bus for the devices that have an option ROM, and copy
  * the corresponding rom data to rom_phys_addr.
  */
-static int pci_load_option_roms(uint32_t rom_base_addr)
+static int pci_load_option_roms(unsigned int option_rom_end,
+                                uint32_t rom_base_addr)
 {
     uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
     uint16_t vendor_id, device_id, devfn, class;
@@ -522,6 +526,7 @@ static int pci_load_option_roms(uint32_t
         pci_writel(devfn, PCI_ROM_ADDRESS, option_rom_addr | 0x1);
 
         rom_phys_addr += scan_option_rom(
+            option_rom_end,
             devfn, vendor_id, device_id,
             (void *)(option_rom_addr & ~2047), rom_phys_addr);
 
@@ -640,10 +645,12 @@ int main(void)
     etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
     if ( etherboot_phys_addr < OPTIONROM_PHYSICAL_ADDRESS )
         etherboot_phys_addr = OPTIONROM_PHYSICAL_ADDRESS;
-    etherboot_sz = scan_etherboot_nic(etherboot_phys_addr);
+    etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END,
+                                      etherboot_phys_addr);
 
     option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
-    option_rom_sz = pci_load_option_roms(option_rom_phys_addr);
+    option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END,
+                                         option_rom_phys_addr);
 
     if ( hvm_info->acpi_enabled )
     {

  parent reply	other threads:[~2011-04-12 11:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 11:28 [PATCH 00 of 19] tools: SeaBIOS integration Ian Campbell
2011-04-12 11:29 ` [PATCH 01 of 19] tools: hvmloader: move ROMBIOS configuration into tools/firmware/rombios/ Ian Campbell
2011-04-12 11:29 ` [PATCH 02 of 19] tools: hvmloader: split e820 support into its own code module Ian Campbell
2011-04-12 11:29 ` [PATCH 03 of 19] tools: hvmloader: pass ACPI_PHYSICAL_ADDRESS as a runtime parameter Ian Campbell
2011-04-12 11:29 ` [PATCH 04 of 19] tools: hvmloader: pass SMBIOS location " Ian Campbell
2011-04-12 11:29 ` Ian Campbell [this message]
2011-04-12 11:29 ` [PATCH 06 of 19] tools: hvmloader: split scratch and hypercall addressing from ROMBIOS low heap Ian Campbell
2011-04-12 11:29 ` [PATCH 07 of 19] tools: hvmloader: refactor Makefile to move ROM filenames into variables Ian Campbell
2011-04-12 11:29 ` [PATCH 08 of 19] tools: hvmloader: remove rombios_sz, just use sizeof(rombios) Ian Campbell
2011-04-12 11:29 ` [PATCH 09 of 19] tools: hvmloader: rename roms.h to roms.inc Ian Campbell
2011-04-12 11:29 ` [PATCH 10 of 19] tools: hvmloader: Define $(OBJS) directly instead of via $(SRCS) Ian Campbell
2011-04-12 11:29 ` [PATCH 11 of 19] tools: hvmloader: add bios_config data structure Ian Campbell
2011-04-12 11:29 ` [PATCH 12 of 19] tools: hvmloader: Refactor APIC, PCI and SMP setup into struct bios_config Ian Campbell
2011-04-12 11:29 ` [PATCH 13 of 19] tools: hvmloader: refactor highbios and bios_info " Ian Campbell
2011-04-12 11:29 ` [PATCH 14 of 19] tools: hvmloader: Refactor VM86 and E820 " Ian Campbell
2011-04-12 11:29 ` [PATCH 15 of 19] tools: hvmloader: Refactor ACPI table " Ian Campbell
2011-04-12 11:29 ` [PATCH 16 of 19] tools: hvmloader: Refactor MP " Ian Campbell
2011-04-12 11:29 ` [PATCH 17 of 19] tools: libxl: hide selection of device-model, hvmloader and BIOS by default Ian Campbell
2011-04-14 18:09   ` Ian Jackson
2011-04-15  7:53     ` Ian Campbell
2011-04-12 11:29 ` [PATCH 18 of 19] tools: hvmloader: select BIOS through xenstore Ian Campbell
2011-04-12 11:29 ` [PATCH 19 of 19] tools: support SeaBIOS. Use by default when upstream qemu is configured Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3596ba54b29dec182f9.1302607744@localhost.localdomain \
    --to=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).