Unleashed v1.4
[unleashed.git] / arch / x86 / include / sys / bootconf.h
blob27a89206cf00c506dde9e8388559d5cc6d3569dc
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 <sys/varargs.h>
43 #include <net/if.h> /* for IFNAMSIZ */
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 * Boot property names
52 #define BP_CPU_APICID_ARRAY "cpu_apicid_array"
53 #define BP_LGRP_SLIT_ENABLE "lgrp_slit_enable"
54 #define BP_LGRP_SRAT_ENABLE "lgrp_srat_enable"
55 #define BP_LGRP_MSCT_ENABLE "lgrp_msct_enable"
56 #define BP_LGRP_TOPO_LEVELS "lgrp_topo_levels"
59 * masks to hand to bsys_alloc memory allocator
60 * XXX These names shouldn't really be srmmu derived.
62 #define BO_NO_ALIGN 0x00001000
64 /* flags for BOP_EALLOC */
65 #define BOPF_X86_ALLOC_CLIENT 0x001
66 #define BOPF_X86_ALLOC_REAL 0x002
67 #define BOPF_X86_ALLOC_IDMAP 0x003
68 #define BOPF_X86_ALLOC_PHYS 0x004
70 /* return values for the newer bootops */
71 #define BOOT_SUCCESS 0
72 #define BOOT_FAILURE (-1)
74 /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
75 #define MAGIC_PHYS 0xF00000
78 * We pass a ptr to the space that boot has been using
79 * for its memory lists.
81 struct bsys_mem {
82 struct memlist *physinstalled; /* amt of physmem installed */
83 struct memlist *rsvdmem; /* amt of bios reserved mem */
84 struct memlist *physavail; /* amt of physmem avail for use */
85 struct memlist *virtavail; /* amt of virtmem avail for use */
86 struct memlist *pcimem; /* amt of pcimem avail for use */
87 uint_t extent; /* number of bytes in the space */
91 * Warning: Changing BO_VERSION blows compatibility between booters
92 * and older kernels. If you want to change the struct bootops,
93 * please consider adding new stuff to the end and using the
94 * "bootops-extensions" mechanism described below.
96 #define BO_VERSION 10 /* bootops interface revision # */
98 typedef struct bootops {
100 * the ubiquitous version number
102 uint_t bsys_version;
105 * the area containing boot's memlists
107 struct bsys_mem *boot_mem;
110 * have boot allocate size bytes at virthint
112 caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
113 int align);
116 * free size bytes allocated at virt - put the
117 * address range back onto the avail lists.
119 void (*bsys_free)(struct bootops *, caddr_t virt, size_t size);
122 * to find the size of the buffer to allocate
124 int (*bsys_getproplen)(struct bootops *, const char *);
127 * get the value associated with this name
129 int (*bsys_getprop)(struct bootops *, const char *, void *);
132 * get the name of the next property in succession
133 * from the standalone
135 char *(*bsys_nextprop)(struct bootops *, char *prevprop);
138 * print formatted output
140 void (*bsys_printf)(void *, const char *, ...);
143 * Do a real mode interrupt
145 void (*bsys_doint)(struct bootops *, int, struct bop_regs *);
148 * Enhanced version of bsys_alloc().
150 caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
151 int align, int flags);
153 /* end of bootops which exist if (bootops-extensions >= 1) */
154 } bootops_t;
156 #define BOP_GETVERSION(bop) ((bop)->bsys_version)
157 #define BOP_ALLOC(bop, virthint, size, align) \
158 ((bop)->bsys_alloc)(bop, virthint, size, align)
159 #define BOP_FREE(bop, virt, size) ((bop)->bsys_free)(bop, virt, size)
160 #define BOP_GETPROPLEN(bop, name) ((bop)->bsys_getproplen)(bop, name)
161 #define BOP_GETPROP(bop, name, buf) ((bop)->bsys_getprop)(bop, name, buf)
162 #define BOP_NEXTPROP(bop, prev) ((bop)->bsys_nextprop)(bop, prev)
163 #define BOP_DOINT(bop, intnum, rp) ((bop)->bsys_doint)(bop, intnum, rp)
164 #define BOP_EALLOC(bop, virthint, size, align, flags)\
165 ((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
167 #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg)
169 #if defined(_KERNEL) && !defined(_BOOT)
172 * Boot configuration information
175 #define BO_MAXFSNAME 16
176 #define BO_MAXOBJNAME 256
178 struct bootobj {
179 char bo_fstype[BO_MAXFSNAME]; /* vfs type name (e.g. nfs) */
180 char bo_name[BO_MAXOBJNAME]; /* name of object */
181 int bo_flags; /* flags, see below */
182 int bo_size; /* number of blocks */
183 struct vnode *bo_vp; /* vnode of object */
184 char bo_devname[BO_MAXOBJNAME];
185 char bo_ifname[BO_MAXOBJNAME];
186 int bo_ppa;
190 * flags
192 #define BO_VALID 0x01 /* all information in object is valid */
193 #define BO_BUSY 0x02 /* object is busy */
195 extern struct bootobj rootfs;
196 extern struct bootobj swapfile;
198 extern char obp_bootpath[BO_MAXOBJNAME];
200 extern void *gfx_devinfo_list;
202 extern dev_t getrootdev(void);
203 extern void getfsname(char *, char *, size_t);
204 extern int loadrootmodules(void);
206 extern int strplumb(void);
207 extern int strplumb_load(void);
208 extern char *strplumb_get_netdev_path(void);
210 extern void consconfig(void);
211 extern void release_bootstrap(void);
213 extern void param_check(void);
214 extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
216 extern int dhcpinit(void);
218 extern struct bootops *bootops;
219 extern int netboot;
220 extern int swaploaded;
221 extern int modrootloaded;
222 extern char kern_bootargs[];
223 extern char kern_bootfile[];
224 extern char *kobj_module_path;
225 extern char *default_path;
226 extern char *dhcack;
227 extern int dhcacklen;
228 extern char dhcifname[IFNAMSIZ];
229 extern char *netdev_path;
231 extern void bop_no_more_mem(void);
233 /*PRINTFLIKE2*/
234 extern void bop_printf(void *, const char *, ...)
235 __KPRINTFLIKE(2);
236 extern void vbop_printf(void *, const char *, va_list);
238 /*PRINTFLIKE1*/
239 extern void bop_panic(const char *, ...)
240 __KPRINTFLIKE(1) __NORETURN;
241 #pragma rarely_called(bop_panic)
243 extern void boot_prop_finish(void);
245 extern int bootprop_getval(const char *, u_longlong_t *);
248 * Back door to fakebop.c to get physical memory allocated.
249 * 64 bit data types are fixed for 32 bit PAE use.
251 extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
253 extern int do_bsys_getproplen(bootops_t *, const char *);
254 extern int do_bsys_getprop(bootops_t *, const char *, void *);
255 extern int do_bsys_getproptype(bootops_t *, const char *);
257 #endif /* _KERNEL && !_BOOT */
259 #ifdef __cplusplus
261 #endif
263 #endif /* _SYS_BOOTCONF_H */