qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS
@ 2008-10-27 10:12 Gleb Natapov
  2008-10-27 10:12 ` [Qemu-devel] [PATCH 1/6] Move PIC initialization out of line to save space in post code area Gleb Natapov
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:12 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

Hello,

This patch series adds S3 (suspend to RAM) ACPI state to BIOS. Most
changes concern themselves with preventing BIOS from using memory
locations available to a guest OS.

---

Gleb Natapov (6):
      Don't power down vga card on entering S3 state.
      Don't use unreserved memory in BIOS.
      Execute rombios32 code from rom address 0xe0000.
      Disable init of SMM.
      Add S3 state to DSDT. Handle resume event in the BIOS.
      Move PIC initialization out of line to save space in post code area.


 bios/Makefile.in      |    1 
 bios/acpi-dsdt.dsl    |   45 +++++-
 bios/acpi-dsdt.hex    |  376 +++++++++++++++++++++++++------------------------
 bios/rombios.c        |  105 ++++++++------
 bios/rombios.h        |    2 
 bios/rombios32.c      |   75 +++++++++-
 bios/rombios32.ld     |    8 -
 bios/rombios32start.S |    9 +
 8 files changed, 377 insertions(+), 244 deletions(-)
 mode change 100644 => 100755 bios/acpi-dsdt.dsl
 mode change 100644 => 100755 bios/rombios32.c


-- 
        Gleb.

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

* [Qemu-devel] [PATCH 1/6] Move PIC initialization out of line to save space in post code area.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
@ 2008-10-27 10:12 ` Gleb Natapov
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 2/6] Add S3 state to DSDT. Handle resume event in the BIOS Gleb Natapov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:12 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

There are only a couple of bytes left in post area.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/rombios.c |   48 ++++++++++++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/bios/rombios.c b/bios/rombios.c
index 3366ad9..88eac04 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -10256,6 +10256,31 @@ rom_scan_increment:
   mov  ds, ax
   ret
 
+post_init_pic:
+  mov al, #0x11 ; send initialisation commands
+  out 0x20, al
+  out 0xa0, al
+  mov al, #0x08
+  out 0x21, al
+  mov al, #0x70
+  out 0xa1, al
+  mov al, #0x04
+  out 0x21, al
+  mov al, #0x02
+  out 0xa1, al
+  mov al, #0x01
+  out 0x21, al
+  out 0xa1, al
+  mov  al, #0xb8
+  out  0x21, AL ;master pic: unmask IRQ 0, 1, 2, 6
+#if BX_USE_PS2_MOUSE
+  mov  al, #0x8f
+#else
+  mov  al, #0x9f
+#endif
+  out  0xa1, AL ;slave  pic: unmask IRQ 12, 13, 14
+  ret
+
 ;; the following area can be used to write dynamically generated tables
   .align 16
 bios_table_area_start:
@@ -10516,28 +10541,7 @@ post_default_ints:
   SET_INT_VECTOR(0x10, #0xF000, #int10_handler)
 
   ;; PIC
-  mov al, #0x11 ; send initialisation commands
-  out 0x20, al
-  out 0xa0, al
-  mov al, #0x08
-  out 0x21, al
-  mov al, #0x70
-  out 0xa1, al
-  mov al, #0x04
-  out 0x21, al
-  mov al, #0x02
-  out 0xa1, al
-  mov al, #0x01
-  out 0x21, al
-  out 0xa1, al
-  mov  al, #0xb8
-  out  0x21, AL ;master pic: unmask IRQ 0, 1, 2, 6
-#if BX_USE_PS2_MOUSE
-  mov  al, #0x8f
-#else
-  mov  al, #0x9f
-#endif
-  out  0xa1, AL ;slave  pic: unmask IRQ 12, 13, 14
+  call post_init_pic
 
   mov  cx, #0xc000  ;; init vga bios
   mov  ax, #0xc780

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

* [Qemu-devel] [PATCH 2/6] Add S3 state to DSDT. Handle resume event in the BIOS.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
  2008-10-27 10:12 ` [Qemu-devel] [PATCH 1/6] Move PIC initialization out of line to save space in post code area Gleb Natapov
@ 2008-10-27 10:13 ` Gleb Natapov
  2008-10-30 22:41   ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Sebastian Herbszt
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 3/6] Disable init of SMM Gleb Natapov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:13 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/acpi-dsdt.dsl |   30 ++++++++++++++++++----
 bios/acpi-dsdt.hex |   17 +++++++-----
 bios/rombios.c     |   34 +++++++++++++++++++++++++
 bios/rombios32.c   |   71 +++++++++++++++++++++++++++++++++++++++++++++++++---
 4 files changed, 135 insertions(+), 17 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index 19ac2f9..f201396 100644
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -531,11 +531,29 @@ DefinitionBlock (
         }
     }
 
-    /* S5 = power off state */
-    Name (_S5, Package (4) {
-        0x00, // PM1a_CNT.SLP_TYP
-        0x00, // PM2a_CNT.SLP_TYP
-        0x00, // reserved
-        0x00, // reserved
+    /*
+     * S3 (suspend-to-ram), S4 (suspend-to-disc) and S5 (power-off) type codes:
+     * must match piix4 emulation.
+     */
+    Name (\_S3, Package (0x04)
+    {
+        0x01,  /* PM1a_CNT.SLP_TYP */
+        0x01,  /* PM1b_CNT.SLP_TYP */
+        Zero,  /* reserved */
+        Zero   /* reserved */
+    })
+    Name (\_S4, Package (0x04)
+    {
+        Zero,  /* PM1a_CNT.SLP_TYP */
+        Zero,  /* PM1b_CNT.SLP_TYP */
+        Zero,  /* reserved */
+        Zero   /* reserved */
+    })
+    Name (\_S5, Package (0x04)
+    {
+        Zero,  /* PM1a_CNT.SLP_TYP */
+        Zero,  /* PM1b_CNT.SLP_TYP */
+        Zero,  /* reserved */
+        Zero   /* reserved */
     })
 }
diff --git a/bios/acpi-dsdt.hex b/bios/acpi-dsdt.hex
index 6bc6268..6088b18 100644
--- a/bios/acpi-dsdt.hex
+++ b/bios/acpi-dsdt.hex
@@ -1,22 +1,22 @@
 /*
  * 
  * Intel ACPI Component Architecture
- * ASL Optimizing Compiler version 20060912 [Nov 25 2006]
+ * ASL Optimizing Compiler version 20061109 [May 15 2007]
  * Copyright (C) 2000 - 2006 Intel Corporation
  * Supports ACPI Specification Revision 3.0a
  * 
- * Compilation of "acpi-dsdt.dsl" - Sun Sep 14 10:27:40 2008
+ * Compilation of "acpi-dsdt.dsl" - Mon Oct 27 10:37:05 2008
  * 
  * C source code output
  *
  */
-unsigned char AmlCode[] =
+const unsigned char AmlCode[] =
 {
-    0x44,0x53,0x44,0x54,0xC9,0x07,0x00,0x00,  /* 00000000    "DSDT...." */
-    0x01,0x0E,0x42,0x58,0x50,0x43,0x00,0x00,  /* 00000008    "..BXPC.." */
+    0x44,0x53,0x44,0x54,0xE1,0x07,0x00,0x00,  /* 00000000    "DSDT...." */
+    0x01,0x24,0x42,0x58,0x50,0x43,0x00,0x00,  /* 00000008    ".$BXPC.." */
     0x42,0x58,0x44,0x53,0x44,0x54,0x00,0x00,  /* 00000010    "BXDSDT.." */
     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
-    0x12,0x09,0x06,0x20,0x10,0x1C,0x5C,0x00,  /* 00000020    "... ..\." */
+    0x09,0x11,0x06,0x20,0x10,0x1C,0x5C,0x00,  /* 00000020    "... ..\." */
     0x5B,0x80,0x44,0x42,0x47,0x5F,0x01,0x0B,  /* 00000028    "[.DBG_.." */
     0x44,0xB0,0x0A,0x04,0x5B,0x81,0x0B,0x44,  /* 00000030    "D...[..D" */
     0x42,0x47,0x5F,0x03,0x44,0x42,0x47,0x4C,  /* 00000038    "BG_.DBGL" */
@@ -260,6 +260,9 @@ unsigned char AmlCode[] =
     0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F,0x82,  /* 000007A8    ".h.TMP_." */
     0x54,0x4D,0x50,0x5F,0x60,0x76,0x60,0x70,  /* 000007B0    "TMP_`v`p" */
     0x60,0x50,0x52,0x51,0x33,0x08,0x5F,0x53,  /* 000007B8    "`PRQ3._S" */
-    0x35,0x5F,0x12,0x06,0x04,0x00,0x00,0x00,  /* 000007C0    "5_......" */
+    0x33,0x5F,0x12,0x06,0x04,0x01,0x01,0x00,  /* 000007C0    "3_......" */
+    0x00,0x08,0x5F,0x53,0x34,0x5F,0x12,0x06,  /* 000007C8    ".._S4_.." */
+    0x04,0x00,0x00,0x00,0x00,0x08,0x5F,0x53,  /* 000007D0    "......_S" */
+    0x35,0x5F,0x12,0x06,0x04,0x00,0x00,0x00,  /* 000007D8    "5_......" */
     0x00,
 };
diff --git a/bios/rombios.c b/bios/rombios.c
index 88eac04..46996fa 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -2198,6 +2198,31 @@ debugger_off()
   outb(0xfedc, 0x00);
 }
 
+void
+s3_resume()
+{
+    Bit32u s3_wakeup_vector;
+    Bit8u s3_resume_flag;
+
+    s3_resume_flag = read_byte(0x40, 0xb0);
+    s3_wakeup_vector = read_dword(0x40, 0xb2);
+
+    BX_INFO("S3 resume called %x 0x%lx\n", s3_resume_flag, s3_wakeup_vector);
+    if (s3_resume_flag != 0xFE || !s3_wakeup_vector)
+	    return;
+
+    write_byte(0x40, 0xb0, 0);
+
+    /* setup wakeup vector */
+    write_word(0x40, 0xb6, (s3_wakeup_vector & 0xF)); /* IP */
+    write_word(0x40, 0xb8, (s3_wakeup_vector >> 4)); /* CS */
+
+    BX_INFO("S3 resume jump to %x:%x\n", *(Bit16u*)0x04b8, *(Bit16u*)0x04b6);
+ASM_START
+    jmpf [0x04b6]
+ASM_END
+}
+
 #if BX_USE_ATADRV
 
 // ---------------------------------------------------------------------------
@@ -10005,6 +10030,10 @@ rombios32_05:
   ;; init the stack pointer
   mov esp, #0x00080000
 
+  ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32
+  push #0x04b0
+  push #0x04b2
+
   ;; call rombios32 code
   mov eax, #0x00040000
   call eax
@@ -10383,6 +10412,9 @@ normal_post:
   rep
     stosw
 
+  ;; Save shutdown status
+  mov 0x04b0, bl
+
   call _log_bios_start
 
   ;; set all interrupts to default handler
@@ -10593,6 +10625,8 @@ post_default_ints:
   mov  ax, #0xe000
   call rom_scan
 
+  call _s3_resume
+
 #if BX_ELTORITO_BOOT
   call _interactive_bootkey
 #endif // BX_ELTORITO_BOOT
diff --git a/bios/rombios32.c b/bios/rombios32.c
index f0daf15..ff84f80 100644
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -180,6 +180,20 @@ void *memmove(void *d1, const void *s1, size_t len)
     return d1;
 }
 
