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