143014Swollman/*-
22742Swollman * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
32742Swollman * All rights reserved.
42742Swollman *
52742Swollman * Redistribution and use in source and binary forms, with or without
62742Swollman * modification, are permitted provided that the following conditions
72742Swollman * are met:
82742Swollman * 1. Redistributions of source code must retain the above copyright
92742Swollman *    notice, this list of conditions and the following disclaimer.
102742Swollman * 2. Redistributions in binary form must reproduce the above copyright
112742Swollman *    notice, this list of conditions and the following disclaimer in the
122742Swollman *    documentation and/or other materials provided with the distribution.
132742Swollman *
142742Swollman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
152742Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
162742Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
172742Swollman * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
182742Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
192742Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
202742Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
212742Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
222742Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
239908Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
242742Swollman * SUCH DAMAGE.
2530711Swollman */
262742Swollman
272742Swollman#include <sys/cdefs.h>
289908Swollman__FBSDID("$FreeBSD: releng/11.0/sys/boot/i386/loader/conf.c 277215 2015-01-15 16:27:20Z royger $");
292742Swollman
302742Swollman#include <stand.h>
3114343Swollman#include <bootstrap.h>
3214343Swollman#include "libi386/libi386.h"
3314343Swollman#if defined(LOADER_ZFS_SUPPORT)
3414343Swollman#include "../zfs/libzfs.h"
3514343Swollman#endif
3614343Swollman
372742Swollman/*
389908Swollman * We could use linker sets for some or all of these, but
3920094Swollman * then we would have to control what ended up linked into
4020094Swollman * the bootstrap.  So it's easier to conditionalise things
4120094Swollman * here.
4220094Swollman *
4320094Swollman * XXX rename these arrays to be consistent and less namespace-hostile
4420094Swollman *
4520094Swollman * XXX as libi386 and biosboot merge, some of these can become linker sets.
4620094Swollman */
4720094Swollman
4820094Swollman#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT)
4920094Swollman#error "Cannot have both tftp and nfs support yet."
5020094Swollman#endif
5120094Swollman
5221217Swollman#if defined(LOADER_FIREWIRE_SUPPORT)
5321217Swollmanextern struct devsw fwohci;
5420094Swollman#endif
5520094Swollman
562742Swollman/* Exported for libstand */
572742Swollmanstruct devsw *devsw[] = {
5814343Swollman    &bioscd,
5914343Swollman    &biosdisk,
6021217Swollman#if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT)
6120094Swollman    &pxedisk,
6220094Swollman#endif
6320094Swollman#if defined(LOADER_FIREWIRE_SUPPORT)
6420094Swollman    &fwohci,
6520094Swollman#endif
662742Swollman#if defined(LOADER_ZFS_SUPPORT)
679908Swollman    &zfs_dev,
682742Swollman#endif
6914343Swollman    NULL
7014343Swollman};
7114343Swollman
7214343Swollmanstruct fs_ops *file_system[] = {
7314343Swollman#if defined(LOADER_ZFS_SUPPORT)
7414343Swollman    &zfs_fsops,
7514343Swollman#endif
7614343Swollman    &ufs_fsops,
7714343Swollman    &ext2fs_fsops,
782742Swollman    &dosfs_fsops,
792742Swollman    &cd9660_fsops,
802742Swollman#if defined(LOADER_NANDFS_SUPPORT)
812742Swollman    &nandfs_fsops,
8214343Swollman#endif
832742Swollman#ifdef LOADER_NFS_SUPPORT
842742Swollman    &nfs_fsops,
859908Swollman#endif
862742Swollman#ifdef LOADER_TFTP_SUPPORT
8714343Swollman    &tftp_fsops,
8814343Swollman#endif
8914343Swollman#ifdef LOADER_GZIP_SUPPORT
9014343Swollman    &gzipfs_fsops,
9114343Swollman#endif
9214343Swollman#ifdef LOADER_BZIP2_SUPPORT
9314343Swollman    &bzipfs_fsops,
9414343Swollman#endif
9514343Swollman#ifdef LOADER_SPLIT_SUPPORT
9614343Swollman    &splitfs_fsops,
9714343Swollman#endif
9814343Swollman    NULL
9914343Swollman};
1002742Swollman
1012742Swollman/* Exported for i386 only */
1022742Swollman/*
10314343Swollman * Sort formats so that those that can detect based on arguments
1042742Swollman * rather than reading the file go first.
1052742Swollman */
1069908Swollmanextern struct file_format	i386_elf;
1072742Swollmanextern struct file_format	i386_elf_obj;
10814343Swollmanextern struct file_format	amd64_elf;
10914343Swollmanextern struct file_format	amd64_elf_obj;
11014343Swollmanextern struct file_format	multiboot;
11114343Swollmanextern struct file_format	multiboot_obj;
11214343Swollman
11314343Swollmanstruct file_format *file_formats[] = {
11414343Swollman	&multiboot,
11514343Swollman	&multiboot_obj,
1162742Swollman#ifdef LOADER_PREFER_AMD64
1172742Swollman    &amd64_elf,
1182742Swollman    &amd64_elf_obj,
11914343Swollman#endif
1202742Swollman    &i386_elf,
1212742Swollman    &i386_elf_obj,
1229908Swollman#ifndef LOADER_PREFER_AMD64
1232742Swollman    &amd64_elf,
12414343Swollman    &amd64_elf_obj,
12514343Swollman#endif
12614343Swollman    NULL
12714343Swollman};
12814343Swollman
12914343Swollman/*
13014343Swollman * Consoles
13114343Swollman *
13214343Swollman * We don't prototype these in libi386.h because they require
13314343Swollman * data structures from bootstrap.h as well.
1342742Swollman */
1352742Swollmanextern struct console vidconsole;
1362742Swollmanextern struct console comconsole;
13714343Swollman#if defined(LOADER_FIREWIRE_SUPPORT)
1382742Swollmanextern struct console dconsole;
1392742Swollman#endif
1402742Swollmanextern struct console nullconsole;
1412742Swollmanextern struct console spinconsole;
1422742Swollman
14314343Swollmanstruct console *consoles[] = {
1442742Swollman    &vidconsole,
1458029Swollman    &comconsole,
14614343Swollman#if defined(LOADER_FIREWIRE_SUPPORT)
14714343Swollman    &dconsole,
14814343Swollman#endif
14914343Swollman    &nullconsole,
15014343Swollman    &spinconsole,
15114343Swollman    NULL
15214343Swollman};
15314343Swollman
15414343Swollmanextern struct pnphandler isapnphandler;
15514343Swollmanextern struct pnphandler biospnphandler;
1562742Swollmanextern struct pnphandler biospcihandler;
1572742Swollman
15814343Swollmanstruct pnphandler *pnphandlers[] = {
1598029Swollman    &biospnphandler,		/* should go first, as it may set isapnp_readport */
16014343Swollman    &isapnphandler,
1612742Swollman    &biospcihandler,
1622742Swollman    NULL
16314343Swollman};
1642742Swollman