1223695Sdfr/*-
2223695Sdfr * Copyright (c) 1997
3223695Sdfr *	Matthias Drochner.  All rights reserved.
4223695Sdfr *
5223695Sdfr * Redistribution and use in source and binary forms, with or without
6223695Sdfr * modification, are permitted provided that the following conditions
7223695Sdfr * are met:
8223695Sdfr * 1. Redistributions of source code must retain the above copyright
9223695Sdfr *    notice, this list of conditions and the following disclaimer.
10223695Sdfr * 2. Redistributions in binary form must reproduce the above copyright
11223695Sdfr *    notice, this list of conditions and the following disclaimer in the
12223695Sdfr *    documentation and/or other materials provided with the distribution.
13223695Sdfr * 3. All advertising materials mentioning features or use of this software
14223695Sdfr *    must display the following acknowledgement:
15223695Sdfr *	This product includes software developed for the NetBSD Project
16223695Sdfr *	by Matthias Drochner.
17223695Sdfr * 4. The name of the author may not be used to endorse or promote products
18223695Sdfr *    derived from this software without specific prior written permission.
19223695Sdfr *
20223695Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21223695Sdfr * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22223695Sdfr * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23223695Sdfr * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24223695Sdfr * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25223695Sdfr * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26223695Sdfr * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27223695Sdfr * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28223695Sdfr * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29223695Sdfr * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30223695Sdfr *
31223695Sdfr *	$NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
32223695Sdfr */
33223695Sdfr
34223695Sdfr#include <sys/cdefs.h>
35223695Sdfr__FBSDID("$FreeBSD: stable/11/stand/userboot/userboot/conf.c 344377 2019-02-20 19:13:09Z kevans $");
36223695Sdfr
37223695Sdfr#include <stand.h>
38223695Sdfr
39223695Sdfr#include "libuserboot.h"
40223695Sdfr
41262331Sgrehan#if defined(USERBOOT_ZFS_SUPPORT)
42344377Skevans#include "libzfs.h"
43262331Sgrehan#endif
44262331Sgrehan
45223695Sdfr/*
46223695Sdfr * We could use linker sets for some or all of these, but
47223695Sdfr * then we would have to control what ended up linked into
48223695Sdfr * the bootstrap.  So it's easier to conditionalise things
49223695Sdfr * here.
50223695Sdfr *
51223695Sdfr * XXX rename these arrays to be consistent and less namespace-hostile
52223695Sdfr */
53223695Sdfr
54223695Sdfr/* Exported for libstand */
55223695Sdfrstruct devsw *devsw[] = {
56223695Sdfr	&host_dev,
57223695Sdfr	&userboot_disk,
58262331Sgrehan#if defined(USERBOOT_ZFS_SUPPORT)
59262331Sgrehan	&zfs_dev,
60262331Sgrehan#endif
61223695Sdfr	NULL
62223695Sdfr};
63223695Sdfr
64223695Sdfrstruct fs_ops *file_system[] = {
65223695Sdfr	&host_fsops,
66223695Sdfr	&ufs_fsops,
67243700Sneel	&cd9660_fsops,
68262331Sgrehan#if defined(USERBOOT_ZFS_SUPPORT)
69262331Sgrehan	&zfs_fsops,
70262331Sgrehan#endif
71283939Savg	&gzipfs_fsops,
72283939Savg	&bzipfs_fsops,
73223695Sdfr	NULL
74223695Sdfr};
75223695Sdfr
76223695Sdfr/* Exported for i386 only */
77223695Sdfr/*
78223695Sdfr * Sort formats so that those that can detect based on arguments
79223695Sdfr * rather than reading the file go first.
80223695Sdfr */
81223695Sdfrextern struct file_format	i386_elf;
82223695Sdfrextern struct file_format	i386_elf_obj;
83223695Sdfrextern struct file_format	amd64_elf;
84223695Sdfrextern struct file_format	amd64_elf_obj;
85223695Sdfr
86223695Sdfrstruct file_format *file_formats[] = {
87223695Sdfr    &i386_elf,
88223695Sdfr    &i386_elf_obj,
89223695Sdfr    &amd64_elf,
90223695Sdfr    &amd64_elf_obj,
91223695Sdfr    NULL
92223695Sdfr};
93223695Sdfr
94223695Sdfr/*
95223695Sdfr * Consoles
96223695Sdfr *
97223695Sdfr * We don't prototype these in libuserboot.h because they require
98223695Sdfr * data structures from bootstrap.h as well.
99223695Sdfr */
100223695Sdfrextern struct console userboot_console;
101265165Sgrehanextern struct console userboot_comconsole;
102223695Sdfr
103223695Sdfrstruct console *consoles[] = {
104223695Sdfr	&userboot_console,
105265165Sgrehan	&userboot_comconsole,
106223695Sdfr	NULL
107223695Sdfr};
108