setup.h 2.9 KB

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