199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/cdefs.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome__FBSDID("$FreeBSD$");
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <stand.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <bootstrap.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include "libi386/libi386.h"
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_ZFS_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include "../zfs/libzfs.h"
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * We could use linker sets for some or all of these, but
199767f8919635c4928607450d9e0abb932109ceToomas Soome * then we would have to control what ended up linked into
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the bootstrap. So it's easier to conditionalise things
199767f8919635c4928607450d9e0abb932109ceToomas Soome * here.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX rename these arrays to be consistent and less namespace-hostile
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX as libi386 and biosboot merge, some of these can become linker sets.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#error "Cannot have both tftp and nfs support yet."
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_FIREWIRE_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct devsw fwohci;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Exported for libstand */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct devsw *devsw[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome &bioscd,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &biosdisk,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &pxedisk,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_FIREWIRE_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &fwohci,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_ZFS_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &zfs_dev,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct fs_ops *file_system[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef LOADER_GZIP_SUPPORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome &gzipfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_ZFS_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &zfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ufs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &dosfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ext2fs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome &cd9660_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_NANDFS_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &nandfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef LOADER_NFS_SUPPORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome &nfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef LOADER_TFTP_SUPPORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome &tftp_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef LOADER_BZIP2_SUPPORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome &bzipfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef LOADER_SPLIT_SUPPORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome &splitfs_fsops,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Exported for i386 only */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Sort formats so that those that can detect based on arguments
199767f8919635c4928607450d9e0abb932109ceToomas Soome * rather than reading the file go first.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format i386_elf;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format i386_elf_obj;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format amd64_elf;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format amd64_elf_obj;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format multiboot;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format multiboot_obj;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format linux;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct file_format linux_initrd;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct file_format *file_formats[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome &multiboot,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &multiboot_obj,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &amd64_elf,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &amd64_elf_obj,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &i386_elf,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &i386_elf_obj,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &linux,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &linux_initrd,
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Consoles
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * We don't prototype these in libi386.h because they require
199767f8919635c4928607450d9e0abb932109ceToomas Soome * data structures from bootstrap.h as well.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console text;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console ttya;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console ttyb;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console ttyc;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console ttyd;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_FIREWIRE_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console dconsole;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console nullconsole;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct console spinconsole;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct console *consoles[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome &text,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ttya,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ttyb,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ttyc,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &ttyd,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(LOADER_FIREWIRE_SUPPORT)
199767f8919635c4928607450d9e0abb932109ceToomas Soome &dconsole,
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome &nullconsole,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &spinconsole,
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct pnphandler isapnphandler;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct pnphandler biospnphandler;
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern struct pnphandler biospcihandler;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pnphandler *pnphandlers[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome &biospnphandler, /* should go first, as it may set isapnp_readport */
199767f8919635c4928607450d9e0abb932109ceToomas Soome &isapnphandler,
199767f8919635c4928607450d9e0abb932109ceToomas Soome &biospcihandler,
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};