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 * $FreeBSD$
36 */
37
38#ifndef	_MACHINE_BOOTINFO_H_
39#define	_MACHINE_BOOTINFO_H_
40
41/* Only change the version number if you break compatibility. */
42#define	BOOTINFO_VERSION	2
43
44#define	MIPS_BOOTINFO_MAGIC	0xCDEACDEA
45
46#if defined(__mips_n32) || defined(__mips_n64)
47typedef	uint64_t	bi_ptr_t;
48#else
49typedef	uint32_t	bi_ptr_t;
50#endif
51
52/*
53 * A zero bootinfo field often means that there is no info available.
54 * Flags are used to indicate the validity of fields where zero is a
55 * normal value.
56 */
57struct bootinfo {
58	/* bootinfo meta-data. */
59	uint32_t	bi_version;
60	uint32_t	bi_size;
61
62	/* bootinfo contents. */
63	uint64_t	bi_boot2opts;	/* boot2 flags to loader. */
64	bi_ptr_t	bi_kernelname;	/* Pointer to name. */
65	bi_ptr_t	bi_nfs_diskless;/* Pointer to NFS data. */
66	bi_ptr_t	bi_dtb;		/* Pointer to dtb. */
67	bi_ptr_t	bi_memsize;	/* Physical memory size in bytes. */
68	bi_ptr_t	bi_modulep;	/* Preloaded modules. */
69	bi_ptr_t	bi_boot_dev_type;	/* Boot-device type. */
70	bi_ptr_t	bi_boot_dev_unitptr;	/* Boot-device unit/pointer. */
71};
72
73/*
74 * Possible boot-device types passed from boot2 to loader, loader to kernel.
75 * In most cases, the object pointed to will hold a filesystem; one exception
76 * is BOOTINFO_DEV_TYPE_DRAM, which points to a pre-loaded object (e.g.,
77 * loader, kernel).
78 */
79#define	BOOTINFO_DEV_TYPE_DRAM		0	/* DRAM loader/kernel (ptr). */
80#define	BOOTINFO_DEV_TYPE_CFI		1	/* CFI flash (unit). */
81#define	BOOTINFO_DEV_TYPE_SDCARD	2	/* SD card (unit). */
82
83#ifdef _KERNEL
84extern struct bootinfo	bootinfo;
85#endif
86
87#endif	/* !_MACHINE_BOOTINFO_H_ */
88