summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-04-20 20:25:55 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-04-20 20:25:55 +0000
commit777ae4d400051c06db9ea175661e4886c0e338ae (patch)
treea2baea1175e1670e31e73f24c95491c729f8bfc3 /sys/arch
parenta7406c0d47a3b097171c7705c9eab426bfe54116 (diff)
print cpu ID (type) if available
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hppa/dev/cpu.c108
1 files changed, 55 insertions, 53 deletions
diff --git a/sys/arch/hppa/dev/cpu.c b/sys/arch/hppa/dev/cpu.c
index 59898347889..b04fe71a018 100644
--- a/sys/arch/hppa/dev/cpu.c
+++ b/sys/arch/hppa/dev/cpu.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: cpu.c,v 1.2 1999/02/17 03:19:07 mickey Exp $ */
+/* $OpenBSD: cpu.c,v 1.3 1999/04/20 20:25:54 mickey Exp $ */
/*
- * Copyright (c) 1998 Michael Shalayeff
+ * Copyright (c) 1998,1999 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -69,8 +69,10 @@ cpumatch(parent, cfdata, aux)
struct cfdata *cf = cfdata;
/* there will be only one for now XXX */
+ /* probe any 1.0, 1.1 or 2.0 */
if (cf->cf_unit > 0 ||
- ca->ca_type.iodc_type != HPPA_TYPE_CPU)
+ ca->ca_type.iodc_type != HPPA_TYPE_NPROC ||
+ ca->ca_type.iodc_sv_model != HPPA_NPROC_HPPA)
return 0;
return 1;
@@ -82,66 +84,66 @@ cpuattach(parent, self, aux)
struct device *self;
void *aux;
{
+ /* machdep.c */
+ extern struct pdc_cache pdc_cache;
+ extern struct pdc_btlb pdc_btlb;
extern u_int cpu_ticksnum, cpu_ticksdenom;
+
+ struct pdc_model pdc_model PDC_ALIGNMENT;
+ struct pdc_cpuid pdc_cpuid PDC_ALIGNMENT;
/* register struct cpu_softc *sc = (struct cpu_softc *)self; */
- register struct confargs *ca = aux;
- struct pdc_cache pdc_cache PDC_ALIGNMENT;
- struct pdc_btlb pdc_btlb PDC_ALIGNMENT;
+ /* register struct confargs *ca = aux; */
u_int mhz;
- int pdcerr;
- char *p;
-
- /* this is finally from "HP-UX Multiprocessing rev 1.3" paper
- * identifying PA revisions! */
- switch (ca->ca_type.iodc_sv_model) {
- case 0: p = "1.0"; break;
- case 4: p = "1.1"; break;
- case 8: p = "2.0"; break;
- default: p = "?.?"; break;
+ int err;
+
+ printf (": ");
+ if (pdc_call((iodcio_t)pdc, 0, PDC_MODEL, PDC_MODEL_CPUID,
+ &pdc_cpuid, 0, 0, 0, 0) >= 0) {
+ const char *p = hppa_mod_info(HPPA_TYPE_CPU,pdc_cpuid.version);
+ if (!p)
+ p = "pa-risc ??";
+ printf (": %s rev %d.%d",
+ p, pdc_cpuid.revision >> 4, pdc_cpuid.revision & 0xf);
}
- mhz = 100 * cpu_ticksnum / cpu_ticksdenom;
- printf(": PA%s %d", mhz / 100);
- if (mhz % 100 > 9)
- printf(".%02d", mhz % 100);
-
- printf(" MHz clock\n%s: ", self->dv_xname);
-
- /*
- * get cache parameters from the PDC
- */
- if ((pdcerr = pdc_call((iodcio_t)pdc, 0, PDC_CACHE, PDC_CACHE_DFLT,
- &pdc_cache)) < 0) {
+ if ((err = pdc_call((iodcio_t)pdc, 0, PDC_MODEL, PDC_MODEL_INFO,
+ &pdc_model)) < 0) {
#ifdef DEBUG
- printf("Warning: PDC_CACHE call Ret'd %d\n", pdcerr);
+ printf("WARNING: PDC_MODEL failed (%d)\n", err);
#endif
} else {
- if (pdc_cache.dc_conf.cc_sh)
- printf("%uK cache", pdc_cache.dc_size / 1024);
- else
- printf("%uK/%uK D/I caches",
- pdc_cache.dc_size / 1024,
- pdc_cache.ic_size / 1024);
- if (pdc_cache.dt_conf.tc_sh)
- printf(", %u shared TLB", pdc_cache.dt_size);
- else
- printf(", %u/%u D/I TLBs",
- pdc_cache.dt_size, pdc_cache.it_size);
+ static const char lvls[4][4] = { "0", "1", "1.5", "2" };
+
+ printf("level %s, category %c, ",
+ lvls[pdc_model.pa_lvl], "AB"[pdc_model.mc]);
}
- if ((pdcerr = pdc_call((iodcio_t)pdc, 0, PDC_BLOCK_TLB,
- PDC_BTLB_DEFAULT, &pdc_btlb)) < 0) {
-#ifdef DEBUG
- printf("Warning: PDC_BTLB call Ret'd %d\n", pdcerr);
-#endif
- } else {
- if (pdc_btlb.finfo.num_c)
- printf(", %u shared BTLB", pdc_btlb.finfo.num_c);
- else {
- printf(", %u/%u D/I BTLBs",
- pdc_btlb.finfo.num_i,
- pdc_btlb.finfo.num_d);
- }
+ mhz = 100 * cpu_ticksnum / cpu_ticksdenom;
+ printf ("%d", mhz / 100);
+ if (mhz % 100 > 9)
+ printf(".%02d", mhz % 100);
+
+ printf(" MHz clock\n%s: %s", self->dv_xname,
+ pdc_model.sh? "shadows, ": "");
+
+ if (pdc_cache.dc_conf.cc_sh)
+ printf("%uK cache", pdc_cache.dc_size / 1024);
+ else
+ printf("%uK/%uK D/I caches",
+ pdc_cache.dc_size / 1024,
+ pdc_cache.ic_size / 1024);
+ if (pdc_cache.dt_conf.tc_sh)
+ printf(", %u shared TLB", pdc_cache.dt_size);
+ else
+ printf(", %u/%u D/I TLBs",
+ pdc_cache.dt_size, pdc_cache.it_size);
+
+ if (pdc_btlb.finfo.num_c)
+ printf(", %u shared BTLB", pdc_btlb.finfo.num_c);
+ else {
+ printf(", %u/%u D/I BTLBs",
+ pdc_btlb.finfo.num_i,
+ pdc_btlb.finfo.num_d);
}
printf("\n");