blob: 7f5d8834427346c4c13e4d424457530b4b421c29 [file] [log] [blame]
Wolfgang Denk7b64fef2006-10-24 14:21:16 +02001/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * Based on linux/include/asm-arm/setup.h
5 * Copyright (C) 1997-1999 Russel King
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25#ifndef __ASM_AVR32_SETUP_H__
26#define __ASM_AVR32_SETUP_H__
27
28#define COMMAND_LINE_SIZE 256
29
30/* Magic number indicating that a tag table is present */
31#define ATAG_MAGIC 0xa2a25441
32
33#ifndef __ASSEMBLY__
34
35/*
36 * Generic memory range, used by several tags.
37 *
38 * addr is always physical.
39 * size is measured in bytes.
40 * next is for use by the OS, e.g. for grouping regions into
41 * linked lists.
42 */
43struct tag_mem_range {
44 u32 addr;
45 u32 size;
46 struct tag_mem_range * next;
47};
48
49/* The list ends with an ATAG_NONE node. */
50#define ATAG_NONE 0x00000000
51
52struct tag_header {
53 u32 size;
54 u32 tag;
55};
56
57/* The list must start with an ATAG_CORE node */
58#define ATAG_CORE 0x54410001
59
60struct tag_core {
61 u32 flags;
62 u32 pagesize;
63 u32 rootdev;
64};
65
66/* it is allowed to have multiple ATAG_MEM nodes */
67#define ATAG_MEM 0x54410002
68/* ATAG_MEM uses tag_mem_range */
69
70/* command line: \0 terminated string */
71#define ATAG_CMDLINE 0x54410003
72
73struct tag_cmdline {
74 char cmdline[1]; /* this is the minimum size */
75};
76
77/* Ramdisk image (may be compressed) */
78#define ATAG_RDIMG 0x54410004
79/* ATAG_RDIMG uses tag_mem_range */
80
81/* Information about various clocks present in the system */
82#define ATAG_CLOCK 0x54410005
83
84struct tag_clock {
85 u32 clock_id; /* Which clock are we talking about? */
86 u32 clock_flags; /* Special features */
87 u64 clock_hz; /* Clock speed in Hz */
88};
89
90/* The clock types we know about */
91#define ACLOCK_BOOTCPU 0 /* The CPU we're booting from */
92#define ACLOCK_HSB 1 /* Deprecated */
93
94/* Memory reserved for the system (e.g. the bootloader) */
95#define ATAG_RSVD_MEM 0x54410006
96/* ATAG_RSVD_MEM uses tag_mem_range */
97
98/* Ethernet information */
99
100#define ATAG_ETHERNET 0x54410007
101
102struct tag_ethernet {
103 u8 mac_index;
104 u8 mii_phy_addr;
105 u8 hw_address[6];
106};
107
108#define AETH_INVALID_PHY 0xff
109
Andreas Bießmann24890f12011-04-12 23:25:41 +0000110/* board information information */
111#define ATAG_BOARDINFO 0x54410008
112
113struct tag_boardinfo {
114 u32 board_number;
115};
116
Wolfgang Denk7b64fef2006-10-24 14:21:16 +0200117struct tag {
118 struct tag_header hdr;
119 union {
120 struct tag_core core;
121 struct tag_mem_range mem_range;
122 struct tag_cmdline cmdline;
123 struct tag_clock clock;
124 struct tag_ethernet ethernet;
Andreas Bießmann24890f12011-04-12 23:25:41 +0000125 struct tag_boardinfo boardinfo;
Wolfgang Denk7b64fef2006-10-24 14:21:16 +0200126 } u;
127};
128
129struct tagtable {
130 u32 tag;
131 int (*parse)(struct tag *);
132};
133
134#define __tag __attribute_used__ __attribute__((__section__(".taglist")))
135#define __tagtable(tag, fn) \
136 static struct tagtable __tagtable_##fn __tag = { tag, fn }
137
138#define tag_member_present(tag,member) \
139 ((unsigned long)(&((struct tag *)0L)->member + 1) \
140 <= (tag)->hdr.size * 4)
141
142#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
143#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
144
145#define for_each_tag(t,base) \
146 for (t = base; t->hdr.size; t = tag_next(t))
147
148#endif /* !__ASSEMBLY__ */
149
150#endif /* __ASM_AVR32_SETUP_H__ */