setup.h 3.2 KB

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