1 /* $NetBSD: autoconf.c,v 1.2 2013/06/20 13:40:09 kiyohara Exp $ */
2 /*
3 * Copyright (c) 2013 KIYOHARA Takashi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #include <sys/cdefs.h>
29 __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2013/06/20 13:40:09 kiyohara Exp $");
30
31 #include <sys/systm.h>
32 #include <sys/types.h>
33 #include <sys/conf.h>
34 #include <sys/device.h>
35
36
37 void
cpu_configure(void)38 cpu_configure(void)
39 {
40
41 splhigh();
42 splserial();
43
44 if (config_rootfound("mainbus", NULL) == NULL)
45 panic("configure: mainbus not configured");
46
47 /* Time to start taking interrupts so lets open the flood gates .... */
48 (void)spl0();
49 }
50
51 void
cpu_rootconf(void)52 cpu_rootconf(void)
53 {
54
55 aprint_normal("boot device: %s\n",
56 booted_device ? device_xname(booted_device) : "<unknown>");
57
58 setroot(booted_device, booted_partition);
59 }
60
61 void
device_register(device_t dev,void * aux)62 device_register(device_t dev, void *aux)
63 {
64
65 if (device_is_a(dev, "clpslcd") ||
66 device_is_a(dev, "wmlcd")) {
67 extern int epoc32_fb_width, epoc32_fb_height, epoc32_fb_addr;
68 prop_dictionary_t dict = device_properties(dev);
69
70 prop_dictionary_set_uint32(dict, "width", epoc32_fb_width);
71 prop_dictionary_set_uint32(dict, "height", epoc32_fb_height);
72 prop_dictionary_set_uint32(dict, "addr", epoc32_fb_addr);
73 }
74
75 if (booted_device == NULL)
76 if (device_is_a(dev, "wd"))
77 booted_device = dev;
78 }
79