xref: /illumos-gate/usr/src/uts/intel/sys/bootinfo.h (revision 6554ec17)
1ae115bc7Smrj /*
2ae115bc7Smrj  * CDDL HEADER START
3ae115bc7Smrj  *
4ae115bc7Smrj  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
7ae115bc7Smrj  *
8ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10ae115bc7Smrj  * See the License for the specific language governing permissions
11ae115bc7Smrj  * and limitations under the License.
12ae115bc7Smrj  *
13ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18ae115bc7Smrj  *
19ae115bc7Smrj  * CDDL HEADER END
20ae115bc7Smrj  */
21ae115bc7Smrj 
22ae115bc7Smrj /*
231de082f7SVikram Hegde  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24ae115bc7Smrj  * Use is subject to license terms.
25ae115bc7Smrj  */
26ae115bc7Smrj 
27*6554ec17SJohn Levon /*
28*6554ec17SJohn Levon  * Copyright 2020 Joyent, Inc.
29*6554ec17SJohn Levon  */
30*6554ec17SJohn Levon 
31ae115bc7Smrj #ifndef	_SYS_BOOTINFO_H
32ae115bc7Smrj #define	_SYS_BOOTINFO_H
33ae115bc7Smrj 
34ae115bc7Smrj #ifdef	__cplusplus
35ae115bc7Smrj extern "C" {
36ae115bc7Smrj #endif
37ae115bc7Smrj 
380181461bSKeith M Wesolowski /*
390181461bSKeith M Wesolowski  * This is used by bootfs and dboot.  It should be at least as large as the
400181461bSKeith M Wesolowski  * number of modules that bootloaders (e.g., grub) can support.  This figure
410181461bSKeith M Wesolowski  * has been chosen to match grub's value exactly.
420181461bSKeith M Wesolowski  */
430181461bSKeith M Wesolowski #define	MAX_BOOT_MODULES	99
440181461bSKeith M Wesolowski 
45ae115bc7Smrj /*
46ae115bc7Smrj  * The 32-bit kernel loader code needs to build several structures that the
47ae115bc7Smrj  * kernel is expecting. They will contain native sized pointers for the
48ae115bc7Smrj  * target kernel.
49ae115bc7Smrj  */
50ae115bc7Smrj 
51ae115bc7Smrj #if defined(_BOOT_TARGET_amd64)
52ae115bc7Smrj 
53ae115bc7Smrj typedef uint64_t native_ptr_t;
54ae115bc7Smrj 
55ae115bc7Smrj #elif defined(_BOOT_TARGET_i386)
56ae115bc7Smrj 
57ae115bc7Smrj typedef uint32_t native_ptr_t;
58ae115bc7Smrj 
59ae115bc7Smrj #elif defined(_KERNEL)
60ae115bc7Smrj 
61ae115bc7Smrj typedef void *native_ptr_t;
62ae115bc7Smrj 
63ae115bc7Smrj #endif
64ae115bc7Smrj 
650181461bSKeith M Wesolowski typedef enum boot_module_type {
660181461bSKeith M Wesolowski 	BMT_ROOTFS,
670181461bSKeith M Wesolowski 	BMT_FILE,
68f289ce6eSToomas Soome 	BMT_HASH,
69cbc8e155SToomas Soome 	BMT_ENV,
70cbc8e155SToomas Soome 	BMT_FONT
710181461bSKeith M Wesolowski } boot_module_type_t;
720181461bSKeith M Wesolowski 
73ae115bc7Smrj struct boot_memlist {
74ae115bc7Smrj 	uint64_t	addr;
75ae115bc7Smrj 	uint64_t	size;
76ae115bc7Smrj 	native_ptr_t	next;
77ae115bc7Smrj 	native_ptr_t	prev;
78ae115bc7Smrj };
79ae115bc7Smrj 
80ae115bc7Smrj /*
81ae115bc7Smrj  * The kernel needs to know how to find its modules.
82ae115bc7Smrj  */
83ae115bc7Smrj struct boot_modules {
840181461bSKeith M Wesolowski 	native_ptr_t		bm_addr;
850181461bSKeith M Wesolowski 	native_ptr_t		bm_name;
860181461bSKeith M Wesolowski 	native_ptr_t		bm_hash;
870181461bSKeith M Wesolowski 	uint32_t		bm_size;
880181461bSKeith M Wesolowski 	boot_module_type_t	bm_type;
89ae115bc7Smrj };
90ae115bc7Smrj 
9141f1e5ceSToomas Soome /* To help to identify UEFI system. */
9241f1e5ceSToomas Soome typedef enum uefi_arch_type {
9341f1e5ceSToomas Soome 	XBI_UEFI_ARCH_NONE,
9441f1e5ceSToomas Soome 	XBI_UEFI_ARCH_32,
9541f1e5ceSToomas Soome 	XBI_UEFI_ARCH_64
9641f1e5ceSToomas Soome } uefi_arch_type_t;
97ae115bc7Smrj /*
98ae115bc7Smrj  *
99ae115bc7Smrj  */
100ae115bc7Smrj #pragma pack(1)
101ae115bc7Smrj struct xboot_info {
102ae115bc7Smrj 	uint64_t	bi_next_paddr;	/* next physical address not used */
103ae115bc7Smrj 	native_ptr_t	bi_next_vaddr;	/* next virtual address not used */
104ae115bc7Smrj 	native_ptr_t	bi_cmdline;
105ae115bc7Smrj 	native_ptr_t	bi_phys_install;
1061de082f7SVikram Hegde 	native_ptr_t	bi_rsvdmem;
107c9464e8bSjosephb 	native_ptr_t	bi_pcimem;
108ae115bc7Smrj 	native_ptr_t	bi_modules;
109ae115bc7Smrj 	uint32_t	bi_module_cnt;
110ae115bc7Smrj 	uint32_t	bi_use_largepage;	/* MMU uses large pages */
111ae115bc7Smrj 	uint32_t	bi_use_pae;	/* MMU uses PAE mode (8 byte PTES) */
112ae115bc7Smrj 	uint32_t	bi_use_nx;	/* MMU uses NX bit in PTEs */
113ae115bc7Smrj 	uint32_t	bi_use_pge;	/* MMU uses Page Global Enable */
114ae115bc7Smrj 	native_ptr_t	bi_pt_window;
115ae115bc7Smrj 	native_ptr_t	bi_pte_to_pt_window;
116ae115bc7Smrj 	native_ptr_t	bi_kseg_size;	/* size used for kernel nucleus pages */
117ae115bc7Smrj 	uint64_t	bi_top_page_table;
118843e1988Sjohnlev #if defined(__xpv)
119843e1988Sjohnlev 	native_ptr_t	bi_xen_start_info;
120843e1988Sjohnlev 	native_ptr_t	bi_shared_info;		/* VA for shared_info */
121843e1988Sjohnlev #else
1221738dd6eSToomas Soome 	native_ptr_t	bi_mb_info;		/* multiboot 1 or 2 info */
1231738dd6eSToomas Soome 	int		bi_mb_version;		/* multiboot version */
1241738dd6eSToomas Soome 	native_ptr_t	bi_acpi_rsdp;
125*6554ec17SJohn Levon 	native_ptr_t	bi_acpi_rsdp_copy;
12694fe7a15SToomas Soome 	native_ptr_t	bi_smbios;
12741f1e5ceSToomas Soome 	native_ptr_t	bi_uefi_systab;
12841f1e5ceSToomas Soome 	uefi_arch_type_t bi_uefi_arch;
129843e1988Sjohnlev #endif
13041f1e5ceSToomas Soome 	native_ptr_t	bi_framebuffer;
131ae115bc7Smrj };
132ae115bc7Smrj #pragma pack()
133ae115bc7Smrj 
134ae115bc7Smrj #ifdef	__cplusplus
135ae115bc7Smrj }
136ae115bc7Smrj #endif
137ae115bc7Smrj 
138ae115bc7Smrj #endif	/* _SYS_BOOTINFO_H */
139