cpu.c revision 1.2
11.2Snisimura/* $NetBSD: cpu.c,v 1.2 2001/06/27 08:20:44 nisimura Exp $ */ 21.1Swdk 31.1Swdk/* 41.1Swdk * Copyright (c) 1994, 1995 Carnegie-Mellon University. 51.1Swdk * All rights reserved. 61.1Swdk * 71.1Swdk * Author: Chris G. Demetriou 81.1Swdk * 91.1Swdk * Permission to use, copy, modify and distribute this software and 101.1Swdk * its documentation is hereby granted, provided that both the copyright 111.1Swdk * notice and this permission notice appear in all copies of the 121.1Swdk * software, derivative works or modified versions, and any portions 131.1Swdk * thereof, and that both notices appear in supporting documentation. 141.1Swdk * 151.1Swdk * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 161.1Swdk * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 171.1Swdk * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 181.1Swdk * 191.1Swdk * Carnegie Mellon requests users of this software to return to 201.1Swdk * 211.1Swdk * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 221.1Swdk * School of Computer Science 231.1Swdk * Carnegie Mellon University 241.1Swdk * Pittsburgh PA 15213-3890 251.1Swdk * 261.1Swdk * any improvements or extensions that they make and grant Carnegie the 271.1Swdk * rights to redistribute these changes. 281.1Swdk */ 291.1Swdk 301.1Swdk#include <sys/param.h> 311.1Swdk#include <sys/device.h> 321.1Swdk#include <sys/systm.h> 331.1Swdk 341.1Swdk#include <machine/cpu.h> 351.1Swdk#include <machine/autoconf.h> 361.1Swdk 371.2Snisimura#include <mips/locore.h> 381.2Snisimura 391.1Swdk/* Definition of the driver for autoconfig. */ 401.1Swdkstatic int cpumatch(struct device *, struct cfdata *, void *); 411.1Swdkstatic void cpuattach(struct device *, struct device *, void *); 421.1Swdk 431.1Swdkstruct cfattach cpu_ca = { 441.1Swdk sizeof(struct device), cpumatch, cpuattach 451.1Swdk}; 461.1Swdk 471.1Swdkextern struct cfdriver cpu_cd; 481.1Swdk 491.1Swdkextern void cpu_identify __P((void)); 501.1Swdk 511.1Swdkstatic int 521.1Swdkcpumatch(parent, cfdata, aux) 531.1Swdk struct device *parent; 541.1Swdk struct cfdata *cfdata; 551.1Swdk void *aux; 561.1Swdk{ 571.1Swdk struct confargs *ca = aux; 581.1Swdk 591.1Swdk /* make sure that we're looking for a CPU. */ 601.1Swdk if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) { 611.1Swdk return 0; 621.1Swdk } 631.1Swdk return 1; 641.1Swdk} 651.1Swdk 661.1Swdkstatic void 671.1Swdkcpuattach(parent, dev, aux) 681.1Swdk struct device *parent; 691.1Swdk struct device *dev; 701.1Swdk void *aux; 711.1Swdk{ 721.2Snisimura char *cpu_name, *fpu_name; 731.1Swdk 741.2Snisimura printf("\n"); 751.2Snisimura switch (MIPS_PRID_IMPL(cpu_id)) { 761.2Snisimura case MIPS_R2000: 771.2Snisimura cpu_name = "MIPS R2000 CPU"; 781.2Snisimura break; 791.2Snisimura case MIPS_R3000: 801.2Snisimura cpu_name = "MIPS R3000 CPU"; 811.2Snisimura break; 821.2Snisimura default: 831.2Snisimura cpu_name = "Unknown CPU"; 841.2Snisimura } 851.1Swdk 861.2Snisimura switch (MIPS_PRID_IMPL(fpu_id)) { 871.2Snisimura case MIPS_R2360: 881.2Snisimura fpu_name = "MIPS R2360 Floating Point Board"; 891.2Snisimura break; 901.2Snisimura case MIPS_R2010: 911.2Snisimura fpu_name = "MIPS R2010 FPA"; 921.2Snisimura break; 931.2Snisimura case MIPS_R3010: 941.2Snisimura fpu_name = "MIPS R3010 FPA"; 951.2Snisimura break; 961.2Snisimura default: 971.2Snisimura fpu_name = "unknown FPA"; 981.2Snisimura break; 991.2Snisimura } 1001.2Snisimura printf("%s: %s (0x%04x) with %s (0x%04x)\n", 1011.2Snisimura dev->dv_xname, cpu_name, cpu_id, fpu_name, fpu_id); 1021.2Snisimura printf("%s: ", dev->dv_xname); 1031.2Snisimura printf("%dKB Instruction, %dKB Data, direct mapped cache\n", 1041.2Snisimura mips_L1ICacheSize/1024, mips_L1DCacheSize/1024); 1051.1Swdk} 106