fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / i386 / kernel / cpu / mtrr / cyrix.c
index dec2b52..0737a59 100644 (file)
@@ -9,7 +9,7 @@ int arr3_protected;
 
 static void
 cyrix_get_arr(unsigned int reg, unsigned long *base,
-             unsigned int *size, mtrr_type * type)
+             unsigned long *size, mtrr_type * type)
 {
        unsigned long flags;
        unsigned char arr, ccr3, rcr, shift;
@@ -77,7 +77,7 @@ cyrix_get_arr(unsigned int reg, unsigned long *base,
 }
 
 static int
-cyrix_get_free_region(unsigned long base, unsigned long size)
+cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg)
 /*  [SUMMARY] Get a free ARR.
     <base> The starting (base) address of the region.
     <size> The size (in bytes) of the region.
@@ -86,9 +86,24 @@ cyrix_get_free_region(unsigned long base, unsigned long size)
 {
        int i;
        mtrr_type ltype;
-       unsigned long lbase;
-       unsigned int  lsize;
+       unsigned long lbase, lsize;
 
+       switch (replace_reg) {
+       case 7:
+               if (size < 0x40)
+                       break;
+       case 6:
+       case 5:
+       case 4:
+               return replace_reg;
+       case 3:
+               if (arr3_protected)
+                       break;
+       case 2:
+       case 1:
+       case 0:
+               return replace_reg;
+       }
        /* If we are to set up a region >32M then look at ARR7 immediately */
        if (size > 0x2000) {
                cyrix_get_arr(7, &lbase, &lsize, &ltype);
@@ -214,16 +229,16 @@ static void cyrix_set_arr(unsigned int reg, unsigned long base,
 
 typedef struct {
        unsigned long base;
-       unsigned int size;
+       unsigned long size;
        mtrr_type type;
 } arr_state_t;
 
-arr_state_t arr_state[8] __initdata = {
+static arr_state_t arr_state[8] __devinitdata = {
        {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL},
        {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}
 };
 
-unsigned char ccr_state[7] __initdata = { 0, 0, 0, 0, 0, 0, 0 };
+static unsigned char ccr_state[7] __devinitdata = { 0, 0, 0, 0, 0, 0, 0 };
 
 static void cyrix_set_all(void)
 {
@@ -243,6 +258,7 @@ static void cyrix_set_all(void)
        post_set();
 }
 
+#if 0
 /*
  * On Cyrix 6x86(MX) and M II the ARR3 is special: it has connection
  * with the SMM (System Management Mode) mode. So we need the following:
@@ -341,10 +357,11 @@ cyrix_arr_init(void)
        if (ccrc[6])
                printk(KERN_INFO "mtrr: ARR3 was write protected, unprotected\n");
 }
+#endif
 
 static struct mtrr_ops cyrix_mtrr_ops = {
        .vendor            = X86_VENDOR_CYRIX,
-       .init              = cyrix_arr_init,
+//     .init              = cyrix_arr_init,
        .set_all           = cyrix_set_all,
        .set               = cyrix_set_arr,
        .get               = cyrix_get_arr,