]> xenbits.xensource.com Git - seabios.git/commitdiff
POST: Move cpu caching and dma setup to platform_hardware_setup().
authorKevin O'Connor <kevin@koconnor.net>
Mon, 21 Jan 2013 17:14:29 +0000 (12:14 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 8 Feb 2013 02:48:35 +0000 (21:48 -0500)
The CPU cache is enabled and DMA is disabled on all real-world POST
entry situations, so no need to do this in the low-level "pre-init"
phase.  Instead, move it to the platform hardware setup stage.

Also, move the setting of the reboot flags (which control reset-vector
entry point handling) to ivt_init().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/post.c
src/resume.c
src/util.h

index ae5e9230b556db4ed7fa6d92f892029700a6b4d7..f2fabbb656e2e084f2bed6d7ddf4f1408f05979a 100644 (file)
@@ -37,6 +37,10 @@ ivt_init(void)
 {
     dprintf(3, "init ivt\n");
 
+    // Setup reset-vector entry point (controls legacy reboots).
+    HaveRunPost = 1;
+    outb_cmos(0, CMOS_RESET_CODE);
+
     // Initialize all vectors to the default handler.
     int i;
     for (i=0; i<256; i++)
@@ -145,6 +149,12 @@ device_hardware_setup(void)
 static void
 platform_hardware_setup(void)
 {
+    // Enable CPU caching
+    setcr0(getcr0() & ~(CR0_CD|CR0_NW));
+
+    // Make sure legacy DMA isn't running.
+    dma_setup();
+
     // Init base pc hardware.
     pic_setup();
     timer_setup();
@@ -305,16 +315,6 @@ reloc_preinit(void *f, void *arg)
 void VISIBLE32INIT
 dopost(void)
 {
-    // Set reboot flags.
-    HaveRunPost = 1;
-    outb_cmos(0, CMOS_RESET_CODE);
-
-    // Enable CPU caching
-    setcr0(getcr0() & ~(CR0_CD|CR0_NW));
-
-    // Make sure legacy DMA isn't running.
-    dma_preinit();
-
     // Check if we are running under Xen.
     xen_preinit();
 
index 99265cda1a49011b0a7537d35bb5fa53b8360634..ffc84fca11f7f5d90376b400c43cc14d6addbed3 100644 (file)
@@ -19,7 +19,7 @@ int HaveRunPost VAR16VISIBLE;
 
 // Reset DMA controller
 void
-dma_preinit(void)
+dma_setup(void)
 {
     // first reset the DMA controllers
     outb(0, PORT_DMA1_MASTER_CLEAR);
@@ -40,7 +40,7 @@ handle_resume(void)
     outb_cmos(0, CMOS_RESET_CODE);
     dprintf(1, "In resume (status=%d)\n", status);
 
-    dma_preinit();
+    dma_setup();
 
     switch (status) {
     case 0x01 ... 0x04:
index f486c85fb22f621e9a962b03bbd7d7a179d40ff2..04c5a9d71862d00c679e6a5ab5082ab2f5300bc5 100644 (file)
@@ -355,7 +355,7 @@ void disable_bootsplash(void);
 
 // resume.c
 extern int HaveRunPost;
-void dma_preinit(void);
+void dma_setup(void);
 
 // pnpbios.c
 #define PNP_SIGNATURE 0x506e5024 // $PnP