atags.h revision 330897
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 M. Warner Losh.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
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 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: stable/11/sys/arm/include/atags.h 330897 2018-03-14 03:19:51Z eadler $
29 */
30
31#ifndef	__MACHINE_ATAGS_H__
32#define __MACHINE_ATAGS_H__
33
34/*
35 * Linux boot ABI compatable ATAG definitions.  All these structures
36 * assume tight packing, but since they are all uint32_t's, I've not
37 * bothered to do the usual alignment dance.
38 */
39
40#define	LBABI_MAX_COMMAND_LINE  1024
41
42struct arm_lbabi_header
43{
44	uint32_t	size;		/* Size of this node, including header */
45	uint32_t	tag;		/* Node type */
46};
47
48#define	ATAG_NONE       0x00000000	/* End of atags list */
49#define	ATAG_CORE	0x54410001	/* List must start with ATAG_CORE */
50#define	ATAG_MEM	0x54410002	/* Multiple ATAG_MEM nodes possible */
51#define	ATAG_VIDEOTEXT	0x54410003	/* Video parameters */
52#define	ATAG_RAMDISK	0x54410004	/* Describes the ramdisk parameters */
53#define	ATAG_INITRD	0x54410005	/* Deprecated ramdisk -- used va not pa */
54#define	ATAG_INITRD2	0x54420005	/* compressed ramdisk image */
55#define	ATAG_SERIAL	0x54410006	/* 64-bits of serial number */
56#define	ATAG_REVISION	0x54410007	/* Board revision */
57#define	ATAG_VIDEOLFB	0x54410008	/* vesafb framebuffer */
58#define	ATAG_CMDLINE	0x54410009	/* Command line */
59
60/*
61 * ATAG_CORE data
62 */
63struct arm_lbabi_core
64{
65	uint32_t flags;			/* bit 0 == read-only */
66	uint32_t pagesize;
67	uint32_t rootdev;
68};
69
70/*
71 * ATAG_MEM data -- Can be more than one to describe different
72 * banks.
73 */
74struct arm_lbabi_mem32
75{
76	uint32_t size;
77	uint32_t start;			/* start of physical memory */
78};
79
80/*
81 * ATAG_INITRD2 - Compressed ramdisk image details
82 */
83struct arm_lbabi_initrd
84{
85	uint32_t start;			/* pa of start */
86	uint32_t size;			/* How big the ram disk is */
87};
88
89/*
90 * ATAG_SERIAL - serial number
91 */
92struct arm_lbabi_serial_number
93{
94	uint32_t low;
95	uint32_t high;
96};
97
98/*
99 * ATAG_REVISION - board revision
100 */
101struct arm_lbabi_revision
102{
103	uint32_t rev;
104};
105
106/*
107 * ATAG_CMDLINE - Command line from uboot
108 */
109struct arm_lbabi_command_line
110{
111	char command[1];		/* Minimum command length */
112};
113
114struct arm_lbabi_tag
115{
116	struct arm_lbabi_header tag_hdr;
117	union {
118		struct arm_lbabi_core tag_core;
119		struct arm_lbabi_mem32 tag_mem;
120		struct arm_lbabi_initrd tag_initrd;
121		struct arm_lbabi_serial_number tag_sn;
122		struct arm_lbabi_revision tag_rev;
123		struct arm_lbabi_command_line tag_cmd;
124	} u;
125};
126
127#define	ATAG_TAG(a)  (a)->tag_hdr.tag
128#define ATAG_SIZE(a) ((a)->tag_hdr.size * sizeof(uint32_t))
129#define ATAG_NEXT(a) (struct arm_lbabi_tag *)((char *)(a) + ATAG_SIZE(a))
130
131#endif /* __MACHINE_ATAGS_H__ */
132