autoconf.c revision 1.3 1 1.3 matt /* $NetBSD: autoconf.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */
2 1.1 freza
3 1.1 freza /*
4 1.1 freza * Copyright (c) 2006 Jachym Holecek
5 1.1 freza * All rights reserved.
6 1.1 freza *
7 1.1 freza * Written for DFC Design, s.r.o.
8 1.1 freza *
9 1.1 freza * Redistribution and use in source and binary forms, with or without
10 1.1 freza * modification, are permitted provided that the following conditions
11 1.1 freza * are met:
12 1.1 freza *
13 1.1 freza * 1. Redistributions of source code must retain the above copyright
14 1.1 freza * notice, this list of conditions and the following disclaimer.
15 1.1 freza *
16 1.1 freza * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 freza * notice, this list of conditions and the following disclaimer in the
18 1.1 freza * documentation and/or other materials provided with the distribution.
19 1.1 freza *
20 1.1 freza * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 freza * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 freza * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 freza * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 freza * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 freza * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 freza * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 freza * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 freza * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 freza * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 freza */
31 1.1 freza
32 1.1 freza /*
33 1.1 freza * Copyright (C) 1995, 1996 Wolfgang Solfrank.
34 1.1 freza * Copyright (C) 1995, 1996 TooLs GmbH.
35 1.1 freza * All rights reserved.
36 1.1 freza *
37 1.1 freza * Redistribution and use in source and binary forms, with or without
38 1.1 freza * modification, are permitted provided that the following conditions
39 1.1 freza * are met:
40 1.1 freza * 1. Redistributions of source code must retain the above copyright
41 1.1 freza * notice, this list of conditions and the following disclaimer.
42 1.1 freza * 2. Redistributions in binary form must reproduce the above copyright
43 1.1 freza * notice, this list of conditions and the following disclaimer in the
44 1.1 freza * documentation and/or other materials provided with the distribution.
45 1.1 freza * 3. All advertising materials mentioning features or use of this software
46 1.1 freza * must display the following acknowledgement:
47 1.1 freza * This product includes software developed by TooLs GmbH.
48 1.1 freza * 4. The name of TooLs GmbH may not be used to endorse or promote products
49 1.1 freza * derived from this software without specific prior written permission.
50 1.1 freza *
51 1.1 freza * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
52 1.1 freza * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 1.1 freza * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 1.1 freza * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 1.1 freza * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
56 1.1 freza * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
57 1.1 freza * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
58 1.1 freza * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
59 1.1 freza * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
60 1.1 freza * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 1.1 freza */
62 1.1 freza
63 1.1 freza #include <sys/cdefs.h>
64 1.3 matt __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2011/06/18 06:44:27 matt Exp $");
65 1.1 freza
66 1.1 freza #include <sys/param.h>
67 1.1 freza #include <sys/conf.h>
68 1.3 matt #include <sys/cpu.h>
69 1.3 matt #include <sys/device_if.h>
70 1.1 freza #include <sys/systm.h>
71 1.1 freza
72 1.2 kiyohara #include <powerpc/ibm4xx/spr.h>
73 1.3 matt
74 1.3 matt #include <powerpc/ibm4xx/cpu.h>
75 1.1 freza #include <powerpc/ibm4xx/dev/plbvar.h>
76 1.1 freza
77 1.1 freza
78 1.1 freza /* List of port-specific devices to attach to the processor local bus. */
79 1.1 freza static const struct plb_dev local_plb_devs [] = {
80 1.2 kiyohara { XILVIRTEX, "xcvbus" },
81 1.2 kiyohara { 0, NULL }
82 1.1 freza };
83 1.1 freza
84 1.1 freza /*
85 1.1 freza * Determine device configuration for a machine.
86 1.1 freza */
87 1.1 freza void
88 1.1 freza cpu_configure(void)
89 1.1 freza {
90 1.1 freza intr_init();
91 1.1 freza calc_delayconst();
92 1.1 freza
93 1.1 freza if (config_rootfound("plb", &local_plb_devs) == NULL)
94 1.1 freza panic("configure: plb not configured");
95 1.1 freza
96 1.1 freza (void)spl0();
97 1.1 freza
98 1.1 freza /* Now allow hardware interrupts. */
99 1.1 freza __asm volatile ("isync ; wrteei 1");
100 1.1 freza }
101 1.1 freza
102 1.1 freza /*
103 1.1 freza * Setup root device, configure swap area.
104 1.1 freza */
105 1.1 freza void
106 1.1 freza cpu_rootconf(void)
107 1.1 freza {
108 1.1 freza setroot(booted_device, booted_partition);
109 1.1 freza }
110