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