1*6d3ceb1dSskrll /* $NetBSD: bootinfo.h,v 1.1 2014/02/24 07:23:43 skrll Exp $ */ 2*6d3ceb1dSskrll 3*6d3ceb1dSskrll /* 4*6d3ceb1dSskrll * Copyright (c) 1997 5*6d3ceb1dSskrll * Matthias Drochner. All rights reserved. 6*6d3ceb1dSskrll * 7*6d3ceb1dSskrll * Redistribution and use in source and binary forms, with or without 8*6d3ceb1dSskrll * modification, are permitted provided that the following conditions 9*6d3ceb1dSskrll * are met: 10*6d3ceb1dSskrll * 1. Redistributions of source code must retain the above copyright 11*6d3ceb1dSskrll * notice, this list of conditions and the following disclaimer. 12*6d3ceb1dSskrll * 2. Redistributions in binary form must reproduce the above copyright 13*6d3ceb1dSskrll * notice, this list of conditions and the following disclaimer in the 14*6d3ceb1dSskrll * documentation and/or other materials provided with the distribution. 15*6d3ceb1dSskrll * 16*6d3ceb1dSskrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*6d3ceb1dSskrll * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*6d3ceb1dSskrll * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*6d3ceb1dSskrll * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*6d3ceb1dSskrll * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21*6d3ceb1dSskrll * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22*6d3ceb1dSskrll * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23*6d3ceb1dSskrll * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24*6d3ceb1dSskrll * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25*6d3ceb1dSskrll * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26*6d3ceb1dSskrll * 27*6d3ceb1dSskrll */ 28*6d3ceb1dSskrll 29*6d3ceb1dSskrll #define BOOTINFO_MAGIC 0xb007babe 30*6d3ceb1dSskrll 31*6d3ceb1dSskrll #ifndef _LOCORE 32*6d3ceb1dSskrll 33*6d3ceb1dSskrll struct btinfo_common { 34*6d3ceb1dSskrll int len; 35*6d3ceb1dSskrll int type; 36*6d3ceb1dSskrll }; 37*6d3ceb1dSskrll 38*6d3ceb1dSskrll #define BTINFO_MAGIC 0 39*6d3ceb1dSskrll #define BTINFO_KERNELFILE 1 40*6d3ceb1dSskrll #define BTINFO_SYMTAB 2 41*6d3ceb1dSskrll 42*6d3ceb1dSskrll struct btinfo_magic { 43*6d3ceb1dSskrll struct btinfo_common common; 44*6d3ceb1dSskrll int magic; 45*6d3ceb1dSskrll }; 46*6d3ceb1dSskrll 47*6d3ceb1dSskrll struct btinfo_kernelfile { 48*6d3ceb1dSskrll struct btinfo_common common; 49*6d3ceb1dSskrll char name[1]; /* variable length */ 50*6d3ceb1dSskrll }; 51*6d3ceb1dSskrll 52*6d3ceb1dSskrll struct btinfo_symtab { 53*6d3ceb1dSskrll struct btinfo_common common; 54*6d3ceb1dSskrll int nsym; 55*6d3ceb1dSskrll int ssym; 56*6d3ceb1dSskrll int esym; 57*6d3ceb1dSskrll }; 58*6d3ceb1dSskrll 59*6d3ceb1dSskrll #endif /* _LOCORE */ 60*6d3ceb1dSskrll 61*6d3ceb1dSskrll #ifdef _KERNEL 62*6d3ceb1dSskrll 63*6d3ceb1dSskrll #define BOOTINFO_MAXSIZE 1024 64*6d3ceb1dSskrll #define BOOTINFO_DATASIZE (BOOTINFO_MAXSIZE - 2 * sizeof(uint32_t)) 65*6d3ceb1dSskrll 66*6d3ceb1dSskrll #ifndef _LOCORE 67*6d3ceb1dSskrll /* 68*6d3ceb1dSskrll * Structure that holds the information passed by the boot loader. 69*6d3ceb1dSskrll */ 70*6d3ceb1dSskrll struct bootinfo { 71*6d3ceb1dSskrll /* Number of bootinfo_* entries in bi_data. */ 72*6d3ceb1dSskrll uint32_t bi_nentries; 73*6d3ceb1dSskrll uint32_t bi_offset; 74*6d3ceb1dSskrll 75*6d3ceb1dSskrll /* Raw data of bootinfo entries. The first one (if any) is 76*6d3ceb1dSskrll * found at bi_data[0] and can be casted to (bootinfo_common *). 77*6d3ceb1dSskrll * Once this is done, the following entry is found at 'len' 78*6d3ceb1dSskrll * offset as specified by the previous entry. */ 79*6d3ceb1dSskrll uint8_t bi_data[BOOTINFO_DATASIZE]; 80*6d3ceb1dSskrll }; 81*6d3ceb1dSskrll 82*6d3ceb1dSskrll void *lookup_bootinfo(int); 83*6d3ceb1dSskrll #endif /* _LOCORE */ 84*6d3ceb1dSskrll 85*6d3ceb1dSskrll #endif /* _KERNEL */ 86