Annotation of prex-old/dev/core/main.c, Revision 1.2
1.1 nbrk 1: /*-
2: * Copyright (c) 2005-2007, Kohsuke Ohtani
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. Neither the name of the author nor the names of any co-contributors
14: * may be used to endorse or promote products derived from this software
15: * without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: */
29:
30: /*
31: * main.c - driver main routine
32: */
33:
34: #include <driver.h>
35: #include <machdep.h>
36:
37: #define MAXDRIVER 100
38:
1.2 ! nbrk 39: #ifndef CONFIG_AUTOCONF
1.1 nbrk 40: extern struct driver *driver_table[];
1.2 ! nbrk 41: #endif
1.1 nbrk 42:
43: /*
44: * Entry point of driver module
45: */
46: void
47: driver_main(void)
48: {
49: struct driver *drv;
50: int order, i, err;
51:
52: printk("Prex driver module built: " __DATE__ "\n");
53:
54: /*
55: * Initialize platform hardware.
56: */
57: if (machine_init())
58: panic("driver_main: init failed");
59:
1.2 ! nbrk 60: #ifndef CONFIG_AUTOCONF
1.1 nbrk 61: /*
62: * Call init routine for all device drivers with init order.
63: * Smaller value will be run first.
64: */
65: for (order = 0; order < 16; order++) {
66: for (i = 0; i < MAXDRIVER; i++) {
67: drv = driver_table[i];
68: if (drv == NULL)
69: break;
70: ASSERT(drv->order < 16);
71: if (drv->order == order) {
72: if (drv->init) {
73: printk("Initializing %s\n", drv->name);
74: err = drv->init();
75: }
76: }
77: }
78: }
1.2 ! nbrk 79: #else
! 80: /*
! 81: * Enter autoconfiguration machinery.
! 82: * Attach 'root' pseudo device, which will then search for its children.
! 83: */
! 84: printk("Entering autoconfiguration phase.\n");
! 85:
! 86: config_attach_rootdev();
! 87:
! 88: printk("Exiting autoconfiguration phase.\n");
! 89:
! 90: #endif /* !CONFIG_AUTOCONF */
! 91:
1.1 nbrk 92: }
CVSweb