xref: /freebsd-src/stand/i386/loader/conf.c (revision 10c429016a3c5adf2e04cfd1ac97eb24c0e7074c)
1ca987d46SWarner Losh /*-
2ca987d46SWarner Losh  * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3ca987d46SWarner Losh  * All rights reserved.
4ca987d46SWarner Losh  *
5ca987d46SWarner Losh  * Redistribution and use in source and binary forms, with or without
6ca987d46SWarner Losh  * modification, are permitted provided that the following conditions
7ca987d46SWarner Losh  * are met:
8ca987d46SWarner Losh  * 1. Redistributions of source code must retain the above copyright
9ca987d46SWarner Losh  *    notice, this list of conditions and the following disclaimer.
10ca987d46SWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
11ca987d46SWarner Losh  *    notice, this list of conditions and the following disclaimer in the
12ca987d46SWarner Losh  *    documentation and/or other materials provided with the distribution.
13ca987d46SWarner Losh  *
14ca987d46SWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15ca987d46SWarner Losh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16ca987d46SWarner Losh  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17ca987d46SWarner Losh  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18ca987d46SWarner Losh  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19ca987d46SWarner Losh  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20ca987d46SWarner Losh  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21ca987d46SWarner Losh  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22ca987d46SWarner Losh  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23ca987d46SWarner Losh  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24ca987d46SWarner Losh  * SUCH DAMAGE.
25ca987d46SWarner Losh  */
26ca987d46SWarner Losh 
27ca987d46SWarner Losh #include <stand.h>
28ca987d46SWarner Losh #include <bootstrap.h>
29ca987d46SWarner Losh #include "libi386/libi386.h"
30ca987d46SWarner Losh #if defined(LOADER_ZFS_SUPPORT)
31007b82d7SWarner Losh #include "libzfs.h"
32ca987d46SWarner Losh #endif
33ca987d46SWarner Losh 
34ca987d46SWarner Losh /*
35ca987d46SWarner Losh  * We could use linker sets for some or all of these, but
36ca987d46SWarner Losh  * then we would have to control what ended up linked into
37ca987d46SWarner Losh  * the bootstrap.  So it's easier to conditionalise things
38ca987d46SWarner Losh  * here.
39ca987d46SWarner Losh  *
40ca987d46SWarner Losh  * XXX rename these arrays to be consistent and less namespace-hostile
41ca987d46SWarner Losh  *
42ca987d46SWarner Losh  * XXX as libi386 and biosboot merge, some of these can become linker sets.
43ca987d46SWarner Losh  */
44ca987d46SWarner Losh 
454914ee11SToomas Soome extern struct devsw vdisk_dev;
46ca987d46SWarner Losh 
47bd001d86SWarner Losh /* Exported for libsa */
48ca987d46SWarner Losh struct devsw *devsw[] = {
49cdff1036SToomas Soome     &biosfd,
50ca987d46SWarner Losh     &bioscd,
51cdff1036SToomas Soome     &bioshd,
52ca987d46SWarner Losh #if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT)
53ca987d46SWarner Losh     &pxedisk,
54ca987d46SWarner Losh #endif
554914ee11SToomas Soome     &vdisk_dev,
56ca987d46SWarner Losh #if defined(LOADER_ZFS_SUPPORT)
57ca987d46SWarner Losh     &zfs_dev,
58ca987d46SWarner Losh #endif
59ca987d46SWarner Losh     NULL
60ca987d46SWarner Losh };
61ca987d46SWarner Losh 
62ca987d46SWarner Losh struct fs_ops *file_system[] = {
63ca987d46SWarner Losh #if defined(LOADER_ZFS_SUPPORT)
64ca987d46SWarner Losh     &zfs_fsops,
65ca987d46SWarner Losh #endif
668f46043bSWarner Losh #if defined(LOADER_UFS_SUPPORT)
67ca987d46SWarner Losh     &ufs_fsops,
688f46043bSWarner Losh #endif
698f46043bSWarner Losh #if defined(LOADER_EXT2FS_SUPPORT)
70ca987d46SWarner Losh     &ext2fs_fsops,
718f46043bSWarner Losh #endif
728f46043bSWarner Losh #if defined(LOADER_MSDOS_SUPPORT)
73ca987d46SWarner Losh     &dosfs_fsops,
748f46043bSWarner Losh #endif
758f46043bSWarner Losh #if defined(LOADER_CD9660_SUPPORT)
76ca987d46SWarner Losh     &cd9660_fsops,
778f46043bSWarner Losh #endif
78ca987d46SWarner Losh #ifdef LOADER_NFS_SUPPORT
79ca987d46SWarner Losh     &nfs_fsops,
80ca987d46SWarner Losh #endif
81ca987d46SWarner Losh #ifdef LOADER_TFTP_SUPPORT
82ca987d46SWarner Losh     &tftp_fsops,
83ca987d46SWarner Losh #endif
84ca987d46SWarner Losh #ifdef LOADER_GZIP_SUPPORT
85ca987d46SWarner Losh     &gzipfs_fsops,
86ca987d46SWarner Losh #endif
87ca987d46SWarner Losh #ifdef LOADER_BZIP2_SUPPORT
88ca987d46SWarner Losh     &bzipfs_fsops,
89ca987d46SWarner Losh #endif
90ca987d46SWarner Losh #ifdef LOADER_SPLIT_SUPPORT
91ca987d46SWarner Losh     &splitfs_fsops,
92ca987d46SWarner Losh #endif
93ca987d46SWarner Losh     NULL
94ca987d46SWarner Losh };
95ca987d46SWarner Losh 
96ca987d46SWarner Losh /* Exported for i386 only */
97ca987d46SWarner Losh /*
98ca987d46SWarner Losh  * Sort formats so that those that can detect based on arguments
99ca987d46SWarner Losh  * rather than reading the file go first.
100ca987d46SWarner Losh  */
101ca987d46SWarner Losh extern struct file_format	i386_elf;
102ca987d46SWarner Losh extern struct file_format	i386_elf_obj;
103ca987d46SWarner Losh extern struct file_format	amd64_elf;
104ca987d46SWarner Losh extern struct file_format	amd64_elf_obj;
105ca987d46SWarner Losh extern struct file_format	multiboot;
106ca987d46SWarner Losh extern struct file_format	multiboot_obj;
107ca987d46SWarner Losh 
108ca987d46SWarner Losh struct file_format *file_formats[] = {
109ca987d46SWarner Losh 	&multiboot,
110ca987d46SWarner Losh 	&multiboot_obj,
111ca987d46SWarner Losh #ifdef LOADER_PREFER_AMD64
112ca987d46SWarner Losh     &amd64_elf,
113ca987d46SWarner Losh     &amd64_elf_obj,
114ca987d46SWarner Losh #endif
115ca987d46SWarner Losh     &i386_elf,
116ca987d46SWarner Losh     &i386_elf_obj,
117ca987d46SWarner Losh #ifndef LOADER_PREFER_AMD64
118ca987d46SWarner Losh     &amd64_elf,
119ca987d46SWarner Losh     &amd64_elf_obj,
120ca987d46SWarner Losh #endif
121ca987d46SWarner Losh     NULL
122ca987d46SWarner Losh };
123ca987d46SWarner Losh 
124ca987d46SWarner Losh /*
125ca987d46SWarner Losh  * Consoles
126ca987d46SWarner Losh  *
127ca987d46SWarner Losh  * We don't prototype these in libi386.h because they require
128ca987d46SWarner Losh  * data structures from bootstrap.h as well.
129ca987d46SWarner Losh  */
130bbfc01c2SWarner Losh extern struct console textvidc;
131ca987d46SWarner Losh extern struct console vidconsole;
132ca987d46SWarner Losh extern struct console comconsole;
133ca987d46SWarner Losh extern struct console nullconsole;
134ca987d46SWarner Losh extern struct console spinconsole;
135ca987d46SWarner Losh 
136ca987d46SWarner Losh struct console *consoles[] = {
137*10c42901SWarner Losh #ifdef BIOS_TEXT_ONLY	/* Note: We need a forced commit for this */
138bbfc01c2SWarner Losh     &textvidc,
139bbfc01c2SWarner Losh #else
140ca987d46SWarner Losh     &vidconsole,
141bbfc01c2SWarner Losh #endif
142ca987d46SWarner Losh     &comconsole,
143ca987d46SWarner Losh     &nullconsole,
144ca987d46SWarner Losh     &spinconsole,
145ca987d46SWarner Losh     NULL
146ca987d46SWarner Losh };
147ca987d46SWarner Losh 
148ca987d46SWarner Losh extern struct pnphandler isapnphandler;
149ca987d46SWarner Losh extern struct pnphandler biospnphandler;
150ca987d46SWarner Losh extern struct pnphandler biospcihandler;
151ca987d46SWarner Losh 
152ca987d46SWarner Losh struct pnphandler *pnphandlers[] = {
153ca987d46SWarner Losh     &biospnphandler,		/* should go first, as it may set isapnp_readport */
154ca987d46SWarner Losh     &isapnphandler,
155ca987d46SWarner Losh     &biospcihandler,
156ca987d46SWarner Losh     NULL
157ca987d46SWarner Losh };
158