xref: /onnv-gate/usr/src/uts/intel/sys/bootconf.h (revision 12004:93f274d4a367)
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 /*
239053Sjonathan.chew@sun.com  * Copyright 2009 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"
519053Sjonathan.chew@sun.com #define	BP_LGRP_SLIT_ENABLE	"lgrp_slit_enable"
529053Sjonathan.chew@sun.com #define	BP_LGRP_SRAT_ENABLE	"lgrp_srat_enable"
53*12004Sjiang.liu@intel.com #define	BP_LGRP_MSCT_ENABLE	"lgrp_msct_enable"
549053Sjonathan.chew@sun.com #define	BP_LGRP_TOPO_LEVELS	"lgrp_topo_levels"
556671Sjjc 
566671Sjjc /*
570Sstevel@tonic-gate  * masks to hand to bsys_alloc memory allocator
580Sstevel@tonic-gate  * XXX	These names shouldn't really be srmmu derived.
590Sstevel@tonic-gate  */
600Sstevel@tonic-gate #define	BO_NO_ALIGN	0x00001000
610Sstevel@tonic-gate 
620Sstevel@tonic-gate /* flags for BOP_EALLOC */
630Sstevel@tonic-gate #define	BOPF_X86_ALLOC_CLIENT	0x001
640Sstevel@tonic-gate #define	BOPF_X86_ALLOC_REAL	0x002
650Sstevel@tonic-gate #define	BOPF_X86_ALLOC_IDMAP	0x003
660Sstevel@tonic-gate #define	BOPF_X86_ALLOC_PHYS	0x004
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /* return values for the newer bootops */
690Sstevel@tonic-gate #define	BOOT_SUCCESS	0
700Sstevel@tonic-gate #define	BOOT_FAILURE	(-1)
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
730Sstevel@tonic-gate #define	MAGIC_PHYS	0xF00000
740Sstevel@tonic-gate 
750Sstevel@tonic-gate /*
760Sstevel@tonic-gate  *  We pass a ptr to the space that boot has been using
770Sstevel@tonic-gate  *  for its memory lists.
780Sstevel@tonic-gate  */
790Sstevel@tonic-gate struct bsys_mem {
800Sstevel@tonic-gate 	struct memlist	*physinstalled;	/* amt of physmem installed */
819940SVikram.Hegde@Sun.COM 	struct memlist	*rsvdmem;	/* amt of bios reserved mem */
820Sstevel@tonic-gate 	struct memlist	*physavail;	/* amt of physmem avail for use */
830Sstevel@tonic-gate 	struct memlist	*virtavail;	/* amt of virtmem avail for use */
840Sstevel@tonic-gate 	struct memlist	*pcimem;	/* amt of pcimem avail for use */
850Sstevel@tonic-gate 	uint_t		extent; 	/* number of bytes in the space */
860Sstevel@tonic-gate };
870Sstevel@tonic-gate 
880Sstevel@tonic-gate /*
890Sstevel@tonic-gate  * Warning: Changing BO_VERSION blows compatibility between booters
900Sstevel@tonic-gate  *          and older kernels.  If you want to change the struct bootops,
910Sstevel@tonic-gate  *          please consider adding new stuff to the end and using the
920Sstevel@tonic-gate  *          "bootops-extensions" mechanism described below.
930Sstevel@tonic-gate  */
940Sstevel@tonic-gate #define	BO_VERSION	10		/* bootops interface revision # */
950Sstevel@tonic-gate 
960Sstevel@tonic-gate typedef struct bootops {
970Sstevel@tonic-gate 	/*
980Sstevel@tonic-gate 	 * the ubiquitous version number
990Sstevel@tonic-gate 	 */
1000Sstevel@tonic-gate 	uint_t	bsys_version;
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 	/*
1030Sstevel@tonic-gate 	 * the area containing boot's memlists
1040Sstevel@tonic-gate 	 */
1050Sstevel@tonic-gate 	struct 	bsys_mem *boot_mem;
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate 	/*
1080Sstevel@tonic-gate 	 * have boot allocate size bytes at virthint
1090Sstevel@tonic-gate 	 */
1100Sstevel@tonic-gate 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
1110Sstevel@tonic-gate 		int align);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate 	/*
1140Sstevel@tonic-gate 	 * free size bytes allocated at virt - put the
1150Sstevel@tonic-gate 	 * address range back onto the avail lists.
1160Sstevel@tonic-gate 	 */
1170Sstevel@tonic-gate 	void	(*bsys_free)(struct bootops *, caddr_t virt, size_t size);
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	/*
1200Sstevel@tonic-gate 	 * to find the size of the buffer to allocate
1210Sstevel@tonic-gate 	 */
1225648Ssetje 	int	(*bsys_getproplen)(struct bootops *, const char *);
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate 	/*
1250Sstevel@tonic-gate 	 * get the value associated with this name
1260Sstevel@tonic-gate 	 */
1275648Ssetje 	int	(*bsys_getprop)(struct bootops *, const char *, void *);
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate 	/*
1300Sstevel@tonic-gate 	 * get the name of the next property in succession
1310Sstevel@tonic-gate 	 * from the standalone
1320Sstevel@tonic-gate 	 */
1330Sstevel@tonic-gate 	char	*(*bsys_nextprop)(struct bootops *, char *prevprop);
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate 	/*
1360Sstevel@tonic-gate 	 * print formatted output
1370Sstevel@tonic-gate 	 */
1385648Ssetje 	void	(*bsys_printf)(struct bootops *, const char *, ...);
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate 	/*
1410Sstevel@tonic-gate 	 * Do a real mode interrupt
1420Sstevel@tonic-gate 	 */
1430Sstevel@tonic-gate 	void	(*bsys_doint)(struct bootops *, int, struct bop_regs *);
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate 	/*
1460Sstevel@tonic-gate 	 * Enhanced version of bsys_alloc().
1470Sstevel@tonic-gate 	 */
1480Sstevel@tonic-gate 	caddr_t	(*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
1490Sstevel@tonic-gate 		int align, int flags);
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate 	/* end of bootops which exist if (bootops-extensions >= 1) */
1520Sstevel@tonic-gate } bootops_t;
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate #define	BOP_GETVERSION(bop)		((bop)->bsys_version)
1550Sstevel@tonic-gate #define	BOP_ALLOC(bop, virthint, size, align)	\
1560Sstevel@tonic-gate 				((bop)->bsys_alloc)(bop, virthint, size, align)
1570Sstevel@tonic-gate #define	BOP_FREE(bop, virt, size)	((bop)->bsys_free)(bop, virt, size)
1580Sstevel@tonic-gate #define	BOP_GETPROPLEN(bop, name)	((bop)->bsys_getproplen)(bop, name)
1590Sstevel@tonic-gate #define	BOP_GETPROP(bop, name, buf)	((bop)->bsys_getprop)(bop, name, buf)
1600Sstevel@tonic-gate #define	BOP_NEXTPROP(bop, prev)		((bop)->bsys_nextprop)(bop, prev)
1610Sstevel@tonic-gate #define	BOP_DOINT(bop, intnum, rp)	((bop)->bsys_doint)(bop, intnum, rp)
1620Sstevel@tonic-gate #define	BOP_EALLOC(bop, virthint, size, align, flags)\
1630Sstevel@tonic-gate 		((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate #define	BOP_PUTSARG(bop, msg, arg)	((bop)->bsys_printf)(bop, msg, arg)
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT)
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate /*
1700Sstevel@tonic-gate  * Boot configuration information
1710Sstevel@tonic-gate  */
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate #define	BO_MAXFSNAME	16
1740Sstevel@tonic-gate #define	BO_MAXOBJNAME	256
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate struct bootobj {
1770Sstevel@tonic-gate 	char	bo_fstype[BO_MAXFSNAME];	/* vfs type name (e.g. nfs) */
1780Sstevel@tonic-gate 	char	bo_name[BO_MAXOBJNAME];		/* name of object */
1790Sstevel@tonic-gate 	int	bo_flags;			/* flags, see below */
1800Sstevel@tonic-gate 	int	bo_size;			/* number of blocks */
1810Sstevel@tonic-gate 	struct vnode *bo_vp;			/* vnode of object */
1820Sstevel@tonic-gate 	char	bo_devname[BO_MAXOBJNAME];
1830Sstevel@tonic-gate 	char	bo_ifname[BO_MAXOBJNAME];
1840Sstevel@tonic-gate 	int	bo_ppa;
1850Sstevel@tonic-gate };
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate /*
1880Sstevel@tonic-gate  * flags
1890Sstevel@tonic-gate  */
1900Sstevel@tonic-gate #define	BO_VALID	0x01	/* all information in object is valid */
1910Sstevel@tonic-gate #define	BO_BUSY		0x02	/* object is busy */
1920Sstevel@tonic-gate 
1930Sstevel@tonic-gate extern struct bootobj rootfs;
1940Sstevel@tonic-gate extern struct bootobj swapfile;
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME];
1970Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME];
1980Sstevel@tonic-gate 
1998215SVikram.Hegde@Sun.COM extern void *gfx_devinfo_list;
2008215SVikram.Hegde@Sun.COM 
2010Sstevel@tonic-gate extern dev_t getrootdev(void);
2020Sstevel@tonic-gate extern void getfsname(char *, char *, size_t);
2030Sstevel@tonic-gate extern int loadrootmodules(void);
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate extern int strplumb(void);
2060Sstevel@tonic-gate extern int strplumb_load(void);
2070Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void);
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate extern void consconfig(void);
2100Sstevel@tonic-gate extern void release_bootstrap(void);
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate extern void param_check(void);
2130Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate extern int dhcpinit(void);
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[];
2227656SSherry.Moore@Sun.COM extern char kern_bootfile[];
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);
2356336Sbholler 
2363446Smrj /*PRINTFLIKE1*/
2375648Ssetje extern void bop_panic(const char *, ...)
2386336Sbholler     __KPRINTFLIKE(1) __NORETURN;
2396336Sbholler #pragma rarely_called(bop_panic)
2406336Sbholler 
2413446Smrj extern void boot_prop_finish(void);
2423446Smrj 
2439053Sjonathan.chew@sun.com extern int bootprop_getval(const char *, u_longlong_t *);
2449053Sjonathan.chew@sun.com 
2453446Smrj /*
2463446Smrj  * Back door to fakebop.c to get physical memory allocated.
2473446Smrj  * 64 bit data types are fixed for 32 bit PAE use.
2483446Smrj  */
2493446Smrj extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
2503446Smrj 
2515648Ssetje extern int do_bsys_getproplen(bootops_t *, const char *);
2525648Ssetje extern int do_bsys_getprop(bootops_t *, const char *, void *);
2533446Smrj 
2540Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate #ifdef __cplusplus
2570Sstevel@tonic-gate }
2580Sstevel@tonic-gate #endif
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate #endif	/* _SYS_BOOTCONF_H */
261