All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] Expand shadow memory area for using option ROM
@ 2008-12-26  4:46 Akio Takebe
  2008-12-29 14:27 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Akio Takebe @ 2008-12-26  4:46 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hi,

This patch expands shadow memory of guest BIOS.
Currently the shadow memory is 0xc0000 - 0xdffff.
It is used by VGA, gPXE, option ROM, but the size of these ROMs is
around 40k->64k, so the area is not enough.

This patch is:
- replace e820 table from 0xe0000 to 0xeb000.
- expand shadowr from 0xc0000-0xdffff to 0xc0000-0xe8fff.
- fix scan size of VGA BIOS.

after this patch, BIOS map is below.
 BIOS map:
  c0000-c8fff: VGA BIOS
  c9000-d57ff: Etherboot ROM
  d5800-e0fff: PCI Option ROMs
  e9000-e919c: SMBIOS tables
  f0000-fffff: Main BIOS

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>

Ref:
http://lists.xensource.com/archives/html/xen-devel/2008-12/msg00835.html

Best Regards,

Akio Takebe

[-- Attachment #2: exp_shadow_memory.patch --]
[-- Type: text/x-diff, Size: 4961 bytes --]

diff -r e2f36d066b7b tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Mon Dec 22 13:48:40 2008 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c	Fri Dec 26 13:33:15 2008 +0900
@@ -401,7 +401,7 @@
         printf(" - Product name: %s\n",
                (char *)rom + pnph->product_name_offset);
 
-    if ( (dest + rom->rom_size * 512 + 1) > 0xe0000u )
+    if ( (dest + rom->rom_size * 512 + 1) > 0xe9000u )
     {
         printf("Option ROM size %x exceeds available space\n",
                rom->rom_size * 512);
diff -r e2f36d066b7b tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c	Mon Dec 22 13:48:40 2008 +0000
+++ b/tools/firmware/rombios/rombios.c	Fri Dec 26 13:33:15 2008 +0900
@@ -1411,8 +1411,8 @@
   Bit32u base_mem;
   if (nr_entries > 32)
        nr_entries = 32;
-  write_word(0xe000, 0x8, nr_entries);
-  memcpyb(0xe000, 0x10, 0x9000, 0x2d0, nr_entries * 0x14);
+  write_word(0xeb00, 0x8, nr_entries);
+  memcpyb(0xeb00, 0x10, 0x9000, 0x2d0, nr_entries * 0x14);
   /* Report the proper base memory size at address 0x0413: otherwise
    * non-e820 code will clobber things if BASE_MEM_IN_K is bigger than
    * the first e820 entry.  Get the size by reading the second 64bit 
@@ -4669,7 +4669,7 @@
         {
 #ifdef HVMASSIST
        case 0x20: {
-            Bit16u e820_table_size = read_word(0xe000, 0x8) * 0x14;
+            Bit16u e820_table_size = read_word(0xeb00, 0x8) * 0x14;
 
             if (regs.u.r32.edx != 0x534D4150) /* SMAP */
                 goto int15_unimplemented;
@@ -4677,7 +4677,7 @@
             if ((regs.u.r16.bx / 0x14) * 0x14 == regs.u.r16.bx) {
                 if (regs.u.r16.bx + 0x14 <= e820_table_size)
                     memcpyb(ES, regs.u.r16.di,
-                            0xe000, 0x10 + regs.u.r16.bx, 0x14);
+                            0xeb00, 0x10 + regs.u.r16.bx, 0x14);
                 regs.u.r32.ebx += 0x14;
                 if ((regs.u.r32.ebx + 0x14 - 1) > e820_table_size)
                     regs.u.r32.ebx = 0;
@@ -4685,8 +4685,8 @@
                 Bit32u base, type;
                 Bit16u off;
                 for (off = 0; off < e820_table_size; off += 0x14) {
-                    base = read_dword(0xe000, 0x10 + off);
-                    type = read_dword(0xe000, 0x20 + off);
+                    base = read_dword(0xeb00, 0x10 + off);
+                    type = read_dword(0xeb00, 0x20 + off);
                     if ((base >= 0x100000) && (type == 1))
                         break;
                 }
@@ -4694,7 +4694,7 @@
                     SET_CF();
                     break;
                 }
-                memcpyb(ES, regs.u.r16.di, 0xe000, 0x10 + off, 0x14);
+                memcpyb(ES, regs.u.r16.di, 0xeb00, 0x10 + off, 0x14);
                 regs.u.r32.ebx = 0;
             } else { /* AX=E820, DX=534D4150, BX unrecognized */
                 goto int15_unimplemented;
@@ -4707,7 +4707,7 @@
         }
 
         case 0x01: {
-            Bit16u off, e820_table_size = read_word(0xe000, 0x8) * 0x14;
+            Bit16u off, e820_table_size = read_word(0xeb00, 0x8) * 0x14;
             Bit32u base, type, size;
 
             // do we have any reason to fail here ?
@@ -4723,8 +4723,8 @@
 
             // Find first RAM E820 entry >= 1MB.
             for (off = 0; off < e820_table_size; off += 0x14) {
-                base = read_dword(0xe000, 0x10 + off);
-                type = read_dword(0xe000, 0x20 + off);
+                base = read_dword(0xeb00, 0x10 + off);
+                type = read_dword(0xeb00, 0x20 + off);
                 if ((base >= 0x100000) && (type == 1))
                     break;
             }
@@ -4732,7 +4732,7 @@
             // If there is RAM above 16MB, return amount in 64kB chunks.
             regs.u.r16.dx = 0;
             if (off != e820_table_size) {
-                size = base + read_dword(0xe000, 0x18 + off);
+                size = base + read_dword(0xeb00, 0x18 + off);
                 if (size > 0x1000000) {
                     size -= 0x1000000;
                     regs.u.r16.dx = (Bit16u)(size >> 16);
@@ -10440,9 +10440,9 @@
 
 rom_scan:
   ;; Scan for existence of valid expansion ROMS.
-  ;;   Video ROM:   from 0xC0000..0xC7FFF in 2k increments
-  ;;   General ROM: from 0xC8000..0xDFFFF in 2k increments
-  ;;   System  ROM: only 0xE0000
+  ;;   Video ROM:   from 0xC0000..0xC8FFF in 2k increments
+  ;;   General ROM: from 0xC9000..0xE8FFF in 2k increments
+  ;;   System  ROM: only 0xE9000
   ;;
   ;; Header:
   ;;   Offset    Value
@@ -10964,7 +10964,7 @@
   call post_init_pic
 
   mov  cx, #0xc000  ;; init vga bios
-  mov  ax, #0xc780
+  mov  ax, #0xc880
   call rom_scan
 
   call _print_bios_banner
@@ -11017,8 +11017,8 @@
 
   call _init_boot_vectors
 
-  mov  cx, #0xc800  ;; init option roms
-  mov  ax, #0xe000
+  mov  cx, #0xc900  ;; init option roms
+  mov  ax, #0xe900
   call rom_scan
 
 #if BX_ELTORITO_BOOT

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Expand shadow memory area for using option ROM
  2008-12-26  4:46 [Patch] Expand shadow memory area for using option ROM Akio Takebe
@ 2008-12-29 14:27 ` Keir Fraser
  2009-01-05  9:33   ` Akio Takebe
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2008-12-29 14:27 UTC (permalink / raw)
  To: Akio Takebe, xen-devel

On 26/12/2008 04:46, "Akio Takebe" <takebe_akio@jp.fujitsu.com> wrote:

> This patch is:
> - replace e820 table from 0xe0000 to 0xeb000.
> - expand shadowr from 0xc0000-0xdffff to 0xc0000-0xe8fff.
> - fix scan size of VGA BIOS.
> 
> after this patch, BIOS map is below.
>  BIOS map:
>   c0000-c8fff: VGA BIOS
>   c9000-d57ff: Etherboot ROM
>   d5800-e0fff: PCI Option ROMs
>   e9000-e919c: SMBIOS tables
>   f0000-fffff: Main BIOS

Comments:

1. Why does the VGA BIOS 'scan size' need to be fixed? What's wrong with
scanning only up to 0xc8000 for it, and letting option ROMs continue to
reside from 0xc8000? Indeed, won't the VGABIOS always be at 0xc0000, so we
could actually only probe that address for it, and let option ROMs load as
low as 0xc0800?

2. It'd be nice to give E820_PHYSICAL_ADDRESS a definition in config.h and
then use that instead of hardcoding the address throughout rombios.c.

 -- Keir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Expand shadow memory area for using option ROM
  2008-12-29 14:27 ` Keir Fraser
@ 2009-01-05  9:33   ` Akio Takebe
  0 siblings, 0 replies; 3+ messages in thread
From: Akio Takebe @ 2009-01-05  9:33 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

Keir Fraser wrote
> On 26/12/2008 04:46, "Akio Takebe" <takebe_akio@jp.fujitsu.com> wrote:
> 
>> This patch is:
>> - replace e820 table from 0xe0000 to 0xeb000.
>> - expand shadowr from 0xc0000-0xdffff to 0xc0000-0xe8fff.
>> - fix scan size of VGA BIOS.
>>
>> after this patch, BIOS map is below.
>>  BIOS map:
>>   c0000-c8fff: VGA BIOS
>>   c9000-d57ff: Etherboot ROM
>>   d5800-e0fff: PCI Option ROMs
>>   e9000-e919c: SMBIOS tables
>>   f0000-fffff: Main BIOS
> 
> Comments:
> 
> 1. Why does the VGA BIOS 'scan size' need to be fixed? What's wrong with
> scanning only up to 0xc8000 for it, and letting option ROMs continue to
> reside from 0xc8000? Indeed, won't the VGABIOS always be at 0xc0000, so we
> could actually only probe that address for it, and let option ROMs load as
> low as 0xc0800?

Because the current VGA BIOS uses 0xc0000-0xc8fff from the following log.
I want just to avoid the unnecessary scanning.

(XEN) HVM1: BIOS map:
(XEN) HVM1:  c0000-c8fff: VGA BIOS
(XEN) HVM1:  c9000-d57ff: Etherboot ROM
(XEN) HVM1:  e9000-e919c: SMBIOS tables
(XEN) HVM1:  f0000-fffff: Main BIOS

I think rombios works fine if we drop the part of the patch.

> 
> 2. It'd be nice to give E820_PHYSICAL_ADDRESS a definition in config.h and
> then use that instead of hardcoding the address throughout rombios.c.
> 
I'll try it.

Best Regards,

Akio Takebe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-05  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-26  4:46 [Patch] Expand shadow memory area for using option ROM Akio Takebe
2008-12-29 14:27 ` Keir Fraser
2009-01-05  9:33   ` Akio Takebe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.