Make MTRR region 0xc0000-0x100000 be cached.
[seabios.git] / src / resume.c
index aab52edc1162f7f066caa9ab2739a73a82d58ad1..59bb90195427e01be1525aeb4d4a3f1813f61f69 100644 (file)
@@ -1,6 +1,6 @@
 // Code for handling calls to "post" that are resume related.
 //
-// Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008,2009  Kevin O'Connor <kevin@koconnor.net>
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
@@ -40,7 +40,7 @@ handle_resume(u8 status)
             asm volatile(
                 "movw %w1, %%ss\n"
                 "movl %0, %%esp\n"
-                "pushl $_code32_s3_resume\n"
+                "pushl $s3_resume\n"
                 "jmp transition32\n"
                 : : "i"(BUILD_S3RESUME_STACK_ADDR), "r"(0)
                 );
@@ -48,7 +48,6 @@ handle_resume(u8 status)
         }
         // NO BREAK
     case 0x00:
-    case 0x09:
     case 0x0d ... 0xfd:
     case 0xff:
         // Normal post - now that status has been cleared a reset will
@@ -61,12 +60,12 @@ handle_resume(u8 status)
         eoi_pic2();
         // NO BREAK
     case 0x0a:
-#define BDA_JUMP_IP (((struct bios_data_area_s *)0)->jump_ip)
+#define BDA_JUMP (((struct bios_data_area_s *)0)->jump)
         // resume execution by jump via 40h:0067h
         asm volatile(
             "movw %w1, %%ds\n"
             "ljmpw *%0\n"
-            : : "m"(BDA_JUMP_IP), "r"(SEG_BDA)
+            : : "m"(BDA_JUMP), "r"(SEG_BDA)
             );
         break;
 
@@ -76,7 +75,7 @@ handle_resume(u8 status)
             "movw %w1, %%ds\n"
             "lssw %0, %%sp\n"
             "iretw\n"
-            : : "m"(BDA_JUMP_IP), "r"(SEG_BDA)
+            : : "m"(BDA_JUMP), "r"(SEG_BDA)
             );
         break;
 
@@ -86,24 +85,27 @@ handle_resume(u8 status)
             "movw %w1, %%ds\n"
             "lssw %0, %%sp\n"
             "lretw\n"
-            : : "m"(BDA_JUMP_IP), "r"(SEG_BDA)
+            : : "m"(BDA_JUMP), "r"(SEG_BDA)
             );
         break;
     }
 
-    BX_PANIC("Unimplemented shutdown status: %02x\n", status);
+    panic("Unimplemented shutdown status: %02x\n", status);
 }
 
-void VISIBLE32
+#if MODESEGMENT == 0
+void VISIBLE32FLAT
 s3_resume()
 {
     if (!CONFIG_S3_RESUME)
-        BX_PANIC("S3 resume support not compiled in.\n");
+        panic("S3 resume support not compiled in.\n");
 
     dprintf(1, "In 32bit resume\n");
 
     smm_init();
 
+    s3_resume_vga_init();
+
     make_bios_readonly();
 
     u32 s3_resume_vector = find_resume_vector();
@@ -113,17 +115,12 @@ s3_resume()
     memset(&br, 0, sizeof(br));
     if (s3_resume_vector) {
         dprintf(1, "Jump to resume vector (%x)\n", s3_resume_vector);
-        br.ip = FLATPTR_TO_OFFSET(s3_resume_vector);
-        br.cs = FLATPTR_TO_SEG(s3_resume_vector);
+        br.code = FLATPTR_TO_SEGOFF((void*)s3_resume_vector);
     } else {
         dprintf(1, "No resume vector set!\n");
         // Jump to the post vector to restart with a normal boot.
-        br.ip = (u32)reset_vector - BUILD_BIOS_ADDR;
-        br.cs = SEG_BIOS;
+        br.code = SEGOFF(SEG_BIOS, (u32)reset_vector - BUILD_BIOS_ADDR);
     }
     call16big(&br);
 }
-
-// Ughh - some older gcc compilers have a bug which causes VISIBLE32
-// functions to not be exported as global variables.
-asm(".global s3_resume");
+#endif