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 */ 216336Sbholler 220Sstevel@tonic-gate /* 236336Sbholler * 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 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> 385648Ssetje #include <sys/dirent.h> /* for struct dirent */ 390Sstevel@tonic-gate #include <sys/memlist.h> 400Sstevel@tonic-gate #include <sys/obpdefs.h> 415648Ssetje #include <net/if.h> /* for IFNAMSIZ */ 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifdef __cplusplus 440Sstevel@tonic-gate extern "C" { 450Sstevel@tonic-gate #endif 460Sstevel@tonic-gate 470Sstevel@tonic-gate /* 486671Sjjc * Boot property names 496671Sjjc */ 506671Sjjc #define BP_CPU_APICID_ARRAY "cpu_apicid_array" 516671Sjjc 526671Sjjc /* 530Sstevel@tonic-gate * masks to hand to bsys_alloc memory allocator 540Sstevel@tonic-gate * XXX These names shouldn't really be srmmu derived. 550Sstevel@tonic-gate */ 560Sstevel@tonic-gate #define BO_NO_ALIGN 0x00001000 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* flags for BOP_EALLOC */ 590Sstevel@tonic-gate #define BOPF_X86_ALLOC_CLIENT 0x001 600Sstevel@tonic-gate #define BOPF_X86_ALLOC_REAL 0x002 610Sstevel@tonic-gate #define BOPF_X86_ALLOC_IDMAP 0x003 620Sstevel@tonic-gate #define BOPF_X86_ALLOC_PHYS 0x004 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* return values for the newer bootops */ 650Sstevel@tonic-gate #define BOOT_SUCCESS 0 660Sstevel@tonic-gate #define BOOT_FAILURE (-1) 670Sstevel@tonic-gate 680Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */ 690Sstevel@tonic-gate #define MAGIC_PHYS 0xF00000 700Sstevel@tonic-gate 710Sstevel@tonic-gate /* 720Sstevel@tonic-gate * We pass a ptr to the space that boot has been using 730Sstevel@tonic-gate * for its memory lists. 740Sstevel@tonic-gate */ 750Sstevel@tonic-gate struct bsys_mem { 760Sstevel@tonic-gate struct memlist *physinstalled; /* amt of physmem installed */ 770Sstevel@tonic-gate struct memlist *physavail; /* amt of physmem avail for use */ 780Sstevel@tonic-gate struct memlist *virtavail; /* amt of virtmem avail for use */ 790Sstevel@tonic-gate struct memlist *pcimem; /* amt of pcimem avail for use */ 800Sstevel@tonic-gate uint_t extent; /* number of bytes in the space */ 810Sstevel@tonic-gate }; 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * Warning: Changing BO_VERSION blows compatibility between booters 850Sstevel@tonic-gate * and older kernels. If you want to change the struct bootops, 860Sstevel@tonic-gate * please consider adding new stuff to the end and using the 870Sstevel@tonic-gate * "bootops-extensions" mechanism described below. 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate #define BO_VERSION 10 /* bootops interface revision # */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate typedef struct bootops { 920Sstevel@tonic-gate /* 930Sstevel@tonic-gate * the ubiquitous version number 940Sstevel@tonic-gate */ 950Sstevel@tonic-gate uint_t bsys_version; 960Sstevel@tonic-gate 970Sstevel@tonic-gate /* 980Sstevel@tonic-gate * the area containing boot's memlists 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate struct bsys_mem *boot_mem; 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* 1030Sstevel@tonic-gate * have boot allocate size bytes at virthint 1040Sstevel@tonic-gate */ 1050Sstevel@tonic-gate caddr_t (*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size, 1060Sstevel@tonic-gate int align); 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * free size bytes allocated at virt - put the 1100Sstevel@tonic-gate * address range back onto the avail lists. 1110Sstevel@tonic-gate */ 1120Sstevel@tonic-gate void (*bsys_free)(struct bootops *, caddr_t virt, size_t size); 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate /* 1150Sstevel@tonic-gate * to find the size of the buffer to allocate 1160Sstevel@tonic-gate */ 1175648Ssetje int (*bsys_getproplen)(struct bootops *, const char *); 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* 1200Sstevel@tonic-gate * get the value associated with this name 1210Sstevel@tonic-gate */ 1225648Ssetje int (*bsys_getprop)(struct bootops *, const char *, void *); 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * get the name of the next property in succession 1260Sstevel@tonic-gate * from the standalone 1270Sstevel@tonic-gate */ 1280Sstevel@tonic-gate char *(*bsys_nextprop)(struct bootops *, char *prevprop); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate /* 1310Sstevel@tonic-gate * print formatted output 1320Sstevel@tonic-gate */ 1335648Ssetje void (*bsys_printf)(struct bootops *, const char *, ...); 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate /* 1360Sstevel@tonic-gate * Do a real mode interrupt 1370Sstevel@tonic-gate */ 1380Sstevel@tonic-gate void (*bsys_doint)(struct bootops *, int, struct bop_regs *); 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 1410Sstevel@tonic-gate * Enhanced version of bsys_alloc(). 1420Sstevel@tonic-gate */ 1430Sstevel@tonic-gate caddr_t (*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size, 1440Sstevel@tonic-gate int align, int flags); 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate /* end of bootops which exist if (bootops-extensions >= 1) */ 1470Sstevel@tonic-gate } bootops_t; 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #define BOP_GETVERSION(bop) ((bop)->bsys_version) 1500Sstevel@tonic-gate #define BOP_ALLOC(bop, virthint, size, align) \ 1510Sstevel@tonic-gate ((bop)->bsys_alloc)(bop, virthint, size, align) 1520Sstevel@tonic-gate #define BOP_FREE(bop, virt, size) ((bop)->bsys_free)(bop, virt, size) 1530Sstevel@tonic-gate #define BOP_GETPROPLEN(bop, name) ((bop)->bsys_getproplen)(bop, name) 1540Sstevel@tonic-gate #define BOP_GETPROP(bop, name, buf) ((bop)->bsys_getprop)(bop, name, buf) 1550Sstevel@tonic-gate #define BOP_NEXTPROP(bop, prev) ((bop)->bsys_nextprop)(bop, prev) 1560Sstevel@tonic-gate #define BOP_DOINT(bop, intnum, rp) ((bop)->bsys_doint)(bop, intnum, rp) 1570Sstevel@tonic-gate #define BOP_EALLOC(bop, virthint, size, align, flags)\ 1580Sstevel@tonic-gate ((bop)->bsys_ealloc)(bop, virthint, size, align, flags) 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate #define BOP_PUTSARG(bop, msg, arg) ((bop)->bsys_printf)(bop, msg, arg) 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT) 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate /* 1650Sstevel@tonic-gate * Boot configuration information 1660Sstevel@tonic-gate */ 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate #define BO_MAXFSNAME 16 1690Sstevel@tonic-gate #define BO_MAXOBJNAME 256 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate struct bootobj { 1720Sstevel@tonic-gate char bo_fstype[BO_MAXFSNAME]; /* vfs type name (e.g. nfs) */ 1730Sstevel@tonic-gate char bo_name[BO_MAXOBJNAME]; /* name of object */ 1740Sstevel@tonic-gate int bo_flags; /* flags, see below */ 1750Sstevel@tonic-gate int bo_size; /* number of blocks */ 1760Sstevel@tonic-gate struct vnode *bo_vp; /* vnode of object */ 1770Sstevel@tonic-gate char bo_devname[BO_MAXOBJNAME]; 1780Sstevel@tonic-gate char bo_ifname[BO_MAXOBJNAME]; 1790Sstevel@tonic-gate int bo_ppa; 1800Sstevel@tonic-gate }; 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate /* 1830Sstevel@tonic-gate * flags 1840Sstevel@tonic-gate */ 1850Sstevel@tonic-gate #define BO_VALID 0x01 /* all information in object is valid */ 1860Sstevel@tonic-gate #define BO_BUSY 0x02 /* object is busy */ 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate extern struct bootobj rootfs; 1890Sstevel@tonic-gate extern struct bootobj swapfile; 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME]; 1920Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME]; 1930Sstevel@tonic-gate 194*8215SVikram.Hegde@Sun.COM extern void *gfx_devinfo_list; 195*8215SVikram.Hegde@Sun.COM extern int startup_amd_iommu_disable; 196*8215SVikram.Hegde@Sun.COM extern char *startup_amd_iommu_disable_list; 197*8215SVikram.Hegde@Sun.COM 1980Sstevel@tonic-gate extern dev_t getrootdev(void); 1990Sstevel@tonic-gate extern void getfsname(char *, char *, size_t); 2000Sstevel@tonic-gate extern int loadrootmodules(void); 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate extern int strplumb(void); 2030Sstevel@tonic-gate extern int strplumb_load(void); 2040Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void); 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate extern void consconfig(void); 2070Sstevel@tonic-gate extern void release_bootstrap(void); 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate extern void param_check(void); 2100Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *); 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate extern int dhcpinit(void); 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate /* 2150Sstevel@tonic-gate * XXX The memlist stuff belongs in a header of its own 2160Sstevel@tonic-gate */ 2170Sstevel@tonic-gate extern int check_boot_version(int); 2180Sstevel@tonic-gate extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t); 2190Sstevel@tonic-gate extern int copy_physavail(struct memlist *, struct memlist **, 2200Sstevel@tonic-gate uint_t, uint_t); 2210Sstevel@tonic-gate extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *); 2220Sstevel@tonic-gate extern int check_memexp(struct memlist *, uint_t); 2230Sstevel@tonic-gate extern void copy_memlist_filter(struct memlist *, struct memlist **, 2240Sstevel@tonic-gate void (*filter)(uint64_t *, uint64_t *)); 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate extern struct bootops *bootops; 2270Sstevel@tonic-gate extern int netboot; 2280Sstevel@tonic-gate extern int swaploaded; 2290Sstevel@tonic-gate extern int modrootloaded; 2300Sstevel@tonic-gate extern char kern_bootargs[]; 2317656SSherry.Moore@Sun.COM extern char kern_bootfile[]; 2323446Smrj extern char *kobj_module_path; 2330Sstevel@tonic-gate extern char *default_path; 2340Sstevel@tonic-gate extern char *dhcack; 2350Sstevel@tonic-gate extern int dhcacklen; 2365648Ssetje extern char dhcifname[IFNAMSIZ]; 2370Sstevel@tonic-gate extern char *netdev_path; 2380Sstevel@tonic-gate 2393446Smrj extern void bop_no_more_mem(void); 2403446Smrj 2413446Smrj /*PRINTFLIKE2*/ 2425648Ssetje extern void bop_printf(struct bootops *, const char *, ...) 2433446Smrj __KPRINTFLIKE(2); 2446336Sbholler 2453446Smrj /*PRINTFLIKE1*/ 2465648Ssetje extern void bop_panic(const char *, ...) 2476336Sbholler __KPRINTFLIKE(1) __NORETURN; 2486336Sbholler #pragma rarely_called(bop_panic) 2496336Sbholler 2503446Smrj extern void boot_prop_finish(void); 2513446Smrj 2523446Smrj /* 2533446Smrj * Back door to fakebop.c to get physical memory allocated. 2543446Smrj * 64 bit data types are fixed for 32 bit PAE use. 2553446Smrj */ 2563446Smrj extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t); 2573446Smrj 2585648Ssetje extern int do_bsys_getproplen(bootops_t *, const char *); 2595648Ssetje extern int do_bsys_getprop(bootops_t *, const char *, void *); 2603446Smrj 2610Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */ 2620Sstevel@tonic-gate 2630Sstevel@tonic-gate #ifdef __cplusplus 2640Sstevel@tonic-gate } 2650Sstevel@tonic-gate #endif 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate #endif /* _SYS_BOOTCONF_H */ 268