xref: /titanic_51/usr/src/uts/intel/sys/bootconf.h (revision 1de082f7b7fd4b6629e14b0f9b8f94f6c0bda3c2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21a563a037Sbholler 
227c478bd9Sstevel@tonic-gate /*
232baa66a0SJonathan Chew  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_BOOTCONF_H
287c478bd9Sstevel@tonic-gate #define	_SYS_BOOTCONF_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Boot time configuration information objects
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/bootregs.h>		/* for struct bop_regs */
377c478bd9Sstevel@tonic-gate #include <sys/bootstat.h>
387c478bd9Sstevel@tonic-gate #include <sys/dirent.h>			/* for struct dirent */
397c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
407c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h>
41986fd29aSsetje #include <net/if.h>			/* for IFNAMSIZ */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifdef __cplusplus
447c478bd9Sstevel@tonic-gate extern "C" {
457c478bd9Sstevel@tonic-gate #endif
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
48dae2fa37Sjjc  * Boot property names
49dae2fa37Sjjc  */
50dae2fa37Sjjc #define	BP_CPU_APICID_ARRAY	"cpu_apicid_array"
512baa66a0SJonathan Chew #define	BP_LGRP_SLIT_ENABLE	"lgrp_slit_enable"
522baa66a0SJonathan Chew #define	BP_LGRP_SRAT_ENABLE	"lgrp_srat_enable"
532baa66a0SJonathan Chew #define	BP_LGRP_TOPO_LEVELS	"lgrp_topo_levels"
54dae2fa37Sjjc 
55dae2fa37Sjjc /*
567c478bd9Sstevel@tonic-gate  * masks to hand to bsys_alloc memory allocator
577c478bd9Sstevel@tonic-gate  * XXX	These names shouldn't really be srmmu derived.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #define	BO_NO_ALIGN	0x00001000
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /* flags for BOP_EALLOC */
627c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_CLIENT	0x001
637c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_REAL	0x002
647c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_IDMAP	0x003
657c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_PHYS	0x004
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /* return values for the newer bootops */
687c478bd9Sstevel@tonic-gate #define	BOOT_SUCCESS	0
697c478bd9Sstevel@tonic-gate #define	BOOT_FAILURE	(-1)
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
727c478bd9Sstevel@tonic-gate #define	MAGIC_PHYS	0xF00000
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  *  We pass a ptr to the space that boot has been using
767c478bd9Sstevel@tonic-gate  *  for its memory lists.
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate struct bsys_mem {
797c478bd9Sstevel@tonic-gate 	struct memlist	*physinstalled;	/* amt of physmem installed */
80*1de082f7SVikram Hegde 	struct memlist	*rsvdmem;	/* amt of bios reserved mem */
817c478bd9Sstevel@tonic-gate 	struct memlist	*physavail;	/* amt of physmem avail for use */
827c478bd9Sstevel@tonic-gate 	struct memlist	*virtavail;	/* amt of virtmem avail for use */
837c478bd9Sstevel@tonic-gate 	struct memlist	*pcimem;	/* amt of pcimem avail for use */
847c478bd9Sstevel@tonic-gate 	uint_t		extent; 	/* number of bytes in the space */
857c478bd9Sstevel@tonic-gate };
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * Warning: Changing BO_VERSION blows compatibility between booters
897c478bd9Sstevel@tonic-gate  *          and older kernels.  If you want to change the struct bootops,
907c478bd9Sstevel@tonic-gate  *          please consider adding new stuff to the end and using the
917c478bd9Sstevel@tonic-gate  *          "bootops-extensions" mechanism described below.
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate #define	BO_VERSION	10		/* bootops interface revision # */
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate typedef struct bootops {
967c478bd9Sstevel@tonic-gate 	/*
977c478bd9Sstevel@tonic-gate 	 * the ubiquitous version number
987c478bd9Sstevel@tonic-gate 	 */
997c478bd9Sstevel@tonic-gate 	uint_t	bsys_version;
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate 	/*
1027c478bd9Sstevel@tonic-gate 	 * the area containing boot's memlists
1037c478bd9Sstevel@tonic-gate 	 */
1047c478bd9Sstevel@tonic-gate 	struct 	bsys_mem *boot_mem;
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate 	/*
1077c478bd9Sstevel@tonic-gate 	 * have boot allocate size bytes at virthint
1087c478bd9Sstevel@tonic-gate 	 */
1097c478bd9Sstevel@tonic-gate 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
1107c478bd9Sstevel@tonic-gate 		int align);
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate 	/*
1137c478bd9Sstevel@tonic-gate 	 * free size bytes allocated at virt - put the
1147c478bd9Sstevel@tonic-gate 	 * address range back onto the avail lists.
1157c478bd9Sstevel@tonic-gate 	 */
1167c478bd9Sstevel@tonic-gate 	void	(*bsys_free)(struct bootops *, caddr_t virt, size_t size);
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate 	/*
1197c478bd9Sstevel@tonic-gate 	 * to find the size of the buffer to allocate
1207c478bd9Sstevel@tonic-gate 	 */
121986fd29aSsetje 	int	(*bsys_getproplen)(struct bootops *, const char *);
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate 	/*
1247c478bd9Sstevel@tonic-gate 	 * get the value associated with this name
1257c478bd9Sstevel@tonic-gate 	 */
126986fd29aSsetje 	int	(*bsys_getprop)(struct bootops *, const char *, void *);
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate 	/*
1297c478bd9Sstevel@tonic-gate 	 * get the name of the next property in succession
1307c478bd9Sstevel@tonic-gate 	 * from the standalone
1317c478bd9Sstevel@tonic-gate 	 */
1327c478bd9Sstevel@tonic-gate 	char	*(*bsys_nextprop)(struct bootops *, char *prevprop);
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate 	/*
1357c478bd9Sstevel@tonic-gate 	 * print formatted output
1367c478bd9Sstevel@tonic-gate 	 */
137986fd29aSsetje 	void	(*bsys_printf)(struct bootops *, const char *, ...);
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate 	/*
1407c478bd9Sstevel@tonic-gate 	 * Do a real mode interrupt
1417c478bd9Sstevel@tonic-gate 	 */
1427c478bd9Sstevel@tonic-gate 	void	(*bsys_doint)(struct bootops *, int, struct bop_regs *);
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate 	/*
1457c478bd9Sstevel@tonic-gate 	 * Enhanced version of bsys_alloc().
1467c478bd9Sstevel@tonic-gate 	 */
1477c478bd9Sstevel@tonic-gate 	caddr_t	(*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
1487c478bd9Sstevel@tonic-gate 		int align, int flags);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate 	/* end of bootops which exist if (bootops-extensions >= 1) */
1517c478bd9Sstevel@tonic-gate } bootops_t;
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	BOP_GETVERSION(bop)		((bop)->bsys_version)
1547c478bd9Sstevel@tonic-gate #define	BOP_ALLOC(bop, virthint, size, align)	\
1557c478bd9Sstevel@tonic-gate 				((bop)->bsys_alloc)(bop, virthint, size, align)
1567c478bd9Sstevel@tonic-gate #define	BOP_FREE(bop, virt, size)	((bop)->bsys_free)(bop, virt, size)
1577c478bd9Sstevel@tonic-gate #define	BOP_GETPROPLEN(bop, name)	((bop)->bsys_getproplen)(bop, name)
1587c478bd9Sstevel@tonic-gate #define	BOP_GETPROP(bop, name, buf)	((bop)->bsys_getprop)(bop, name, buf)
1597c478bd9Sstevel@tonic-gate #define	BOP_NEXTPROP(bop, prev)		((bop)->bsys_nextprop)(bop, prev)
1607c478bd9Sstevel@tonic-gate #define	BOP_DOINT(bop, intnum, rp)	((bop)->bsys_doint)(bop, intnum, rp)
1617c478bd9Sstevel@tonic-gate #define	BOP_EALLOC(bop, virthint, size, align, flags)\
1627c478bd9Sstevel@tonic-gate 		((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #define	BOP_PUTSARG(bop, msg, arg)	((bop)->bsys_printf)(bop, msg, arg)
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT)
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate  * Boot configuration information
1707c478bd9Sstevel@tonic-gate  */
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate #define	BO_MAXFSNAME	16
1737c478bd9Sstevel@tonic-gate #define	BO_MAXOBJNAME	256
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate struct bootobj {
1767c478bd9Sstevel@tonic-gate 	char	bo_fstype[BO_MAXFSNAME];	/* vfs type name (e.g. nfs) */
1777c478bd9Sstevel@tonic-gate 	char	bo_name[BO_MAXOBJNAME];		/* name of object */
1787c478bd9Sstevel@tonic-gate 	int	bo_flags;			/* flags, see below */
1797c478bd9Sstevel@tonic-gate 	int	bo_size;			/* number of blocks */
1807c478bd9Sstevel@tonic-gate 	struct vnode *bo_vp;			/* vnode of object */
1817c478bd9Sstevel@tonic-gate 	char	bo_devname[BO_MAXOBJNAME];
1827c478bd9Sstevel@tonic-gate 	char	bo_ifname[BO_MAXOBJNAME];
1837c478bd9Sstevel@tonic-gate 	int	bo_ppa;
1847c478bd9Sstevel@tonic-gate };
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * flags
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate #define	BO_VALID	0x01	/* all information in object is valid */
1907c478bd9Sstevel@tonic-gate #define	BO_BUSY		0x02	/* object is busy */
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate extern struct bootobj rootfs;
1937c478bd9Sstevel@tonic-gate extern struct bootobj swapfile;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME];
1967c478bd9Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME];
1977c478bd9Sstevel@tonic-gate 
19894f1124eSVikram Hegde extern void *gfx_devinfo_list;
19994f1124eSVikram Hegde 
2007c478bd9Sstevel@tonic-gate extern dev_t getrootdev(void);
2017c478bd9Sstevel@tonic-gate extern void getfsname(char *, char *, size_t);
2027c478bd9Sstevel@tonic-gate extern int loadrootmodules(void);
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate extern int strplumb(void);
2057c478bd9Sstevel@tonic-gate extern int strplumb_load(void);
2067c478bd9Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void);
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate extern void consconfig(void);
2097c478bd9Sstevel@tonic-gate extern void release_bootstrap(void);
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate extern void param_check(void);
2127c478bd9Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate extern int dhcpinit(void);
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate /*
2177c478bd9Sstevel@tonic-gate  * XXX	The memlist stuff belongs in a header of its own
2187c478bd9Sstevel@tonic-gate  */
2197c478bd9Sstevel@tonic-gate extern int check_boot_version(int);
2207c478bd9Sstevel@tonic-gate extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t);
2217c478bd9Sstevel@tonic-gate extern int copy_physavail(struct memlist *, struct memlist **,
2227c478bd9Sstevel@tonic-gate     uint_t, uint_t);
2237c478bd9Sstevel@tonic-gate extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *);
2247c478bd9Sstevel@tonic-gate extern int check_memexp(struct memlist *, uint_t);
2257c478bd9Sstevel@tonic-gate extern void copy_memlist_filter(struct memlist *, struct memlist **,
2267c478bd9Sstevel@tonic-gate     void (*filter)(uint64_t *, uint64_t *));
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate extern struct bootops *bootops;
2297c478bd9Sstevel@tonic-gate extern int netboot;
2307c478bd9Sstevel@tonic-gate extern int swaploaded;
2317c478bd9Sstevel@tonic-gate extern int modrootloaded;
2327c478bd9Sstevel@tonic-gate extern char kern_bootargs[];
23319397407SSherry Moore extern char kern_bootfile[];
234ae115bc7Smrj extern char *kobj_module_path;
2357c478bd9Sstevel@tonic-gate extern char *default_path;
2367c478bd9Sstevel@tonic-gate extern char *dhcack;
2377c478bd9Sstevel@tonic-gate extern int dhcacklen;
238986fd29aSsetje extern char dhcifname[IFNAMSIZ];
2397c478bd9Sstevel@tonic-gate extern char *netdev_path;
2407c478bd9Sstevel@tonic-gate 
241ae115bc7Smrj extern void bop_no_more_mem(void);
242ae115bc7Smrj 
243ae115bc7Smrj /*PRINTFLIKE2*/
244986fd29aSsetje extern void bop_printf(struct bootops *, const char *, ...)
245ae115bc7Smrj     __KPRINTFLIKE(2);
246a563a037Sbholler 
247ae115bc7Smrj /*PRINTFLIKE1*/
248986fd29aSsetje extern void bop_panic(const char *, ...)
249a563a037Sbholler     __KPRINTFLIKE(1) __NORETURN;
250a563a037Sbholler #pragma rarely_called(bop_panic)
251a563a037Sbholler 
252ae115bc7Smrj extern void boot_prop_finish(void);
253ae115bc7Smrj 
2542baa66a0SJonathan Chew extern int bootprop_getval(const char *, u_longlong_t *);
2552baa66a0SJonathan Chew 
256ae115bc7Smrj /*
257ae115bc7Smrj  * Back door to fakebop.c to get physical memory allocated.
258ae115bc7Smrj  * 64 bit data types are fixed for 32 bit PAE use.
259ae115bc7Smrj  */
260ae115bc7Smrj extern paddr_t do_bop_phys_alloc(uint64_t, uint64_t);
261ae115bc7Smrj 
262986fd29aSsetje extern int do_bsys_getproplen(bootops_t *, const char *);
263986fd29aSsetje extern int do_bsys_getprop(bootops_t *, const char *, void *);
264ae115bc7Smrj 
2657c478bd9Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2687c478bd9Sstevel@tonic-gate }
2697c478bd9Sstevel@tonic-gate #endif
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate #endif	/* _SYS_BOOTCONF_H */
272