atags.h revision 237069
1258945Sroberto/*-
2258945Sroberto * Copyright (c) 2012 M. Warner Losh.
3258945Sroberto * All rights reserved.
4258945Sroberto *
5258945Sroberto * Redistribution and use in source and binary forms, with or without
6258945Sroberto * modification, are permitted provided that the following conditions
7258945Sroberto * are met:
8258945Sroberto * 1. Redistributions of source code must retain the above copyright
9258945Sroberto *    notice, this list of conditions and the following disclaimer.
10258945Sroberto * 2. Redistributions in binary form must reproduce the above copyright
11258945Sroberto *    notice, this list of conditions and the following disclaimer in the
12258945Sroberto *    documentation and/or other materials provided with the distribution.
13258945Sroberto *
14258945Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15258945Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16258945Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17258945Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18258945Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19258945Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20258945Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21258945Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22258945Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23258945Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24258945Sroberto * SUCH DAMAGE.
25258945Sroberto *
26258945Sroberto * $FreeBSD: head/sys/arm/include/atags.h 237069 2012-06-14 14:38:55Z imp $
27258945Sroberto */
28258945Sroberto
29258945Sroberto#ifndef	__MACHINE_ATAGS_H__
30258945Sroberto#define __MACHINE_ATAGS_H__
31280849Scy
32258945Sroberto/*
33258945Sroberto * Linux boot ABI compatable ATAG definitions.  All these structures
34258945Sroberto * assume tight packing, but since they are all uint32_t's, I've not
35258945Sroberto * bothered to do the usual alignment dance.
36258945Sroberto */
37258945Sroberto
38258945Sroberto#define	LBABI_MAX_COMMAND_LINE  1024
39258945Sroberto
40258945Srobertostruct arm_lbabi_header
41258945Sroberto{
42258945Sroberto	uint32_t	size;		/* Size of this node, including header */
43258945Sroberto	uint32_t	tag;		/* Node type */
44258945Sroberto};
45258945Sroberto
46258945Sroberto#define	ATAG_NONE       0x00000000	/* End of atags list */
47258945Sroberto#define	ATAG_CORE	0x54410001	/* List must start with ATAG_CORE */
48258945Sroberto#define	ATAG_MEM	0x54410002	/* Multiple ATAG_MEM nodes possible */
49258945Sroberto#define	ATAG_VIDEOTEXT	0x54410003	/* Video parameters */
50258945Sroberto#define	ATAG_RAMDISK	0x54410004	/* Describes the ramdisk parameters */
51258945Sroberto#define	ATAG_INITRD	0x54410005	/* Deprecated ramdisk -- used va not pa */
52258945Sroberto#define	ATAG_INITRD2	0x54420005	/* compressed ramdisk image */
53258945Sroberto#define	ATAG_SERIAL	0x54410006	/* 64-bits of serial number */
54258945Sroberto#define	ATAG_REVISION	0x54410007	/* Board revision */
55258945Sroberto#define	ATAG_VIDEOLFB	0x54410008	/* vesafb framebuffer */
56258945Sroberto#define	ATAG_CMDLINE	0x54410009	/* Command line */
57258945Sroberto
58258945Sroberto/*
59258945Sroberto * ATAG_CORE data
60258945Sroberto */
61258945Srobertostruct arm_lbabi_core
62258945Sroberto{
63258945Sroberto	uint32_t flags;			/* bit 0 == read-only */
64258945Sroberto	uint32_t pagesize;
65258945Sroberto	uint32_t rootdev;
66258945Sroberto};
67258945Sroberto
68258945Sroberto/*
69258945Sroberto * ATAG_MEM data -- Can be more than one to describe different
70258945Sroberto * banks.
71258945Sroberto */
72258945Srobertostruct arm_lbabi_mem32
73258945Sroberto{
74258945Sroberto	uint32_t size;
75258945Sroberto	uint32_t start;			/* start of physical memory */
76258945Sroberto};
77258945Sroberto
78258945Sroberto/*
79258945Sroberto * ATAG_INITRD2 - Compressed ramdisk image details
80258945Sroberto */
81258945Srobertostruct arm_lbabi_initrd
82258945Sroberto{
83258945Sroberto	uint32_t start;			/* pa of start */
84258945Sroberto	uint32_t size;			/* How big the ram disk is */
85258945Sroberto};
86258945Sroberto
87258945Sroberto/*
88258945Sroberto * ATAG_SERIAL - serial number
89258945Sroberto */
90258945Srobertostruct arm_lbabi_serial_number
91258945Sroberto{
92258945Sroberto	uint32_t low;
93258945Sroberto	uint32_t high;
94258945Sroberto};
95258945Sroberto
96258945Sroberto/*
97258945Sroberto * ATAG_REVISION - board revision
98258945Sroberto */
99258945Srobertostruct arm_lbabi_revision
100258945Sroberto{
101258945Sroberto	uint32_t rev;
102258945Sroberto};
103258945Sroberto
104258945Sroberto/*
105258945Sroberto * ATAG_CMDLINE - Command line from uboot
106258945Sroberto */
107258945Srobertostruct arm_lbabi_command_line
108258945Sroberto{
109258945Sroberto	char command[1];		/* Minimum command length */
110258945Sroberto};
111258945Sroberto
112258945Srobertostruct arm_lbabi_tag
113258945Sroberto{
114258945Sroberto	struct arm_lbabi_header tag_hdr;
115258945Sroberto	union {
116258945Sroberto		struct arm_lbabi_core tag_core;
117258945Sroberto		struct arm_lbabi_mem32 tag_mem;
118258945Sroberto		struct arm_lbabi_initrd tag_initrd;
119280849Scy		struct arm_lbabi_serial_number tag_sn;
120280849Scy		struct arm_lbabi_revision tag_rev;
121258945Sroberto		struct arm_lbabi_command_line tag_cmd;
122258945Sroberto	} u;
123258945Sroberto};
124258945Sroberto
125258945Sroberto#define	ATAG_TAG(a)  (a)->tag_hdr.tag
126258945Sroberto#define ATAG_SIZE(a) (a)->tag_hdr.size
127258945Sroberto#define ATAG_NEXT(a) (struct arm_lbabi_tag *)((char *)(a) + ATAG_SIZE(a))
128258945Sroberto
129258945Sroberto#endif /* __MACHINE_ATAGS_H__ */
130258945Sroberto