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