1*6d3ceb1dSskrll /* $NetBSD: bootinfo.h,v 1.1 2014/02/24 07:23:43 skrll Exp $ */ 2*6d3ceb1dSskrll 3*6d3ceb1dSskrll /*- 4*6d3ceb1dSskrll * Copyright (c) 1999 The NetBSD Foundation, Inc. 5*6d3ceb1dSskrll * All rights reserved. 6*6d3ceb1dSskrll * 7*6d3ceb1dSskrll * This code is derived from software contributed to The NetBSD Foundation 8*6d3ceb1dSskrll * by Jonathan Stone, Michael Hitch and Simon Burge. 9*6d3ceb1dSskrll * 10*6d3ceb1dSskrll * Redistribution and use in source and binary forms, with or without 11*6d3ceb1dSskrll * modification, are permitted provided that the following conditions 12*6d3ceb1dSskrll * are met: 13*6d3ceb1dSskrll * 1. Redistributions of source code must retain the above copyright 14*6d3ceb1dSskrll * notice, this list of conditions and the following disclaimer. 15*6d3ceb1dSskrll * 2. Redistributions in binary form must reproduce the above copyright 16*6d3ceb1dSskrll * notice, this list of conditions and the following disclaimer in the 17*6d3ceb1dSskrll * documentation and/or other materials provided with the distribution. 18*6d3ceb1dSskrll * 19*6d3ceb1dSskrll * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*6d3ceb1dSskrll * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*6d3ceb1dSskrll * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*6d3ceb1dSskrll * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*6d3ceb1dSskrll * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*6d3ceb1dSskrll * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*6d3ceb1dSskrll * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*6d3ceb1dSskrll * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*6d3ceb1dSskrll * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*6d3ceb1dSskrll * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*6d3ceb1dSskrll * POSSIBILITY OF SUCH DAMAGE. 30*6d3ceb1dSskrll */ 31*6d3ceb1dSskrll 32*6d3ceb1dSskrll #include <machine/bootinfo.h> 33*6d3ceb1dSskrll 34*6d3ceb1dSskrll #define BOOTINFO_MAXSIZE 1024 35*6d3ceb1dSskrll #define BOOTINFO_DATASIZE (BOOTINFO_MAXSIZE - 2 * sizeof(int)) 36*6d3ceb1dSskrll 37*6d3ceb1dSskrll /* 38*6d3ceb1dSskrll * Structure that holds the information passed by the boot loader. 39*6d3ceb1dSskrll */ 40*6d3ceb1dSskrll struct bootinfo { 41*6d3ceb1dSskrll int bi_nentries; /* Number of bootinfo_* entries in bi_data. */ 42*6d3ceb1dSskrll int bi_offset; /* Offset into bi_data for next bootinfo_* */ 43*6d3ceb1dSskrll 44*6d3ceb1dSskrll /* Raw data of bootinfo entries. The first one (if any) is 45*6d3ceb1dSskrll * found at &bi_data[0] and can be cast to (bootinfo_common *). 46*6d3ceb1dSskrll * Once this is done, the following entry is found at 'len' 47*6d3ceb1dSskrll * offset as specified by the previous entry. */ 48*6d3ceb1dSskrll char bi_data[BOOTINFO_DATASIZE]; 49*6d3ceb1dSskrll }; 50*6d3ceb1dSskrll 51*6d3ceb1dSskrll extern struct bootinfo bootinfo; 52*6d3ceb1dSskrll 53*6d3ceb1dSskrll #define BI_ADD(x, type, size) bi_add((struct btinfo_common *)(x), type, size) 54*6d3ceb1dSskrll 55*6d3ceb1dSskrll void bi_init(void); 56*6d3ceb1dSskrll void bi_add(struct btinfo_common *, int, size_t); 57