1 /* 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * Copyright 2024 MNX Cloud, Inc. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 #include <sys/cdefs.h> 29 30 #include <stand.h> 31 #include <bootstrap.h> 32 #include "libi386.h" 33 #include "libzfs.h" 34 35 /* 36 * We could use linker sets for some or all of these, but 37 * then we would have to control what ended up linked into 38 * the bootstrap. So it's easier to conditionalise things 39 * here. 40 * 41 * XXX rename these arrays to be consistent and less namespace-hostile 42 * 43 * XXX as libi386 and biosboot merge, some of these can become linker sets. 44 */ 45 46 extern struct devsw vdisk_dev; 47 48 /* Exported for libstand */ 49 struct devsw *devsw[] = { 50 &biosfd, 51 &bioscd, 52 &bioshd, 53 &pxedisk, 54 &vdisk_dev, 55 &zfs_dev, 56 NULL 57 }; 58 59 struct fs_ops *file_system[] = { 60 &gzipfs_fsops, 61 &zfs_fsops, 62 &ufs_fsops, 63 &dosfs_fsops, 64 &cd9660_fsops, 65 &tftp_fsops, 66 &nfs_fsops, 67 NULL 68 }; 69 70 /* Exported for i386 only */ 71 /* 72 * Sort formats so that those that can detect based on arguments 73 * rather than reading the file go first. 74 */ 75 extern struct file_format i386_elf; 76 extern struct file_format i386_elf_obj; 77 extern struct file_format amd64_elf; 78 extern struct file_format amd64_elf_obj; 79 extern struct file_format multiboot; 80 extern struct file_format multiboot_obj; 81 extern struct file_format multiboot2; 82 extern struct file_format linux; 83 extern struct file_format linux_initrd; 84 85 struct file_format *file_formats[] = { 86 &multiboot2, 87 &multiboot, 88 &multiboot_obj, 89 &amd64_elf, 90 &amd64_elf_obj, 91 &i386_elf, 92 &i386_elf_obj, 93 &linux, 94 &linux_initrd, 95 NULL 96 }; 97 98 /* 99 * Consoles 100 * 101 * We don't prototype these in libi386.h because they require 102 * data structures from bootstrap.h as well. 103 */ 104 extern struct console text; 105 extern struct console nullconsole; 106 extern struct console spinconsole; 107 extern void comc_ini(void); 108 109 struct console_template ct_list[] = { 110 [0] = { .ct_dev = &text, .ct_init = NULL }, 111 [1] = { .ct_dev = NULL, .ct_init = comc_ini }, 112 [2] = { .ct_dev = &nullconsole, .ct_init = NULL }, 113 [3] = { .ct_dev = &spinconsole, .ct_init = NULL }, 114 [4] = { .ct_dev = NULL, .ct_init = NULL }, 115 }; 116 117 struct console **consoles; 118 119 extern struct pnphandler isapnphandler; 120 extern struct pnphandler biospnphandler; 121 extern struct pnphandler biospcihandler; 122 123 struct pnphandler *pnphandlers[] = { 124 &biospnphandler, /* should go first, as it may set isapnp_readport */ 125 &isapnphandler, 126 &biospcihandler, 127 NULL 128 }; 129