1237069Simp/*-
2237069Simp * Copyright (c) 2012 M. Warner Losh.
3237069Simp * All rights reserved.
4237069Simp *
5237069Simp * Redistribution and use in source and binary forms, with or without
6237069Simp * modification, are permitted provided that the following conditions
7237069Simp * are met:
8237069Simp * 1. Redistributions of source code must retain the above copyright
9237069Simp *    notice, this list of conditions and the following disclaimer.
10237069Simp * 2. Redistributions in binary form must reproduce the above copyright
11237069Simp *    notice, this list of conditions and the following disclaimer in the
12237069Simp *    documentation and/or other materials provided with the distribution.
13237069Simp *
14237069Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15237069Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16237069Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17237069Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18237069Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19237069Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20237069Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21237069Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22237069Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23237069Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24237069Simp * SUCH DAMAGE.
25237069Simp *
26237069Simp * $FreeBSD$
27237069Simp */
28237069Simp
29237069Simp#ifndef	__MACHINE_ATAGS_H__
30237069Simp#define __MACHINE_ATAGS_H__
31237069Simp
32237069Simp/*
33237069Simp * Linux boot ABI compatable ATAG definitions.  All these structures
34237069Simp * assume tight packing, but since they are all uint32_t's, I've not
35237069Simp * bothered to do the usual alignment dance.
36237069Simp */
37237069Simp
38237069Simp#define	LBABI_MAX_COMMAND_LINE  1024
39237069Simp
40237069Simpstruct arm_lbabi_header
41237069Simp{
42237069Simp	uint32_t	size;		/* Size of this node, including header */
43237069Simp	uint32_t	tag;		/* Node type */
44237069Simp};
45237069Simp
46237069Simp#define	ATAG_NONE       0x00000000	/* End of atags list */
47237069Simp#define	ATAG_CORE	0x54410001	/* List must start with ATAG_CORE */
48237069Simp#define	ATAG_MEM	0x54410002	/* Multiple ATAG_MEM nodes possible */
49237069Simp#define	ATAG_VIDEOTEXT	0x54410003	/* Video parameters */
50237069Simp#define	ATAG_RAMDISK	0x54410004	/* Describes the ramdisk parameters */
51237069Simp#define	ATAG_INITRD	0x54410005	/* Deprecated ramdisk -- used va not pa */
52237069Simp#define	ATAG_INITRD2	0x54420005	/* compressed ramdisk image */
53237069Simp#define	ATAG_SERIAL	0x54410006	/* 64-bits of serial number */
54237069Simp#define	ATAG_REVISION	0x54410007	/* Board revision */
55237069Simp#define	ATAG_VIDEOLFB	0x54410008	/* vesafb framebuffer */
56237069Simp#define	ATAG_CMDLINE	0x54410009	/* Command line */
57237069Simp
58237069Simp/*
59237069Simp * ATAG_CORE data
60237069Simp */
61237069Simpstruct arm_lbabi_core
62237069Simp{
63237069Simp	uint32_t flags;			/* bit 0 == read-only */
64237069Simp	uint32_t pagesize;
65237069Simp	uint32_t rootdev;
66237069Simp};
67290648Smmel
68237069Simp/*
69237069Simp * ATAG_MEM data -- Can be more than one to describe different
70237069Simp * banks.
71237069Simp */
72237069Simpstruct arm_lbabi_mem32
73237069Simp{
74237069Simp	uint32_t size;
75237069Simp	uint32_t start;			/* start of physical memory */
76237069Simp};
77237069Simp
78290648Smmel/*
79237069Simp * ATAG_INITRD2 - Compressed ramdisk image details
80237069Simp */
81237069Simpstruct arm_lbabi_initrd
82237069Simp{
83237069Simp	uint32_t start;			/* pa of start */
84237069Simp	uint32_t size;			/* How big the ram disk is */
85237069Simp};
86237069Simp
87237069Simp/*
88237069Simp * ATAG_SERIAL - serial number
89237069Simp */
90237069Simpstruct arm_lbabi_serial_number
91237069Simp{
92237069Simp	uint32_t low;
93237069Simp	uint32_t high;
94237069Simp};
95290648Smmel
96237069Simp/*
97237069Simp * ATAG_REVISION - board revision
98237069Simp */
99237069Simpstruct arm_lbabi_revision
100237069Simp{
101237069Simp	uint32_t rev;
102237069Simp};
103290648Smmel
104237069Simp/*
105237069Simp * ATAG_CMDLINE - Command line from uboot
106237069Simp */
107237069Simpstruct arm_lbabi_command_line
108237069Simp{
109237069Simp	char command[1];		/* Minimum command length */
110237069Simp};
111237069Simp
112290648Smmelstruct arm_lbabi_tag
113237069Simp{
114237069Simp	struct arm_lbabi_header tag_hdr;
115237069Simp	union {
116237069Simp		struct arm_lbabi_core tag_core;
117237069Simp		struct arm_lbabi_mem32 tag_mem;
118237069Simp		struct arm_lbabi_initrd tag_initrd;
119237069Simp		struct arm_lbabi_serial_number tag_sn;
120237069Simp		struct arm_lbabi_revision tag_rev;
121237069Simp		struct arm_lbabi_command_line tag_cmd;
122237069Simp	} u;
123237069Simp};
124237069Simp
125237069Simp#define	ATAG_TAG(a)  (a)->tag_hdr.tag
126297285Smmel#define ATAG_SIZE(a) ((a)->tag_hdr.size * sizeof(uint32_t))
127237069Simp#define ATAG_NEXT(a) (struct arm_lbabi_tag *)((char *)(a) + ATAG_SIZE(a))
128237069Simp
129237069Simp#endif /* __MACHINE_ATAGS_H__ */
130