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