Home | History | Annotate | Line # | Download | only in obs405
obs200_autoconf.c revision 1.2.12.1
      1  1.2.12.1   tron /*	$NetBSD: obs200_autoconf.c,v 1.2.12.1 2006/05/24 15:47:55 tron Exp $	*/
      2       1.1  shige 
      3       1.1  shige /*
      4       1.1  shige  * Copyright 2004 Shigeyuki Fukushima.
      5       1.1  shige  * All rights reserved.
      6       1.1  shige  *
      7       1.1  shige  * Written by Shigeyuki Fukushima for The NetBSD Project.
      8       1.1  shige  *
      9       1.1  shige  * Redistribution and use in source and binary forms, with or without
     10       1.1  shige  * modification, are permitted provided that the following conditions
     11       1.1  shige  * are met:
     12       1.1  shige  * 1. Redistributions of source code must retain the above copyright
     13       1.1  shige  *    notice, this list of conditions and the following disclaimer.
     14       1.1  shige  * 2. Redistributions in binary form must reproduce the above
     15       1.1  shige  *    copyright notice, this list of conditions and the following
     16       1.1  shige  *    disclaimer in the documentation and/or other materials provided
     17       1.1  shige  *    with the distribution.
     18       1.1  shige  * 3. The name of the author may not be used to endorse or promote
     19       1.1  shige  *    products derived from this software without specific prior
     20       1.1  shige  *    written permission.
     21       1.1  shige  *
     22       1.1  shige  * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23       1.1  shige  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     24       1.1  shige  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     25       1.1  shige  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
     26       1.1  shige  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27       1.1  shige  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
     28       1.1  shige  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     29       1.1  shige  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     30       1.1  shige  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31       1.1  shige  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
     32       1.1  shige  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
     33       1.1  shige  * DAMAGE.
     34       1.1  shige  */
     35       1.1  shige #include <sys/cdefs.h>
     36  1.2.12.1   tron __KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.2.12.1 2006/05/24 15:47:55 tron Exp $");
     37       1.1  shige 
     38       1.1  shige #include <sys/systm.h>
     39       1.1  shige #include <sys/device.h>
     40       1.1  shige 
     41       1.1  shige #include <machine/obs200.h>
     42       1.1  shige 
     43  1.2.12.1   tron #include <powerpc/ibm4xx/dcr405gp.h>
     44  1.2.12.1   tron 
     45  1.2.12.1   tron 
     46  1.2.12.1   tron /*
     47  1.2.12.1   tron  * Determine device configuration for a machine.
     48  1.2.12.1   tron  */
     49  1.2.12.1   tron void
     50  1.2.12.1   tron cpu_configure(void)
     51  1.2.12.1   tron {
     52  1.2.12.1   tron 
     53  1.2.12.1   tron 	intr_init();
     54  1.2.12.1   tron 	calc_delayconst();
     55  1.2.12.1   tron 
     56  1.2.12.1   tron 	/* Make sure that timers run at CPU frequency */
     57  1.2.12.1   tron 	mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
     58  1.2.12.1   tron 
     59  1.2.12.1   tron 	if (config_rootfound("plb", NULL) == NULL)
     60  1.2.12.1   tron 		panic("configure: mainbus not configured");
     61  1.2.12.1   tron 
     62  1.2.12.1   tron 	printf("biomask %x netmask %x ttymask %x\n", (u_short)imask[IPL_BIO],
     63  1.2.12.1   tron 		(u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]);
     64  1.2.12.1   tron 
     65  1.2.12.1   tron 	(void)spl0();
     66  1.2.12.1   tron 
     67  1.2.12.1   tron 	/*
     68  1.2.12.1   tron 	 * Now allow hardware interrupts.
     69  1.2.12.1   tron 	 */
     70  1.2.12.1   tron 	__asm volatile ("wrteei 1");
     71  1.2.12.1   tron }
     72  1.2.12.1   tron 
     73       1.1  shige void device_register(struct device *dev, void *aux)
     74       1.1  shige {
     75       1.1  shige 
     76       1.1  shige 	obs405_device_register(dev, aux, OBS200_COM_FREQ);
     77       1.1  shige }
     78