1 /* $NetBSD: bootinfo.h,v 1.3 2006/02/11 17:57:31 cdi Exp $ */
4 * Copyright (c) 2005 The NetBSD Foundation, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
32 #include <machine/param.h>
33 #include <sparc/bootinfo.h>
36 * The bootloader v1.9 and higher makes a call into a kernel with the following
39 * %o0 OpenFirmware entry point, to keep Sun's updaters happy
40 * %o1 Address of boot information vector (see below)
41 * %o2 Length of the vector, in bytes
42 * %o3 OpenFirmware entry point, to mimic Sun bootloader behavior
43 * %o4 OpenFirmware entry point, to meet earlier NetBSD kernels
46 * All parameters are of void* type except for vector length which is of
49 * The boot information vector format was dictated by earlier kernels and
50 * starting from ofwboot v1.9 has four entries:
52 * +-------------------------------------+
53 * #0 | NetBSD boot magic number ('DDB2') |
54 * +-------------------------------------+
55 * #1 | ksyms' table end address |
56 * +-------------------------------------+
57 * #2 | ksyms' table start address |
58 * +-------------------------------------+
59 * #3 | Pointer to a bootinfo binary object |
60 * +-------------------------------------+
62 * Kernels written for pre-v1.8 ofwboot require first three cells to present
63 * in this particular order, those that rely on v1.9 and higher won't work if
64 * the last pointer is not in the table; therefore, the vector cannot be
65 * shorter than 4 * sizeof(uint32_t) or 4 * sizeof(uint64_t) for 32-bit and
66 * 64-bit boot loader, respectively.
68 * As of ofwboot v1.9, bootinfo binary object is placed right after the kernel
69 * data segment end, i.e. in the permanently locked 4MB page. There is no order
70 * for the data located in bootinfo binary object. The kernel however expects
71 * at least following parameters to exist in there:
73 * - Symbol information (size, start, end; see struct btinfo_symtab)
74 * - Kernel end address, calculated as true kernel end address plus size of
75 * space reserved for bootinfo binary object (struct btinfo_kernend)
76 * - Number of text segment pages (struct btinfo_count)
77 * - Number of data segment pages (struct btinfo_count)
78 * - Array of text pages VA/PA (struct btinfo_tlb)
79 * - Array of data pages VA/PA (struct btinfo_tlb)
81 * The last four data structures fully describe kernel mappings. ofwboot v1.9
82 * and higher map the kernel with 4MB permanent pages and this is the only
83 * way to let kernel know how exactly it was mapped.
86 /* Boot magic number */
87 #define SPARC_MACHINE_OPENFIRMWARE 0x44444230
93 #define BOOTINFO_SIZE NBPG
95 #define BTINFO_DTLB_SLOTS 100
96 #define BTINFO_ITLB_SLOTS 101
97 #define BTINFO_DTLB 102
98 #define BTINFO_ITLB 103
99 #define BTINFO_KERNEND 104
101 #define LOOKUP_BOOTINFO(btp, info) \
103 if ( ((btp) = lookup_bootinfo(info)) == NULL) { \
104 panic("lookup_bootinfo: No " #info " found.\n"); \
113 struct btinfo_count
{
114 struct btinfo_common common
;
119 struct btinfo_common common
;
120 struct tlb_entry tlb
[1];
123 struct btinfo_kernend
{
124 struct btinfo_common common
;
128 #endif /* _BOOTINFO_H_ */