1b6871f55SYonghong Yan /*- 2b6871f55SYonghong Yan * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon 97222 3b6871f55SYonghong Yan * All rights reserved. 4b6871f55SYonghong Yan * 5b6871f55SYonghong Yan * Redistribution and use in source and binary forms, with or without 6b6871f55SYonghong Yan * modification, are permitted provided that the following conditions 7b6871f55SYonghong Yan * are met: 8b6871f55SYonghong Yan * 1. Redistributions of source code must retain the above copyright 9b6871f55SYonghong Yan * notice, this list of conditions and the following disclaimer as 10b6871f55SYonghong Yan * the first lines of this file unmodified. 11b6871f55SYonghong Yan * 2. Redistributions in binary form must reproduce the above copyright 12b6871f55SYonghong Yan * notice, this list of conditions and the following disclaimer in the 13b6871f55SYonghong Yan * documentation and/or other materials provided with the distribution. 14b6871f55SYonghong Yan * 3. All advertising materials mentioning features or use of this software 15b6871f55SYonghong Yan * must display the following acknowledgement: 16b6871f55SYonghong Yan * This product includes software developed by Rodney W. Grimes. 17b6871f55SYonghong Yan * 4. The name of the author may not be used to endorse or promote products 18b6871f55SYonghong Yan * derived from this software without specific prior written permission. 19b6871f55SYonghong Yan * 20b6871f55SYonghong Yan * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND 21b6871f55SYonghong Yan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22b6871f55SYonghong Yan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23b6871f55SYonghong Yan * ARE DISCLAIMED. IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE 24b6871f55SYonghong Yan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25b6871f55SYonghong Yan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26b6871f55SYonghong Yan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27b6871f55SYonghong Yan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28b6871f55SYonghong Yan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29b6871f55SYonghong Yan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30b6871f55SYonghong Yan * SUCH DAMAGE. 31b6871f55SYonghong Yan * 32b6871f55SYonghong Yan * $FreeBSD: src/sys/i386/include/bootinfo.h,v 1.14 1999/12/29 04:32:57 peter Exp $ 33b6871f55SYonghong Yan * $DragonFly: src/sys/platform/pc64/include/bootinfo.h,v 1.1 2007/09/23 04:42:07 yanyh Exp $ 34b6871f55SYonghong Yan */ 35b6871f55SYonghong Yan 36b6871f55SYonghong Yan #ifndef _MACHINE_BOOTINFO_H_ 37b6871f55SYonghong Yan #define _MACHINE_BOOTINFO_H_ 38b6871f55SYonghong Yan 39b6871f55SYonghong Yan /* Only change the version number if you break compatibility. */ 40b6871f55SYonghong Yan #define BOOTINFO_VERSION 1 41b6871f55SYonghong Yan 42b6871f55SYonghong Yan #define N_BIOS_GEOM 8 43b6871f55SYonghong Yan 44b6871f55SYonghong Yan /* 45b6871f55SYonghong Yan * A zero bootinfo field often means that there is no info available. 46b6871f55SYonghong Yan * Flags are used to indicate the validity of fields where zero is a 47b6871f55SYonghong Yan * normal value. 48b6871f55SYonghong Yan */ 49b6871f55SYonghong Yan struct bootinfo { 50b6871f55SYonghong Yan u_int32_t bi_version; 51b6871f55SYonghong Yan u_int32_t bi_kernelname; /* represents a char * */ 52b6871f55SYonghong Yan u_int32_t bi_nfs_diskless; /* struct nfs_diskless * */ 53b6871f55SYonghong Yan /* End of fields that are always present. */ 54b6871f55SYonghong Yan #define bi_endcommon bi_n_bios_used 55b6871f55SYonghong Yan u_int32_t bi_n_bios_used; 56b6871f55SYonghong Yan u_int32_t bi_bios_geom[N_BIOS_GEOM]; 57b6871f55SYonghong Yan u_int32_t bi_size; 58b6871f55SYonghong Yan u_int8_t bi_memsizes_valid; 59b6871f55SYonghong Yan u_int8_t bi_bios_dev; /* bootdev BIOS unit number */ 60b6871f55SYonghong Yan u_int8_t bi_pad[2]; 61b6871f55SYonghong Yan u_int32_t bi_basemem; 62b6871f55SYonghong Yan u_int32_t bi_extmem; 63b6871f55SYonghong Yan u_int32_t bi_symtab; /* struct symtab * */ 64b6871f55SYonghong Yan u_int32_t bi_esymtab; /* struct symtab * */ 65b6871f55SYonghong Yan /* Items below only from advanced bootloader */ 66b6871f55SYonghong Yan u_int32_t bi_kernend; /* end of kernel space */ 67b6871f55SYonghong Yan u_int32_t bi_envp; /* environment */ 68b6871f55SYonghong Yan u_int32_t bi_modulep; /* preloaded modules */ 69b6871f55SYonghong Yan }; 70b6871f55SYonghong Yan 71b6871f55SYonghong Yan #ifdef _KERNEL 72b6871f55SYonghong Yan extern struct bootinfo bootinfo; 73b6871f55SYonghong Yan #endif 74b6871f55SYonghong Yan 75b6871f55SYonghong Yan /* 76b6871f55SYonghong Yan * Constants for converting boot-style device number to type, 77b6871f55SYonghong Yan * adaptor (uba, mba, etc), unit number and partition number. 78b6871f55SYonghong Yan * Type (== major device number) is in the low byte 79b6871f55SYonghong Yan * for backward compatibility. Except for that of the "magic 80b6871f55SYonghong Yan * number", each mask applies to the shifted value. 81b6871f55SYonghong Yan * Format: 82*a05cac60Szrj * (4) (8) (4) (8) (8) 83b6871f55SYonghong Yan * -------------------------------- 84*a05cac60Szrj * |MA | SLICE | UN| PART | TYPE | 85b6871f55SYonghong Yan * -------------------------------- 86b6871f55SYonghong Yan */ 87b6871f55SYonghong Yan #define B_SLICESHIFT 20 88b6871f55SYonghong Yan #define B_SLICEMASK 0xff 89b6871f55SYonghong Yan #define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK) 90b6871f55SYonghong Yan #define B_UNITSHIFT 16 91b6871f55SYonghong Yan #define B_UNITMASK 0xf 92b6871f55SYonghong Yan #define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) 93b6871f55SYonghong Yan #define B_PARTITIONSHIFT 8 94b6871f55SYonghong Yan #define B_PARTITIONMASK 0xff 95b6871f55SYonghong Yan #define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) 96b6871f55SYonghong Yan #define B_TYPESHIFT 0 97b6871f55SYonghong Yan #define B_TYPEMASK 0xff 98b6871f55SYonghong Yan #define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) 99b6871f55SYonghong Yan 100b6871f55SYonghong Yan #define B_MAGICMASK 0xf0000000 101b6871f55SYonghong Yan #define B_DEVMAGIC 0xa0000000 102b6871f55SYonghong Yan 103*a05cac60Szrj #define MAKEBOOTDEV(type, slice, unit, partition) \ 104*a05cac60Szrj (((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \ 105*a05cac60Szrj ((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \ 106*a05cac60Szrj B_DEVMAGIC) 107b6871f55SYonghong Yan 108b6871f55SYonghong Yan #define BASE_SLICE 2 109b6871f55SYonghong Yan #define COMPATIBILITY_SLICE 0 110b6871f55SYonghong Yan #define MAX_SLICES 16 111b6871f55SYonghong Yan #define WHOLE_DISK_SLICE 1 112b6871f55SYonghong Yan 113b6871f55SYonghong Yan #endif /* !_MACHINE_BOOTINFO_H_ */ 114