+int memcmp(const void *s1, const void *s2, size_t len)
+{
+	const int8_t *p1 = s1;
+	const int8_t *p2 = s2;
+
+	while (len--) {
+		int r = *p1++ - *p2++;
+		if(r)
+			return r;
+	}
+
+	return 0;
+}
+
 size_t strlen(const char *s)
 {
     const char *s1;
@@ -644,7 +658,7 @@ static void bios_shadow_init(PCIDevice *d)
 {
     int v;
 
-    if (find_bios_table_area() < 0)
+    if (bios_table_cur_addr == 0)
         return;
 
     /* remap the BIOS to shadow RAM an keep it read/write while we
@@ -1461,7 +1475,7 @@ void acpi_bios_init(void)
     memset(facs, 0, sizeof(*facs));
     memcpy(facs->signature, "FACS", 4);
     facs->length = cpu_to_le32(sizeof(*facs));
-
+    BX_INFO("Firmware waking vector %p\n", &facs->firmware_waking_vector);
     /* DSDT */
     memcpy(dsdt, AmlCode, sizeof(AmlCode));
 
@@ -2011,9 +2025,40 @@ void smbios_init(void)
     BX_INFO("SMBIOS table addr=0x%08lx\n", (unsigned long)start);
 }
 
-void rombios32_init(void)
+static uint32_t find_resume_vector(void)
 {
-    BX_INFO("Starting rombios32\n");
+    unsigned long addr;
+
+    if (bios_table_cur_addr == 0)
+        return 0;
+
+    for (addr = bios_table_cur_addr; addr < bios_table_end_addr; addr++) {
+        if (!memcmp((void*)addr, "RSD PTR ", 8)) {
+            struct rsdp_descriptor *rsdp = (void*)addr;
+            struct rsdt_descriptor_rev1 *rsdt = (void*)rsdp->rsdt_physical_address;
+            struct fadt_descriptor_rev1 *fadt = (void*)rsdt->table_offset_entry[0];
+            struct facs_descriptor_rev1 *facs = (void*)fadt->firmware_ctrl;
+            return facs->firmware_waking_vector;
+        }
+    }
+
+    return 0;
+}
+
+static void find_440fx(PCIDevice *d)
+{
+    uint16_t vendor_id, device_id;
+
+    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
+    device_id = pci_config_readw(d, PCI_DEVICE_ID);
+
+    if (vendor_id == 0x8086 && device_id == 0x1237)
+        i440_pcidev = *d;
+}
+
+void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag)
+{
+    BX_INFO("Starting rombios32 %p %p %x\n", s3_resume_vector, shutdown_flag, *shutdown_flag);
 
 #ifdef BX_QEMU
     qemu_cfg_port = qemu_cfg_port_probe();
@@ -2025,6 +2070,24 @@ void rombios32_init(void)
 
     smp_probe();
 
+    if (find_bios_table_area() < 0)
+        return;
+
+    if (*shutdown_flag == 0xfe) {
+        *s3_resume_vector = find_resume_vector();
+        if (!*s3_resume_vector) {
+	        BX_INFO("This is S3 resume but wakeup vector is NULL\n");
+        } else {
+	        BX_INFO("S3 resume vector %p\n", *s3_resume_vector);
+            /* redirect bios read access to RAM */
+            pci_for_each_device(find_440fx);
+            bios_lock_shadow_ram(); /* bios is already copied */
+            return;
+        }
+    }
+
+    uuid_probe();
+
     pci_bios_init();
 
     if (bios_table_cur_addr != 0) {

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

* [Qemu-devel] [PATCH 3/6] Disable init of SMM.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
  2008-10-27 10:12 ` [Qemu-devel] [PATCH 1/6] Move PIC initialization out of line to save space in post code area Gleb Natapov
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 2/6] Add S3 state to DSDT. Handle resume event in the BIOS Gleb Natapov
@ 2008-10-27 10:13 ` Gleb Natapov
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 4/6] Execute rombios32 code from rom address 0xe0000 Gleb Natapov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:13 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

SMM initialization uses memory available for OS use.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/rombios32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 bios/rombios32.c

diff --git a/bios/rombios32.c b/bios/rombios32.c
old mode 100644
new mode 100755
index ff84f80..e887d71
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -38,7 +38,7 @@ typedef unsigned long long uint64_t;
 //#define BX_USE_EBDA_TABLES
 
 /* define it if the (emulated) hardware supports SMM mode */
-#define BX_USE_SMM
+//#define BX_USE_SMM
 
 #define cpuid(index, eax, ebx, ecx, edx) \
   asm volatile ("cpuid" \

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

* [Qemu-devel] [PATCH 4/6] Execute rombios32 code from rom address 0xe0000.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
                   ` (2 preceding siblings ...)
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 3/6] Disable init of SMM Gleb Natapov
@ 2008-10-27 10:13 ` Gleb Natapov
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 5/6] Don't use unreserved memory in BIOS Gleb Natapov
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 6/6] Don't power down vga card on entering S3 state Gleb Natapov
  5 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:13 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/Makefile.in      |    1 +
 bios/rombios.c        |   17 +----------------
 bios/rombios32.ld     |    8 +++-----
 bios/rombios32start.S |    9 ++++++++-
 4 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/bios/Makefile.in b/bios/Makefile.in
index b055910..af674b4 100644
--- a/bios/Makefile.in
+++ b/bios/Makefile.in
@@ -106,6 +106,7 @@ rombios32.o: rombios32.c acpi-dsdt.hex
 ifeq ("1", "0")
 acpi-dsdt.hex: acpi-dsdt.dsl
 	iasl -tc -p $@ $<
+	sed -i -e's/^unsigned/const unsigned/' $@
 endif
 
 rombios32start.o: rombios32start.S
diff --git a/bios/rombios.c b/bios/rombios.c
index 46996fa..c4c1e35 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -10020,13 +10020,6 @@ rombios32_05:
   mov gs, ax
   cld
 
-  ;; copy rombios32 code to ram (ram offset = 1MB)
-  mov esi, #0xfffe0000
-  mov edi, #0x00040000
-  mov ecx, #0x10000 / 4
-  rep
-    movsd
-
   ;; init the stack pointer
   mov esp, #0x00080000
 
@@ -10035,17 +10028,9 @@ rombios32_05:
   push #0x04b2
 
   ;; call rombios32 code
-  mov eax, #0x00040000
+  mov eax, #0x000e0000
   call eax
 
-  ;; reset the memory (some boot loaders such as syslinux suppose
-  ;; that the memory is set to zero)
-  mov edi, #0x00040000
-  mov ecx, #0x40000 / 4
-  xor eax, eax
-  rep
-    stosd
-
   ;; return to 16 bit protected mode first
   db 0xea
   dd rombios32_10
