xref: /titanic_50/usr/src/uts/intel/sys/bootconf.h (revision e64d0ff97a1fb57a6e93e6d31ea549511c90b318)
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_TOPO_LEVELS	"lgrp_topo_levels"
54 
55 /*
56  * masks to hand to bsys_alloc memory allocator
57  * XXX	These names shouldn't really be srmmu derived.
58  */
59 #define	BO_NO_ALIGN	0x00001000
60 
61 /* flags for BOP_EALLOC */
62 #define	BOPF_X86_ALLOC_CLIENT	0x001
63 #define	BOPF_X86_ALLOC_REAL	0x002
64 #define	BOPF_X86_ALLOC_IDMAP	0x003
65 #define	BOPF_X86_ALLOC_PHYS	0x004
66 
67 /* return values for the newer bootops */
68 #define	BOOT_SUCCESS	0
69 #define	BOOT_FAILURE	(-1)
70 
71 /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
72 #define	MAGIC_PHYS	0xF00000
73 
74 /*
75  *  We pass a ptr to the space that boot has been using
76  *  for its memory lists.
77  */
78 struct bsys_mem {
79 	struct memlist	*physinstalled;	/* amt of physmem installed */
80 	struct memlist	*rsvdmem;	/* amt of bios reserved mem */
81 	struct memlist	*physavail;	/* amt of physmem avail for use */
82 	struct memlist	*virtavail;	/* amt of virtmem avail for use */
83 	struct memlist	*pcimem;	/* amt of pcimem avail for use */
84 	uint_t		extent; 	/* number of bytes in the space */
85 };
86 
87 /*
88  * Warning: Changing BO_VERSION blows compatibility between booters
89  *          and older kernels.  If you want to change the struct bootops,
90  *          please consider adding new stuff to the end and using the
91  *          "bootops-extensions" mechanism described below.
92  */
93 #define	BO_VERSION	10		/* bootops interface revision # */
94 
95 typedef struct bootops {
96 	/*
97 	 * the ubiquitous version number
98 	 */
99 	uint_t	bsys_version;
100 
101 	/*
102 	 * the area containing boot's memlists
103 	 */
104 	struct 	bsys_mem *boot_mem;
105 
106 	/*
107 	 * have boot allocate size bytes at virthint
108 	 */
109 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
110 		int align);
111 
112 	/*
113 	 * free size bytes allocated at virt - put the
114 	 * address range back onto the avail lists.
115 	 */
116 	void	(*bsys_free)(struct bootops *, caddr_t virt, size_t size);
117 
118 	/*
119 	 * to find the size of the buffer to allocate
120 	 */
121 	int	(*bsys_getproplen)(struct bootops *, const char *);
122 
123 	/*
124 	 * get the value associated with this name
125 	 */
126 	int	(*bsys_getprop)(struct bootops *, const char *, void *);
127 
128 	/*
129 	 * get the name of the next property in succession
130 	 * from the standalone
131 	 */
132 	char	*(*bsys_nextprop)(struct bootops *, char *prevprop);
133 
134 	/*
135 	 * print formatted output
136 	 */
137 	void	(*bsys_printf)(struct bootops *, const char *, ...);
138 
139 	/*
140 	 * Do a real mode interrupt
141 	 */
142 	void	(*bsys_doint)(struct bootops *, int, struct bop_regs *);
143 
144 	/*
145 	 * Enhanced version of bsys_alloc().
146 	 */
147 	caddr_t	(*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
148 		int align, int flags);
149 
150 	/* end of bootops which exist if (bootops-extensions >= 1) */
151 } bootops_t;
152 
153 #define	BOP_GETVERSION(bop)		((bop)->bsys_version)
154 #define	BOP_ALLOC(bop, virthint, size, align)	\
155 				((bop)->bsys_alloc)(bop, virthint, size, align)
156 #define	BOP_FREE(bop, virt, size)	((bop)->bsys_free)(bop, virt, size)
157 #define	BOP_GETPROPLEN(bop, name)	((bop)->bsys_getproplen)(bop, name)
158 #define	BOP_GETPROP(bop, name, buf)	((bop)->bsys_getprop)(bop, name, buf)
159 #define	BOP_NEXTPROP(bop, prev)		((bop)->bsys_nextprop)(bop, prev)
160 #define	BOP_DOINT(bop, intnum, rp)	((bop)->bsys_doint)(bop, intnum, rp)
161 #define	BOP_EALLOC(bop, virthint, size, align, flags)\
162 		((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
163 
164 #define	BOP_PUTSARG(bop, msg, arg)	((bop)->bsys_printf)(bop, msg, arg)
165 
166 #if defined(_KERNEL) && !defined(_BOOT)
167 
168 /*
169  * Boot configuration information
170  */
171 
172 #define	BO_MAXFSNAME	16
173 #define	BO_MAXOBJNAME	256
174 
175 struct bootobj {
176 	char	bo_fstype[BO_MAXFSNAME];	/* vfs type name (e.g. nfs) */
177 	char	bo_name[BO_MAXOBJNAME];		/* name of object */
178 	int	bo_flags;			/* flags, see below */
179 	int	bo_size;			/* number of blocks */
180 	struct vnode *bo_vp;			/* vnode of object */
181 	char	bo_devname[BO_MAXOBJNAME];
182 	char	bo_ifname[BO_MAXOBJNAME];
183 	int	bo_ppa;
184 };
185 
186 /*
187  * flags
188  */
189 #define	BO_VALID	0x01	/* all information in object is valid */
190 #define	BO_BUSY		0x02	/* object is busy */
191 
192 extern struct bootobj rootfs;
193 extern struct bootobj swapfile;
194 
195 extern char obp_bootpath[BO_MAXOBJNAME];
196 extern char svm_bootpath[BO_MAXOBJNAME];
197 
198 extern void *gfx_devinfo_list;
199 
200 extern dev_t getrootdev(void);
201 extern void getfsname(char *, char *, size_t);
202 extern int loadrootmodules(void);
203 
204 extern int strplumb(void);
205 extern int strplumb_load(void);
206 extern char *strplumb_get_netdev_path(void);
207 
208 extern void consconfig(void);
209 extern void release_bootstrap(void);
210 
211 extern void param_check(void);
212 extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
213 
214 extern int dhcpinit(void);
215 
216 /*
217  * XXX	The memlist stuff belongs in a header of its own
218  */
219 extern int check_boot_version(int);
220 extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t);
221 extern int copy_physavail(struct memlist *, struct memlist **,
222     uint_t, uint_t);
223 extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *);
224 extern int check_memexp(struct memlist *, uint_t);
225 extern void copy_memlist_filter(struct memlist *, struct memlist **,
226     void (*filter)(uint64_t *, uint64_t *));
227 
228 extern struct bootops *bootops;
229 extern int netboot;
230 extern int swaploaded;
231 extern int modrootloaded;
232 extern char kern_bootargs[];
233 extern char kern_bootfile[];
234 extern char *kobj_module_path;
235 extern char *default_path;
236 extern char *dhcack;
237 extern int dhcacklen;
238 extern char dhcifname[IFNAMSIZ];
239 extern char *netdev_path;
240 
241 extern void bop_no_more_mem(void);
242 
243 /*PRINTFLIKE2*/
244 extern void bop_printf(struct bootops *, const char *, ...)
245     __KPRINTFLIKE(2);
246 
247 /*PRINTFLIKE1*/
248 extern void bop_panic(const char *, ...)
249     __KPRINTFLIKE(1) __NORETURN;
250 #pragma rarely_called(bop_panic)
251 
252 extern void boot_prop_finish(void);
253 
254 extern int bootprop_getval(const char *, u_longlong_t *);
255 
256 /*
257  * Back door to fakebop.c to get physical memory allocated.
258  * 64 bit data types are fixed for 32 bit PAE use.
259  */
260 extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
261 
262 extern int do_bsys_getproplen(bootops_t *, const char *);
263 extern int do_bsys_getprop(bootops_t *, const char *, void *);
264 
265 #endif /* _KERNEL && !_BOOT */
266 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif	/* _SYS_BOOTCONF_H */
272