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 83241047Sae#ifdef LOADER_SPLIT_SUPPORT 8492494Ssobomax &splitfs_fsops, 85241047Sae#endif 8683616Ssobomax#ifdef LOADER_GZIP_SUPPORT 87108100Sjake &gzipfs_fsops, 8883616Ssobomax#endif 8983616Ssobomax#ifdef LOADER_BZIP2_SUPPORT 9083616Ssobomax &bzipfs_fsops, 9183616Ssobomax#endif 9259087Sps#ifdef LOADER_NFS_SUPPORT 9359087Sps &nfs_fsops, 9459087Sps#endif 9559087Sps#ifdef LOADER_TFTP_SUPPORT 9659087Sps &tftp_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; 11038465Smsmith 11159854Sbpstruct file_format *file_formats[] = { 112241068Sae#ifdef LOADER_PREFER_AMD64 113241068Sae &amd64_elf, 114241068Sae &amd64_elf_obj, 115241068Sae#endif 11639834Speter &i386_elf, 117134459Siedowse &i386_elf_obj, 118241068Sae#ifndef LOADER_PREFER_AMD64 119114379Speter &amd64_elf, 120134459Siedowse &amd64_elf_obj, 121241068Sae#endif 12238465Smsmith NULL 12338465Smsmith}; 12438465Smsmith 12538465Smsmith/* 12638465Smsmith * Consoles 12738465Smsmith * 12838465Smsmith * We don't prototype these in libi386.h because they require 12938465Smsmith * data structures from bootstrap.h as well. 13038465Smsmith */ 13138465Smsmithextern struct console vidconsole; 13238465Smsmithextern struct console comconsole; 133170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 134170101Ssimokawaextern struct console dconsole; 135170101Ssimokawa#endif 13666133Sarchieextern struct console nullconsole; 137199855Ssobomaxextern struct console spinconsole; 13838465Smsmith 13938465Smsmithstruct console *consoles[] = { 14038465Smsmith &vidconsole, 14138465Smsmith &comconsole, 142170101Ssimokawa#if defined(LOADER_FIREWIRE_SUPPORT) 143170101Ssimokawa &dconsole, 144170101Ssimokawa#endif 14566133Sarchie &nullconsole, 146199855Ssobomax &spinconsole, 14738465Smsmith NULL 14838465Smsmith}; 14939178Smsmith 15039178Smsmithextern struct pnphandler isapnphandler; 15140600Smsmithextern struct pnphandler biospnphandler; 15240618Smsmithextern struct pnphandler biospcihandler; 15339178Smsmith 15439178Smsmithstruct pnphandler *pnphandlers[] = { 15540600Smsmith &biospnphandler, /* should go first, as it may set isapnp_readport */ 15640555Smsmith &isapnphandler, 15740618Smsmith &biospcihandler, 15839178Smsmith NULL 15939178Smsmith}; 160