11.12Sriastrad/*	$NetBSD: cpu.c,v 1.12 2022/03/03 06:27:03 riastradh 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.6Slukem
301.6Slukem#include <sys/cdefs.h>
311.12Sriastrad__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.12 2022/03/03 06:27:03 riastradh Exp $");
321.1Swdk
331.1Swdk#include <sys/param.h>
341.1Swdk#include <sys/device.h>
351.10Smatt#include <sys/cpu.h>
361.1Swdk#include <sys/systm.h>
371.1Swdk
381.1Swdk#include <machine/autoconf.h>
391.1Swdk
401.2Snisimura#include <mips/locore.h>
411.2Snisimura
421.1Swdk/* Definition of the driver for autoconfig. */
431.10Smattstatic int	cpumatch(device_t, cfdata_t, void *);
441.10Smattstatic void	cpuattach(device_t, device_t, void *);
451.1Swdk
461.11SchsCFATTACH_DECL_NEW(cpu, 0,
471.5Sthorpej    cpumatch, cpuattach, NULL, NULL);
481.1Swdk
491.1Swdkextern struct cfdriver cpu_cd;
501.1Swdk
511.1Swdkstatic int
521.10Smattcpumatch(device_t parent, cfdata_t cfdata, void *aux)
531.1Swdk{
541.1Swdk	struct confargs *ca = aux;
551.1Swdk
561.1Swdk	/* make sure that we're looking for a CPU. */
571.1Swdk	if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) {
581.1Swdk		return 0;
591.1Swdk	}
601.1Swdk	return 1;
611.1Swdk}
621.1Swdk
631.1Swdkstatic void
641.10Smattcpuattach(device_t parent, device_t self, void *aux)
651.1Swdk{
661.10Smatt	struct cpu_info * const ci = curcpu();
671.10Smatt
681.10Smatt	ci->ci_dev = self;
691.12Sriastrad	device_set_private(self, ci);
701.1Swdk
711.10Smatt	aprint_normal(": ");
721.10Smatt	cpu_identify(self);
731.1Swdk}
74