diff --git a/bios/rombios32.ld b/bios/rombios32.ld
index c7f6066..113a2c0 100644
--- a/bios/rombios32.ld
+++ b/bios/rombios32.ld
@@ -3,14 +3,12 @@ OUTPUT_ARCH(i386)
 ENTRY(_start);
 SECTIONS
 {
-        . = 0x00040000;
+        . = 0x000e0000;
         .text     : { *(.text)    }
         .rodata    : { *(.rodata) }
-        . = ALIGN(4096);
-        .data     : { *(.data)    }
-        __bss_start = . ;
-        .bss      : { *(.bss) *(COMMON) }
         _end = . ;
+        .data 0x700 : AT (_end) { __data_start = .; *(.data); __data_end = .;}
+        .bss      : { __bss_start = .; *(.bss) *(COMMON); __bss_end = .;}
         /DISCARD/ : { *(.stab)
                      *(.stabstr)
                      *(.comment)
diff --git a/bios/rombios32start.S b/bios/rombios32start.S
index 601e2b0..1900261 100644
--- a/bios/rombios32start.S
+++ b/bios/rombios32start.S
@@ -32,10 +32,17 @@ _start:
   /* clear bss section */
   xor %eax, %eax
   mov $__bss_start, %edi
-  mov $_end, %ecx
+  mov $__bss_end, %ecx
   sub %edi, %ecx
   rep stosb
 
+  /* copy data section */
+  mov $_end, %esi
+  mov $__data_start, %edi
+  mov $__data_end, %ecx
+  sub %edi, %ecx
+  rep movsb
+
   jmp rombios32_init
 
   .code16

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

* [Qemu-devel] [PATCH 5/6] Don't use unreserved memory in BIOS.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
                   ` (3 preceding siblings ...)
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 4/6] Execute rombios32 code from rom address 0xe0000 Gleb Natapov
@ 2008-10-27 10:13 ` Gleb Natapov
  2008-10-30 23:12   ` [Qemu-devel] Re: [Bochs-developers] " Sebastian Herbszt
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 6/6] Don't power down vga card on entering S3 state Gleb Natapov
  5 siblings, 1 reply; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:13 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

Use only first page and last page of low memory. OSes assumes that first
page is used by bios and last page is reserved in e820 map.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/rombios.c   |    6 +++---
 bios/rombios.h   |    2 +-
 bios/rombios32.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bios/rombios.c b/bios/rombios.c
index c4c1e35..19f0e93 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -4541,7 +4541,7 @@ ASM_END
                 {
                     case 0:
                         set_e820_range(ES, regs.u.r16.di,
-                                       0x0000000L, 0x0009fc00L, 1);
+                                       0x0000000L, 0x0009f000L, 1);
                         regs.u.r32.ebx = 1;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4550,7 +4550,7 @@ ASM_END
                         break;
                     case 1:
                         set_e820_range(ES, regs.u.r16.di,
-                                       0x0009fc00L, 0x000a0000L, 2);
+                                       0x0009f000L, 0x000a0000L, 2);
                         regs.u.r32.ebx = 2;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -10021,7 +10021,7 @@ rombios32_05:
   cld
 
   ;; init the stack pointer
-  mov esp, #0x00080000
+  mov esp, #0x9fbf0
 
   ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32
   push #0x04b0
diff --git a/bios/rombios.h b/bios/rombios.h
index f0ed88e..57b0f46 100644
--- a/bios/rombios.h
+++ b/bios/rombios.h
@@ -56,7 +56,7 @@
 #define ACPI_DATA_SIZE    0x00010000L
 #define PM_IO_BASE        0xb000
 #define SMB_IO_BASE       0xb100
-#define CPU_COUNT_ADDR    0xf000
+#define CPU_COUNT_ADDR    0x0500
 
   // Define the application NAME
 #if defined(BX_QEMU)
diff --git a/bios/rombios32.c b/bios/rombios32.c
index e887d71..c192cf3 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -57,7 +57,7 @@ typedef unsigned long long uint64_t;
 
 #define APIC_ENABLED 0x0100
 
-#define AP_BOOT_ADDR 0x10000
+#define AP_BOOT_ADDR 0x9f000
 
 #define MPTABLE_MAX_SIZE  0x00002000
 #define SMI_CMD_IO_ADDR   0xb2

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

* [Qemu-devel] [PATCH 6/6] Don't power down vga card on entering S3 state.
  2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
                   ` (4 preceding siblings ...)
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 5/6] Don't use unreserved memory in BIOS Gleb Natapov
@ 2008-10-27 10:13 ` Gleb Natapov
  5 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-10-27 10:13 UTC (permalink / raw)
  To: bochs-developers; +Cc: qemu-devel

This is needed to fool windows to enter S3. The trick works for XP and
Windows2003, but Vista still refuse to allow S3.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

 bios/acpi-dsdt.dsl |   15 ++
 bios/acpi-dsdt.hex |  373 ++++++++++++++++++++++++++--------------------------
 2 files changed, 204 insertions(+), 184 deletions(-)
 mode change 100644 => 100755 bios/acpi-dsdt.dsl

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
old mode 100644
new mode 100755
index f201396..3829569
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -133,6 +133,21 @@ DefinitionBlock (
     }
 
     Scope(\_SB.PCI0) {
+        Device (VGA) {
+                 Name (_ADR, 0x00020000)
+                 Method (_S1D, 0, NotSerialized)
+                 {
+                         Return (0x00)
+                 }
+                 Method (_S2D, 0, NotSerialized)
+                 {
+                         Return (0x00)
+                 }
+                 Method (_S3D, 0, NotSerialized)
+                 {
+                         Return (0x00)
+                 }
+        }
 
 	/* PIIX3 ISA bridge */
         Device (ISA) {
diff --git a/bios/acpi-dsdt.hex b/bios/acpi-dsdt.hex
index 6088b18..a4c64e6 100644
--- a/bios/acpi-dsdt.hex
+++ b/bios/acpi-dsdt.hex
@@ -5,15 +5,15 @@
  * Copyright (C) 2000 - 2006 Intel Corporation
  * Supports ACPI Specification Revision 3.0a
  * 
- * Compilation of "acpi-dsdt.dsl" - Mon Oct 27 10:37:05 2008
+ * Compilation of "acpi-dsdt.dsl" - Mon Oct 27 10:39:43 2008
  * 
  * C source code output
  *
  */
 const unsigned char AmlCode[] =
 {
-    0x44,0x53,0x44,0x54,0xE1,0x07,0x00,0x00,  /* 00000000    "DSDT...." */
-    0x01,0x24,0x42,0x58,0x50,0x43,0x00,0x00,  /* 00000008    ".$BXPC.." */
+    0x44,0x53,0x44,0x54,0x0D,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
+    0x01,0xA1,0x42,0x58,0x50,0x43,0x00,0x00,  /* 00000008    "..BXPC.." */
     0x42,0x58,0x44,0x53,0x44,0x54,0x00,0x00,  /* 00000010    "BXDSDT.." */
     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
     0x09,0x11,0x06,0x20,0x10,0x1C,0x5C,0x00,  /* 00000020    "... ..\." */
@@ -83,186 +83,191 @@ const unsigned char AmlCode[] =
     0x17,0x00,0x00,0x0C,0x01,0x00,0x00,0x00,  /* 00000220    "........" */
     0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xBF,  /* 00000228    "........" */
     0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,  /* 00000230    "........" */
-    0x1E,0x79,0x00,0x10,0x41,0x29,0x2E,0x5F,  /* 00000238    ".y..A)._" */
+    0x1E,0x79,0x00,0x10,0x4D,0x2B,0x2E,0x5F,  /* 00000238    ".y..M+._" */
     0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x5B,  /* 00000240    "SB_PCI0[" */
-    0x82,0x42,0x23,0x49,0x53,0x41,0x5F,0x08,  /* 00000248    ".B#ISA_." */
-    0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x01,  /* 00000250    "_ADR...." */
-    0x00,0x5B,0x80,0x50,0x34,0x30,0x43,0x02,  /* 00000258    ".[.P40C." */
-    0x0A,0x60,0x0A,0x04,0x5B,0x82,0x2D,0x52,  /* 00000260    ".`..[.-R" */
-    0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 00000268    "TC_._HID" */
-    0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,0x43,  /* 00000270    ".A...._C" */
-    0x52,0x53,0x11,0x18,0x0A,0x15,0x47,0x01,  /* 00000278    "RS....G." */
-    0x70,0x00,0x70,0x00,0x10,0x02,0x22,0x00,  /* 00000280    "p.p..."." */
-    0x01,0x47,0x01,0x72,0x00,0x72,0x00,0x02,  /* 00000288    ".G.r.r.." */
-    0x06,0x79,0x00,0x5B,0x82,0x44,0x04,0x4B,  /* 00000290    ".y.[.D.K" */
-    0x42,0x44,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 00000298    "BD_._HID" */
-    0x0C,0x41,0xD0,0x03,0x03,0x14,0x09,0x5F,  /* 000002A0    ".A....._" */
-    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x14,  /* 000002A8    "STA....." */
-    0x29,0x5F,0x43,0x52,0x53,0x00,0x08,0x54,  /* 000002B0    ")_CRS..T" */
-    0x4D,0x50,0x5F,0x11,0x18,0x0A,0x15,0x47,  /* 000002B8    "MP_....G" */
-    0x01,0x60,0x00,0x60,0x00,0x01,0x01,0x47,  /* 000002C0    ".`.`...G" */
-    0x01,0x64,0x00,0x64,0x00,0x01,0x01,0x22,  /* 000002C8    ".d.d..."" */
-    0x02,0x00,0x79,0x00,0xA4,0x54,0x4D,0x50,  /* 000002D0    "..y..TMP" */
-    0x5F,0x5B,0x82,0x33,0x4D,0x4F,0x55,0x5F,  /* 000002D8    "_[.3MOU_" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000002E0    "._HID.A." */
-    0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 000002E8    "...._STA" */
-    0x00,0xA4,0x0A,0x0F,0x14,0x19,0x5F,0x43,  /* 000002F0    "......_C" */
-    0x52,0x53,0x00,0x08,0x54,0x4D,0x50,0x5F,  /* 000002F8    "RS..TMP_" */
-    0x11,0x08,0x0A,0x05,0x22,0x00,0x10,0x79,  /* 00000300    "...."..y" */
-    0x00,0xA4,0x54,0x4D,0x50,0x5F,0x5B,0x82,  /* 00000308    "..TMP_[." */
-    0x47,0x04,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000310    "G.FDC0._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000318    "HID.A..." */
-    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000320    ".._STA.." */
-    0x0A,0x0F,0x14,0x2C,0x5F,0x43,0x52,0x53,  /* 00000328    "...,_CRS" */
-    0x00,0x08,0x42,0x55,0x46,0x30,0x11,0x1B,  /* 00000330    "..BUF0.." */
-    0x0A,0x18,0x47,0x01,0xF2,0x03,0xF2,0x03,  /* 00000338    "..G....." */
-    0x00,0x04,0x47,0x01,0xF7,0x03,0xF7,0x03,  /* 00000340    "..G....." */
-    0x00,0x01,0x22,0x40,0x00,0x2A,0x04,0x00,  /* 00000348    ".."@.*.." */
-    0x79,0x00,0xA4,0x42,0x55,0x46,0x30,0x5B,  /* 00000350    "y..BUF0[" */
-    0x82,0x4B,0x05,0x4C,0x50,0x54,0x5F,0x08,  /* 00000358    ".K.LPT_." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x04,  /* 00000360    "_HID.A.." */
-    0x00,0x14,0x28,0x5F,0x53,0x54,0x41,0x00,  /* 00000368    "..(_STA." */
-    0x70,0x5E,0x5E,0x5E,0x2E,0x50,0x58,0x31,  /* 00000370    "p^^^.PX1" */
-    0x33,0x44,0x52,0x53,0x41,0x60,0x7B,0x60,  /* 00000378    "3DRSA`{`" */
-    0x0C,0x00,0x00,0x00,0x80,0x60,0xA0,0x06,  /* 00000380    ".....`.." */
-    0x93,0x60,0x00,0xA4,0x00,0xA1,0x04,0xA4,  /* 00000388    ".`......" */
-    0x0A,0x0F,0x14,0x21,0x5F,0x43,0x52,0x53,  /* 00000390    "...!_CRS" */
-    0x00,0x08,0x42,0x55,0x46,0x30,0x11,0x10,  /* 00000398    "..BUF0.." */
-    0x0A,0x0D,0x47,0x01,0x78,0x03,0x78,0x03,  /* 000003A0    "..G.x.x." */
-    0x08,0x08,0x22,0x80,0x00,0x79,0x00,0xA4,  /* 000003A8    ".."..y.." */
-    0x42,0x55,0x46,0x30,0x5B,0x82,0x41,0x06,  /* 000003B0    "BUF0[.A." */
-    0x43,0x4F,0x4D,0x31,0x08,0x5F,0x48,0x49,  /* 000003B8    "COM1._HI" */
-    0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,  /* 000003C0    "D.A...._" */
-    0x55,0x49,0x44,0x01,0x14,0x28,0x5F,0x53,  /* 000003C8    "UID..(_S" */
-    0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E,0x2E,  /* 000003D0    "TA.p^^^." */
-    0x50,0x58,0x31,0x33,0x44,0x52,0x53,0x43,  /* 000003D8    "PX13DRSC" */
-    0x60,0x7B,0x60,0x0C,0x00,0x00,0x00,0x08,  /* 000003E0    "`{`....." */
-    0x60,0xA0,0x06,0x93,0x60,0x00,0xA4,0x00,  /* 000003E8    "`...`..." */
-    0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21,0x5F,  /* 000003F0    "......!_" */
-    0x43,0x52,0x53,0x00,0x08,0x42,0x55,0x46,  /* 000003F8    "CRS..BUF" */
-    0x30,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000400    "0....G.." */
-    0x03,0xF8,0x03,0x00,0x08,0x22,0x10,0x00,  /* 00000408    ".....".." */
-    0x79,0x00,0xA4,0x42,0x55,0x46,0x30,0x5B,  /* 00000410    "y..BUF0[" */
-    0x82,0x42,0x06,0x43,0x4F,0x4D,0x32,0x08,  /* 00000418    ".B.COM2." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,  /* 00000420    "_HID.A.." */
-    0x01,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 00000428    ".._UID.." */
-    0x14,0x28,0x5F,0x53,0x54,0x41,0x00,0x70,  /* 00000430    ".(_STA.p" */
-    0x5E,0x5E,0x5E,0x2E,0x50,0x58,0x31,0x33,  /* 00000438    "^^^.PX13" */
-    0x44,0x52,0x53,0x43,0x60,0x7B,0x60,0x0C,  /* 00000440    "DRSC`{`." */
-    0x00,0x00,0x00,0x80,0x60,0xA0,0x06,0x93,  /* 00000448    "....`..." */
-    0x60,0x00,0xA4,0x00,0xA1,0x04,0xA4,0x0A,  /* 00000450    "`......." */
-    0x0F,0x14,0x21,0x5F,0x43,0x52,0x53,0x00,  /* 00000458    "..!_CRS." */
-    0x08,0x42,0x55,0x46,0x30,0x11,0x10,0x0A,  /* 00000460    ".BUF0..." */
-    0x0D,0x47,0x01,0xF8,0x02,0xF8,0x02,0x00,  /* 00000468    ".G......" */
-    0x08,0x22,0x08,0x00,0x79,0x00,0xA4,0x42,  /* 00000470    "."..y..B" */
-    0x55,0x46,0x30,0x5B,0x82,0x40,0x05,0x50,  /* 00000478    "UF0[.@.P" */
-    0x58,0x31,0x33,0x08,0x5F,0x41,0x44,0x52,  /* 00000480    "X13._ADR" */
-    0x0C,0x03,0x00,0x01,0x00,0x5B,0x80,0x50,  /* 00000488    ".....[.P" */
-    0x31,0x33,0x43,0x02,0x0A,0x5C,0x0A,0x24,  /* 00000490    "13C..\.$" */
-    0x5B,0x81,0x33,0x50,0x31,0x33,0x43,0x03,  /* 00000498    "[.3P13C." */
-    0x44,0x52,0x53,0x41,0x20,0x44,0x52,0x53,  /* 000004A0    "DRSA DRS" */
-    0x42,0x20,0x44,0x52,0x53,0x43,0x20,0x44,  /* 000004A8    "B DRSC D" */
-    0x52,0x53,0x45,0x20,0x44,0x52,0x53,0x46,  /* 000004B0    "RSE DRSF" */
-    0x20,0x44,0x52,0x53,0x47,0x20,0x44,0x52,  /* 000004B8    " DRSG DR" */
-    0x53,0x48,0x20,0x44,0x52,0x53,0x49,0x20,  /* 000004C0    "SH DRSI " */
-    0x44,0x52,0x53,0x4A,0x20,0x10,0x4F,0x2E,  /* 000004C8    "DRSJ .O." */
-    0x5F,0x53,0x42,0x5F,0x5B,0x81,0x24,0x2F,  /* 000004D0    "_SB_[.$/" */
-    0x03,0x50,0x43,0x49,0x30,0x49,0x53,0x41,  /* 000004D8    ".PCI0ISA" */
-    0x5F,0x50,0x34,0x30,0x43,0x01,0x50,0x52,  /* 000004E0    "_P40C.PR" */
-    0x51,0x30,0x08,0x50,0x52,0x51,0x31,0x08,  /* 000004E8    "Q0.PRQ1." */
-    0x50,0x52,0x51,0x32,0x08,0x50,0x52,0x51,  /* 000004F0    "PRQ2.PRQ" */
-    0x33,0x08,0x5B,0x82,0x4E,0x0A,0x4C,0x4E,  /* 000004F8    "3.[.N.LN" */
-    0x4B,0x41,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000500    "KA._HID." */
-    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 00000508    "A...._UI" */
-    0x44,0x01,0x08,0x5F,0x50,0x52,0x53,0x11,  /* 00000510    "D.._PRS." */
-    0x09,0x0A,0x06,0x23,0xF8,0x1E,0x18,0x79,  /* 00000518    "...#...y" */
-    0x00,0x14,0x1A,0x5F,0x53,0x54,0x41,0x00,  /* 00000520    "..._STA." */
-    0x70,0x0A,0x0B,0x60,0xA0,0x0D,0x7B,0x0A,  /* 00000528    "p..`..{." */
-    0x80,0x50,0x52,0x51,0x30,0x61,0x70,0x0A,  /* 00000530    ".PRQ0ap." */
-    0x09,0x60,0xA4,0x60,0x14,0x11,0x5F,0x44,  /* 00000538    ".`.`.._D" */
-    0x49,0x53,0x00,0x7D,0x50,0x52,0x51,0x30,  /* 00000540    "IS.}PRQ0" */
-    0x0A,0x80,0x50,0x52,0x51,0x30,0x14,0x3F,  /* 00000548    "..PRQ0.?" */
-    0x5F,0x43,0x52,0x53,0x00,0x08,0x50,0x52,  /* 00000550    "_CRS..PR" */
-    0x52,0x30,0x11,0x09,0x0A,0x06,0x23,0x02,  /* 00000558    "R0....#." */
-    0x00,0x18,0x79,0x00,0x8B,0x50,0x52,0x52,  /* 00000560    "..y..PRR" */
-    0x30,0x01,0x54,0x4D,0x50,0x5F,0x70,0x50,  /* 00000568    "0.TMP_pP" */
-    0x52,0x51,0x30,0x60,0xA0,0x0C,0x95,0x60,  /* 00000570    "RQ0`...`" */
-    0x0A,0x80,0x79,0x01,0x60,0x54,0x4D,0x50,  /* 00000578    "..y.`TMP" */
-    0x5F,0xA1,0x07,0x70,0x00,0x54,0x4D,0x50,  /* 00000580    "_..p.TMP" */
-    0x5F,0xA4,0x50,0x52,0x52,0x30,0x14,0x1B,  /* 00000588    "_.PRR0.." */
-    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000590    "_SRS..h." */
-    0x54,0x4D,0x50,0x5F,0x82,0x54,0x4D,0x50,  /* 00000598    "TMP_.TMP" */
-    0x5F,0x60,0x76,0x60,0x70,0x60,0x50,0x52,  /* 000005A0    "_`v`p`PR" */
-    0x51,0x30,0x5B,0x82,0x4F,0x0A,0x4C,0x4E,  /* 000005A8    "Q0[.O.LN" */
-    0x4B,0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 000005B0    "KB._HID." */
-    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 000005B8    "A...._UI" */
-    0x44,0x0A,0x02,0x08,0x5F,0x50,0x52,0x53,  /* 000005C0    "D..._PRS" */
-    0x11,0x09,0x0A,0x06,0x23,0xF8,0x1E,0x18,  /* 000005C8    "....#..." */
-    0x79,0x00,0x14,0x1A,0x5F,0x53,0x54,0x41,  /* 000005D0    "y..._STA" */
-    0x00,0x70,0x0A,0x0B,0x60,0xA0,0x0D,0x7B,  /* 000005D8    ".p..`..{" */
-    0x0A,0x80,0x50,0x52,0x51,0x31,0x61,0x70,  /* 000005E0    "..PRQ1ap" */
-    0x0A,0x09,0x60,0xA4,0x60,0x14,0x11,0x5F,  /* 000005E8    "..`.`.._" */
-    0x44,0x49,0x53,0x00,0x7D,0x50,0x52,0x51,  /* 000005F0    "DIS.}PRQ" */
-    0x31,0x0A,0x80,0x50,0x52,0x51,0x31,0x14,  /* 000005F8    "1..PRQ1." */
-    0x3F,0x5F,0x43,0x52,0x53,0x00,0x08,0x50,  /* 00000600    "?_CRS..P" */
-    0x52,0x52,0x30,0x11,0x09,0x0A,0x06,0x23,  /* 00000608    "RR0....#" */
-    0x02,0x00,0x18,0x79,0x00,0x8B,0x50,0x52,  /* 00000610    "...y..PR" */
-    0x52,0x30,0x01,0x54,0x4D,0x50,0x5F,0x70,  /* 00000618    "R0.TMP_p" */
-    0x50,0x52,0x51,0x31,0x60,0xA0,0x0C,0x95,  /* 00000620    "PRQ1`..." */
-    0x60,0x0A,0x80,0x79,0x01,0x60,0x54,0x4D,  /* 00000628    "`..y.`TM" */
-    0x50,0x5F,0xA1,0x07,0x70,0x00,0x54,0x4D,  /* 00000630    "P_..p.TM" */
-    0x50,0x5F,0xA4,0x50,0x52,0x52,0x30,0x14,  /* 00000638    "P_.PRR0." */
-    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 00000640    "._SRS..h" */
-    0x01,0x54,0x4D,0x50,0x5F,0x82,0x54,0x4D,  /* 00000648    ".TMP_.TM" */
-    0x50,0x5F,0x60,0x76,0x60,0x70,0x60,0x50,  /* 00000650    "P_`v`p`P" */
-    0x52,0x51,0x31,0x5B,0x82,0x4F,0x0A,0x4C,  /* 00000658    "RQ1[.O.L" */
-    0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,  /* 00000660    "NKC._HID" */
-    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 00000668    ".A...._U" */
-    0x49,0x44,0x0A,0x03,0x08,0x5F,0x50,0x52,  /* 00000670    "ID..._PR" */
-    0x53,0x11,0x09,0x0A,0x06,0x23,0xF8,0x1E,  /* 00000678    "S....#.." */
-    0x18,0x79,0x00,0x14,0x1A,0x5F,0x53,0x54,  /* 00000680    ".y..._ST" */
-    0x41,0x00,0x70,0x0A,0x0B,0x60,0xA0,0x0D,  /* 00000688    "A.p..`.." */
-    0x7B,0x0A,0x80,0x50,0x52,0x51,0x32,0x61,  /* 00000690    "{..PRQ2a" */
-    0x70,0x0A,0x09,0x60,0xA4,0x60,0x14,0x11,  /* 00000698    "p..`.`.." */
-    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x52,  /* 000006A0    "_DIS.}PR" */
-    0x51,0x32,0x0A,0x80,0x50,0x52,0x51,0x32,  /* 000006A8    "Q2..PRQ2" */
-    0x14,0x3F,0x5F,0x43,0x52,0x53,0x00,0x08,  /* 000006B0    ".?_CRS.." */
-    0x50,0x52,0x52,0x30,0x11,0x09,0x0A,0x06,  /* 000006B8    "PRR0...." */
-    0x23,0x02,0x00,0x18,0x79,0x00,0x8B,0x50,  /* 000006C0    "#...y..P" */
-    0x52,0x52,0x30,0x01,0x54,0x4D,0x50,0x5F,  /* 000006C8    "RR0.TMP_" */
-    0x70,0x50,0x52,0x51,0x32,0x60,0xA0,0x0C,  /* 000006D0    "pPRQ2`.." */
-    0x95,0x60,0x0A,0x80,0x79,0x01,0x60,0x54,  /* 000006D8    ".`..y.`T" */
-    0x4D,0x50,0x5F,0xA1,0x07,0x70,0x00,0x54,  /* 000006E0    "MP_..p.T" */
-    0x4D,0x50,0x5F,0xA4,0x50,0x52,0x52,0x30,  /* 000006E8    "MP_.PRR0" */
-    0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,  /* 000006F0    ".._SRS.." */
-    0x68,0x01,0x54,0x4D,0x50,0x5F,0x82,0x54,  /* 000006F8    "h.TMP_.T" */
-    0x4D,0x50,0x5F,0x60,0x76,0x60,0x70,0x60,  /* 00000700    "MP_`v`p`" */
-    0x50,0x52,0x51,0x32,0x5B,0x82,0x4F,0x0A,  /* 00000708    "PRQ2[.O." */
-    0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48,0x49,  /* 00000710    "LNKD._HI" */
-    0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,  /* 00000718    "D.A...._" */
-    0x55,0x49,0x44,0x0A,0x04,0x08,0x5F,0x50,  /* 00000720    "UID..._P" */
-    0x52,0x53,0x11,0x09,0x0A,0x06,0x23,0xF8,  /* 00000728    "RS....#." */
-    0x1E,0x18,0x79,0x00,0x14,0x1A,0x5F,0x53,  /* 00000730    "..y..._S" */
-    0x54,0x41,0x00,0x70,0x0A,0x0B,0x60,0xA0,  /* 00000738    "TA.p..`." */
-    0x0D,0x7B,0x0A,0x80,0x50,0x52,0x51,0x33,  /* 00000740    ".{..PRQ3" */
-    0x61,0x70,0x0A,0x09,0x60,0xA4,0x60,0x14,  /* 00000748    "ap..`.`." */
-    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000750    "._DIS.}P" */
-    0x52,0x51,0x33,0x0A,0x80,0x50,0x52,0x51,  /* 00000758    "RQ3..PRQ" */
-    0x33,0x14,0x3F,0x5F,0x43,0x52,0x53,0x00,  /* 00000760    "3.?_CRS." */
-    0x08,0x50,0x52,0x52,0x30,0x11,0x09,0x0A,  /* 00000768    ".PRR0..." */
-    0x06,0x23,0x02,0x00,0x18,0x79,0x00,0x8B,  /* 00000770    ".#...y.." */
-    0x50,0x52,0x52,0x30,0x01,0x54,0x4D,0x50,  /* 00000778    "PRR0.TMP" */
-    0x5F,0x70,0x50,0x52,0x51,0x33,0x60,0xA0,  /* 00000780    "_pPRQ3`." */
-    0x0C,0x95,0x60,0x0A,0x80,0x79,0x01,0x60,  /* 00000788    "..`..y.`" */
-    0x54,0x4D,0x50,0x5F,0xA1,0x07,0x70,0x00,  /* 00000790    "TMP_..p." */
-    0x54,0x4D,0x50,0x5F,0xA4,0x50,0x52,0x52,  /* 00000798    "TMP_.PRR" */
-    0x30,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 000007A0    "0.._SRS." */
-    0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F,0x82,  /* 000007A8    ".h.TMP_." */
-    0x54,0x4D,0x50,0x5F,0x60,0x76,0x60,0x70,  /* 000007B0    "TMP_`v`p" */
-    0x60,0x50,0x52,0x51,0x33,0x08,0x5F,0x53,  /* 000007B8    "`PRQ3._S" */
-    0x33,0x5F,0x12,0x06,0x04,0x01,0x01,0x00,  /* 000007C0    "3_......" */
-    0x00,0x08,0x5F,0x53,0x34,0x5F,0x12,0x06,  /* 000007C8    ".._S4_.." */
-    0x04,0x00,0x00,0x00,0x00,0x08,0x5F,0x53,  /* 000007D0    "......_S" */
-    0x35,0x5F,0x12,0x06,0x04,0x00,0x00,0x00,  /* 000007D8    "5_......" */
-    0x00,
+    0x82,0x2A,0x56,0x47,0x41,0x5F,0x08,0x5F,  /* 00000248    ".*VGA_._" */
+    0x41,0x44,0x52,0x0C,0x00,0x00,0x02,0x00,  /* 00000250    "ADR....." */
+    0x14,0x08,0x5F,0x53,0x31,0x44,0x00,0xA4,  /* 00000258    ".._S1D.." */
+    0x00,0x14,0x08,0x5F,0x53,0x32,0x44,0x00,  /* 00000260    "..._S2D." */
+    0xA4,0x00,0x14,0x08,0x5F,0x53,0x33,0x44,  /* 00000268    "...._S3D" */
+    0x00,0xA4,0x00,0x5B,0x82,0x42,0x23,0x49,  /* 00000270    "...[.B#I" */
+    0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,0x52,  /* 00000278    "SA_._ADR" */
+    0x0C,0x00,0x00,0x01,0x00,0x5B,0x80,0x50,  /* 00000280    ".....[.P" */
+    0x34,0x30,0x43,0x02,0x0A,0x60,0x0A,0x04,  /* 00000288    "40C..`.." */
+    0x5B,0x82,0x2D,0x52,0x54,0x43,0x5F,0x08,  /* 00000290    "[.-RTC_." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,  /* 00000298    "_HID.A.." */
+    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 000002A0    ".._CRS.." */
+    0x0A,0x15,0x47,0x01,0x70,0x00,0x70,0x00,  /* 000002A8    "..G.p.p." */
+    0x10,0x02,0x22,0x00,0x01,0x47,0x01,0x72,  /* 000002B0    ".."..G.r" */
+    0x00,0x72,0x00,0x02,0x06,0x79,0x00,0x5B,  /* 000002B8    ".r...y.[" */
+    0x82,0x44,0x04,0x4B,0x42,0x44,0x5F,0x08,  /* 000002C0    ".D.KBD_." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,  /* 000002C8    "_HID.A.." */
+    0x03,0x14,0x09,0x5F,0x53,0x54,0x41,0x00,  /* 000002D0    "..._STA." */
+    0xA4,0x0A,0x0F,0x14,0x29,0x5F,0x43,0x52,  /* 000002D8    "....)_CR" */
+    0x53,0x00,0x08,0x54,0x4D,0x50,0x5F,0x11,  /* 000002E0    "S..TMP_." */
+    0x18,0x0A,0x15,0x47,0x01,0x60,0x00,0x60,  /* 000002E8    "...G.`.`" */
+    0x00,0x01,0x01,0x47,0x01,0x64,0x00,0x64,  /* 000002F0    "...G.d.d" */
+    0x00,0x01,0x01,0x22,0x02,0x00,0x79,0x00,  /* 000002F8    "..."..y." */
+    0xA4,0x54,0x4D,0x50,0x5F,0x5B,0x82,0x33,  /* 00000300    ".TMP_[.3" */
+    0x4D,0x4F,0x55,0x5F,0x08,0x5F,0x48,0x49,  /* 00000308    "MOU_._HI" */
+    0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,  /* 00000310    "D.A....." */
+    0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,  /* 00000318    "_STA...." */
+    0x14,0x19,0x5F,0x43,0x52,0x53,0x00,0x08,  /* 00000320    ".._CRS.." */
+    0x54,0x4D,0x50,0x5F,0x11,0x08,0x0A,0x05,  /* 00000328    "TMP_...." */
+    0x22,0x00,0x10,0x79,0x00,0xA4,0x54,0x4D,  /* 00000330    ""..y..TM" */
+    0x50,0x5F,0x5B,0x82,0x47,0x04,0x46,0x44,  /* 00000338    "P_[.G.FD" */
+    0x43,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000340    "C0._HID." */
+    0x41,0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,  /* 00000348    "A....._S" */
+    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x14,0x2C,  /* 00000350    "TA.....," */
+    0x5F,0x43,0x52,0x53,0x00,0x08,0x42,0x55,  /* 00000358    "_CRS..BU" */
+    0x46,0x30,0x11,0x1B,0x0A,0x18,0x47,0x01,  /* 00000360    "F0....G." */
+    0xF2,0x03,0xF2,0x03,0x00,0x04,0x47,0x01,  /* 00000368    "......G." */
+    0xF7,0x03,0xF7,0x03,0x00,0x01,0x22,0x40,  /* 00000370    "......"@" */
+    0x00,0x2A,0x04,0x00,0x79,0x00,0xA4,0x42,  /* 00000378    ".*..y..B" */
+    0x55,0x46,0x30,0x5B,0x82,0x4B,0x05,0x4C,  /* 00000380    "UF0[.K.L" */
+    0x50,0x54,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 00000388    "PT_._HID" */
+    0x0C,0x41,0xD0,0x04,0x00,0x14,0x28,0x5F,  /* 00000390    ".A....(_" */
+    0x53,0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E,  /* 00000398    "STA.p^^^" */
+    0x2E,0x50,0x58,0x31,0x33,0x44,0x52,0x53,  /* 000003A0    ".PX13DRS" */
+    0x41,0x60,0x7B,0x60,0x0C,0x00,0x00,0x00,  /* 000003A8    "A`{`...." */
+    0x80,0x60,0xA0,0x06,0x93,0x60,0x00,0xA4,  /* 000003B0    ".`...`.." */
+    0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21,  /* 000003B8    ".......!" */
+    0x5F,0x43,0x52,0x53,0x00,0x08,0x42,0x55,  /* 000003C0    "_CRS..BU" */
+    0x46,0x30,0x11,0x10,0x0A,0x0D,0x47,0x01,  /* 000003C8    "F0....G." */
+    0x78,0x03,0x78,0x03,0x08,0x08,0x22,0x80,  /* 000003D0    "x.x..."." */
+    0x00,0x79,0x00,0xA4,0x42,0x55,0x46,0x30,  /* 000003D8    ".y..BUF0" */
+    0x5B,0x82,0x41,0x06,0x43,0x4F,0x4D,0x31,  /* 000003E0    "[.A.COM1" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000003E8    "._HID.A." */
+    0x05,0x01,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 000003F0    "..._UID." */
+    0x14,0x28,0x5F,0x53,0x54,0x41,0x00,0x70,  /* 000003F8    ".(_STA.p" */
+    0x5E,0x5E,0x5E,0x2E,0x50,0x58,0x31,0x33,  /* 00000400    "^^^.PX13" */
+    0x44,0x52,0x53,0x43,0x60,0x7B,0x60,0x0C,  /* 00000408    "DRSC`{`." */
+    0x00,0x00,0x00,0x08,0x60,0xA0,0x06,0x93,  /* 00000410    "....`..." */
+    0x60,0x00,0xA4,0x00,0xA1,0x04,0xA4,0x0A,  /* 00000418    "`......." */
+    0x0F,0x14,0x21,0x5F,0x43,0x52,0x53,0x00,  /* 00000420    "..!_CRS." */
+    0x08,0x42,0x55,0x46,0x30,0x11,0x10,0x0A,  /* 00000428    ".BUF0..." */
+    0x0D,0x47,0x01,0xF8,0x03,0xF8,0x03,0x00,  /* 00000430    ".G......" */
+    0x08,0x22,0x10,0x00,0x79,0x00,0xA4,0x42,  /* 00000438    "."..y..B" */
+    0x55,0x46,0x30,0x5B,0x82,0x42,0x06,0x43,  /* 00000440    "UF0[.B.C" */
+    0x4F,0x4D,0x32,0x08,0x5F,0x48,0x49,0x44,  /* 00000448    "OM2._HID" */
+    0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,  /* 00000450    ".A...._U" */
+    0x49,0x44,0x0A,0x02,0x14,0x28,0x5F,0x53,  /* 00000458    "ID...(_S" */
+    0x54,0x41,0x00,0x70,0x5E,0x5E,0x5E,0x2E,  /* 00000460    "TA.p^^^." */
+    0x50,0x58,0x31,0x33,0x44,0x52,0x53,0x43,  /* 00000468    "PX13DRSC" */
+    0x60,0x7B,0x60,0x0C,0x00,0x00,0x00,0x80,  /* 00000470    "`{`....." */
+    0x60,0xA0,0x06,0x93,0x60,0x00,0xA4,0x00,  /* 00000478    "`...`..." */
+    0xA1,0x04,0xA4,0x0A,0x0F,0x14,0x21,0x5F,  /* 00000480    "......!_" */
+    0x43,0x52,0x53,0x00,0x08,0x42,0x55,0x46,  /* 00000488    "CRS..BUF" */
+    0x30,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000490    "0....G.." */
+    0x02,0xF8,0x02,0x00,0x08,0x22,0x08,0x00,  /* 00000498    ".....".." */
+    0x79,0x00,0xA4,0x42,0x55,0x46,0x30,0x5B,  /* 000004A0    "y..BUF0[" */
+    0x82,0x40,0x05,0x50,0x58,0x31,0x33,0x08,  /* 000004A8    ".@.PX13." */
+    0x5F,0x41,0x44,0x52,0x0C,0x03,0x00,0x01,  /* 000004B0    "_ADR...." */
+    0x00,0x5B,0x80,0x50,0x31,0x33,0x43,0x02,  /* 000004B8    ".[.P13C." */
+    0x0A,0x5C,0x0A,0x24,0x5B,0x81,0x33,0x50,  /* 000004C0    ".\.$[.3P" */
+    0x31,0x33,0x43,0x03,0x44,0x52,0x53,0x41,  /* 000004C8    "13C.DRSA" */
+    0x20,0x44,0x52,0x53,0x42,0x20,0x44,0x52,  /* 000004D0    " DRSB DR" */
+    0x53,0x43,0x20,0x44,0x52,0x53,0x45,0x20,  /* 000004D8    "SC DRSE " */
+    0x44,0x52,0x53,0x46,0x20,0x44,0x52,0x53,  /* 000004E0    "DRSF DRS" */
+    0x47,0x20,0x44,0x52,0x53,0x48,0x20,0x44,  /* 000004E8    "G DRSH D" */
+    0x52,0x53,0x49,0x20,0x44,0x52,0x53,0x4A,  /* 000004F0    "RSI DRSJ" */
+    0x20,0x10,0x4F,0x2E,0x5F,0x53,0x42,0x5F,  /* 000004F8    " .O._SB_" */
+    0x5B,0x81,0x24,0x2F,0x03,0x50,0x43,0x49,  /* 00000500    "[.$/.PCI" */
+    0x30,0x49,0x53,0x41,0x5F,0x50,0x34,0x30,  /* 00000508    "0ISA_P40" */
+    0x43,0x01,0x50,0x52,0x51,0x30,0x08,0x50,  /* 00000510    "C.PRQ0.P" */
+    0x52,0x51,0x31,0x08,0x50,0x52,0x51,0x32,  /* 00000518    "RQ1.PRQ2" */
+    0x08,0x50,0x52,0x51,0x33,0x08,0x5B,0x82,  /* 00000520    ".PRQ3.[." */
+    0x4E,0x0A,0x4C,0x4E,0x4B,0x41,0x08,0x5F,  /* 00000528    "N.LNKA._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,  /* 00000530    "HID.A..." */
+    0x08,0x5F,0x55,0x49,0x44,0x01,0x08,0x5F,  /* 00000538    "._UID.._" */
+    0x50,0x52,0x53,0x11,0x09,0x0A,0x06,0x23,  /* 00000540    "PRS....#" */
+    0xF8,0x1E,0x18,0x79,0x00,0x14,0x1A,0x5F,  /* 00000548    "...y..._" */
+    0x53,0x54,0x41,0x00,0x70,0x0A,0x0B,0x60,  /* 00000550    "STA.p..`" */
+    0xA0,0x0D,0x7B,0x0A,0x80,0x50,0x52,0x51,  /* 00000558    "..{..PRQ" */
+    0x30,0x61,0x70,0x0A,0x09,0x60,0xA4,0x60,  /* 00000560    "0ap..`.`" */
+    0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,  /* 00000568    ".._DIS.}" */
+    0x50,0x52,0x51,0x30,0x0A,0x80,0x50,0x52,  /* 00000570    "PRQ0..PR" */
+    0x51,0x30,0x14,0x3F,0x5F,0x43,0x52,0x53,  /* 00000578    "Q0.?_CRS" */
+    0x00,0x08,0x50,0x52,0x52,0x30,0x11,0x09,  /* 00000580    "..PRR0.." */
+    0x0A,0x06,0x23,0x02,0x00,0x18,0x79,0x00,  /* 00000588    "..#...y." */
+    0x8B,0x50,0x52,0x52,0x30,0x01,0x54,0x4D,  /* 00000590    ".PRR0.TM" */
+    0x50,0x5F,0x70,0x50,0x52,0x51,0x30,0x60,  /* 00000598    "P_pPRQ0`" */
+    0xA0,0x0C,0x95,0x60,0x0A,0x80,0x79,0x01,  /* 000005A0    "...`..y." */
+    0x60,0x54,0x4D,0x50,0x5F,0xA1,0x07,0x70,  /* 000005A8    "`TMP_..p" */
+    0x00,0x54,0x4D,0x50,0x5F,0xA4,0x50,0x52,  /* 000005B0    ".TMP_.PR" */
+    0x52,0x30,0x14,0x1B,0x5F,0x53,0x52,0x53,  /* 000005B8    "R0.._SRS" */
+    0x01,0x8B,0x68,0x01,0x54,0x4D,0x50,0x5F,  /* 000005C0    "..h.TMP_" */
+    0x82,0x54,0x4D,0x50,0x5F,0x60,0x76,0x60,  /* 000005C8    ".TMP_`v`" */
+    0x70,0x60,0x50,0x52,0x51,0x30,0x5B,0x82,  /* 000005D0    "p`PRQ0[." */
+    0x4F,0x0A,0x4C,0x4E,0x4B,0x42,0x08,0x5F,  /* 000005D8    "O.LNKB._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,  /* 000005E0    "HID.A..." */
+    0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,0x08,  /* 000005E8    "._UID..." */
+    0x5F,0x50,0x52,0x53,0x11,0x09,0x0A,0x06,  /* 000005F0    "_PRS...." */
+    0x23,0xF8,0x1E,0x18,0x79,0x00,0x14,0x1A,  /* 000005F8    "#...y..." */
+    0x5F,0x53,0x54,0x41,0x00,0x70,0x0A,0x0B,  /* 00000600    "_STA.p.." */
+    0x60,0xA0,0x0D,0x7B,0x0A,0x80,0x50,0x52,  /* 00000608    "`..{..PR" */
+    0x51,0x31,0x61,0x70,0x0A,0x09,0x60,0xA4,  /* 00000610    "Q1ap..`." */
+    0x60,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000618    "`.._DIS." */
+    0x7D,0x50,0x52,0x51,0x31,0x0A,0x80,0x50,  /* 00000620    "}PRQ1..P" */
+    0x52,0x51,0x31,0x14,0x3F,0x5F,0x43,0x52,  /* 00000628    "RQ1.?_CR" */
+    0x53,0x00,0x08,0x50,0x52,0x52,0x30,0x11,  /* 00000630    "S..PRR0." */
+    0x09,0x0A,0x06,0x23,0x02,0x00,0x18,0x79,  /* 00000638    "...#...y" */
+    0x00,0x8B,0x50,0x52,0x52,0x30,0x01,0x54,  /* 00000640    "..PRR0.T" */
+    0x4D,0x50,0x5F,0x70,0x50,0x52,0x51,0x31,  /* 00000648    "MP_pPRQ1" */
+    0x60,0xA0,0x0C,0x95,0x60,0x0A,0x80,0x79,  /* 00000650    "`...`..y" */
+    0x01,0x60,0x54,0x4D,0x50,0x5F,0xA1,0x07,  /* 00000658    ".`TMP_.." */
+    0x70,0x00,0x54,0x4D,0x50,0x5F,0xA4,0x50,  /* 00000660    "p.TMP_.P" */
+    0x52,0x52,0x30,0x14,0x1B,0x5F,0x53,0x52,  /* 00000668    "RR0.._SR" */
+    0x53,0x01,0x8B,0x68,0x01,0x54,0x4D,0x50,  /* 00000670    "S..h.TMP" */
+    0x5F,0x82,0x54,0x4D,0x50,0x5F,0x60,0x76,  /* 00000678    "_.TMP_`v" */
+    0x60,0x70,0x60,0x50,0x52,0x51,0x31,0x5B,  /* 00000680    "`p`PRQ1[" */
+    0x82,0x4F,0x0A,0x4C,0x4E,0x4B,0x43,0x08,  /* 00000688    ".O.LNKC." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 00000690    "_HID.A.." */
+    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x03,  /* 00000698    ".._UID.." */
+    0x08,0x5F,0x50,0x52,0x53,0x11,0x09,0x0A,  /* 000006A0    "._PRS..." */
+    0x06,0x23,0xF8,0x1E,0x18,0x79,0x00,0x14,  /* 000006A8    ".#...y.." */
+    0x1A,0x5F,0x53,0x54,0x41,0x00,0x70,0x0A,  /* 000006B0    "._STA.p." */
+    0x0B,0x60,0xA0,0x0D,0x7B,0x0A,0x80,0x50,  /* 000006B8    ".`..{..P" */
+    0x52,0x51,0x32,0x61,0x70,0x0A,0x09,0x60,  /* 000006C0    "RQ2ap..`" */
+    0xA4,0x60,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 000006C8    ".`.._DIS" */
+    0x00,0x7D,0x50,0x52,0x51,0x32,0x0A,0x80,  /* 000006D0    ".}PRQ2.." */
+    0x50,0x52,0x51,0x32,0x14,0x3F,0x5F,0x43,  /* 000006D8    "PRQ2.?_C" */
+    0x52,0x53,0x00,0x08,0x50,0x52,0x52,0x30,  /* 000006E0    "RS..PRR0" */
+    0x11,0x09,0x0A,0x06,0x23,0x02,0x00,0x18,  /* 000006E8    "....#..." */
+    0x79,0x00,0x8B,0x50,0x52,0x52,0x30,0x01,  /* 000006F0    "y..PRR0." */
+    0x54,0x4D,0x50,0x5F,0x70,0x50,0x52,0x51,  /* 000006F8    "TMP_pPRQ" */
+    0x32,0x60,0xA0,0x0C,0x95,0x60,0x0A,0x80,  /* 00000700    "2`...`.." */
+    0x79,0x01,0x60,0x54,0x4D,0x50,0x5F,0xA1,  /* 00000708    "y.`TMP_." */
+    0x07,0x70,0x00,0x54,0x4D,0x50,0x5F,0xA4,  /* 00000710    ".p.TMP_." */
+    0x50,0x52,0x52,0x30,0x14,0x1B,0x5F,0x53,  /* 00000718    "PRR0.._S" */
+    0x52,0x53,0x01,0x8B,0x68,0x01,0x54,0x4D,  /* 00000720    "RS..h.TM" */
+    0x50,0x5F,0x82,0x54,0x4D,0x50,0x5F,0x60,  /* 00000728    "P_.TMP_`" */
+    0x76,0x60,0x70,0x60,0x50,0x52,0x51,0x32,  /* 00000730    "v`p`PRQ2" */
+    0x5B,0x82,0x4F,0x0A,0x4C,0x4E,0x4B,0x44,  /* 00000738    "[.O.LNKD" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000740    "._HID.A." */
+    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 00000748    "..._UID." */
+    0x04,0x08,0x5F,0x50,0x52,0x53,0x11,0x09,  /* 00000750    ".._PRS.." */
+    0x0A,0x06,0x23,0xF8,0x1E,0x18,0x79,0x00,  /* 00000758    "..#...y." */
+    0x14,0x1A,0x5F,0x53,0x54,0x41,0x00,0x70,  /* 00000760    ".._STA.p" */
+    0x0A,0x0B,0x60,0xA0,0x0D,0x7B,0x0A,0x80,  /* 00000768    "..`..{.." */
+    0x50,0x52,0x51,0x33,0x61,0x70,0x0A,0x09,  /* 00000770    "PRQ3ap.." */
+    0x60,0xA4,0x60,0x14,0x11,0x5F,0x44,0x49,  /* 00000778    "`.`.._DI" */
+    0x53,0x00,0x7D,0x50,0x52,0x51,0x33,0x0A,  /* 00000780    "S.}PRQ3." */
+    0x80,0x50,0x52,0x51,0x33,0x14,0x3F,0x5F,  /* 00000788    ".PRQ3.?_" */
+    0x43,0x52,0x53,0x00,0x08,0x50,0x52,0x52,  /* 00000790    "CRS..PRR" */
+    0x30,0x11,0x09,0x0A,0x06,0x23,0x02,0x00,  /* 00000798    "0....#.." */
+    0x18,0x79,0x00,0x8B,0x50,0x52,0x52,0x30,  /* 000007A0    ".y..PRR0" */
+    0x01,0x54,0x4D,0x50,0x5F,0x70,0x50,0x52,  /* 000007A8    ".TMP_pPR" */
+    0x51,0x33,0x60,0xA0,0x0C,0x95,0x60,0x0A,  /* 000007B0    "Q3`...`." */
+    0x80,0x79,0x01,0x60,0x54,0x4D,0x50,0x5F,  /* 000007B8    ".y.`TMP_" */
+    0xA1,0x07,0x70,0x00,0x54,0x4D,0x50,0x5F,  /* 000007C0    "..p.TMP_" */
+    0xA4,0x50,0x52,0x52,0x30,0x14,0x1B,0x5F,  /* 000007C8    ".PRR0.._" */
+    0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x54,  /* 000007D0    "SRS..h.T" */
+    0x4D,0x50,0x5F,0x82,0x54,0x4D,0x50,0x5F,  /* 000007D8    "MP_.TMP_" */
+    0x60,0x76,0x60,0x70,0x60,0x50,0x52,0x51,  /* 000007E0    "`v`p`PRQ" */
+    0x33,0x08,0x5F,0x53,0x33,0x5F,0x12,0x06,  /* 000007E8    "3._S3_.." */
+    0x04,0x01,0x01,0x00,0x00,0x08,0x5F,0x53,  /* 000007F0    "......_S" */
+    0x34,0x5F,0x12,0x06,0x04,0x00,0x00,0x00,  /* 000007F8    "4_......" */
+    0x00,0x08,0x5F,0x53,0x35,0x5F,0x12,0x06,  /* 00000800    ".._S5_.." */
+    0x04,0x00,0x00,0x00,0x00,
 };

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent in the BIOS.
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 2/6] Add S3 state to DSDT. Handle resume event in the BIOS Gleb Natapov
@ 2008-10-30 22:41   ` Sebastian Herbszt
  2008-11-02 10:04     ` Gleb Natapov
  2008-11-02 16:31     ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Kevin O'Connor
  0 siblings, 2 replies; 18+ messages in thread
