setup.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. * 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. /* 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. struct tag {
  75. struct tag_header hdr;
  76. union {
  77. struct tag_core core;
  78. struct tag_mem_range mem_range;
  79. struct tag_cmdline cmdline;
  80. struct tag_clock clock;
  81. struct tag_ethernet ethernet;
  82. } u;
  83. };
  84. struct tagtable {
  85. u32 tag;
  86. int (*parse)(struct tag *);
  87. };
  88. #define __tag __attribute_used__ __attribute__((__section__(".taglist")))
  89. #define __tagtable(tag, fn) \
  90. static struct tagtable __tagtable_##fn __tag = { tag, fn }
  91. #define tag_member_present(tag,member) \
  92. ((unsigned long)(&((struct tag *)0L)->member + 1) \
  93. <= (tag)->hdr.size * 4)
  94. #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size))
  95. #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
  96. #define for_each_tag(t,base) \
  97. for (t = base; t->hdr.size; t = tag_next(t))
  98. extern struct tag_mem_range *mem_phys;
  99. extern struct tag_mem_range *mem_reserved;
  100. extern struct tag_mem_range *mem_ramdisk;
  101. extern struct tag *bootloader_tags;
  102. extern void setup_bootmem(void);
  103. extern void setup_processor(void);
  104. extern void board_setup_fbmem(unsigned long fbmem_start,
  105. unsigned long fbmem_size);
  106. /* Chip-specific hook to enable the use of SDRAM */
  107. void chip_enable_sdram(void);
  108. #endif /* !__ASSEMBLY__ */
  109. #endif /* __ASM_AVR32_SETUP_H__ */