Add CONFIG_S3_RESUME to control support for S3 resume.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 18 Jan 2009 02:52:52 +0000 (21:52 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 18 Jan 2009 02:52:52 +0000 (21:52 -0500)
src/config.h
src/resume.c

index 044e11017f74b2a289523f0e83e3b0ae1741edbb..50dbd58f9ad2112fd7d9d6cc22846a034e463f19 100644 (file)
 #define CONFIG_ACPI 1
 // Support bios callbacks specific to via vgabios.
 #define CONFIG_VGAHOOKS 0
+// Support S3 resume handler.
+#define CONFIG_S3_RESUME 1
+// define it if the (emulated) hardware supports SMM mode
+#define CONFIG_USE_SMM 1
 // Maximum number of map entries in the e820 map
 #define CONFIG_MAX_E820 32
 // Space to reserve in f-segment for run-time built bios tables.
 #define CONFIG_MAX_BIOSTABLE 512
 
-/* define it if the (emulated) hardware supports SMM mode */
-#define CONFIG_USE_SMM 1
-
 #define CONFIG_MAX_ATA_INTERFACES 4
 #define CONFIG_MAX_ATA_DEVICES  (CONFIG_MAX_ATA_INTERFACES*2)
 
 #define SEG_BDA      0x0040
 #define SEG_BIOS     0xf000
 
-// Segment definitions in protected mode (see rombios32_gdt in romlayout.S)
+// Segment definitions in protected mode (see rombios32_gdt in misc.c)
 #define SEG32_MODE32_CS    (1 << 3)
 #define SEG32_MODE32_DS    (2 << 3)
 #define SEG32_MODE16_CS    (3 << 3)
index 1bffd499fb6533eb0c2d66df6f56258ce5c1e625..86c0555a8715bfa5cae6ea1f7ba4e53e87f1b9d4 100644 (file)
@@ -36,16 +36,18 @@ handle_resume(u8 status)
     struct bios_data_area_s *bda = MAKE_FARPTR(SEG_BDA, 0);
     switch (status) {
     case 0xfe:
-        // S3 resume request.  Jump to 32bit mode to handle the resume.
-        asm volatile(
-            "movw %%ax, %%ss\n"
-            "movl %0, %%esp\n"
-            "pushl $_code32_s3_resume\n"
-            "jmp transition32\n"
-            : : "i"(BUILD_S3RESUME_STACK_ADDR), "a"(0)
-            );
-        break;
-
+        if (CONFIG_S3_RESUME) {
+            // S3 resume request.  Jump to 32bit mode to handle the resume.
+            asm volatile(
+                "movw %%ax, %%ss\n"
+                "movl %0, %%esp\n"
+                "pushl $_code32_s3_resume\n"
+                "jmp transition32\n"
+                : : "i"(BUILD_S3RESUME_STACK_ADDR), "a"(0)
+                );
+            break;
+        }
+        // NO BREAK
     case 0x00:
     case 0x09:
     case 0x0d ... 0xfd:
@@ -97,6 +99,9 @@ handle_resume(u8 status)
 void VISIBLE32
 s3_resume()
 {
+    if (!CONFIG_S3_RESUME)
+        BX_PANIC("S3 resume support not compiled in.\n");
+
     dprintf(1, "In 32bit resume\n");
 
     smm_init();