* Now calls get_current_cpuid() instead of get_cpuid() - that doesn't work on

SMP machines since we're already in a call_all_cpus() function (that also
  needs to run synchronously). MTRR does now work on SMP machines again; ie.
  SMP machines should boot fine again now.
* Fixed warning when compiled with tracing turned on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16181 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-02-01 12:39:20 +00:00
parent 99085d6771
commit 2457c453c5
1 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Haiku, Inc.
* Copyright 2005-2006, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -12,6 +12,9 @@
#include "amd.h"
#include "via.h"
#include <KernelExport.h>
#include <arch_system_info.h>
//#define TRACE_MTRR
#ifdef TRACE_MTRR
@ -44,12 +47,12 @@ uint32
generic_count_mtrrs(void)
{
cpuid_info cpuInfo;
if (get_cpuid(&cpuInfo, 1, 0) != B_OK
if (get_current_cpuid(&cpuInfo, 1) != B_OK
|| (cpuInfo.eax_1.features & IA32_FEATURE_MTRR) == 0)
return 0;
mtrr_capabilities capabilities(x86_read_msr(IA32_MSR_MTRR_CAPABILITIES));
TRACE(("cpu has %ld variable range MTRs.\n", capabilities.variable_ranges));
TRACE(("CPU has %u variable range MTRs.\n", (uint8)capabilities.variable_ranges));
return capabilities.variable_ranges;
}
@ -60,6 +63,7 @@ generic_init_mtrrs(uint32 count)
// disable and clear all MTRRs
// (we leave the fixed MTRRs as is)
// TODO: check if the fixed MTRRs are set on all CPUs identically?
TRACE(("generic_init_mtrrs(count = %ld)\n", count));
x86_write_msr(IA32_MSR_MTRR_DEFAULT_TYPE,
x86_read_msr(IA32_MSR_MTRR_DEFAULT_TYPE) & ~IA32_MTRR_ENABLE);