xref: /freebsd/stand/i386/loader/conf.c (revision 6829dae12bb055451fa467da4589c43bd03b1e64)
1 /*-
2  * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
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  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26 
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
29 
30 #include <stand.h>
31 #include <bootstrap.h>
32 #include "libi386/libi386.h"
33 #if defined(LOADER_ZFS_SUPPORT)
34 #include "libzfs.h"
35 #endif
36 
37 /*
38  * We could use linker sets for some or all of these, but
39  * then we would have to control what ended up linked into
40  * the bootstrap.  So it's easier to conditionalise things
41  * here.
42  *
43  * XXX rename these arrays to be consistent and less namespace-hostile
44  *
45  * XXX as libi386 and biosboot merge, some of these can become linker sets.
46  */
47 
48 #if defined(LOADER_FIREWIRE_SUPPORT)
49 extern struct devsw fwohci;
50 #endif
51 
52 /* Exported for libstand */
53 struct devsw *devsw[] = {
54     &biosfd,
55     &bioscd,
56     &bioshd,
57 #if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT)
58     &pxedisk,
59 #endif
60 #if defined(LOADER_FIREWIRE_SUPPORT)
61     &fwohci,
62 #endif
63 #if defined(LOADER_ZFS_SUPPORT)
64     &zfs_dev,
65 #endif
66     NULL
67 };
68 
69 struct fs_ops *file_system[] = {
70 #if defined(LOADER_ZFS_SUPPORT)
71     &zfs_fsops,
72 #endif
73 #if defined(LOADER_UFS_SUPPORT)
74     &ufs_fsops,
75 #endif
76 #if defined(LOADER_EXT2FS_SUPPORT)
77     &ext2fs_fsops,
78 #endif
79 #if defined(LOADER_MSDOS_SUPPORT)
80     &dosfs_fsops,
81 #endif
82 #if defined(LOADER_CD9660_SUPPORT)
83     &cd9660_fsops,
84 #endif
85 #if defined(LOADER_NANDFS_SUPPORT)
86     &nandfs_fsops,
87 #endif
88 #ifdef LOADER_NFS_SUPPORT
89     &nfs_fsops,
90 #endif
91 #ifdef LOADER_TFTP_SUPPORT
92     &tftp_fsops,
93 #endif
94 #ifdef LOADER_GZIP_SUPPORT
95     &gzipfs_fsops,
96 #endif
97 #ifdef LOADER_BZIP2_SUPPORT
98     &bzipfs_fsops,
99 #endif
100 #ifdef LOADER_SPLIT_SUPPORT
101     &splitfs_fsops,
102 #endif
103     NULL
104 };
105 
106 /* Exported for i386 only */
107 /*
108  * Sort formats so that those that can detect based on arguments
109  * rather than reading the file go first.
110  */
111 extern struct file_format	i386_elf;
112 extern struct file_format	i386_elf_obj;
113 extern struct file_format	amd64_elf;
114 extern struct file_format	amd64_elf_obj;
115 extern struct file_format	multiboot;
116 extern struct file_format	multiboot_obj;
117 
118 struct file_format *file_formats[] = {
119 	&multiboot,
120 	&multiboot_obj,
121 #ifdef LOADER_PREFER_AMD64
122     &amd64_elf,
123     &amd64_elf_obj,
124 #endif
125     &i386_elf,
126     &i386_elf_obj,
127 #ifndef LOADER_PREFER_AMD64
128     &amd64_elf,
129     &amd64_elf_obj,
130 #endif
131     NULL
132 };
133 
134 /*
135  * Consoles
136  *
137  * We don't prototype these in libi386.h because they require
138  * data structures from bootstrap.h as well.
139  */
140 extern struct console vidconsole;
141 extern struct console comconsole;
142 #if defined(LOADER_FIREWIRE_SUPPORT)
143 extern struct console dconsole;
144 #endif
145 extern struct console nullconsole;
146 extern struct console spinconsole;
147 
148 struct console *consoles[] = {
149     &vidconsole,
150     &comconsole,
151 #if defined(LOADER_FIREWIRE_SUPPORT)
152     &dconsole,
153 #endif
154     &nullconsole,
155     &spinconsole,
156     NULL
157 };
158 
159 extern struct pnphandler isapnphandler;
160 extern struct pnphandler biospnphandler;
161 extern struct pnphandler biospcihandler;
162 
163 struct pnphandler *pnphandlers[] = {
164     &biospnphandler,		/* should go first, as it may set isapnp_readport */
165     &isapnphandler,
166     &biospcihandler,
167     NULL
168 };
169