xref: /freebsd-13-stable/sys/mips/include/bootinfo.h (revision f8167e0404dab9ffeaca95853dd237ab7c587f82)
1 /*-
2  * SPDX-License-Identifier: BSD-4-Clause
3  *
4  * Copyright (c) 2013 Robert N. M. Watson
5  * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer as
13  *    the first lines of this file unmodified.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by Rodney W. Grimes.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
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