aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/cpu/mtrr/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/cpu/mtrr/main.c')
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 1e9db198c440..3b4618bed70d 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -44,12 +44,10 @@
44#include <asm/msr.h> 44#include <asm/msr.h>
45#include "mtrr.h" 45#include "mtrr.h"
46 46
47#define MTRR_VERSION "2.0 (20020519)"
48
49u32 num_var_ranges = 0; 47u32 num_var_ranges = 0;
50 48
51unsigned int *usage_table; 49unsigned int *usage_table;
52static DECLARE_MUTEX(main_lock); 50static DECLARE_MUTEX(mtrr_sem);
53 51
54u32 size_or_mask, size_and_mask; 52u32 size_or_mask, size_and_mask;
55 53
@@ -335,7 +333,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
335 /* No CPU hotplug when we change MTRR entries */ 333 /* No CPU hotplug when we change MTRR entries */
336 lock_cpu_hotplug(); 334 lock_cpu_hotplug();
337 /* Search for existing MTRR */ 335 /* Search for existing MTRR */
338 down(&main_lock); 336 down(&mtrr_sem);
339 for (i = 0; i < num_var_ranges; ++i) { 337 for (i = 0; i < num_var_ranges; ++i) {
340 mtrr_if->get(i, &lbase, &lsize, &ltype); 338 mtrr_if->get(i, &lbase, &lsize, &ltype);
341 if (base >= lbase + lsize) 339 if (base >= lbase + lsize)
@@ -373,7 +371,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
373 printk(KERN_INFO "mtrr: no more MTRRs available\n"); 371 printk(KERN_INFO "mtrr: no more MTRRs available\n");
374 error = i; 372 error = i;
375 out: 373 out:
376 up(&main_lock); 374 up(&mtrr_sem);
377 unlock_cpu_hotplug(); 375 unlock_cpu_hotplug();
378 return error; 376 return error;
379} 377}
@@ -466,7 +464,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
466 max = num_var_ranges; 464 max = num_var_ranges;
467 /* No CPU hotplug when we change MTRR entries */ 465 /* No CPU hotplug when we change MTRR entries */
468 lock_cpu_hotplug(); 466 lock_cpu_hotplug();
469 down(&main_lock); 467 down(&mtrr_sem);
470 if (reg < 0) { 468 if (reg < 0) {
471 /* Search for existing MTRR */ 469 /* Search for existing MTRR */
472 for (i = 0; i < max; ++i) { 470 for (i = 0; i < max; ++i) {
@@ -505,7 +503,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
505 set_mtrr(reg, 0, 0, 0); 503 set_mtrr(reg, 0, 0, 0);
506 error = reg; 504 error = reg;
507 out: 505 out:
508 up(&main_lock); 506 up(&mtrr_sem);
509 unlock_cpu_hotplug(); 507 unlock_cpu_hotplug();
510 return error; 508 return error;
511} 509}
@@ -671,7 +669,6 @@ void __init mtrr_bp_init(void)
671 break; 669 break;
672 } 670 }
673 } 671 }
674 printk(KERN_INFO "mtrr: v%s\n",MTRR_VERSION);
675 672
676 if (mtrr_if) { 673 if (mtrr_if) {
677 set_num_var_ranges(); 674 set_num_var_ranges();
@@ -688,7 +685,7 @@ void mtrr_ap_init(void)
688 if (!mtrr_if || !use_intel()) 685 if (!mtrr_if || !use_intel())
689 return; 686 return;
690 /* 687 /*
691 * Ideally we should hold main_lock here to avoid mtrr entries changed, 688 * Ideally we should hold mtrr_sem here to avoid mtrr entries changed,
692 * but this routine will be called in cpu boot time, holding the lock 689 * but this routine will be called in cpu boot time, holding the lock
693 * breaks it. This routine is called in two cases: 1.very earily time 690 * breaks it. This routine is called in two cases: 1.very earily time
694 * of software resume, when there absolutely isn't mtrr entry changes; 691 * of software resume, when there absolutely isn't mtrr entry changes;