conf.c revision 119482
138465Smsmith/*-
238465Smsmith * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
338465Smsmith * All rights reserved.
438465Smsmith *
538465Smsmith * Redistribution and use in source and binary forms, with or without
638465Smsmith * modification, are permitted provided that the following conditions
738465Smsmith * are met:
838465Smsmith * 1. Redistributions of source code must retain the above copyright
938465Smsmith *    notice, this list of conditions and the following disclaimer.
1038465Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1138465Smsmith *    notice, this list of conditions and the following disclaimer in the
1238465Smsmith *    documentation and/or other materials provided with the distribution.
1338465Smsmith *
1438465Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1538465Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1638465Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1738465Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1838465Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1938465Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2038465Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2138465Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2238465Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2338465Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2438465Smsmith * SUCH DAMAGE.
2538465Smsmith */
2638465Smsmith
27119482Sobrien#include <sys/cdefs.h>
28119482Sobrien__FBSDID("$FreeBSD: head/sys/boot/i386/loader/conf.c 119482 2003-08-25 23:28:32Z obrien $");
29119482Sobrien
3038465Smsmith#include <stand.h>
3138465Smsmith#include <bootstrap.h>
3238465Smsmith#include "libi386/libi386.h"
3338465Smsmith
3438465Smsmith/*
3538465Smsmith * We could use linker sets for some or all of these, but
3638465Smsmith * then we would have to control what ended up linked into
3738465Smsmith * the bootstrap.  So it's easier to conditionalise things
3838465Smsmith * here.
3938465Smsmith *
4038465Smsmith * XXX rename these arrays to be consistent and less namespace-hostile
4138465Smsmith *
4238465Smsmith * XXX as libi386 and biosboot merge, some of these can become linker sets.
4338465Smsmith */
4438465Smsmith
4559087Sps#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT)
4659087Sps#error "Cannot have both tftp and nfs support yet."
4759087Sps#endif
4859087Sps
4938465Smsmith/* Exported for libstand */
5038465Smsmithstruct devsw *devsw[] = {
5186093Sjhb    &bioscd,
5239450Smsmith    &biosdisk,
5359087Sps#if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT)
5458713Sjhb    &pxedisk,
5559087Sps#endif
5638465Smsmith    NULL
5738465Smsmith};
5838465Smsmith
5938465Smsmithstruct fs_ops *file_system[] = {
6038465Smsmith    &ufs_fsops,
6159767Sjlemon    &ext2fs_fsops,
6238465Smsmith    &dosfs_fsops,
6386093Sjhb    &cd9660_fsops,
6492494Ssobomax    &splitfs_fsops,
6583616Ssobomax#ifdef LOADER_GZIP_SUPPORT
66108100Sjake    &gzipfs_fsops,
6783616Ssobomax#endif
6883616Ssobomax#ifdef LOADER_BZIP2_SUPPORT
6983616Ssobomax    &bzipfs_fsops,
7083616Ssobomax#endif
7159087Sps#ifdef LOADER_NFS_SUPPORT
7259087Sps    &nfs_fsops,
7359087Sps#endif
7459087Sps#ifdef LOADER_TFTP_SUPPORT
7559087Sps    &tftp_fsops,
7659087Sps#endif
7738465Smsmith    NULL
7838465Smsmith};
7938465Smsmith
8038465Smsmith/* Exported for i386 only */
8138465Smsmith/*
8238465Smsmith * Sort formats so that those that can detect based on arguments
8338465Smsmith * rather than reading the file go first.
8438465Smsmith */
8559854Sbpextern struct file_format	i386_elf;
86114379Speterextern struct file_format	amd64_elf;
8738465Smsmith
8859854Sbpstruct file_format *file_formats[] = {
8939834Speter    &i386_elf,
90114379Speter    &amd64_elf,
9138465Smsmith    NULL
9238465Smsmith};
9338465Smsmith
9438465Smsmith/*
9538465Smsmith * Consoles
9638465Smsmith *
9738465Smsmith * We don't prototype these in libi386.h because they require
9838465Smsmith * data structures from bootstrap.h as well.
9938465Smsmith */
10038465Smsmithextern struct console vidconsole;
10138465Smsmithextern struct console comconsole;
10266133Sarchieextern struct console nullconsole;
10338465Smsmith
10438465Smsmithstruct console *consoles[] = {
10538465Smsmith    &vidconsole,
10638465Smsmith    &comconsole,
10766133Sarchie    &nullconsole,
10838465Smsmith    NULL
10938465Smsmith};
11039178Smsmith
11139178Smsmithextern struct pnphandler isapnphandler;
11240600Smsmithextern struct pnphandler biospnphandler;
11340618Smsmithextern struct pnphandler biospcihandler;
11439178Smsmith
11539178Smsmithstruct pnphandler *pnphandlers[] = {
11640600Smsmith    &biospnphandler,		/* should go first, as it may set isapnp_readport */
11740555Smsmith    &isapnphandler,
11840618Smsmith    &biospcihandler,
11939178Smsmith    NULL
12039178Smsmith};
121