setup.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2004-2006 Atmel Corporation
  3. *
  4. * Based on linux/include/asm-arm/setup.h
  5. * Copyright (C) 1997-1999 Russell King
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __ASM_AVR32_SETUP_H__
  12. #define __ASM_AVR32_SETUP_H__
  13. #include <uapi/asm/setup.h>
  14. /* Magic number indicating that a tag table is present */
  15. #define ATAG_MAGIC 0xa2a25441
  16. #ifndef __ASSEMBLY__
  17. /*
  18. * Generic memory range, used by several tags.
  19. *
  20. * addr is always physical.
  21. * size is measured in bytes.
  22. * next is for use by the OS, e.g. for grouping regions into
  23. * linked lists.
  24. */
  25. struct tag_mem_range {
  26. u32 addr;
  27. u32 size;
  28. struct tag_mem_range * next;
  29. };
  30. /* The list ends with an ATAG_NONE node. */
  31. #define ATAG_NONE 0x00000000
  32. struct tag_header {
  33. u32 size;
  34. u32 tag;
  35. };
  36. /* The list must start with an ATAG_CORE node */
  37. #define ATAG_CORE 0x54410001
  38. struct tag_core {
  39. u32 flags;
  40. u32 pagesize;
  41. u32 rootdev;
  42. };
  43. /* it is allowed to have multiple ATAG_MEM nodes */
  44. #define ATAG_MEM 0x54410002
  45. /* ATAG_MEM uses tag_mem_range */
  46. /* command line: \0 terminated string */
  47. #define ATAG_CMDLINE 0x54410003
  48. struct tag_cmdline {
  49. char cmdline[1]; /* this is the minimum size */
  50. };
  51. /* Ramdisk image (may be compressed) */
  52. #define ATAG_RDIMG 0x54410004
  53. /* ATAG_RDIMG uses tag_mem_range */
  54. /* Information about various clocks present in the system */
  55. #define ATAG_CLOCK 0x54410005
  56. struct tag_clock {
  57. u32 clock_id; /* Which clock are we talking about? */
  58. u32 clock_flags; /* Special features */
  59. u64 clock_hz; /* Clock speed in Hz */
  60. };
  61. /* The clock types we know about */
  62. #define CLOCK_BOOTCPU 0
  63. /* Memory reserved for the system (e.g. the bootloader) */
  64. #define ATAG_RSVD_MEM 0x54410006
  65. /* ATAG_RSVD_MEM uses tag_mem_range */
  66. /* Ethernet information */
  67. #define ATAG_ETHERNET 0x54410007
  68. struct tag_ethernet {
  69. u8 mac_index;
  70. u8 mii_phy_addr;
  71. u8 hw_address[6];
  72. };
  73. #define ETH_INVALID_PHY 0xff
  74. /* board information */
  75. #define ATAG_BOARDINFO 0x54410008
  76. struct tag_boardinfo {
  77. u32 board_number;
  78. };
  79. struct tag {
  80. struct tag_header hdr;
  81. union {
  82. struct tag_core core;
  83. struct tag_mem_range mem_range;
  84. struct tag_cmdline cmdline;
  85. struct tag_clock clock;
  86. struct tag_ethernet ethernet;
  87. struct tag_boardinfo boardinfo;
  88. } u;
  89. };
  90. struct tagtable {
  91. u32 tag;
  92. int (*parse)(struct tag *);
  93. };
  94. #define __tag __used __attribute__((__section__(".taglist.init")))
  95. #define __tagtable(tag, fn) \
  96. static struct tagtable __tagtable_##fn __tag = { tag, fn }
  97. #define tag_member_present(tag,member) \
  98. ((unsigned long)(&((struct tag *)0L)->member + 1) \
  99. <= (tag)->hdr.size * 4)
  100. #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
  101. #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
  102. #define for_each_tag(t,base) \
  103. for (t = base; t->hdr.size; t = tag_next(t))
  104. extern struct tag *bootloader_tags;
  105. extern resource_size_t fbmem_start;
  106. extern resource_size_t fbmem_size;
  107. extern u32 board_number;
  108. void setup_processor(void);
  109. #endif /* !__ASSEMBLY__ */
  110. #endif /* __ASM_AVR32_SETUP_H__ */