Lots and lots of fixes to the cpu identification code, and dealing with
L2 and L3 cache initialization. Mostly to get the L2 enabled on the pegasos, but since I had the manual, I fixed a few other things I saw while I was there.
This commit is contained in:
parent
b7d6181694
commit
07cb4134b6
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: cpu_subr.c,v 1.35 2007/11/17 08:30:35 kefren Exp $ */
|
/* $NetBSD: cpu_subr.c,v 1.36 2007/12/27 05:40:49 garbled Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2001 Matt Thomas.
|
* Copyright (c) 2001 Matt Thomas.
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.35 2007/11/17 08:30:35 kefren Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.36 2007/12/27 05:40:49 garbled Exp $");
|
||||||
|
|
||||||
#include "opt_ppcparam.h"
|
#include "opt_ppcparam.h"
|
||||||
#include "opt_multiprocessor.h"
|
#include "opt_multiprocessor.h"
|
||||||
|
@ -83,6 +83,8 @@ static const struct fmttab cpu_7450_l2cr_formats[] = {
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
||||||
{ L2CR_L2E, ~0, " 256KB L2 cache" },
|
{ L2CR_L2E, ~0, " 256KB L2 cache" },
|
||||||
|
{ L2CR_L2PE, 0, " no parity" },
|
||||||
|
{ L2CR_L2PE, ~0, " parity enabled" },
|
||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,6 +94,8 @@ static const struct fmttab cpu_7448_l2cr_formats[] = {
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
||||||
{ L2CR_L2E, ~0, " 1MB L2 cache" },
|
{ L2CR_L2E, ~0, " 1MB L2 cache" },
|
||||||
|
{ L2CR_L2PE, 0, " no parity" },
|
||||||
|
{ L2CR_L2PE, ~0, " parity enabled" },
|
||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,6 +105,8 @@ static const struct fmttab cpu_7457_l2cr_formats[] = {
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
|
||||||
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
|
||||||
{ L2CR_L2E, ~0, " 512KB L2 cache" },
|
{ L2CR_L2E, ~0, " 512KB L2 cache" },
|
||||||
|
{ L2CR_L2PE, 0, " no parity" },
|
||||||
|
{ L2CR_L2PE, ~0, " parity enabled" },
|
||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -540,14 +546,23 @@ cpu_setup(self, ci)
|
||||||
cpu_probe_speed(ci);
|
cpu_probe_speed(ci);
|
||||||
aprint_normal("%u.%02u MHz",
|
aprint_normal("%u.%02u MHz",
|
||||||
ci->ci_khz / 1000, (ci->ci_khz / 10) % 100);
|
ci->ci_khz / 1000, (ci->ci_khz / 10) % 100);
|
||||||
|
switch (vers) {
|
||||||
if (vers == IBM750FX || vers == MPC750 ||
|
case IBM750FX:
|
||||||
vers == MPC7400 || vers == MPC7410 || MPC745X_P(vers)) {
|
case MPC750:
|
||||||
if (MPC745X_P(vers)) {
|
case MPC7400:
|
||||||
|
case MPC7410:
|
||||||
cpu_config_l3cr(vers);
|
cpu_config_l3cr(vers);
|
||||||
} else {
|
break;
|
||||||
|
case MPC7450: /* 7441 does not have L3! */
|
||||||
|
case MPC7455: /* 7445 does not have L3! */
|
||||||
|
case MPC7457: /* 7447 does not have L3! */
|
||||||
|
/* do something special XXX */
|
||||||
|
case MPC7447A:
|
||||||
|
case MPC7448:
|
||||||
cpu_config_l2cr(pvr);
|
cpu_config_l2cr(pvr);
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
aprint_normal("\n");
|
aprint_normal("\n");
|
||||||
break;
|
break;
|
||||||
|
@ -612,6 +627,16 @@ cpu_setup(self, ci)
|
||||||
NULL, self->dv_xname, "IPIs");
|
NULL, self->dv_xname, "IPIs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* According to a document labeled "PVR Register Settings":
|
||||||
|
** For integrated microprocessors the PVR register inside the device
|
||||||
|
** will identify the version of the microprocessor core. You must also
|
||||||
|
** read the Device ID, PCI register 02, to identify the part and the
|
||||||
|
** Revision ID, PCI register 08, to identify the revision of the
|
||||||
|
** integrated microprocessor.
|
||||||
|
* This apparently applies to 8240/8245/8241, PVR 00810101 and 80811014
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cpu_identify(char *str, size_t len)
|
cpu_identify(char *str, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -630,9 +655,13 @@ cpu_identify(char *str, size_t len)
|
||||||
minor = (pvr >> 0) & 0xff;
|
minor = (pvr >> 0) & 0xff;
|
||||||
major = minor <= 4 ? 1 : 2;
|
major = minor <= 4 ? 1 : 2;
|
||||||
break;
|
break;
|
||||||
default:
|
case MPCG2: /*XXX see note above */
|
||||||
major = (pvr >> 4) & 0xf;
|
major = (pvr >> 4) & 0xf;
|
||||||
minor = (pvr >> 0) & 0xf;
|
minor = (pvr >> 0) & 0xf;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
major = (pvr >> 8) & 0xf;
|
||||||
|
minor = (pvr >> 0) & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cp = models; cp->name[0] != '\0'; cp++) {
|
for (cp = models; cp->name[0] != '\0'; cp++) {
|
||||||
|
@ -708,7 +737,7 @@ cpu_enable_l2cr(register_t l2cr)
|
||||||
mtspr(SPR_L2CR, l2cr | L2CR_L2I);
|
mtspr(SPR_L2CR, l2cr | L2CR_L2I);
|
||||||
do {
|
do {
|
||||||
x = mfspr(SPR_L2CR);
|
x = mfspr(SPR_L2CR);
|
||||||
} while (x & L2CR_L2IP);
|
} while (x & L2CR_L2I);
|
||||||
|
|
||||||
/* Enable L2 cache. */
|
/* Enable L2 cache. */
|
||||||
l2cr |= L2CR_L2E;
|
l2cr |= L2CR_L2E;
|
||||||
|
@ -768,6 +797,7 @@ void
|
||||||
cpu_config_l2cr(int pvr)
|
cpu_config_l2cr(int pvr)
|
||||||
{
|
{
|
||||||
register_t l2cr;
|
register_t l2cr;
|
||||||
|
u_int vers = (pvr >> 16) & 0xffff;
|
||||||
|
|
||||||
l2cr = mfspr(SPR_L2CR);
|
l2cr = mfspr(SPR_L2CR);
|
||||||
|
|
||||||
|
@ -792,14 +822,33 @@ cpu_config_l2cr(int pvr)
|
||||||
aprint_normal(" L2 cache present but not enabled ");
|
aprint_normal(" L2 cache present but not enabled ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aprint_normal(",");
|
aprint_normal(",");
|
||||||
if ((pvr >> 16) == IBM750FX ||
|
|
||||||
(pvr & 0xffffff00) == 0x00082200 /* IBM750CX */ ||
|
switch (vers) {
|
||||||
(pvr & 0xffffef00) == 0x00082300 /* IBM750CXe */) {
|
case IBM750FX:
|
||||||
cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
|
cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
|
||||||
} else {
|
break;
|
||||||
|
case MPC750:
|
||||||
|
if ((pvr & 0xffffff00) == 0x00082200 /* IBM750CX */ ||
|
||||||
|
(pvr & 0xffffef00) == 0x00082300 /* IBM750CXe */)
|
||||||
|
cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
|
||||||
|
else
|
||||||
cpu_fmttab_print(cpu_l2cr_formats, l2cr);
|
cpu_fmttab_print(cpu_l2cr_formats, l2cr);
|
||||||
|
break;
|
||||||
|
case MPC7447A:
|
||||||
|
case MPC7457:
|
||||||
|
cpu_fmttab_print(cpu_7457_l2cr_formats, l2cr);
|
||||||
|
return;
|
||||||
|
case MPC7448:
|
||||||
|
cpu_fmttab_print(cpu_7448_l2cr_formats, l2cr);
|
||||||
|
return;
|
||||||
|
case MPC7450:
|
||||||
|
case MPC7455:
|
||||||
|
cpu_fmttab_print(cpu_7450_l2cr_formats, l2cr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cpu_fmttab_print(cpu_l2cr_formats, l2cr);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue