xref: /netbsd-src/sys/arch/x86/include/bootspace.h (revision 448b1ee94e48df35e9eda28488b13d226085141f)
1*448b1ee9Sriastradh /*	$NetBSD: bootspace.h,v 1.1 2022/08/20 23:15:37 riastradh Exp $	*/
2*448b1ee9Sriastradh 
3*448b1ee9Sriastradh /*
4*448b1ee9Sriastradh  * Copyright (c) 1997 Charles D. Cranor and Washington University.
5*448b1ee9Sriastradh  * All rights reserved.
6*448b1ee9Sriastradh  *
7*448b1ee9Sriastradh  * Redistribution and use in source and binary forms, with or without
8*448b1ee9Sriastradh  * modification, are permitted provided that the following conditions
9*448b1ee9Sriastradh  * are met:
10*448b1ee9Sriastradh  * 1. Redistributions of source code must retain the above copyright
11*448b1ee9Sriastradh  *    notice, this list of conditions and the following disclaimer.
12*448b1ee9Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*448b1ee9Sriastradh  *    notice, this list of conditions and the following disclaimer in the
14*448b1ee9Sriastradh  *    documentation and/or other materials provided with the distribution.
15*448b1ee9Sriastradh  *
16*448b1ee9Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*448b1ee9Sriastradh  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*448b1ee9Sriastradh  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*448b1ee9Sriastradh  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*448b1ee9Sriastradh  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*448b1ee9Sriastradh  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*448b1ee9Sriastradh  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*448b1ee9Sriastradh  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*448b1ee9Sriastradh  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*448b1ee9Sriastradh  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*448b1ee9Sriastradh  */
27*448b1ee9Sriastradh 
28*448b1ee9Sriastradh /*
29*448b1ee9Sriastradh  * Copyright (c) 2001 Wasabi Systems, Inc.
30*448b1ee9Sriastradh  * All rights reserved.
31*448b1ee9Sriastradh  *
32*448b1ee9Sriastradh  * Written by Frank van der Linden for Wasabi Systems, Inc.
33*448b1ee9Sriastradh  *
34*448b1ee9Sriastradh  * Redistribution and use in source and binary forms, with or without
35*448b1ee9Sriastradh  * modification, are permitted provided that the following conditions
36*448b1ee9Sriastradh  * are met:
37*448b1ee9Sriastradh  * 1. Redistributions of source code must retain the above copyright
38*448b1ee9Sriastradh  *    notice, this list of conditions and the following disclaimer.
39*448b1ee9Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
40*448b1ee9Sriastradh  *    notice, this list of conditions and the following disclaimer in the
41*448b1ee9Sriastradh  *    documentation and/or other materials provided with the distribution.
42*448b1ee9Sriastradh  * 3. All advertising materials mentioning features or use of this software
43*448b1ee9Sriastradh  *    must display the following acknowledgement:
44*448b1ee9Sriastradh  *      This product includes software developed for the NetBSD Project by
45*448b1ee9Sriastradh  *      Wasabi Systems, Inc.
46*448b1ee9Sriastradh  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
47*448b1ee9Sriastradh  *    or promote products derived from this software without specific prior
48*448b1ee9Sriastradh  *    written permission.
49*448b1ee9Sriastradh  *
50*448b1ee9Sriastradh  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
51*448b1ee9Sriastradh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
52*448b1ee9Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53*448b1ee9Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
54*448b1ee9Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
55*448b1ee9Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
56*448b1ee9Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
57*448b1ee9Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
58*448b1ee9Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
59*448b1ee9Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60*448b1ee9Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
61*448b1ee9Sriastradh  */
62*448b1ee9Sriastradh 
63*448b1ee9Sriastradh #ifndef	_X86_BOOTSPACE_H_
64*448b1ee9Sriastradh #define	_X86_BOOTSPACE_H_
65*448b1ee9Sriastradh 
66*448b1ee9Sriastradh #include <sys/types.h>
67*448b1ee9Sriastradh 
68*448b1ee9Sriastradh #define BTSEG_NONE	0
69*448b1ee9Sriastradh #define BTSEG_TEXT	1
70*448b1ee9Sriastradh #define BTSEG_RODATA	2
71*448b1ee9Sriastradh #define BTSEG_DATA	3
72*448b1ee9Sriastradh #define BTSPACE_NSEGS	64
73*448b1ee9Sriastradh 
74*448b1ee9Sriastradh struct bootspace {
75*448b1ee9Sriastradh 	struct {
76*448b1ee9Sriastradh 		vaddr_t va;
77*448b1ee9Sriastradh 		paddr_t pa;
78*448b1ee9Sriastradh 		size_t sz;
79*448b1ee9Sriastradh 	} head;
80*448b1ee9Sriastradh 
81*448b1ee9Sriastradh 	/* Kernel segments. */
82*448b1ee9Sriastradh 	struct {
83*448b1ee9Sriastradh 		int type;
84*448b1ee9Sriastradh 		vaddr_t va;
85*448b1ee9Sriastradh 		paddr_t pa;
86*448b1ee9Sriastradh 		size_t sz;
87*448b1ee9Sriastradh 	} segs[BTSPACE_NSEGS];
88*448b1ee9Sriastradh 
89*448b1ee9Sriastradh 	/*
90*448b1ee9Sriastradh 	 * The area used by the early kernel bootstrap. It contains the kernel
91*448b1ee9Sriastradh 	 * symbols, the preloaded modules, the bootstrap tables, and the ISA I/O
92*448b1ee9Sriastradh 	 * mem.
93*448b1ee9Sriastradh 	 */
94*448b1ee9Sriastradh 	struct {
95*448b1ee9Sriastradh 		vaddr_t va;
96*448b1ee9Sriastradh 		paddr_t pa;
97*448b1ee9Sriastradh 		size_t sz;
98*448b1ee9Sriastradh 	} boot;
99*448b1ee9Sriastradh 
100*448b1ee9Sriastradh 	/* A magic VA usable by the bootstrap code. */
101*448b1ee9Sriastradh 	vaddr_t spareva;
102*448b1ee9Sriastradh 
103*448b1ee9Sriastradh 	/* Virtual address of the page directory. */
104*448b1ee9Sriastradh 	vaddr_t pdir;
105*448b1ee9Sriastradh 
106*448b1ee9Sriastradh 	/* Area dedicated to kernel modules (amd64 only). */
107*448b1ee9Sriastradh 	vaddr_t smodule;
108*448b1ee9Sriastradh 	vaddr_t emodule;
109*448b1ee9Sriastradh };
110*448b1ee9Sriastradh 
111*448b1ee9Sriastradh #endif	/* _X86_BOOTSPACE_H_ */
112