xref: /titanic_50/usr/src/uts/intel/sys/bootconf.h (revision a69116193464f859a8b27a2db19ad330ce163a55)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_BOOTCONF_H
28 #define	_SYS_BOOTCONF_H
29 
30 
31 /*
32  * Boot time configuration information objects
33  */
34 
35 #include <sys/types.h>
36 #include <sys/bootregs.h>		/* for struct bop_regs */
37 #include <sys/bootstat.h>
38 #include <sys/dirent.h>			/* for struct dirent */
39 #include <sys/memlist.h>
40 #include <sys/obpdefs.h>
41 #include <net/if.h>			/* for IFNAMSIZ */
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Boot property names
49  */
50 #define	BP_CPU_APICID_ARRAY	"cpu_apicid_array"
51 #define	BP_LGRP_SLIT_ENABLE	"lgrp_slit_enable"
52 #define	BP_LGRP_SRAT_ENABLE	"lgrp_srat_enable"
53 #define	BP_LGRP_MSCT_ENABLE	"lgrp_msct_enable"
54 #define	BP_LGRP_TOPO_LEVELS	"lgrp_topo_levels"
55 
56 /*
57  * masks to hand to bsys_alloc memory allocator
58  * XXX	These names shouldn't really be srmmu derived.
59  */
60 #define	BO_NO_ALIGN	0x00001000
61 
62 /* flags for BOP_EALLOC */
63 #define	BOPF_X86_ALLOC_CLIENT	0x001
64 #define	BOPF_X86_ALLOC_REAL	0x002
65 #define	BOPF_X86_ALLOC_IDMAP	0x003
66 #define	BOPF_X86_ALLOC_PHYS	0x004
67 
68 /* return values for the newer bootops */
69 #define	BOOT_SUCCESS	0
70 #define	BOOT_FAILURE	(-1)
71 
72 /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
73 #define	MAGIC_PHYS	0xF00000
74 
75 /*
76  *  We pass a ptr to the space that boot has been using
77  *  for its memory lists.
78  */
79 struct bsys_mem {
80 	struct memlist	*physinstalled;	/* amt of physmem installed */
81 	struct memlist	*rsvdmem;	/* amt of bios reserved mem */
82 	struct memlist	*physavail;	/* amt of physmem avail for use */
83 	struct memlist	*virtavail;	/* amt of virtmem avail for use */
84 	struct memlist	*pcimem;	/* amt of pcimem avail for use */
85 	uint_t		extent; 	/* number of bytes in the space */
86 };
87 
88 /*
89  * Warning: Changing BO_VERSION blows compatibility between booters
90  *          and older kernels.  If you want to change the struct bootops,
91  *          please consider adding new stuff to the end and using the
92  *          "bootops-extensions" mechanism described below.
93  */
94 #define	BO_VERSION	10		/* bootops interface revision # */
95 
96 typedef struct bootops {
97 	/*
98 	 * the ubiquitous version number
99 	 */
100 	uint_t	bsys_version;
101 
102 	/*
103 	 * the area containing boot's memlists
104 	 */
105 	struct 	bsys_mem *boot_mem;
106 
107 	/*
108 	 * have boot allocate size bytes at virthint
109 	 */
110 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
111 		int align);
112 
113 	/*
114 	 * free size bytes allocated at virt - put the
115 	 * address range back onto the avail lists.
116 	 */
117 	void	(*bsys_free)(struct bootops *, caddr_t virt, size_t size);
118 
119 	/*
120 	 * to find the size of the buffer to allocate
121 	 */
122 	int	(*bsys_getproplen)(struct bootops *, const char *);
123 
124 	/*
125 	 * get the value associated with this name
126 	 */
127 	int	(*bsys_getprop)(struct bootops *, const char *, void *);
128 
129 	/*
130 	 * get the name of the next property in succession
131 	 * from the standalone
132 	 */
133 	char	*(*bsys_nextprop)(struct bootops *, char *prevprop);
134 
135 	/*
136 	 * print formatted output
137 	 */
138 	void	(*bsys_printf)(struct bootops *, const char *, ...);
139 
140 	/*
141 	 * Do a real mode interrupt
142 	 */
143 	void	(*bsys_doint)(struct bootops *, int, struct bop_regs *);
144 
145 	/*
146 	 * Enhanced version of bsys_alloc().
147 	 */
148 	caddr_t	(*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
149 		int align, int flags);
150 
151 	/* end of bootops which exist if (bootops-extensions >= 1) */
152 } bootops_t;
153 
154 #define	BOP_GETVERSION(bop)		((bop)->bsys_version)
155 #define	BOP_ALLOC(bop, virthint, size, align)	\
156 				((bop)->bsys_alloc)(bop, virthint, size, align)
157 #define	BOP_FREE(bop, virt, size)	((bop)->bsys_free)(bop, virt, size)
158 #define	BOP_GETPROPLEN(bop, name)	((bop)->bsys_getproplen)(bop, name)
159 #define	BOP_GETPROP(bop, name, buf)	((bop)->bsys_getprop)(bop, name, buf)
160 #define	BOP_NEXTPROP(bop, prev)		((bop)->bsys_nextprop)(bop, prev)
161 #define	BOP_DOINT(bop, intnum, rp)	((bop)->bsys_doint)(bop, intnum, rp)
162 #define	BOP_EALLOC(bop, virthint, size, align, flags)\
163 		((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
164 
165 #define	BOP_PUTSARG(bop, msg, arg)	((bop)->bsys_printf)(bop, msg, arg)
166 
167 #if defined(_KERNEL) && !defined(_BOOT)
168 
169 /*
170  * Boot configuration information
171  */
172 
173 #define	BO_MAXFSNAME	16
174 #define	BO_MAXOBJNAME	256
175 
176 struct bootobj {
177 	char	bo_fstype[BO_MAXFSNAME];	/* vfs type name (e.g. nfs) */
178 	char	bo_name[BO_MAXOBJNAME];		/* name of object */
179 	int	bo_flags;			/* flags, see below */
180 	int	bo_size;			/* number of blocks */
181 	struct vnode *bo_vp;			/* vnode of object */
182 	char	bo_devname[BO_MAXOBJNAME];
183 	char	bo_ifname[BO_MAXOBJNAME];
184 	int	bo_ppa;
185 };
186 
187 /*
188  * flags
189  */
190 #define	BO_VALID	0x01	/* all information in object is valid */
191 #define	BO_BUSY		0x02	/* object is busy */
192 
193 extern struct bootobj rootfs;
194 extern struct bootobj swapfile;
195 
196 extern char obp_bootpath[BO_MAXOBJNAME];
197 extern char svm_bootpath[BO_MAXOBJNAME];
198 
199 extern void *gfx_devinfo_list;
200 
201 extern dev_t getrootdev(void);
202 extern void getfsname(char *, char *, size_t);
203 extern int loadrootmodules(void);
204 
205 extern int strplumb(void);
206 extern int strplumb_load(void);
207 extern char *strplumb_get_netdev_path(void);
208 
209 extern void consconfig(void);
210 extern void release_bootstrap(void);
211 
212 extern void param_check(void);
213 extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
214 
215 extern int dhcpinit(void);
216 
217 extern struct bootops *bootops;
218 extern int netboot;
219 extern int swaploaded;
220 extern int modrootloaded;
221 extern char kern_bootargs[];
222 extern char kern_bootfile[];
223 extern char *kobj_module_path;
224 extern char *default_path;
225 extern char *dhcack;
226 extern int dhcacklen;
227 extern char dhcifname[IFNAMSIZ];
228 extern char *netdev_path;
229 
230 extern void bop_no_more_mem(void);
231 
232 /*PRINTFLIKE2*/
233 extern void bop_printf(struct bootops *, const char *, ...)
234     __KPRINTFLIKE(2);
235 
236 /*PRINTFLIKE1*/
237 extern void bop_panic(const char *, ...)
238     __KPRINTFLIKE(1) __NORETURN;
239 #pragma rarely_called(bop_panic)
240 
241 extern void boot_prop_finish(void);
242 
243 extern int bootprop_getval(const char *, u_longlong_t *);
244 
245 /*
246  * Back door to fakebop.c to get physical memory allocated.
247  * 64 bit data types are fixed for 32 bit PAE use.
248  */
249 extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
250 
251 extern int do_bsys_getproplen(bootops_t *, const char *);
252 extern int do_bsys_getprop(bootops_t *, const char *, void *);
253 
254 #endif /* _KERNEL && !_BOOT */
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif	/* _SYS_BOOTCONF_H */
261