]> xenbits.xensource.com Git - seabios.git/commitdiff
seabios: make mttr UC area setup dynamic
authorJason Baron <jbaron@redhat.com>
Wed, 28 Nov 2012 09:17:30 +0000 (10:17 +0100)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 2 Dec 2012 04:18:23 +0000 (23:18 -0500)
Set up the UC area of mtrr dynamically based on mtrr_base. This allows
the bios to work for other chipsets that might want to set the mtrr.
Since BUILD_MAX_HIGHMEM is no longer used we can remove the config parameter.

This change reverses the order of pci_setup() and smm_init() with
mtrr_setup().

Signed-off-by: Jason Baron <jbaron@redhat.com>
src/config.h
src/mtrr.c
src/post.c

index 0d4066d91cc249f3e6f86d93ed6bfad067149bd6..71c0b7e6375ad1b07e8df4f33682c8ecaba56415 100644 (file)
@@ -44,7 +44,6 @@
 #define BUILD_SMM_INIT_ADDR       0x38000
 #define BUILD_SMM_ADDR            0xa8000
 #define BUILD_SMM_SIZE            0x8000
-#define BUILD_MAX_HIGHMEM         0xe0000000
 
 #define BUILD_PCIMEM_START        0xe0000000
 #define BUILD_PCIMEM_END          0xfec00000    /* IOAPIC is mapped at */
index 09578348c192bda7a4bc9b1ae51ebc5c56d13ebb..2cbf2349833fef671c86db12725725f6792b41db 100644 (file)
@@ -7,6 +7,7 @@
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_*
 #include "xen.h" // usingXen
+#include "pci.h" // pcimem_start
 
 #define MSR_MTRRcap                    0x000000fe
 #define MSR_MTRRfix64K_00000           0x00000250
@@ -94,9 +95,9 @@ void mtrr_setup(void)
         wrmsr_smp(MTRRphysMask_MSR(i), 0);
     }
     /* Mark 3.5-4GB as UC, anything not specified defaults to WB */
-    wrmsr_smp(MTRRphysBase_MSR(0), BUILD_MAX_HIGHMEM | MTRR_MEMTYPE_UC);
+    wrmsr_smp(MTRRphysBase_MSR(0), pcimem_start | MTRR_MEMTYPE_UC);
     wrmsr_smp(MTRRphysMask_MSR(0)
-              , (-((1ull<<32)-BUILD_MAX_HIGHMEM) & phys_mask) | 0x800);
+              , (-((1ull<<32)-pcimem_start) & phys_mask) | 0x800);
 
     // Enable fixed and variable MTRRs; set default type.
     wrmsr_smp(MSR_MTRRdefType, 0xc00 | MTRR_MEMTYPE_WB);
index 9a6dd3fd15094d1a6da9e5b15b07efa5132ad93a..3705c3b16fc2075030cd87530c9df93f6b7d2b02 100644 (file)
@@ -230,13 +230,13 @@ maininit(void)
     timer_setup();
     mathcp_setup();
 
-    // Initialize mtrr
-    mtrr_setup();
-
     // Initialize pci
     pci_setup();
     smm_init();
 
+    // Initialize mtrr
+    mtrr_setup();
+
     // Setup Xen hypercalls
     xen_init_hypercalls();