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