1178172Simp/*-
2262217Srwatson * Copyright (c) 2013 Robert N. M. Watson
3178172Simp * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
4178172Simp * All rights reserved.
5178172Simp *
6178172Simp * Redistribution and use in source and binary forms, with or without
7178172Simp * modification, are permitted provided that the following conditions
8178172Simp * are met:
9178172Simp * 1. Redistributions of source code must retain the above copyright
10178172Simp *    notice, this list of conditions and the following disclaimer as
11178172Simp *    the first lines of this file unmodified.
12178172Simp * 2. Redistributions in binary form must reproduce the above copyright
13178172Simp *    notice, this list of conditions and the following disclaimer in the
14178172Simp *    documentation and/or other materials provided with the distribution.
15178172Simp * 3. All advertising materials mentioning features or use of this software
16178172Simp *    must display the following acknowledgement:
17178172Simp *	This product includes software developed by Rodney W. Grimes.
18178172Simp * 4. The name of the author may not be used to endorse or promote products
19178172Simp *    derived from this software without specific prior written permission.
20178172Simp *
21178172Simp * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
22178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
25178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31178172Simp * SUCH DAMAGE.
32178172Simp *
33178172Simp * $FreeBSD$
34178172Simp */
35178172Simp
36178172Simp#ifndef	_MACHINE_BOOTINFO_H_
37178172Simp#define	_MACHINE_BOOTINFO_H_
38178172Simp
39178172Simp/* Only change the version number if you break compatibility. */
40262217Srwatson#define	BOOTINFO_VERSION	2
41178172Simp
42178172Simp#define	MIPS_BOOTINFO_MAGIC	0xCDEACDEA
43178172Simp
44262217Srwatson#if defined(__mips_n32) || defined(__mips_n64)
45262217Srwatsontypedef	uint64_t	bi_ptr_t;
46262217Srwatson#else
47262217Srwatsontypedef	uint32_t	bi_ptr_t;
48262217Srwatson#endif
49178172Simp
50178172Simp/*
51178172Simp * A zero bootinfo field often means that there is no info available.
52178172Simp * Flags are used to indicate the validity of fields where zero is a
53178172Simp * normal value.
54178172Simp */
55178172Simpstruct bootinfo {
56262217Srwatson	/* bootinfo meta-data. */
57262217Srwatson	uint32_t	bi_version;
58262217Srwatson	uint32_t	bi_size;
59262217Srwatson
60262217Srwatson	/* bootinfo contents. */
61262217Srwatson	uint64_t	bi_boot2opts;	/* boot2 flags to loader. */
62262217Srwatson	bi_ptr_t	bi_kernelname;	/* Pointer to name. */
63262217Srwatson	bi_ptr_t	bi_nfs_diskless;/* Pointer to NFS data. */
64262217Srwatson	bi_ptr_t	bi_dtb;		/* Pointer to dtb. */
65262217Srwatson	bi_ptr_t	bi_memsize;	/* Physical memory size in bytes. */
66262217Srwatson	bi_ptr_t	bi_modulep;	/* Preloaded modules. */
67262217Srwatson	bi_ptr_t	bi_boot_dev_type;	/* Boot-device type. */
68262217Srwatson	bi_ptr_t	bi_boot_dev_unitptr;	/* Boot-device unit/pointer. */
69178172Simp};
70178172Simp
71262217Srwatson/*
72262217Srwatson * Possible boot-device types passed from boot2 to loader, loader to kernel.
73262217Srwatson * In most cases, the object pointed to will hold a filesystem; one exception
74262217Srwatson * is BOOTINFO_DEV_TYPE_DRAM, which points to a pre-loaded object (e.g.,
75262217Srwatson * loader, kernel).
76262217Srwatson */
77262217Srwatson#define	BOOTINFO_DEV_TYPE_DRAM		0	/* DRAM loader/kernel (ptr). */
78262217Srwatson#define	BOOTINFO_DEV_TYPE_CFI		1	/* CFI flash (unit). */
79262217Srwatson#define	BOOTINFO_DEV_TYPE_SDCARD	2	/* SD card (unit). */
80262217Srwatson
81178172Simp#ifdef _KERNEL
82178172Simpextern struct bootinfo	bootinfo;
83178172Simp#endif
84178172Simp
85178172Simp#endif	/* !_MACHINE_BOOTINFO_H_ */
86