[PATCH] [11/48] Suspend2 2.1.9.8 for 2.6.12: 401-e820-table-support.patch

Nigel Cunningham
2005-07-06T02:22:00Z

diff -ruNp 402-mtrr-remove-sysdev.patch-old/arch/i386/kernel/cpu/mtrr/main.c 402-mtrr-remove-sysdev.patch-new/arch/i386/kernel/cpu/mtrr/main.c
--- 402-mtrr-remove-sysdev.patch-old/arch/i386/kernel/cpu/mtrr/main.c 2005-06-20 11:46:42.000000000 +1000
+++ 402-mtrr-remove-sysdev.patch-new/arch/i386/kernel/cpu/mtrr/main.c 2005-07-04 23:14:19.000000000 +1000
@@ -166,7 +166,6 @@ static void ipi_handler(void *info)
atomic_dec(&data->count);
local_irq_restore(flags);
}
-
#endif

/**
@@ -560,7 +559,7 @@ struct mtrr_value {

static struct mtrr_value * mtrr_state;

-static int mtrr_save(struct sys_device * sysdev, u32 state)
+int mtrr_save(void)
{
int i;
int size = num_var_ranges * sizeof(struct mtrr_value);
@@ -580,28 +579,27 @@ static int mtrr_save(struct sys_device *
return 0;
}

-static int mtrr_restore(struct sys_device * sysdev)
+/* Restore mtrrs on this CPU only.
+ * Done with interrupts disabled via __smp_lowlevel_suspend
+ */
+int mtrr_restore_one_cpu(void)
{
int i;

for (i = 0; i < num_var_ranges; i++) {
if (mtrr_state[i].lsize)
- set_mtrr(i,
+ mtrr_if->set(i,
mtrr_state[i].lbase,
mtrr_state[i].lsize,
mtrr_state[i].ltype);
}
- kfree(mtrr_state);
return 0;
}

-
-
-static struct sysdev_driver mtrr_sysdev_driver = {
- .suspend = mtrr_save,
- .resume = mtrr_restore,
-};
-
+void mtrr_restore_finish(void)
+{
+ kfree(mtrr_state);
+}

/**
* mtrr_init - initialize mtrrs on the boot CPU
@@ -669,8 +667,7 @@ static int __init mtrr_init(void)
init_table();
init_other_cpus();

- return sysdev_driver_register(&cpu_sysdev_class,
- &mtrr_sysdev_driver);
+ return 0;
}
return -ENXIO;
}