Fix MTRR code which had been broken since the MP merge (but silently

failed due to a missing include of opt_mtrr.h in cpu.c)
This commit is contained in:
fvdl 2002-10-25 12:01:56 +00:00
parent 526dd035ea
commit fe9d9a8b25
4 changed files with 17 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.4 2002/10/05 21:18:44 fvdl Exp $ */
/* $NetBSD: cpu.c,v 1.5 2002/10/25 12:01:56 fvdl Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -73,6 +73,7 @@
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
#include "opt_mpbios.h" /* for MPDEBUG */
#include "opt_mtrr.h"
#include "lapic.h"
#include "ioapic.h"
@ -419,10 +420,10 @@ cpu_init(ci)
/*
* Must be a K6-2 Step >= 7 or a K6-III.
*/
if (CPUID2FAMILY(cpu_id) == 5) {
if (CPUID2MODEL(cpu_id) > 8 ||
(CPUID2MODEL(cpu_id) == 8 &&
CPUID2STEPPING(cpu_id) >= 7)) {
if (CPUID2FAMILY(ci->ci_signature) == 5) {
if (CPUID2MODEL(ci->ci_signature) > 8 ||
(CPUID2MODEL(ci->ci_signature) == 8 &&
CPUID2STEPPING(ci->ci_signature) >= 7)) {
mtrr_funcs = &k6_mtrr_funcs;
k6_mtrr_init_first();
mtrr_init_cpu(ci);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.494 2002/10/24 07:43:21 fvdl Exp $ */
/* $NetBSD: machdep.c,v 1.495 2002/10/25 12:01:56 fvdl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.494 2002/10/24 07:43:21 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.495 2002/10/25 12:01:56 fvdl Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@ -227,10 +227,6 @@ int i386_has_sse2;
int tmx86_has_longrun;
#define CPUID2FAMILY(cpuid) (((cpuid) >> 8) & 15)
#define CPUID2MODEL(cpuid) (((cpuid) >> 4) & 15)
#define CPUID2STEPPING(cpuid) ((cpuid) & 15)
vaddr_t msgbuf_vaddr;
paddr_t msgbuf_paddr;
@ -478,29 +474,6 @@ cpu_startup()
printf("%s", version);
#if 0
#ifdef MTRR
if (cpu_feature & CPUID_MTRR) {
mtrr_funcs = &i686_mtrr_funcs;
i686_mtrr_init_first();
mtrr_init_cpu(ci);
} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
/*
* Must be a K6-2 Step >= 7 or a K6-III.
*/
if (CPUID2FAMILY(cpu_id) == 5) {
if (CPUID2MODEL(cpu_id) > 8 ||
(CPUID2MODEL(cpu_id) == 8 &&
CPUID2STEPPING(cpu_id) >= 7)) {
mtrr_funcs = &k6_mtrr_funcs;
k6_mtrr_init_first();
mtrr_init_cpu(ci);
}
}
}
#endif
#endif
#ifdef TRAPLOG
/*
* Enable recording of branch from/to in MSR's

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtrr_i686.c,v 1.5 2002/10/01 12:56:58 fvdl Exp $ */
/* $NetBSD: mtrr_i686.c,v 1.6 2002/10/25 12:01:57 fvdl Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.5 2002/10/01 12:56:58 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: mtrr_i686.c,v 1.6 2002/10/25 12:01:57 fvdl Exp $");
#include "opt_multiprocessor.h"
@ -314,6 +314,7 @@ i686_mtrr_init_first(void)
mtrr_var_raw = &mtrr_raw[0];
mtrr_fixed_raw = &mtrr_raw[MTRR_I686_NVAR * 2];
mtrr_funcs = &i686_mtrr_funcs;
i686_raw2soft();
}
@ -707,5 +708,8 @@ static void
i686_mtrr_commit(void)
{
i686_soft2raw();
#ifdef MULTIPROCESSOR
i386_broadcast_ipi(I386_IPI_MTRR);
#endif
i686_mtrr_reload(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtrr_k6.c,v 1.4 2002/10/01 12:56:58 fvdl Exp $ */
/* $NetBSD: mtrr_k6.c,v 1.5 2002/10/25 12:01:57 fvdl Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.4 2002/10/01 12:56:58 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.5 2002/10/25 12:01:57 fvdl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -152,6 +152,7 @@ k6_mtrr_init_first(void)
malloc(MTRR_K6_NVAR * sizeof(struct mtrr), M_TEMP, M_NOWAIT);
if (mtrr_var == NULL)
panic("can't allocate variable MTRR array");
mtrr_funcs = &k6_mtrr_funcs;
k6_raw2soft();
}