From: Sebastian Herbszt @ 2008-10-30 22:41 UTC (permalink / raw)
  To: Gleb Natapov, bochs-developers; +Cc: qemu-devel

Gleb Natapov wrote:
> diff --git a/bios/rombios.c b/bios/rombios.c
> index 88eac04..46996fa 100644
> --- a/bios/rombios.c
> +++ b/bios/rombios.c
> @@ -2198,6 +2198,31 @@ debugger_off()
>   outb(0xfedc, 0x00);
> }
> 
> +void
> +s3_resume()
> +{
> +    Bit32u s3_wakeup_vector;
> +    Bit8u s3_resume_flag;
> +
> +    s3_resume_flag = read_byte(0x40, 0xb0);
> +    s3_wakeup_vector = read_dword(0x40, 0xb2);
> +
> +    BX_INFO("S3 resume called %x 0x%lx\n", s3_resume_flag, s3_wakeup_vector);
> +    if (s3_resume_flag != 0xFE || !s3_wakeup_vector)
> +     return;
> +
> +    write_byte(0x40, 0xb0, 0);
> +
> +    /* setup wakeup vector */
> +    write_word(0x40, 0xb6, (s3_wakeup_vector & 0xF)); /* IP */
> +    write_word(0x40, 0xb8, (s3_wakeup_vector >> 4)); /* CS */

Any reason not to use 0040h:0067h instead?

> +    BX_INFO("S3 resume jump to %x:%x\n", *(Bit16u*)0x04b8, *(Bit16u*)0x04b6);
> +ASM_START
> +    jmpf [0x04b6]
> +ASM_END
> +}
> +
> #if BX_USE_ATADRV
> 
> // ---------------------------------------------------------------------------
> @@ -10005,6 +10030,10 @@ rombios32_05:
>   ;; init the stack pointer
>   mov esp, #0x00080000
> 
> +  ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32
> +  push #0x04b0
> +  push #0x04b2
> +
>   ;; call rombios32 code
>   mov eax, #0x00040000
>   call eax
> @@ -10383,6 +10412,9 @@ normal_post:
>   rep
>     stosw
> 
> +  ;; Save shutdown status
> +  mov 0x04b0, bl
> +
>   call _log_bios_start
> 
>   ;; set all interrupts to default handler
> @@ -10593,6 +10625,8 @@ post_default_ints:
>   mov  ax, #0xe000
>   call rom_scan
> 
> +  call _s3_resume
> +
> #if BX_ELTORITO_BOOT
>   call _interactive_bootkey
> #endif // BX_ELTORITO_BOOT
> diff --git a/bios/rombios32.c b/bios/rombios32.c
> index f0daf15..ff84f80 100644
> --- a/bios/rombios32.c
> +++ b/bios/rombios32.c
> @@ -180,6 +180,20 @@ void *memmove(void *d1, const void *s1, size_t len)
>     return d1;
> }
> 
> +int memcmp(const void *s1, const void *s2, size_t len)
> +{
> + const int8_t *p1 = s1;
> + const int8_t *p2 = s2;
> +
> + while (len--) {
> + int r = *p1++ - *p2++;
> + if(r)
> + return r;
> + }
> +
> + return 0;
> +}
> +
> size_t strlen(const char *s)
> {
>     const char *s1;
> @@ -644,7 +658,7 @@ static void bios_shadow_init(PCIDevice *d)
> {
>     int v;
> 
> -    if (find_bios_table_area() < 0)
> +    if (bios_table_cur_addr == 0)
>         return;
> 
>     /* remap the BIOS to shadow RAM an keep it read/write while we
> @@ -1461,7 +1475,7 @@ void acpi_bios_init(void)
>     memset(facs, 0, sizeof(*facs));
>     memcpy(facs->signature, "FACS", 4);
>     facs->length = cpu_to_le32(sizeof(*facs));
> -
> +    BX_INFO("Firmware waking vector %p\n", &facs->firmware_waking_vector);
>     /* DSDT */
>     memcpy(dsdt, AmlCode, sizeof(AmlCode));
> 
> @@ -2011,9 +2025,40 @@ void smbios_init(void)
>     BX_INFO("SMBIOS table addr=0x%08lx\n", (unsigned long)start);
> }
> 
> -void rombios32_init(void)
> +static uint32_t find_resume_vector(void)
> {
> -    BX_INFO("Starting rombios32\n");
> +    unsigned long addr;
> +
> +    if (bios_table_cur_addr == 0)
> +        return 0;

BX_USE_EBDA_TABLES case

> +
> +    for (addr = bios_table_cur_addr; addr < bios_table_end_addr; addr++) {
> +        if (!memcmp((void*)addr, "RSD PTR ", 8)) {
> +            struct rsdp_descriptor *rsdp = (void*)addr;
> +            struct rsdt_descriptor_rev1 *rsdt = (void*)rsdp->rsdt_physical_address;
> +            struct fadt_descriptor_rev1 *fadt = (void*)rsdt->table_offset_entry[0];
> +            struct facs_descriptor_rev1 *facs = (void*)fadt->firmware_ctrl;
> +            return facs->firmware_waking_vector;
> +        }
> +    }
> +

RSDP is on a 16-byte boundary

> +    return 0;
> +}
> +
> +static void find_440fx(PCIDevice *d)
> +{
> +    uint16_t vendor_id, device_id;
> +
> +    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
> +    device_id = pci_config_readw(d, PCI_DEVICE_ID);
> +
> +    if (vendor_id == 0x8086 && device_id == 0x1237)
> +        i440_pcidev = *d;

Please use PCI_VENDOR_ID_INTEL and PCI_DEVICE_ID_INTEL_82441.

> +}
> +
> +void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag)
> +{
> +    BX_INFO("Starting rombios32 %p %p %x\n", s3_resume_vector, shutdown_flag, *shutdown_flag);

Maybe make it two lines and explain the values for the log:

BX_INFO("Starting rombios32\n");
BX_INFO("s3_resume_vector=%p ... \n", s3_resume_vector, ...

> 
> #ifdef BX_QEMU
>     qemu_cfg_port = qemu_cfg_port_probe();
> @@ -2025,6 +2070,24 @@ void rombios32_init(void)
> 
>     smp_probe();
> 
> +    if (find_bios_table_area() < 0)
> +        return;

It should not return if BX_USE_EBDA_TABLES is defined.
Is there a need to return at all?

> +
> +    if (*shutdown_flag == 0xfe) {
> +        *s3_resume_vector = find_resume_vector();
> +        if (!*s3_resume_vector) {
> +         BX_INFO("This is S3 resume but wakeup vector is NULL\n");
> +        } else {
> +         BX_INFO("S3 resume vector %p\n", *s3_resume_vector);
> +            /* redirect bios read access to RAM */
> +            pci_for_each_device(find_440fx);
> +            bios_lock_shadow_ram(); /* bios is already copied */

bios_shadow_init() is called in pci_bios_init(). Why do we need to lock it here?

> +            return;
> +        }
> +    }
> +
> +    uuid_probe();
> +
>     pci_bios_init();
> 
>     if (bios_table_cur_addr != 0) {
> 

rombios32.c r1.32 got:

    smp_probe();

    pci_bios_init();

    if (bios_table_cur_addr != 0) {

        mptable_init();

        uuid_probe();

The patch should remove uuid_probe() from the if-case.

- Sebastian

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory in BIOS.
  2008-10-27 10:13 ` [Qemu-devel] [PATCH 5/6] Don't use unreserved memory in BIOS Gleb Natapov
@ 2008-10-30 23:12   ` Sebastian Herbszt
  2008-11-02 10:06     ` Gleb Natapov
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Herbszt @ 2008-10-30 23:12 UTC (permalink / raw)
  To: Gleb Natapov, bochs-developers; +Cc: qemu-devel

Gleb Natapov wrote:

> Use only first page and last page of low memory. OSes assumes that first
> page is used by bios and last page is reserved in e820 map.
> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
> 
> bios/rombios.c   |    6 +++---
> bios/rombios.h   |    2 +-
> bios/rombios32.c |    2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/bios/rombios.c b/bios/rombios.c
> index c4c1e35..19f0e93 100644
> --- a/bios/rombios.c
> +++ b/bios/rombios.c
> @@ -4541,7 +4541,7 @@ ASM_END
>                 {
>                     case 0:
>                         set_e820_range(ES, regs.u.r16.di,
> -                                       0x0000000L, 0x0009fc00L, 1);
> +                                       0x0000000L, 0x0009f000L, 1);
>                         regs.u.r32.ebx = 1;
>                         regs.u.r32.eax = 0x534D4150;
>                         regs.u.r32.ecx = 0x14;
> @@ -4550,7 +4550,7 @@ ASM_END
>                         break;
>                     case 1:
>                         set_e820_range(ES, regs.u.r16.di,
> -                                       0x0009fc00L, 0x000a0000L, 2);
> +                                       0x0009f000L, 0x000a0000L, 2);
>                         regs.u.r32.ebx = 2;
>                         regs.u.r32.eax = 0x534D4150;
>                         regs.u.r32.ecx = 0x14;
> @@ -10021,7 +10021,7 @@ rombios32_05:
>   cld
> 
>   ;; init the stack pointer
> -  mov esp, #0x00080000
> +  mov esp, #0x9fbf0
> 
>   ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32
>   push #0x04b0
> diff --git a/bios/rombios.h b/bios/rombios.h
> index f0ed88e..57b0f46 100644
> --- a/bios/rombios.h
> +++ b/bios/rombios.h
> @@ -56,7 +56,7 @@
> #define ACPI_DATA_SIZE    0x00010000L
> #define PM_IO_BASE        0xb000
> #define SMB_IO_BASE       0xb100
> -#define CPU_COUNT_ADDR    0xf000
> +#define CPU_COUNT_ADDR    0x0500

Why did you pick 0x500?

>   // Define the application NAME
> #if defined(BX_QEMU)
> diff --git a/bios/rombios32.c b/bios/rombios32.c
> index e887d71..c192cf3 100755
> --- a/bios/rombios32.c
> +++ b/bios/rombios32.c
> @@ -57,7 +57,7 @@ typedef unsigned long long uint64_t;
> 
> #define APIC_ENABLED 0x0100
> 
> -#define AP_BOOT_ADDR 0x10000
> +#define AP_BOOT_ADDR 0x9f000
> 
> #define MPTABLE_MAX_SIZE  0x00002000
> #define SMI_CMD_IO_ADDR   0xb2
> 

- Sebastian

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent in the BIOS.
  2008-10-30 22:41   ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Sebastian Herbszt
@ 2008-11-02 10:04     ` Gleb Natapov
  2008-11-02 18:13       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
  2008-11-02 16:31     ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Kevin O'Connor
  1 sibling, 1 reply; 18+ messages in thread
From: Gleb Natapov @ 2008-11-02 10:04 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel

On Thu, Oct 30, 2008 at 11:41:28PM +0100, Sebastian Herbszt wrote:
> Gleb Natapov wrote:
>> diff --git a/bios/rombios.c b/bios/rombios.c
>> index 88eac04..46996fa 100644
>> --- a/bios/rombios.c
>> +++ b/bios/rombios.c
>> @@ -2198,6 +2198,31 @@ debugger_off()
>>   outb(0xfedc, 0x00);
>> }
>>
>> +void
>> +s3_resume()
>> +{
>> +    Bit32u s3_wakeup_vector;
>> +    Bit8u s3_resume_flag;
>> +
>> +    s3_resume_flag = read_byte(0x40, 0xb0);
>> +    s3_wakeup_vector = read_dword(0x40, 0xb2);
>> +
>> +    BX_INFO("S3 resume called %x 0x%lx\n", s3_resume_flag, s3_wakeup_vector);
>> +    if (s3_resume_flag != 0xFE || !s3_wakeup_vector)
>> +     return;
>> +
>> +    write_byte(0x40, 0xb0, 0);
>> +
>> +    /* setup wakeup vector */
>> +    write_word(0x40, 0xb6, (s3_wakeup_vector & 0xF)); /* IP */
>> +    write_word(0x40, 0xb8, (s3_wakeup_vector >> 4)); /* CS */
>
> Any reason not to use 0040h:0067h instead?
>
It is OS visible. OS can assume that a value written there will stay
there till overwritten by the OS itself.

>> -void rombios32_init(void)
>> +static uint32_t find_resume_vector(void)
>> {
>> -    BX_INFO("Starting rombios32\n");
>> +    unsigned long addr;
>> +
>> +    if (bios_table_cur_addr == 0)
>> +        return 0;
>
> BX_USE_EBDA_TABLES case
>
>> +
OK.

>> +    for (addr = bios_table_cur_addr; addr < bios_table_end_addr; addr++) {
>> +        if (!memcmp((void*)addr, "RSD PTR ", 8)) {
>> +            struct rsdp_descriptor *rsdp = (void*)addr;
>> +            struct rsdt_descriptor_rev1 *rsdt = (void*)rsdp->rsdt_physical_address;
>> +            struct fadt_descriptor_rev1 *fadt = (void*)rsdt->table_offset_entry[0];
>> +            struct facs_descriptor_rev1 *facs = (void*)fadt->firmware_ctrl;
>> +            return facs->firmware_waking_vector;
>> +        }
>> +    }
>> +
>
> RSDP is on a 16-byte boundary
>
OK.

>> +    return 0;
>> +}
>> +
>> +static void find_440fx(PCIDevice *d)
>> +{
>> +    uint16_t vendor_id, device_id;
>> +
>> +    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
>> +    device_id = pci_config_readw(d, PCI_DEVICE_ID);
>> +
>> +    if (vendor_id == 0x8086 && device_id == 0x1237)
>> +        i440_pcidev = *d;
>
> Please use PCI_VENDOR_ID_INTEL and PCI_DEVICE_ID_INTEL_82441.
>
OK.

>> +}
>> +
>> +void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag)
>> +{
>> +    BX_INFO("Starting rombios32 %p %p %x\n", s3_resume_vector, shutdown_flag, *shutdown_flag);
>
> Maybe make it two lines and explain the values for the log:
>
> BX_INFO("Starting rombios32\n");
> BX_INFO("s3_resume_vector=%p ... \n", s3_resume_vector, ...
>
OK. Actually printing *shutdown_flag is enough. Pointer are always
same and were needed for debug only.

>>
>> #ifdef BX_QEMU
>>     qemu_cfg_port = qemu_cfg_port_probe();
>> @@ -2025,6 +2070,24 @@ void rombios32_init(void)
>>
>>     smp_probe();
>>
>> +    if (find_bios_table_area() < 0)
>> +        return;
>
> It should not return if BX_USE_EBDA_TABLES is defined.
> Is there a need to return at all?
>
Indeed. No need to return here.

>> +
>> +    if (*shutdown_flag == 0xfe) {
>> +        *s3_resume_vector = find_resume_vector();
>> +        if (!*s3_resume_vector) {
>> +         BX_INFO("This is S3 resume but wakeup vector is NULL\n");
>> +        } else {
>> +         BX_INFO("S3 resume vector %p\n", *s3_resume_vector);
>> +            /* redirect bios read access to RAM */
>> +            pci_for_each_device(find_440fx);
>> +            bios_lock_shadow_ram(); /* bios is already copied */
>
> bios_shadow_init() is called in pci_bios_init(). Why do we need to lock it here?
>
Because we don't call pci_bios_init() if it is S3 resume.

>> +            return;
>> +        }
>> +    }
>> +
>> +    uuid_probe();
>> +
>>     pci_bios_init();
>>
>>     if (bios_table_cur_addr != 0) {
>>
>
> rombios32.c r1.32 got:
>
>    smp_probe();
>
>    pci_bios_init();
>
>    if (bios_table_cur_addr != 0) {
>
>        mptable_init();
>
>        uuid_probe();
>
> The patch should remove uuid_probe() from the if-case.
>
Why? uuid_probe() is needed only if SMBIOS tables are built. And
smbios_init() call is in the same if. BTW judging by this if it
looks like BX_USE_EBDA_TABLES is not supported today too since
bios_table_cur_addr is always zero in this case. 

--
			Gleb.

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory in BIOS.
  2008-10-30 23:12   ` [Qemu-devel] Re: [Bochs-developers] " Sebastian Herbszt
@ 2008-11-02 10:06     ` Gleb Natapov
  2008-11-02 23:44       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory inBIOS Sebastian Herbszt
  0 siblings, 1 reply; 18+ messages in thread
From: Gleb Natapov @ 2008-11-02 10:06 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel

On Fri, Oct 31, 2008 at 12:12:00AM +0100, Sebastian Herbszt wrote:
> Gleb Natapov wrote:
>
>> Use only first page and last page of low memory. OSes assumes that first
>> page is used by bios and last page is reserved in e820 map.
>>
>> Signed-off-by: Gleb Natapov <gleb@redhat.com>
>> ---
>>
>> bios/rombios.c   |    6 +++---
>> bios/rombios.h   |    2 +-
>> bios/rombios32.c |    2 +-
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/bios/rombios.c b/bios/rombios.c
>> index c4c1e35..19f0e93 100644
>> --- a/bios/rombios.c
>> +++ b/bios/rombios.c
>> @@ -4541,7 +4541,7 @@ ASM_END
>>                 {
>>                     case 0:
>>                         set_e820_range(ES, regs.u.r16.di,
>> -                                       0x0000000L, 0x0009fc00L, 1);
>> +                                       0x0000000L, 0x0009f000L, 1);
>>                         regs.u.r32.ebx = 1;
>>                         regs.u.r32.eax = 0x534D4150;
>>                         regs.u.r32.ecx = 0x14;
>> @@ -4550,7 +4550,7 @@ ASM_END
>>                         break;
>>                     case 1:
>>                         set_e820_range(ES, regs.u.r16.di,
>> -                                       0x0009fc00L, 0x000a0000L, 2);
>> +                                       0x0009f000L, 0x000a0000L, 2);
>>                         regs.u.r32.ebx = 2;
>>                         regs.u.r32.eax = 0x534D4150;
>>                         regs.u.r32.ecx = 0x14;
>> @@ -10021,7 +10021,7 @@ rombios32_05:
>>   cld
>>
>>   ;; init the stack pointer
>> -  mov esp, #0x00080000
>> +  mov esp, #0x9fbf0
>>
>>   ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32
>>   push #0x04b0
>> diff --git a/bios/rombios.h b/bios/rombios.h
>> index f0ed88e..57b0f46 100644
>> --- a/bios/rombios.h
>> +++ b/bios/rombios.h
>> @@ -56,7 +56,7 @@
>> #define ACPI_DATA_SIZE    0x00010000L
>> #define PM_IO_BASE        0xb000
>> #define SMB_IO_BASE       0xb100
>> -#define CPU_COUNT_ADDR    0xf000
>> +#define CPU_COUNT_ADDR    0x0500
>
> Why did you pick 0x500?
>
Cool number, don't you think so? It is unused location in a first page.
if 0x666 is unused we can use it instead.

--
			Gleb.

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent in the BIOS.
  2008-10-30 22:41   ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Sebastian Herbszt
  2008-11-02 10:04     ` Gleb Natapov
@ 2008-11-02 16:31     ` Kevin O'Connor
  2008-11-02 23:28       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
  1 sibling, 1 reply; 18+ messages in thread
From: Kevin O'Connor @ 2008-11-02 16:31 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel, Gleb Natapov

On Thu, Oct 30, 2008 at 11:41:28PM +0100, Sebastian Herbszt wrote:
> Gleb Natapov wrote:
> > +    if (bios_table_cur_addr == 0)
> > +        return 0;
> 
> BX_USE_EBDA_TABLES case
[...]
> > +    if (find_bios_table_area() < 0)
> > +        return;
> 
> It should not return if BX_USE_EBDA_TABLES is defined.

BX_USE_EBDA_TABLES is broken.  I think we'd be better off removing it
instead of adding more to it.

-Kevin

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent in the BIOS.
  2008-11-02 10:04     ` Gleb Natapov
@ 2008-11-02 18:13       ` Sebastian Herbszt
  2008-11-02 18:39         ` Gleb Natapov
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Herbszt @ 2008-11-02 18:13 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: bochs-developers, qemu-devel

Gleb Natapov wrote:
> On Thu, Oct 30, 2008 at 11:41:28PM +0100, Sebastian Herbszt wrote:
>> Gleb Natapov wrote:
>>> diff --git a/bios/rombios.c b/bios/rombios.c
>>> index 88eac04..46996fa 100644
>>> --- a/bios/rombios.c
>>> +++ b/bios/rombios.c
>>> @@ -2198,6 +2198,31 @@ debugger_off()
>>>   outb(0xfedc, 0x00);
>>> }
>>>
>>> +void
>>> +s3_resume()
>>> +{
>>> +    Bit32u s3_wakeup_vector;
>>> +    Bit8u s3_resume_flag;
>>> +
>>> +    s3_resume_flag = read_byte(0x40, 0xb0);
>>> +    s3_wakeup_vector = read_dword(0x40, 0xb2);
>>> +
>>> +    BX_INFO("S3 resume called %x 0x%lx\n", s3_resume_flag, s3_wakeup_vector);
>>> +    if (s3_resume_flag != 0xFE || !s3_wakeup_vector)
>>> +     return;
>>> +
>>> +    write_byte(0x40, 0xb0, 0);
>>> +
>>> +    /* setup wakeup vector */
>>> +    write_word(0x40, 0xb6, (s3_wakeup_vector & 0xF)); /* IP */
>>> +    write_word(0x40, 0xb8, (s3_wakeup_vector >> 4)); /* CS */
>>
>> Any reason not to use 0040h:0067h instead?
>>
> It is OS visible. OS can assume that a value written there will stay
> there till overwritten by the OS itself.

0040h:00B6h is as much OS visiable as the "RESET RESTART ADDRESS".
The former has no standard definition tho and could or not be used
by the OS or BIOS. The "RESET RESTART ADDRESS" is used by the
(commercial) BIOS together with the CMOS "Shutdown Status Byte" for
internal purpose. I am not sure whether the OS expectation is valid.
This however is a minor detail which can be changed later if needed.

>>> +
>>> +    if (*shutdown_flag == 0xfe) {
>>> +        *s3_resume_vector = find_resume_vector();
>>> +        if (!*s3_resume_vector) {
>>> +         BX_INFO("This is S3 resume but wakeup vector is NULL\n");
>>> +        } else {
>>> +         BX_INFO("S3 resume vector %p\n", *s3_resume_vector);
>>> +            /* redirect bios read access to RAM */
>>> +            pci_for_each_device(find_440fx);
>>> +            bios_lock_shadow_ram(); /* bios is already copied */
>>
>> bios_shadow_init() is called in pci_bios_init(). Why do we need to lock it here?
>>
> Because we don't call pci_bios_init() if it is S3 resume.

If pci_bios_init() is not called on S3 resume, pci_bios_init_bridges()
is not called either. This way bios_shadow_init() is never called and the
bios is never shadowed. Since it's not shadowed there is no need to lock it.
What do i miss here?

>>> +            return;
>>> +        }
>>> +    }
>>> +
>>> +    uuid_probe();
>>> +
>>>     pci_bios_init();
>>>
>>>     if (bios_table_cur_addr != 0) {
>>>
>>
>> rombios32.c r1.32 got:
>>
>>    smp_probe();
>>
>>    pci_bios_init();
>>
>>    if (bios_table_cur_addr != 0) {
>>
>>        mptable_init();
>>
>>        uuid_probe();
>>
>> The patch should remove uuid_probe() from the if-case.
>>
> Why? uuid_probe() is needed only if SMBIOS tables are built. And
> smbios_init() call is in the same if.

Your patch does also add a uuid_probe() before the if-case. Since it does
not remove the one in the if-case, uuid_probe() will be called twice.

> BTW judging by this if it
> looks like BX_USE_EBDA_TABLES is not supported today too since
> bios_table_cur_addr is always zero in this case. 

find_bios_table_area() is supposed to also succeed in the
BX_USE_EBDA_TABLES case because bios_table_area_start in rombios.c
is unconditional. In the BX_USE_EBDA_TABLES case mptable_init() does use
mp_config_table and smbios_init() does use ebda_cur_addr which is set in
ram_probe().

- Sebastian

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent in the BIOS.
  2008-11-02 18:13       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
@ 2008-11-02 18:39         ` Gleb Natapov
  0 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-11-02 18:39 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel

On Sun, Nov 02, 2008 at 07:13:37PM +0100, Sebastian Herbszt wrote:
>>>> +
>>>> +    if (*shutdown_flag == 0xfe) {
>>>> +        *s3_resume_vector = find_resume_vector();
>>>> +        if (!*s3_resume_vector) {
>>>> +         BX_INFO("This is S3 resume but wakeup vector is NULL\n");
>>>> +        } else {
>>>> +         BX_INFO("S3 resume vector %p\n", *s3_resume_vector);
>>>> +            /* redirect bios read access to RAM */
>>>> +            pci_for_each_device(find_440fx);
>>>> +            bios_lock_shadow_ram(); /* bios is already copied */
>>>
>>> bios_shadow_init() is called in pci_bios_init(). Why do we need to lock it here?
>>>
>> Because we don't call pci_bios_init() if it is S3 resume.
>
> If pci_bios_init() is not called on S3 resume, pci_bios_init_bridges()
> is not called either. This way bios_shadow_init() is never called and the
> bios is never shadowed. Since it's not shadowed there is no need to lock it.
> What do i miss here?
>
The BIOS is already shadowed during a regular boot. No need to copy it, just
lock.

>>>> +            return;
>>>> +        }
>>>> +    }
>>>> +
>>>> +    uuid_probe();
>>>> +
>>>>     pci_bios_init();
>>>>
>>>>     if (bios_table_cur_addr != 0) {
>>>>
>>>
>>> rombios32.c r1.32 got:
>>>
>>>    smp_probe();
>>>
>>>    pci_bios_init();
>>>
>>>    if (bios_table_cur_addr != 0) {
>>>
>>>        mptable_init();
>>>
>>>        uuid_probe();
>>>
>>> The patch should remove uuid_probe() from the if-case.
>>>
>> Why? uuid_probe() is needed only if SMBIOS tables are built. And
>> smbios_init() call is in the same if.
>
> Your patch does also add a uuid_probe() before the if-case. Since it does
> not remove the one in the if-case, uuid_probe() will be called twice.
>
Ah. Now I see. I added this by mistake. I'll fix this.

--
			Gleb.

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent in the BIOS.
  2008-11-02 16:31     ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Kevin O'Connor
@ 2008-11-02 23:28       ` Sebastian Herbszt
  2008-11-03  0:03         ` Kevin O'Connor
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Herbszt @ 2008-11-02 23:28 UTC (permalink / raw)
  To: Kevin O'Connor; +Cc: bochs-developers, qemu-devel, Gleb Natapov

Kevin O'Connor wrote:
> On Thu, Oct 30, 2008 at 11:41:28PM +0100, Sebastian Herbszt wrote:
>> Gleb Natapov wrote:
>> > +    if (bios_table_cur_addr == 0)
>> > +        return 0;
>> 
>> BX_USE_EBDA_TABLES case
> [...]
>> > +    if (find_bios_table_area() < 0)
>> > +        return;
>> 
>> It should not return if BX_USE_EBDA_TABLES is defined.
> 
> BX_USE_EBDA_TABLES is broken.  I think we'd be better off removing it
> instead of adding more to it.

Can you define "broken"?
ebda_cur_addr points to EBDA_SEG + 0x38 = 0x9FF8. Since the BBS code
got added it unfortunatelly overlaps since IPL_SEG is 0x9FF0. Last element of
the IPL data is at offset 0x84 and the total size is 134 bytes. There are 256 bytes
reserved for the IPL data, so we still got some space left.
Currently the MP table size is 0x10 and the RSDP is 0x24, so we need a total of
0x34 bytes. The new SMBIOS tables need 0x110 bytes. This is a total of 0x144 bytes
and does exceed the spare EBDA space.
This can be fixed by extending the EBDA to 2KB or keep using 1KB and not support
SMBIOS tables with BX_USE_EBDA_TABLES.

- Sebastian

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory inBIOS.
  2008-11-02 10:06     ` Gleb Natapov
@ 2008-11-02 23:44       ` Sebastian Herbszt
  2008-11-03  6:29         ` Gleb Natapov
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Herbszt @ 2008-11-02 23:44 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: bochs-developers, qemu-devel

Gleb Natapov wrote:
> On Fri, Oct 31, 2008 at 12:12:00AM +0100, Sebastian Herbszt wrote:
>> Gleb Natapov wrote:
>>> diff --git a/bios/rombios.h b/bios/rombios.h
>>> index f0ed88e..57b0f46 100644
>>> --- a/bios/rombios.h
>>> +++ b/bios/rombios.h
>>> @@ -56,7 +56,7 @@
>>> #define ACPI_DATA_SIZE    0x00010000L
>>> #define PM_IO_BASE        0xb000
>>> #define SMB_IO_BASE       0xb100
>>> -#define CPU_COUNT_ADDR    0xf000
>>> +#define CPU_COUNT_ADDR    0x0500
>>
>> Why did you pick 0x500?
>>
> Cool number, don't you think so? It is unused location in a first page.
> if 0x666 is unused we can use it instead.

Actually 0050h:0000h seems to be used for PRINT-SCREEN STATUS.
This byte is used by the int 5h service, which is currently not
implemented. The EBDA could be used here or some reserved BDA
space (e.g. 0x4d0, 0x4ac).

- Sebastian

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent in the BIOS.
  2008-11-02 23:28       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
@ 2008-11-03  0:03         ` Kevin O'Connor
  0 siblings, 0 replies; 18+ messages in thread
From: Kevin O'Connor @ 2008-11-03  0:03 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel, Gleb Natapov

On Mon, Nov 03, 2008 at 12:28:08AM +0100, Sebastian Herbszt wrote:
> Kevin O'Connor wrote:
>> On Thu, Oct 30, 2008 at 11:41:28PM +0100, Sebastian Herbszt wrote:
>>> It should not return if BX_USE_EBDA_TABLES is defined.
>> BX_USE_EBDA_TABLES is broken.  I think we'd be better off removing it
>> instead of adding more to it.
>
> Can you define "broken"?

Well, I think you answered your own question.  However, I'm aware of
the following problems:

1 - it uses memory that clashes with the ipl table

2 - it places the smbios in the ebda, but the smbios spec states it
    must be located in the 0xf0000 segment.

3 - from a style point of view, it's rather ugly to spread ifdefs
    throughout the code - if having bios tables in ebda is desired,
    then wrapper functions should be introduced

4 - it's an unnecessary complication - writing to 0xf0000 works.  Why
    maintain code that is unneeded and doesn't work?

-Kevin

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

* [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory inBIOS.
  2008-11-02 23:44       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory inBIOS Sebastian Herbszt
@ 2008-11-03  6:29         ` Gleb Natapov
  0 siblings, 0 replies; 18+ messages in thread
From: Gleb Natapov @ 2008-11-03  6:29 UTC (permalink / raw)
  To: Sebastian Herbszt; +Cc: bochs-developers, qemu-devel

On Mon, Nov 03, 2008 at 12:44:26AM +0100, Sebastian Herbszt wrote:
> Gleb Natapov wrote:
>> On Fri, Oct 31, 2008 at 12:12:00AM +0100, Sebastian Herbszt wrote:
>>> Gleb Natapov wrote:
>>>> diff --git a/bios/rombios.h b/bios/rombios.h
>>>> index f0ed88e..57b0f46 100644
>>>> --- a/bios/rombios.h
>>>> +++ b/bios/rombios.h
>>>> @@ -56,7 +56,7 @@
>>>> #define ACPI_DATA_SIZE    0x00010000L
>>>> #define PM_IO_BASE        0xb000
>>>> #define SMB_IO_BASE       0xb100
>>>> -#define CPU_COUNT_ADDR    0xf000
>>>> +#define CPU_COUNT_ADDR    0x0500
>>>
>>> Why did you pick 0x500?
>>>
>> Cool number, don't you think so? It is unused location in a first page.
>> if 0x666 is unused we can use it instead.
>
> Actually 0050h:0000h seems to be used for PRINT-SCREEN STATUS.
> This byte is used by the int 5h service, which is currently not
> implemented. The EBDA could be used here or some reserved BDA
> space (e.g. 0x4d0, 0x4ac).
>
The memory location can be reused after smp initialization.

--
			Gleb.

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

end of thread, other threads:[~2008-11-03  6:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-27 10:12 [Qemu-devel] [PATCH 0/6] Support for S3 ACPI state (suspend to memory) in BIOS Gleb Natapov
2008-10-27 10:12 ` [Qemu-devel] [PATCH 1/6] Move PIC initialization out of line to save space in post code area Gleb Natapov
2008-10-27 10:13 ` [Qemu-devel] [PATCH 2/6] Add S3 state to DSDT. Handle resume event in the BIOS Gleb Natapov
2008-10-30 22:41   ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Sebastian Herbszt
2008-11-02 10:04     ` Gleb Natapov
2008-11-02 18:13       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
2008-11-02 18:39         ` Gleb Natapov
2008-11-02 16:31     ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handle resumeevent " Kevin O'Connor
2008-11-02 23:28       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 2/6] Add S3 state to DSDT. Handleresumeevent " Sebastian Herbszt
2008-11-03  0:03         ` Kevin O'Connor
2008-10-27 10:13 ` [Qemu-devel] [PATCH 3/6] Disable init of SMM Gleb Natapov
2008-10-27 10:13 ` [Qemu-devel] [PATCH 4/6] Execute rombios32 code from rom address 0xe0000 Gleb Natapov
2008-10-27 10:13 ` [Qemu-devel] [PATCH 5/6] Don't use unreserved memory in BIOS Gleb Natapov
2008-10-30 23:12   ` [Qemu-devel] Re: [Bochs-developers] " Sebastian Herbszt
2008-11-02 10:06     ` Gleb Natapov
2008-11-02 23:44       ` [Qemu-devel] Re: [Bochs-developers] [PATCH 5/6] Don't use unreserved memory inBIOS Sebastian Herbszt
2008-11-03  6:29         ` Gleb Natapov
2008-10-27 10:13 ` [Qemu-devel] [PATCH 6/6] Don't power down vga card on entering S3 state Gleb Natapov

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).