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 * Copyright 2016 Nexenta Systems, Inc. 26 */ 27 28 #ifndef _SYS_BOOTCONF_H 29 #define _SYS_BOOTCONF_H 30 31 32 /* 33 * Boot time configuration information objects 34 */ 35 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 */ 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /* 49 * Boot property names 50 */ 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" 56 57 /* 58 * masks to hand to bsys_alloc memory allocator 59 * XXX These names shouldn't really be srmmu derived. 60 */ 61 #define BO_NO_ALIGN 0x00001000 62 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 68 69 /* return values for the newer bootops */ 70 #define BOOT_SUCCESS 0 71 #define BOOT_FAILURE (-1) 72 73 /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */ 74 #define MAGIC_PHYS 0xF00000 75 76 /* 77 * We pass a ptr to the space that boot has been using 78 * for its memory lists. 79 */ 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 */ 87 }; 88 89 /* 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. 94 */ 95 #define BO_VERSION 10 /* bootops interface revision # */ 96 97 typedef struct bootops { 98 /* 99 * the ubiquitous version number 100 */ 101 uint_t bsys_version; 102 103 /* 104 * the area containing boot's memlists 105 */ 106 struct bsys_mem *boot_mem; 107 108 /* 109 * have boot allocate size bytes at virthint 110 */ 111 caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size, 112 int align); 113 114 /* 115 * free size bytes allocated at virt - put the 116 * address range back onto the avail lists. 117 */ 118 void (*bsys_free)(struct bootops *, caddr_t virt, size_t size); 119 120 /* 121 * to find the size of the buffer to allocate 122 */ 123 int (*bsys_getproplen)(struct bootops *, const char *); 124 125 /* 126 * get the value associated with this name 127 */ 128 int (*bsys_getprop)(struct bootops *, const char *, void *); 129 130 /* 131 * get the name of the next property in succession 132 * from the standalone 133 */ 134 char *(*bsys_nextprop)(struct bootops *, char *prevprop); 135 136 /* 137 * print formatted output 138 */ 139 void (*bsys_printf)(struct bootops *, const char *, ...); 140 141 /* 142 * Do a real mode interrupt 143 */ 144 void (*bsys_doint)(struct bootops *, int, struct bop_regs *); 145 146 /* 147 * Enhanced version of bsys_alloc(). 148 */ 149 caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size, 150 int align, int flags); 151 152 /* end of bootops which exist if (bootops-extensions >= 1) */ 153 } bootops_t; 154 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) 165 166 #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg) 167 168 #if defined(_KERNEL) && !defined(_BOOT) 169 170 /* 171 * Boot configuration information 172 */ 173 174 #define BO_MAXFSNAME 16 175 #define BO_MAXOBJNAME 256 176 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; 186 }; 187 188 /* 189 * flags 190 */ 191 #define BO_VALID 0x01 /* all information in object is valid */ 192 #define BO_BUSY 0x02 /* object is busy */ 193 194 extern struct bootobj rootfs; 195 extern struct bootobj swapfile; 196 197 extern char obp_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