xref: /titanic_54/usr/src/uts/intel/sys/bootconf.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_BOOTCONF_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_BOOTCONF_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * Boot time configuration information objects
34*7c478bd9Sstevel@tonic-gate  */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/bootregs.h>		/* for struct bop_regs */
38*7c478bd9Sstevel@tonic-gate #include <sys/bootstat.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/dirent.h>		/* for struct dirent */
40*7c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h>
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
44*7c478bd9Sstevel@tonic-gate extern "C" {
45*7c478bd9Sstevel@tonic-gate #endif
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * masks to hand to bsys_alloc memory allocator
49*7c478bd9Sstevel@tonic-gate  * XXX	These names shouldn't really be srmmu derived.
50*7c478bd9Sstevel@tonic-gate  */
51*7c478bd9Sstevel@tonic-gate #define	BO_NO_ALIGN	0x00001000
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate /* flags for BOP_EALLOC */
54*7c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_CLIENT	0x001
55*7c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_REAL	0x002
56*7c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_IDMAP	0x003
57*7c478bd9Sstevel@tonic-gate #define	BOPF_X86_ALLOC_PHYS	0x004
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate /* return values for the newer bootops */
60*7c478bd9Sstevel@tonic-gate #define	BOOT_SUCCESS	0
61*7c478bd9Sstevel@tonic-gate #define	BOOT_FAILURE	(-1)
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /* top of boot scratch memory: 15 MB; multiboot loads at 16 MB */
64*7c478bd9Sstevel@tonic-gate #define	MAGIC_PHYS	0xF00000
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate /*
67*7c478bd9Sstevel@tonic-gate  *  We pass a ptr to the space that boot has been using
68*7c478bd9Sstevel@tonic-gate  *  for its memory lists.
69*7c478bd9Sstevel@tonic-gate  */
70*7c478bd9Sstevel@tonic-gate struct bsys_mem {
71*7c478bd9Sstevel@tonic-gate 	struct memlist	*physinstalled;	/* amt of physmem installed */
72*7c478bd9Sstevel@tonic-gate 	struct memlist	*physavail;	/* amt of physmem avail for use */
73*7c478bd9Sstevel@tonic-gate 	struct memlist	*virtavail;	/* amt of virtmem avail for use */
74*7c478bd9Sstevel@tonic-gate 	struct memlist	*pcimem;	/* amt of pcimem avail for use */
75*7c478bd9Sstevel@tonic-gate 	uint_t		extent; 	/* number of bytes in the space */
76*7c478bd9Sstevel@tonic-gate };
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate /*
79*7c478bd9Sstevel@tonic-gate  * Warning: Changing BO_VERSION blows compatibility between booters
80*7c478bd9Sstevel@tonic-gate  *          and older kernels.  If you want to change the struct bootops,
81*7c478bd9Sstevel@tonic-gate  *          please consider adding new stuff to the end and using the
82*7c478bd9Sstevel@tonic-gate  *          "bootops-extensions" mechanism described below.
83*7c478bd9Sstevel@tonic-gate  */
84*7c478bd9Sstevel@tonic-gate #define	BO_VERSION	10		/* bootops interface revision # */
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate typedef struct bootops {
87*7c478bd9Sstevel@tonic-gate 	/*
88*7c478bd9Sstevel@tonic-gate 	 * the ubiquitous version number
89*7c478bd9Sstevel@tonic-gate 	 */
90*7c478bd9Sstevel@tonic-gate 	uint_t	bsys_version;
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 	/*
93*7c478bd9Sstevel@tonic-gate 	 * the area containing boot's memlists
94*7c478bd9Sstevel@tonic-gate 	 */
95*7c478bd9Sstevel@tonic-gate 	struct 	bsys_mem *boot_mem;
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate 	/*
98*7c478bd9Sstevel@tonic-gate 	 * have boot allocate size bytes at virthint
99*7c478bd9Sstevel@tonic-gate 	 */
100*7c478bd9Sstevel@tonic-gate 	caddr_t	(*bsys_alloc)(struct bootops *, caddr_t virthint, size_t size,
101*7c478bd9Sstevel@tonic-gate 		int align);
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 	/*
104*7c478bd9Sstevel@tonic-gate 	 * free size bytes allocated at virt - put the
105*7c478bd9Sstevel@tonic-gate 	 * address range back onto the avail lists.
106*7c478bd9Sstevel@tonic-gate 	 */
107*7c478bd9Sstevel@tonic-gate 	void	(*bsys_free)(struct bootops *, caddr_t virt, size_t size);
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate 	/*
110*7c478bd9Sstevel@tonic-gate 	 * to find the size of the buffer to allocate
111*7c478bd9Sstevel@tonic-gate 	 */
112*7c478bd9Sstevel@tonic-gate 	int	(*bsys_getproplen)(struct bootops *, char *name);
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate 	/*
115*7c478bd9Sstevel@tonic-gate 	 * get the value associated with this name
116*7c478bd9Sstevel@tonic-gate 	 */
117*7c478bd9Sstevel@tonic-gate 	int	(*bsys_getprop)(struct bootops *, char *name, void *value);
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 	/*
120*7c478bd9Sstevel@tonic-gate 	 * get the name of the next property in succession
121*7c478bd9Sstevel@tonic-gate 	 * from the standalone
122*7c478bd9Sstevel@tonic-gate 	 */
123*7c478bd9Sstevel@tonic-gate 	char	*(*bsys_nextprop)(struct bootops *, char *prevprop);
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate 	/*
126*7c478bd9Sstevel@tonic-gate 	 * print formatted output
127*7c478bd9Sstevel@tonic-gate 	 */
128*7c478bd9Sstevel@tonic-gate 	void	(*bsys_printf)(struct bootops *, char *, ...);
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate 	/*
131*7c478bd9Sstevel@tonic-gate 	 * Do a real mode interrupt
132*7c478bd9Sstevel@tonic-gate 	 */
133*7c478bd9Sstevel@tonic-gate 	void	(*bsys_doint)(struct bootops *, int, struct bop_regs *);
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate 	/*
136*7c478bd9Sstevel@tonic-gate 	 * Enhanced version of bsys_alloc().
137*7c478bd9Sstevel@tonic-gate 	 */
138*7c478bd9Sstevel@tonic-gate 	caddr_t	(*bsys_ealloc)(struct bootops *, caddr_t virthint, size_t size,
139*7c478bd9Sstevel@tonic-gate 		int align, int flags);
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate 	/* end of bootops which exist if (bootops-extensions >= 1) */
142*7c478bd9Sstevel@tonic-gate } bootops_t;
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #define	BOP_GETVERSION(bop)		((bop)->bsys_version)
145*7c478bd9Sstevel@tonic-gate #define	BOP_ALLOC(bop, virthint, size, align)	\
146*7c478bd9Sstevel@tonic-gate 				((bop)->bsys_alloc)(bop, virthint, size, align)
147*7c478bd9Sstevel@tonic-gate #define	BOP_FREE(bop, virt, size)	((bop)->bsys_free)(bop, virt, size)
148*7c478bd9Sstevel@tonic-gate #define	BOP_GETPROPLEN(bop, name)	((bop)->bsys_getproplen)(bop, name)
149*7c478bd9Sstevel@tonic-gate #define	BOP_GETPROP(bop, name, buf)	((bop)->bsys_getprop)(bop, name, buf)
150*7c478bd9Sstevel@tonic-gate #define	BOP_NEXTPROP(bop, prev)		((bop)->bsys_nextprop)(bop, prev)
151*7c478bd9Sstevel@tonic-gate #define	BOP_DOINT(bop, intnum, rp)	((bop)->bsys_doint)(bop, intnum, rp)
152*7c478bd9Sstevel@tonic-gate #define	BOP_EALLOC(bop, virthint, size, align, flags)\
153*7c478bd9Sstevel@tonic-gate 		((bop)->bsys_ealloc)(bop, virthint, size, align, flags)
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #define	BOP_PUTSARG(bop, msg, arg)	((bop)->bsys_printf)(bop, msg, arg)
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_BOOT)
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * Boot configuration information
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate #define	BO_MAXFSNAME	16
164*7c478bd9Sstevel@tonic-gate #define	BO_MAXOBJNAME	256
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate struct bootobj {
167*7c478bd9Sstevel@tonic-gate 	char	bo_fstype[BO_MAXFSNAME];	/* vfs type name (e.g. nfs) */
168*7c478bd9Sstevel@tonic-gate 	char	bo_name[BO_MAXOBJNAME];		/* name of object */
169*7c478bd9Sstevel@tonic-gate 	int	bo_flags;			/* flags, see below */
170*7c478bd9Sstevel@tonic-gate 	int	bo_size;			/* number of blocks */
171*7c478bd9Sstevel@tonic-gate 	struct vnode *bo_vp;			/* vnode of object */
172*7c478bd9Sstevel@tonic-gate 	char	bo_devname[BO_MAXOBJNAME];
173*7c478bd9Sstevel@tonic-gate 	char	bo_ifname[BO_MAXOBJNAME];
174*7c478bd9Sstevel@tonic-gate 	int	bo_ppa;
175*7c478bd9Sstevel@tonic-gate };
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate /*
178*7c478bd9Sstevel@tonic-gate  * flags
179*7c478bd9Sstevel@tonic-gate  */
180*7c478bd9Sstevel@tonic-gate #define	BO_VALID	0x01	/* all information in object is valid */
181*7c478bd9Sstevel@tonic-gate #define	BO_BUSY		0x02	/* object is busy */
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate extern struct bootobj rootfs;
184*7c478bd9Sstevel@tonic-gate extern struct bootobj swapfile;
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate extern char obp_bootpath[BO_MAXOBJNAME];
187*7c478bd9Sstevel@tonic-gate extern char svm_bootpath[BO_MAXOBJNAME];
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate extern dev_t getrootdev(void);
190*7c478bd9Sstevel@tonic-gate extern void getfsname(char *, char *, size_t);
191*7c478bd9Sstevel@tonic-gate extern int loadrootmodules(void);
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate extern int strplumb(void);
194*7c478bd9Sstevel@tonic-gate extern int strplumb_load(void);
195*7c478bd9Sstevel@tonic-gate extern char *strplumb_get_netdev_path(void);
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate extern void consconfig(void);
198*7c478bd9Sstevel@tonic-gate extern void release_bootstrap(void);
199*7c478bd9Sstevel@tonic-gate 
200*7c478bd9Sstevel@tonic-gate extern void param_check(void);
201*7c478bd9Sstevel@tonic-gate extern int octet_to_hexascii(const void *, uint_t, char *, uint_t *);
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate extern int dhcpinit(void);
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate /*
206*7c478bd9Sstevel@tonic-gate  * XXX	The memlist stuff belongs in a header of its own
207*7c478bd9Sstevel@tonic-gate  */
208*7c478bd9Sstevel@tonic-gate extern int check_boot_version(int);
209*7c478bd9Sstevel@tonic-gate extern void size_physavail(struct memlist *, pgcnt_t *, int *, pfn_t);
210*7c478bd9Sstevel@tonic-gate extern int copy_physavail(struct memlist *, struct memlist **,
211*7c478bd9Sstevel@tonic-gate     uint_t, uint_t);
212*7c478bd9Sstevel@tonic-gate extern void installed_top_size(struct memlist *, pfn_t *, pgcnt_t *, int *);
213*7c478bd9Sstevel@tonic-gate extern int check_memexp(struct memlist *, uint_t);
214*7c478bd9Sstevel@tonic-gate extern void copy_memlist_filter(struct memlist *, struct memlist **,
215*7c478bd9Sstevel@tonic-gate     void (*filter)(uint64_t *, uint64_t *));
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate extern struct bootops *bootops;
218*7c478bd9Sstevel@tonic-gate extern int netboot;
219*7c478bd9Sstevel@tonic-gate extern int swaploaded;
220*7c478bd9Sstevel@tonic-gate extern int modrootloaded;
221*7c478bd9Sstevel@tonic-gate extern char kern_bootargs[];
222*7c478bd9Sstevel@tonic-gate extern char *default_path;
223*7c478bd9Sstevel@tonic-gate extern char *dhcack;
224*7c478bd9Sstevel@tonic-gate extern int dhcacklen;
225*7c478bd9Sstevel@tonic-gate extern char *netdev_path;
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL && !_BOOT */
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
230*7c478bd9Sstevel@tonic-gate }
231*7c478bd9Sstevel@tonic-gate #endif
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_BOOTCONF_H */
234