1 /* 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 * SPDX-License-Identifier: GPL-2.0+ 8 */ 9 #ifndef __ASM_AVR32_SETUP_H__ 10 #define __ASM_AVR32_SETUP_H__ 11 12 #define COMMAND_LINE_SIZE 256 13 14 /* Magic number indicating that a tag table is present */ 15 #define ATAG_MAGIC 0xa2a25441 16 17 #ifndef __ASSEMBLY__ 18 19 /* 20 * Generic memory range, used by several tags. 21 * 22 * addr is always physical. 23 * size is measured in bytes. 24 * next is for use by the OS, e.g. for grouping regions into 25 * linked lists. 26 */ 27 struct tag_mem_range { 28 u32 addr; 29 u32 size; 30 struct tag_mem_range * next; 31 }; 32 33 /* The list ends with an ATAG_NONE node. */ 34 #define ATAG_NONE 0x00000000 35 36 struct tag_header { 37 u32 size; 38 u32 tag; 39 }; 40 41 /* The list must start with an ATAG_CORE node */ 42 #define ATAG_CORE 0x54410001 43 44 struct tag_core { 45 u32 flags; 46 u32 pagesize; 47 u32 rootdev; 48 }; 49 50 /* it is allowed to have multiple ATAG_MEM nodes */ 51 #define ATAG_MEM 0x54410002 52 /* ATAG_MEM uses tag_mem_range */ 53 54 /* command line: \0 terminated string */ 55 #define ATAG_CMDLINE 0x54410003 56 57 struct tag_cmdline { 58 char cmdline[1]; /* this is the minimum size */ 59 }; 60 61 /* Ramdisk image (may be compressed) */ 62 #define ATAG_RDIMG 0x54410004 63 /* ATAG_RDIMG uses tag_mem_range */ 64 65 /* Information about various clocks present in the system */ 66 #define ATAG_CLOCK 0x54410005 67 68 struct tag_clock { 69 u32 clock_id; /* Which clock are we talking about? */ 70 u32 clock_flags; /* Special features */ 71 u64 clock_hz; /* Clock speed in Hz */ 72 }; 73 74 /* The clock types we know about */ 75 #define ACLOCK_BOOTCPU 0 /* The CPU we're booting from */ 76 #define ACLOCK_HSB 1 /* Deprecated */ 77 78 /* Memory reserved for the system (e.g. the bootloader) */ 79 #define ATAG_RSVD_MEM 0x54410006 80 /* ATAG_RSVD_MEM uses tag_mem_range */ 81 82 /* Ethernet information */ 83 84 #define ATAG_ETHERNET 0x54410007 85 86 struct tag_ethernet { 87 u8 mac_index; 88 u8 mii_phy_addr; 89 u8 hw_address[6]; 90 }; 91 92 #define AETH_INVALID_PHY 0xff 93 94 /* board information information */ 95 #define ATAG_BOARDINFO 0x54410008 96 97 struct tag_boardinfo { 98 u32 board_number; 99 }; 100 101 struct tag { 102 struct tag_header hdr; 103 union { 104 struct tag_core core; 105 struct tag_mem_range mem_range; 106 struct tag_cmdline cmdline; 107 struct tag_clock clock; 108 struct tag_ethernet ethernet; 109 struct tag_boardinfo boardinfo; 110 } u; 111 }; 112 113 struct tagtable { 114 u32 tag; 115 int (*parse)(struct tag *); 116 }; 117 118 #define __tag __attribute_used__ __attribute__((__section__(".taglist"))) 119 #define __tagtable(tag, fn) \ 120 static struct tagtable __tagtable_##fn __tag = { tag, fn } 121 122 #define tag_member_present(tag,member) \ 123 ((unsigned long)(&((struct tag *)0L)->member + 1) \ 124 <= (tag)->hdr.size * 4) 125 126 #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) 127 #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) 128 129 #define for_each_tag(t,base) \ 130 for (t = base; t->hdr.size; t = tag_next(t)) 131 132 #endif /* !__ASSEMBLY__ */ 133 134 #endif /* __ASM_AVR32_SETUP_H__ */ 135