Home | History | Annotate | Line # | Download | only in amigappc
      1 /*	$NetBSD: cpu.c,v 1.3 2011/07/18 17:51:17 dyoung Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2008,2009 Frank Wille.
      5  * All rights reserved.
      6  *
      7  * Written by Frank Wille for The NetBSD Project.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  * POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #include <sys/cdefs.h>
     32 __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.3 2011/07/18 17:51:17 dyoung Exp $");
     33 
     34 #include <sys/param.h>
     35 #include <sys/systm.h>
     36 #include <sys/device.h>
     37 #include <sys/bus.h>
     38 
     39 #include <machine/autoconf.h>
     40 #include <machine/cpu.h>
     41 
     42 #include <amiga/amiga/device.h>
     43 
     44 int cpu_match(device_t, cfdata_t, void *);
     45 void cpu_attach(device_t, device_t, void *);
     46 
     47 CFATTACH_DECL_NEW(cpu, 0,
     48     cpu_match, cpu_attach, NULL, NULL);
     49 
     50 extern struct cfdriver cpu_cd;
     51 
     52 int
     53 cpu_match(device_t parent, cfdata_t cf, void *aux)
     54 {
     55 
     56 	if (strcmp((char *)aux, cpu_cd.cd_name) != 0)
     57 		return 0;
     58 	if (amiga_realconfig == 0 || cpu_info[0].ci_dev != NULL)
     59 		return 0;
     60 	return 1;
     61 }
     62 
     63 void
     64 cpu_attach(device_t parent, device_t self, void *aux)
     65 {
     66 
     67 	if (amiga_realconfig)
     68 		(void)cpu_attach_common(self, 0);
     69 }
     70