10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51544Seschrock * Common Development and Distribution License (the "License"). 61544Seschrock * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_BOOTCONF_H 270Sstevel@tonic-gate #define _SYS_BOOTCONF_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * Boot time configuration information objects 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/bootregs.h> /* for struct bop_regs */ 370Sstevel@tonic-gate #include <sys/bootstat.h> 380Sstevel@tonic-gate #include <sys/dirent.h> /* for struct dirent */ 390Sstevel@tonic-gate #include <sys/memlist.h> 400Sstevel@tonic-gate #include <sys/obpdefs.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate #ifdef __cplusplus 430Sstevel@tonic-gate extern "C" { 440Sstevel@tonic-gate #endif 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * masks to hand to bsys_alloc memory allocator 480Sstevel@tonic-gate * XXX These names shouldn't really be srmmu derived. 490Sstevel@tonic-gate */ 500Sstevel@tonic-gate #define BO_NO_ALIGN 0x00001000 510Sstevel@tonic-gate 520Sstevel@tonic-gate /* flags for BOP_EALLOC */ 530Sstevel@tonic-gate #define BOPF_X86_ALLOC_CLIENT 0x001 540Sstevel@tonic-gate #define BOPF_X86_ALLOC_REAL 0x002 550Sstevel@tonic-gate #define BOPF_X86_ALLOC_IDMAP 0x003 560Sstevel@tonic-gate #define BOPF_X86_ALLOC_PHYS 0x004 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* return values for the newer bootops */ 590Sstevel@tonic-gate #define BOOT_SUCCESS 0 600Sstevel@tonic-gate #define BOOT_FAILURE (-1) 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */ 630Sstevel@tonic-gate #define MAGIC_PHYS 0xF00000 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * We pass a ptr to the space that boot has been using 670Sstevel@tonic-gate * for its memory lists. 680Sstevel@tonic-gate */ 690Sstevel@tonic-gate struct bsys_mem { 700Sstevel@tonic-gate struct memlist *physinstalled; /* amt of physmem installed */ 710Sstevel@tonic-gate struct memlist *physavail; /* amt of physmem avail for use */ 720Sstevel@tonic-gate struct memlist *virtavail; /* amt of virtmem avail for use */ 730Sstevel@tonic-gate struct memlist *pcimem; /* amt of pcimem avail for use */ 740Sstevel@tonic-gate uint_t extent; /* number of bytes in the space */ 750Sstevel@tonic-gate }; 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* 780Sstevel@tonic-gate * Warning: Changing BO_VERSION blows compatibility between booters 790Sstevel@tonic-gate * and older kernels. If you want to change the struct bootops, 800Sstevel@tonic-gate * please consider adding new stuff to the end and using the 810Sstevel@tonic-gate * "bootops-extensions" mechanism described below. 820Sstevel@tonic-gate */ 830Sstevel@tonic-gate #define BO_VERSION 10 /* bootops interface revision # */ 840Sstevel@tonic-gate 850Sstevel@tonic-gate typedef struct bootops { 860Sstevel@tonic-gate /* 870Sstevel@tonic-gate * the ubiquitous version number 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate uint_t bsys_version; 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * the area containing boot's memlists 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate struct bsys_mem *boot_mem; 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* 970Sstevel@tonic-gate * have boot allocate size bytes at virthint 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size, 1000Sstevel@tonic-gate int align); 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* 1030Sstevel@tonic-gate * free size bytes allocated at virt - put the 1040Sstevel@tonic-gate * address range back onto the avail lists. 1050Sstevel@tonic-gate */ 1060Sstevel@tonic-gate void (*bsys_free)(struct bootops *, caddr_t virt, size_t size); 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * to find the size of the buffer to allocate 1100Sstevel@tonic-gate */ 1110Sstevel@tonic-gate int (*bsys_getproplen)(struct bootops *, char *name); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate /* 1140Sstevel@tonic-gate * get the value associated with this name 1150Sstevel@tonic-gate */ 1160Sstevel@tonic-gate int (*bsys_getprop)(struct bootops *, char *name, void *value); 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate /* 1190Sstevel@tonic-gate * get the name of the next property in succession 1200Sstevel@tonic-gate * from the standalone 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate char *(*bsys_nextprop)(struct bootops *, char *prevprop); 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * print formatted output 1260Sstevel@tonic-gate */ 1270Sstevel@tonic-gate void (*bsys_printf)(struct bootops *, char *, ...); 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate /* 1300Sstevel@tonic-gate * Do a real mode interrupt 1310Sstevel@tonic-gate */ 1320Sstevel@tonic-gate void (*bsys_doint)(struct bootops *, int, struct bop_regs *); 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate /* 1350Sstevel@tonic-gate * Enhanced version of bsys_alloc(). 1360Sstevel@tonic-gate */ 1370Sstevel@tonic-gate caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size, 1380Sstevel@tonic-gate int align, int flags); 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* end of bootops which exist if (bootops-extensions >= 1) */ 1410Sstevel@tonic-gate } bootops_t; 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate #define BOP_GETVERSION(bop) ((bop)->bsys_version) 1440Sstevel@tonic-gate #define BOP_ALLOC(bop, virthint, size, align) \ 1450Sstevel@tonic-gate ((bop)->bsys_alloc)(bop, virthint, size, align) 1460Sstevel@tonic-gate #define BOP_FREE(bop, virt, size) ((bop)->bsys_free)(bop, virt, size) 1470Sstevel@tonic-gate #define BOP_GETPROPLEN(bop, name) ((bop)->bsys_getproplen)(bop, name) 1480Sstevel@tonic-gate #define BOP_GETPROP(bop, name, buf) ((bop)->bsys_getprop)(bop, name, buf) 1490Sstevel@tonic-gate #define BOP_NEXTPROP(bop, prev) ((bop)->bsys_nextprop)(bop, prev) 1500Sstevel@tonic-gate #define BOP_DOINT(bop, intnum, rp) ((bop)->bsys_doint)(bop, intnum, rp) 1510Sstevel@tonic-gate #define BOP_EALLOC(bop, virthint, size, align, flags)\ 1520Sstevel@tonic-gate ((bop)->bsys_ealloc)(bop, virthint, size, align, flags) 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg) 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT) 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate /* 1590Sstevel@tonic-gate * Boot configuration information 1600Sstevel@tonic-gate */ 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate #define BO_MAXFSNAME 16 1630Sstevel@tonic-gate #define BO_MAXOBJNAME 256 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate struct bootobj { 1660Sstevel@tonic-gate char bo_fstype[BO_MAXFSNAME]; /* vfs type name (e.g. nfs) */ 1670Sstevel@tonic-gate char bo_name[BO_MAXOBJNAME]; /* name of object */ 1680Sstevel@tonic-gate int bo_flags; /* flags, see below */ 1690Sstevel@tonic-gate int bo_size; /* number of blocks */ 1700Sstevel@tonic-gate struct vnode *bo_vp; /* vnode of object */ 1710Sstevel@tonic-gate char bo_devname[BO_MAXOBJNAME]; 1720Sstevel@tonic-gate char bo_ifname[BO_MAXOBJNAME]; 1730Sstevel@tonic-gate int bo_ppa; 1740Sstevel@tonic-gate }; 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate /* 1770Sstevel@tonic-gate * flags 1780Sstevel@tonic-gate */ 1790Sstevel@tonic-gate #define BO_VALID 0x01 /* all information in object is valid */ 1800Sstevel@tonic-gate #define BO_BUSY 0x02 /* object is busy */ 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate extern struct bootobj rootfs; 1830Sstevel@tonic-gate extern struct bootobj swapfile; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME]; 1860Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME]; 1871544Seschrock extern char zfs_bootpath[BO_MAXOBJNAME]; 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate extern dev_t getrootdev(void); 1900Sstevel@tonic-gate extern void getfsname(char *, char *, size_t); 1910Sstevel@tonic-gate extern int loadrootmodules(void); 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate extern int strplumb(void); 1940Sstevel@tonic-gate extern int strplumb_load(void); 1950Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void); 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate extern void consconfig(void); 1980Sstevel@tonic-gate extern void release_bootstrap(void); 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate extern void param_check(void); 2010Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *); 2020Sstevel@tonic-gate 2030Sstevel@tonic-gate extern int dhcpinit(void); 2040Sstevel@tonic-gate 2050Sstevel@tonic-gate /* 2060Sstevel@tonic-gate * XXX The memlist stuff belongs in a header of its own 2070Sstevel@tonic-gate */ 2080Sstevel@tonic-gate extern int check_boot_version(int); 2090Sstevel@tonic-gate extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t); 2100Sstevel@tonic-gate extern int copy_physavail(struct memlist *, struct memlist **, 2110Sstevel@tonic-gate uint_t, uint_t); 2120Sstevel@tonic-gate extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *); 2130Sstevel@tonic-gate extern int check_memexp(struct memlist *, uint_t); 2140Sstevel@tonic-gate extern void copy_memlist_filter(struct memlist *, struct memlist **, 2150Sstevel@tonic-gate void (*filter)(uint64_t *, uint64_t *)); 2160Sstevel@tonic-gate 2170Sstevel@tonic-gate extern struct bootops *bootops; 2180Sstevel@tonic-gate extern int netboot; 2190Sstevel@tonic-gate extern int swaploaded; 2200Sstevel@tonic-gate extern int modrootloaded; 2210Sstevel@tonic-gate extern char kern_bootargs[]; 222*3446Smrj extern char *kobj_module_path; 2230Sstevel@tonic-gate extern char *default_path; 2240Sstevel@tonic-gate extern char *dhcack; 2250Sstevel@tonic-gate extern int dhcacklen; 2260Sstevel@tonic-gate extern char *netdev_path; 2270Sstevel@tonic-gate 228*3446Smrj extern void bop_no_more_mem(void); 229*3446Smrj 230*3446Smrj /*PRINTFLIKE2*/ 231*3446Smrj extern void bop_printf(struct bootops *, char *, ...) 232*3446Smrj __KPRINTFLIKE(2); 233*3446Smrj /*PRINTFLIKE1*/ 234*3446Smrj extern void bop_panic(char *, ...) 235*3446Smrj __KPRINTFLIKE(1); 236*3446Smrj extern void boot_prop_finish(void); 237*3446Smrj 238*3446Smrj /* 239*3446Smrj * Back door to fakebop.c to get physical memory allocated. 240*3446Smrj * 64 bit data types are fixed for 32 bit PAE use. 241*3446Smrj */ 242*3446Smrj extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t); 243*3446Smrj 244*3446Smrj 2450Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */ 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate #ifdef __cplusplus 2480Sstevel@tonic-gate } 2490Sstevel@tonic-gate #endif 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate #endif /* _SYS_BOOTCONF_H */ 252