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$"); 29119482Sobrien 3038465Smsmith#include <stand.h> 3138465Smsmith#include <bootstrap.h> 3238465Smsmith#include "libi386/libi386.h" 33235329Savg#if defined(LOADER_ZFS_SUPPORT) 34235329Savg#include "../zfs/libzfs.h" 35235329Savg#endif 3638465Smsmith 3738465Smsmith/* 3838465Smsmith * We could use linker sets for some or all of these, but 3938465Smsmith * then we would have to control what ended up linked into 4038465Smsmith * the bootstrap. So it's easier to conditionalise things 4138465Smsmith * here. 4238465Smsmith * 4338465Smsmith * XXX rename these arrays to be consistent and less namespace-hostile 4438465Smsmith * 4538465Smsmith * XXX as libi386 and biosboot merge, some of these can become linker sets. 4638465Smsmith */ 4738465Smsmith 4859087Sps#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT) 4959087Sps#error "Cannot have both tftp and nfs support yet." 5059087Sps#endif 5159087Sps 52170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 53170101Ssimokawaextern struct devsw fwohci; 54170101Ssimokawa#endif 55170101Ssimokawa 5638465Smsmith/* Exported for libstand */ 5738465Smsmithstruct devsw *devsw[] = { 5886093Sjhb &bioscd, 5939450Smsmith &biosdisk, 6059087Sps#if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT) 6158713Sjhb &pxedisk, 6259087Sps#endif 63170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 64170101Ssimokawa &fwohci, 65170101Ssimokawa#endif 66185029Spjd#if defined(LOADER_ZFS_SUPPORT) 67185029Spjd &zfs_dev, 68185029Spjd#endif 6938465Smsmith NULL 7038465Smsmith}; 7138465Smsmith 7238465Smsmithstruct fs_ops *file_system[] = { 73240335Sae#if defined(LOADER_ZFS_SUPPORT) 74240335Sae &zfs_fsops, 75240335Sae#endif 7638465Smsmith &ufs_fsops, 7759767Sjlemon &ext2fs_fsops, 7838465Smsmith &dosfs_fsops, 7986093Sjhb &cd9660_fsops, 80235537Sgber#if defined(LOADER_NANDFS_SUPPORT) 81235537Sgber &nandfs_fsops, 82235537Sgber#endif 83277946Sjhb#ifdef LOADER_NFS_SUPPORT 84277946Sjhb &nfs_fsops, 85241047Sae#endif 86277946Sjhb#ifdef LOADER_TFTP_SUPPORT 87277946Sjhb &tftp_fsops, 88277946Sjhb#endif 8983616Ssobomax#ifdef LOADER_GZIP_SUPPORT 90108100Sjake &gzipfs_fsops, 9183616Ssobomax#endif 9283616Ssobomax#ifdef LOADER_BZIP2_SUPPORT 9383616Ssobomax &bzipfs_fsops, 9483616Ssobomax#endif 95277946Sjhb#ifdef LOADER_SPLIT_SUPPORT 96277946Sjhb &splitfs_fsops, 9759087Sps#endif 9838465Smsmith NULL 9938465Smsmith}; 10038465Smsmith 10138465Smsmith/* Exported for i386 only */ 10238465Smsmith/* 10338465Smsmith * Sort formats so that those that can detect based on arguments 10438465Smsmith * rather than reading the file go first. 10538465Smsmith */ 10659854Sbpextern struct file_format i386_elf; 107134459Siedowseextern struct file_format i386_elf_obj; 108114379Speterextern struct file_format amd64_elf; 109134459Siedowseextern struct file_format amd64_elf_obj; 110294417Sroygerextern struct file_format multiboot; 111294417Sroygerextern struct file_format multiboot_obj; 11238465Smsmith 11359854Sbpstruct file_format *file_formats[] = { 114294417Sroyger &multiboot, 115294417Sroyger &multiboot_obj, 116241068Sae#ifdef LOADER_PREFER_AMD64 117241068Sae &amd64_elf, 118241068Sae &amd64_elf_obj, 119241068Sae#endif 12039834Speter &i386_elf, 121134459Siedowse &i386_elf_obj, 122241068Sae#ifndef LOADER_PREFER_AMD64 123114379Speter &amd64_elf, 124134459Siedowse &amd64_elf_obj, 125241068Sae#endif 12638465Smsmith NULL 12738465Smsmith}; 12838465Smsmith 12938465Smsmith/* 13038465Smsmith * Consoles 13138465Smsmith * 13238465Smsmith * We don't prototype these in libi386.h because they require 13338465Smsmith * data structures from bootstrap.h as well. 13438465Smsmith */ 13538465Smsmithextern struct console vidconsole; 13638465Smsmithextern struct console comconsole; 137170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 138170101Ssimokawaextern struct console dconsole; 139170101Ssimokawa#endif 14066133Sarchieextern struct console nullconsole; 141199855Ssobomaxextern struct console spinconsole; 14238465Smsmith 14338465Smsmithstruct console *consoles[] = { 14438465Smsmith &vidconsole, 14538465Smsmith &comconsole, 146170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 147170101Ssimokawa &dconsole, 148170101Ssimokawa#endif 14966133Sarchie &nullconsole, 150199855Ssobomax &spinconsole, 15138465Smsmith NULL 15238465Smsmith}; 15339178Smsmith 15439178Smsmithextern struct pnphandler isapnphandler; 15540600Smsmithextern struct pnphandler biospnphandler; 15640618Smsmithextern struct pnphandler biospcihandler; 15739178Smsmith 15839178Smsmithstruct pnphandler *pnphandlers[] = { 15940600Smsmith &biospnphandler, /* should go first, as it may set isapnp_readport */ 16040555Smsmith &isapnphandler, 16140618Smsmith &biospcihandler, 16239178Smsmith NULL 16339178Smsmith}; 164