9854 uts: add type for early boot properties
[unleashed.git] / usr / src / uts / intel / sys / bootconf.h
blob03bd4b70b8dd1a8d551da74581a23fe352cd23f8
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2016 Nexenta Systems, Inc.
28 #ifndef _SYS_BOOTCONF_H
29 #define _SYS_BOOTCONF_H
33 * Boot time configuration information objects
36 #include <sys/types.h>
37 #include <sys/bootregs.h> /* for struct bop_regs */
38 #include <sys/bootstat.h>
39 #include <sys/dirent.h> /* for struct dirent */
40 #include <sys/memlist.h>
41 #include <sys/obpdefs.h>
42 #include <net/if.h> /* for IFNAMSIZ */
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
49 * Boot property names
51 #define BP_CPU_APICID_ARRAY "cpu_apicid_array"
52 #define BP_LGRP_SLIT_ENABLE "lgrp_slit_enable"
53 #define BP_LGRP_SRAT_ENABLE "lgrp_srat_enable"
54 #define BP_LGRP_MSCT_ENABLE "lgrp_msct_enable"
55 #define BP_LGRP_TOPO_LEVELS "lgrp_topo_levels"
58 * masks to hand to bsys_alloc memory allocator
59 * XXX These names shouldn't really be srmmu derived.
61 #define BO_NO_ALIGN 0x00001000
63 /* flags for BOP_EALLOC */
64 #define BOPF_X86_ALLOC_CLIENT 0x001
65 #define BOPF_X86_ALLOC_REAL 0x002
66 #define BOPF_X86_ALLOC_IDMAP 0x003
67 #define BOPF_X86_ALLOC_PHYS 0x004
69 /* return values for the newer bootops */
70 #define BOOT_SUCCESS 0
71 #define BOOT_FAILURE (-1)
73 /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
74 #define MAGIC_PHYS 0xF00000
77 * We pass a ptr to the space that boot has been using
78 * for its memory lists.
80 struct bsys_mem {
81 struct memlist *physinstalled; /* amt of physmem installed */
82 struct memlist *rsvdmem; /* amt of bios reserved mem */
83 struct memlist *physavail; /* amt of physmem avail for use */
84 struct memlist *virtavail; /* amt of virtmem avail for use */
85 struct memlist *pcimem; /* amt of pcimem avail for use */
86 uint_t extent; /* number of bytes in the space */
90 * Warning: Changing BO_VERSION blows compatibility between booters
91 * and older kernels. If you want to change the struct bootops,
92 * please consider adding new stuff to the end and using the
93 * "bootops-extensions" mechanism described below.
95 #define BO_VERSION 10 /* bootops interface revision # */
97 typedef struct bootops {
99 * the ubiquitous version number
101 uint_t bsys_version;
104 * the area containing boot's memlists
106 struct bsys_mem *boot_mem;
109 * have boot allocate size bytes at virthint
111 caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
112 int align);
115 * free size bytes allocated at virt - put the
116 * address range back onto the avail lists.
118 void (*bsys_free)(struct bootops *, caddr_t virt, size_t size);
121 * to find the size of the buffer to allocate
123 int (*bsys_getproplen)(struct bootops *, const char *);
126 * get the value associated with this name
128 int (*bsys_getprop)(struct bootops *, const char *, void *);
131 * get the name of the next property in succession
132 * from the standalone
134 char *(*bsys_nextprop)(struct bootops *, char *prevprop);
137 * print formatted output
139 void (*bsys_printf)(struct bootops *, const char *, ...);
142 * Do a real mode interrupt
144 void (*bsys_doint)(struct bootops *, int, struct bop_regs *);
147 * Enhanced version of bsys_alloc().
149 caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
150 int align, int flags);
152 /* end of bootops which exist if (bootops-extensions >= 1) */
153 } bootops_t;
155 #define BOP_GETVERSION(bop) ((bop)->bsys_version)
156 #define BOP_ALLOC(bop, virthint, size, align) \
157 ((bop)->bsys_alloc)(bop, virthint, size, align)
158 #define BOP_FREE(bop, virt, size) ((bop)->bsys_free)(bop, virt, size)
159 #define BOP_GETPROPLEN(bop, name) ((bop)->bsys_getproplen)(bop, name)
160 #define BOP_GETPROP(bop, name, buf) ((bop)->bsys_getprop)(bop, name, buf)
161 #define BOP_NEXTPROP(bop, prev) ((bop)->bsys_nextprop)(bop, prev)
162 #define BOP_DOINT(bop, intnum, rp) ((bop)->bsys_doint)(bop, intnum, rp)
163 #define BOP_EALLOC(bop, virthint, size, align, flags)\
164 ((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
166 #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg)
168 #if defined(_KERNEL) && !defined(_BOOT)
171 * Boot configuration information
174 #define BO_MAXFSNAME 16
175 #define BO_MAXOBJNAME 256
177 struct bootobj {
178 char bo_fstype[BO_MAXFSNAME]; /* vfs type name (e.g. nfs) */
179 char bo_name[BO_MAXOBJNAME]; /* name of object */
180 int bo_flags; /* flags, see below */
181 int bo_size; /* number of blocks */
182 struct vnode *bo_vp; /* vnode of object */
183 char bo_devname[BO_MAXOBJNAME];
184 char bo_ifname[BO_MAXOBJNAME];
185 int bo_ppa;
189 * flags
191 #define BO_VALID 0x01 /* all information in object is valid */
192 #define BO_BUSY 0x02 /* object is busy */
194 extern struct bootobj rootfs;
195 extern struct bootobj swapfile;
197 extern char obp_bootpath[BO_MAXOBJNAME];
199 extern void *gfx_devinfo_list;
201 extern dev_t getrootdev(void);
202 extern void getfsname(char *, char *, size_t);
203 extern int loadrootmodules(void);
205 extern int strplumb(void);
206 extern int strplumb_load(void);
207 extern char *strplumb_get_netdev_path(void);
209 extern void consconfig(void);
210 extern void release_bootstrap(void);
212 extern void param_check(void);
213 extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
215 extern int dhcpinit(void);
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;
230 extern void bop_no_more_mem(void);
232 /*PRINTFLIKE2*/
233 extern void bop_printf(struct bootops *, const char *, ...)
234 __KPRINTFLIKE(2);
236 /*PRINTFLIKE1*/
237 extern void bop_panic(const char *, ...)
238 __KPRINTFLIKE(1) __NORETURN;
239 #pragma rarely_called(bop_panic)
241 extern void boot_prop_finish(void);
243 extern int bootprop_getval(const char *, u_longlong_t *);
246 * Back door to fakebop.c to get physical memory allocated.
247 * 64 bit data types are fixed for 32 bit PAE use.
249 extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
251 extern int do_bsys_getproplen(bootops_t *, const char *);
252 extern int do_bsys_getprop(bootops_t *, const char *, void *);
253 extern int do_bsys_getproptype(bootops_t *, const char *);
255 #endif /* _KERNEL && !_BOOT */
257 #ifdef __cplusplus
259 #endif
261 #endif /* _SYS_BOOTCONF_H */