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 */ 21*6336Sbholler 220Sstevel@tonic-gate /* 23*6336Sbholler * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_BOOTCONF_H 280Sstevel@tonic-gate #define _SYS_BOOTCONF_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * Boot time configuration information objects 340Sstevel@tonic-gate */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #include <sys/types.h> 370Sstevel@tonic-gate #include <sys/bootregs.h> /* for struct bop_regs */ 380Sstevel@tonic-gate #include <sys/bootstat.h> 395648Ssetje #include <sys/dirent.h> /* for struct dirent */ 400Sstevel@tonic-gate #include <sys/memlist.h> 410Sstevel@tonic-gate #include <sys/obpdefs.h> 425648Ssetje #include <net/if.h> /* for IFNAMSIZ */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate #ifdef __cplusplus 450Sstevel@tonic-gate extern "C" { 460Sstevel@tonic-gate #endif 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * masks to hand to bsys_alloc memory allocator 500Sstevel@tonic-gate * XXX These names shouldn't really be srmmu derived. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define BO_NO_ALIGN 0x00001000 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* flags for BOP_EALLOC */ 550Sstevel@tonic-gate #define BOPF_X86_ALLOC_CLIENT 0x001 560Sstevel@tonic-gate #define BOPF_X86_ALLOC_REAL 0x002 570Sstevel@tonic-gate #define BOPF_X86_ALLOC_IDMAP 0x003 580Sstevel@tonic-gate #define BOPF_X86_ALLOC_PHYS 0x004 590Sstevel@tonic-gate 600Sstevel@tonic-gate /* return values for the newer bootops */ 610Sstevel@tonic-gate #define BOOT_SUCCESS 0 620Sstevel@tonic-gate #define BOOT_FAILURE (-1) 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */ 650Sstevel@tonic-gate #define MAGIC_PHYS 0xF00000 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* 680Sstevel@tonic-gate * We pass a ptr to the space that boot has been using 690Sstevel@tonic-gate * for its memory lists. 700Sstevel@tonic-gate */ 710Sstevel@tonic-gate struct bsys_mem { 720Sstevel@tonic-gate struct memlist *physinstalled; /* amt of physmem installed */ 730Sstevel@tonic-gate struct memlist *physavail; /* amt of physmem avail for use */ 740Sstevel@tonic-gate struct memlist *virtavail; /* amt of virtmem avail for use */ 750Sstevel@tonic-gate struct memlist *pcimem; /* amt of pcimem avail for use */ 760Sstevel@tonic-gate uint_t extent; /* number of bytes in the space */ 770Sstevel@tonic-gate }; 780Sstevel@tonic-gate 790Sstevel@tonic-gate /* 800Sstevel@tonic-gate * Warning: Changing BO_VERSION blows compatibility between booters 810Sstevel@tonic-gate * and older kernels. If you want to change the struct bootops, 820Sstevel@tonic-gate * please consider adding new stuff to the end and using the 830Sstevel@tonic-gate * "bootops-extensions" mechanism described below. 840Sstevel@tonic-gate */ 850Sstevel@tonic-gate #define BO_VERSION 10 /* bootops interface revision # */ 860Sstevel@tonic-gate 870Sstevel@tonic-gate typedef struct bootops { 880Sstevel@tonic-gate /* 890Sstevel@tonic-gate * the ubiquitous version number 900Sstevel@tonic-gate */ 910Sstevel@tonic-gate uint_t bsys_version; 920Sstevel@tonic-gate 930Sstevel@tonic-gate /* 940Sstevel@tonic-gate * the area containing boot's memlists 950Sstevel@tonic-gate */ 960Sstevel@tonic-gate struct bsys_mem *boot_mem; 970Sstevel@tonic-gate 980Sstevel@tonic-gate /* 990Sstevel@tonic-gate * have boot allocate size bytes at virthint 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size, 1020Sstevel@tonic-gate int align); 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate /* 1050Sstevel@tonic-gate * free size bytes allocated at virt - put the 1060Sstevel@tonic-gate * address range back onto the avail lists. 1070Sstevel@tonic-gate */ 1080Sstevel@tonic-gate void (*bsys_free)(struct bootops *, caddr_t virt, size_t size); 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * to find the size of the buffer to allocate 1120Sstevel@tonic-gate */ 1135648Ssetje int (*bsys_getproplen)(struct bootops *, const char *); 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * get the value associated with this name 1170Sstevel@tonic-gate */ 1185648Ssetje int (*bsys_getprop)(struct bootops *, const char *, void *); 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate /* 1210Sstevel@tonic-gate * get the name of the next property in succession 1220Sstevel@tonic-gate * from the standalone 1230Sstevel@tonic-gate */ 1240Sstevel@tonic-gate char *(*bsys_nextprop)(struct bootops *, char *prevprop); 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate /* 1270Sstevel@tonic-gate * print formatted output 1280Sstevel@tonic-gate */ 1295648Ssetje void (*bsys_printf)(struct bootops *, const char *, ...); 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * Do a real mode interrupt 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate void (*bsys_doint)(struct bootops *, int, struct bop_regs *); 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* 1370Sstevel@tonic-gate * Enhanced version of bsys_alloc(). 1380Sstevel@tonic-gate */ 1390Sstevel@tonic-gate caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size, 1400Sstevel@tonic-gate int align, int flags); 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* end of bootops which exist if (bootops-extensions >= 1) */ 1430Sstevel@tonic-gate } bootops_t; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #define BOP_GETVERSION(bop) ((bop)->bsys_version) 1460Sstevel@tonic-gate #define BOP_ALLOC(bop, virthint, size, align) \ 1470Sstevel@tonic-gate ((bop)->bsys_alloc)(bop, virthint, size, align) 1480Sstevel@tonic-gate #define BOP_FREE(bop, virt, size) ((bop)->bsys_free)(bop, virt, size) 1490Sstevel@tonic-gate #define BOP_GETPROPLEN(bop, name) ((bop)->bsys_getproplen)(bop, name) 1500Sstevel@tonic-gate #define BOP_GETPROP(bop, name, buf) ((bop)->bsys_getprop)(bop, name, buf) 1510Sstevel@tonic-gate #define BOP_NEXTPROP(bop, prev) ((bop)->bsys_nextprop)(bop, prev) 1520Sstevel@tonic-gate #define BOP_DOINT(bop, intnum, rp) ((bop)->bsys_doint)(bop, intnum, rp) 1530Sstevel@tonic-gate #define BOP_EALLOC(bop, virthint, size, align, flags)\ 1540Sstevel@tonic-gate ((bop)->bsys_ealloc)(bop, virthint, size, align, flags) 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg) 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT) 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate /* 1610Sstevel@tonic-gate * Boot configuration information 1620Sstevel@tonic-gate */ 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate #define BO_MAXFSNAME 16 1650Sstevel@tonic-gate #define BO_MAXOBJNAME 256 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate struct bootobj { 1680Sstevel@tonic-gate char bo_fstype[BO_MAXFSNAME]; /* vfs type name (e.g. nfs) */ 1690Sstevel@tonic-gate char bo_name[BO_MAXOBJNAME]; /* name of object */ 1700Sstevel@tonic-gate int bo_flags; /* flags, see below */ 1710Sstevel@tonic-gate int bo_size; /* number of blocks */ 1720Sstevel@tonic-gate struct vnode *bo_vp; /* vnode of object */ 1730Sstevel@tonic-gate char bo_devname[BO_MAXOBJNAME]; 1740Sstevel@tonic-gate char bo_ifname[BO_MAXOBJNAME]; 1750Sstevel@tonic-gate int bo_ppa; 1760Sstevel@tonic-gate }; 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate /* 1790Sstevel@tonic-gate * flags 1800Sstevel@tonic-gate */ 1810Sstevel@tonic-gate #define BO_VALID 0x01 /* all information in object is valid */ 1820Sstevel@tonic-gate #define BO_BUSY 0x02 /* object is busy */ 1830Sstevel@tonic-gate 1840Sstevel@tonic-gate extern struct bootobj rootfs; 1850Sstevel@tonic-gate extern struct bootobj swapfile; 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME]; 1880Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME]; 1890Sstevel@tonic-gate 1900Sstevel@tonic-gate extern dev_t getrootdev(void); 1910Sstevel@tonic-gate extern void getfsname(char *, char *, size_t); 1920Sstevel@tonic-gate extern int loadrootmodules(void); 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate extern int strplumb(void); 1950Sstevel@tonic-gate extern int strplumb_load(void); 1960Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void); 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate extern void consconfig(void); 1990Sstevel@tonic-gate extern void release_bootstrap(void); 2000Sstevel@tonic-gate 2010Sstevel@tonic-gate extern void param_check(void); 2020Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *); 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate extern int dhcpinit(void); 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate /* 2070Sstevel@tonic-gate * XXX The memlist stuff belongs in a header of its own 2080Sstevel@tonic-gate */ 2090Sstevel@tonic-gate extern int check_boot_version(int); 2100Sstevel@tonic-gate extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t); 2110Sstevel@tonic-gate extern int copy_physavail(struct memlist *, struct memlist **, 2120Sstevel@tonic-gate uint_t, uint_t); 2130Sstevel@tonic-gate extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *); 2140Sstevel@tonic-gate extern int check_memexp(struct memlist *, uint_t); 2150Sstevel@tonic-gate extern void copy_memlist_filter(struct memlist *, struct memlist **, 2160Sstevel@tonic-gate void (*filter)(uint64_t *, uint64_t *)); 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate extern struct bootops *bootops; 2190Sstevel@tonic-gate extern int netboot; 2200Sstevel@tonic-gate extern int swaploaded; 2210Sstevel@tonic-gate extern int modrootloaded; 2220Sstevel@tonic-gate extern char kern_bootargs[]; 2233446Smrj extern char *kobj_module_path; 2240Sstevel@tonic-gate extern char *default_path; 2250Sstevel@tonic-gate extern char *dhcack; 2260Sstevel@tonic-gate extern int dhcacklen; 2275648Ssetje extern char dhcifname[IFNAMSIZ]; 2280Sstevel@tonic-gate extern char *netdev_path; 2290Sstevel@tonic-gate 2303446Smrj extern void bop_no_more_mem(void); 2313446Smrj 2323446Smrj /*PRINTFLIKE2*/ 2335648Ssetje extern void bop_printf(struct bootops *, const char *, ...) 2343446Smrj __KPRINTFLIKE(2); 235*6336Sbholler 2363446Smrj /*PRINTFLIKE1*/ 2375648Ssetje extern void bop_panic(const char *, ...) 238*6336Sbholler __KPRINTFLIKE(1) __NORETURN; 239*6336Sbholler #pragma rarely_called(bop_panic) 240*6336Sbholler 2413446Smrj extern void boot_prop_finish(void); 2423446Smrj 2433446Smrj /* 2443446Smrj * Back door to fakebop.c to get physical memory allocated. 2453446Smrj * 64 bit data types are fixed for 32 bit PAE use. 2463446Smrj */ 2473446Smrj extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t); 2483446Smrj 2495648Ssetje extern int do_bsys_getproplen(bootops_t *, const char *); 2505648Ssetje extern int do_bsys_getprop(bootops_t *, const char *, void *); 2513446Smrj 2520Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */ 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate #ifdef __cplusplus 2550Sstevel@tonic-gate } 2560Sstevel@tonic-gate #endif 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate #endif /* _SYS_BOOTCONF_H */ 259