176b993fbSRodney W. Grimes /*- 283ef78beSPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 383ef78beSPedro F. Giffuni * 476b993fbSRodney W. Grimes * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon 97222 576b993fbSRodney W. Grimes * All rights reserved. 676b993fbSRodney W. Grimes * 776b993fbSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 876b993fbSRodney W. Grimes * modification, are permitted provided that the following conditions 976b993fbSRodney W. Grimes * are met: 1076b993fbSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 1176b993fbSRodney W. Grimes * notice, this list of conditions and the following disclaimer as 1276b993fbSRodney W. Grimes * the first lines of this file unmodified. 1376b993fbSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 1476b993fbSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 1576b993fbSRodney W. Grimes * documentation and/or other materials provided with the distribution. 1676b993fbSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 1776b993fbSRodney W. Grimes * must display the following acknowledgement: 1876b993fbSRodney W. Grimes * This product includes software developed by Rodney W. Grimes. 1976b993fbSRodney W. Grimes * 4. The name of the author may not be used to endorse or promote products 2076b993fbSRodney W. Grimes * derived from this software without specific prior written permission. 2176b993fbSRodney W. Grimes * 2276b993fbSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND 2376b993fbSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2476b993fbSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2576b993fbSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE 2676b993fbSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2776b993fbSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2876b993fbSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2976b993fbSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3076b993fbSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3176b993fbSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3276b993fbSRodney W. Grimes * SUCH DAMAGE. 3376b993fbSRodney W. Grimes */ 3476b993fbSRodney W. Grimes 3576b993fbSRodney W. Grimes #ifndef _MACHINE_BOOTINFO_H_ 3676b993fbSRodney W. Grimes #define _MACHINE_BOOTINFO_H_ 3776b993fbSRodney W. Grimes 38b5d89ca8SBruce Evans /* Only change the version number if you break compatibility. */ 39b5d89ca8SBruce Evans #define BOOTINFO_VERSION 1 40b5d89ca8SBruce Evans 4159b1d074SWarner Losh #define _WAS_N_BIOS_GEOM 8 42b5d89ca8SBruce Evans 43b5d89ca8SBruce Evans /* 44b5d89ca8SBruce Evans * A zero bootinfo field often means that there is no info available. 45*4134f677SWarner Losh * Assumes booting with a boot loader from FreeBSD 2.1 or newer and 46*4134f677SWarner Losh * that bi_size is always valid when bi_version == 1. 47b5d89ca8SBruce Evans */ 48b5d89ca8SBruce Evans struct bootinfo { 49*4134f677SWarner Losh u_int32_t bi_version; /* Must be 1 */ 509d508ad2SBruce Evans u_int32_t bi_kernelname; /* represents a char * */ 519d508ad2SBruce Evans u_int32_t bi_nfs_diskless; /* struct nfs_diskless * */ 5259b1d074SWarner Losh u_int32_t _was_bi_n_bios_used; 5359b1d074SWarner Losh u_int32_t _was_bi_bios_geom[_WAS_N_BIOS_GEOM]; 549d508ad2SBruce Evans u_int32_t bi_size; 559d508ad2SBruce Evans u_int8_t bi_memsizes_valid; 5659b1d074SWarner Losh u_int8_t bi_bios_dev; /* bootdev BIOS unit number (bootX -> loader only) */ 57882ffc4bSMike Smith u_int8_t bi_pad[2]; 589d508ad2SBruce Evans u_int32_t bi_basemem; 599d508ad2SBruce Evans u_int32_t bi_extmem; 609d508ad2SBruce Evans u_int32_t bi_symtab; /* struct symtab * */ 619d508ad2SBruce Evans u_int32_t bi_esymtab; /* struct symtab * */ 627877a80aSMike Smith /* Items below only from advanced bootloader */ 637877a80aSMike Smith u_int32_t bi_kernend; /* end of kernel space */ 647877a80aSMike Smith u_int32_t bi_envp; /* environment */ 657877a80aSMike Smith u_int32_t bi_modulep; /* preloaded modules */ 6676b993fbSRodney W. Grimes }; 6776b993fbSRodney W. Grimes 68664a31e4SPeter Wemm #ifdef _KERNEL 69b5d89ca8SBruce Evans extern struct bootinfo bootinfo; 70e0abbebfSPoul-Henning Kamp #endif 71b5d89ca8SBruce Evans 72197e5e73SPoul-Henning Kamp /* 73197e5e73SPoul-Henning Kamp * Constants for converting boot-style device number to type, 74197e5e73SPoul-Henning Kamp * adaptor (uba, mba, etc), unit number and partition number. 75197e5e73SPoul-Henning Kamp * Type (== major device number) is in the low byte 76197e5e73SPoul-Henning Kamp * for backward compatibility. Except for that of the "magic 77197e5e73SPoul-Henning Kamp * number", each mask applies to the shifted value. 78197e5e73SPoul-Henning Kamp * Format: 795c5b5d46SJohn Baldwin * (4) (8) (4) (8) (8) 80197e5e73SPoul-Henning Kamp * -------------------------------- 815c5b5d46SJohn Baldwin * |MA | SLICE | UN| PART | TYPE | 82197e5e73SPoul-Henning Kamp * -------------------------------- 83197e5e73SPoul-Henning Kamp */ 84197e5e73SPoul-Henning Kamp #define B_SLICESHIFT 20 85197e5e73SPoul-Henning Kamp #define B_SLICEMASK 0xff 86197e5e73SPoul-Henning Kamp #define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK) 87197e5e73SPoul-Henning Kamp #define B_UNITSHIFT 16 88197e5e73SPoul-Henning Kamp #define B_UNITMASK 0xf 89197e5e73SPoul-Henning Kamp #define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) 90197e5e73SPoul-Henning Kamp #define B_PARTITIONSHIFT 8 91197e5e73SPoul-Henning Kamp #define B_PARTITIONMASK 0xff 92197e5e73SPoul-Henning Kamp #define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) 93197e5e73SPoul-Henning Kamp #define B_TYPESHIFT 0 94197e5e73SPoul-Henning Kamp #define B_TYPEMASK 0xff 95197e5e73SPoul-Henning Kamp #define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) 96197e5e73SPoul-Henning Kamp 97197e5e73SPoul-Henning Kamp #define B_MAGICMASK 0xf0000000 98197e5e73SPoul-Henning Kamp #define B_DEVMAGIC 0xa0000000 99197e5e73SPoul-Henning Kamp 1005c5b5d46SJohn Baldwin #define MAKEBOOTDEV(type, slice, unit, partition) \ 1015c5b5d46SJohn Baldwin (((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \ 1025c5b5d46SJohn Baldwin ((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \ 1035c5b5d46SJohn Baldwin B_DEVMAGIC) 104197e5e73SPoul-Henning Kamp 105197e5e73SPoul-Henning Kamp #define BASE_SLICE 2 106197e5e73SPoul-Henning Kamp #define COMPATIBILITY_SLICE 0 107197e5e73SPoul-Henning Kamp #define MAX_SLICES 32 108197e5e73SPoul-Henning Kamp #define WHOLE_DISK_SLICE 1 109197e5e73SPoul-Henning Kamp 110b5d89ca8SBruce Evans #endif /* !_MACHINE_BOOTINFO_H_ */ 111