xref: /NextBSD/sys/mips/include/bootinfo.h (revision 95f7c2f56c7268d6ed9c2a56d357aeeac260363b)
1 /*-
2  * Copyright (c) 2013 Robert N. M. Watson
3  * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer as
11  *    the first lines of this file unmodified.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Rodney W. Grimes.
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * $FreeBSD$
34  */
35 
36 #ifndef	_MACHINE_BOOTINFO_H_
37 #define	_MACHINE_BOOTINFO_H_
38 
39 /* Only change the version number if you break compatibility. */
40 #define	BOOTINFO_VERSION	2
41 
42 #define	MIPS_BOOTINFO_MAGIC	0xCDEACDEA
43 
44 #if defined(__mips_n32) || defined(__mips_n64)
45 typedef	uint64_t	bi_ptr_t;
46 #else
47 typedef	uint32_t	bi_ptr_t;
48 #endif
49 
50 /*
51  * A zero bootinfo field often means that there is no info available.
52  * Flags are used to indicate the validity of fields where zero is a
53  * normal value.
54  */
55 struct bootinfo {
56 	/* bootinfo meta-data. */
57 	uint32_t	bi_version;
58 	uint32_t	bi_size;
59 
60 	/* bootinfo contents. */
61 	uint64_t	bi_boot2opts;	/* boot2 flags to loader. */
62 	bi_ptr_t	bi_kernelname;	/* Pointer to name. */
63 	bi_ptr_t	bi_nfs_diskless;/* Pointer to NFS data. */
64 	bi_ptr_t	bi_dtb;		/* Pointer to dtb. */
65 	bi_ptr_t	bi_memsize;	/* Physical memory size in bytes. */
66 	bi_ptr_t	bi_modulep;	/* Preloaded modules. */
67 	bi_ptr_t	bi_boot_dev_type;	/* Boot-device type. */
68 	bi_ptr_t	bi_boot_dev_unitptr;	/* Boot-device unit/pointer. */
69 };
70 
71 /*
72  * Possible boot-device types passed from boot2 to loader, loader to kernel.
73  * In most cases, the object pointed to will hold a filesystem; one exception
74  * is BOOTINFO_DEV_TYPE_DRAM, which points to a pre-loaded object (e.g.,
75  * loader, kernel).
76  */
77 #define	BOOTINFO_DEV_TYPE_DRAM		0	/* DRAM loader/kernel (ptr). */
78 #define	BOOTINFO_DEV_TYPE_CFI		1	/* CFI flash (unit). */
79 #define	BOOTINFO_DEV_TYPE_SDCARD	2	/* SD card (unit). */
80 
81 #ifdef _KERNEL
82 extern struct bootinfo	bootinfo;
83 #endif
84 
85 #endif	/* !_MACHINE_BOOTINFO_H_ */
86