Add CONFIG_S3_RESUME to control support for S3 resume.
[seabios.git] / src / resume.c
index 9db8cad2e0b1e02a028c9b890233bf1ffd6d9d6e..86c0555a8715bfa5cae6ea1f7ba4e53e87f1b9d4 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
 //
-// This file may be distributed under the terms of the GNU GPLv3 license.
+// This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "util.h" // dprintf
 #include "ioport.h" // outb
@@ -33,18 +33,21 @@ handle_resume(u8 status)
     debug_serial_setup();
     dprintf(1, "In resume (status=%d)\n", 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:
@@ -60,7 +63,6 @@ handle_resume(u8 status)
         // NO BREAK
     case 0x0a:
         // resume execution by jump via 40h:0067h
-#define bda ((struct bios_data_area_s *)0)
         asm volatile(
             "movw %%ax, %%ds\n"
             "ljmpw *%0\n"
@@ -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();