atags.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #ifndef __ATAG_H__
  2. #define __ATAG_H__
  3. #include <stdint.h>
  4. #include <sys/types.h>
  5. #include <platform/mt_typedefs.h>
  6. struct tag_header {
  7. u32 size;
  8. u32 tag;
  9. };
  10. #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
  11. #define SIZE_1M (1024 * 1024)
  12. #define SIZE_2M (2 * SIZE_1M)
  13. #define SIZE_256M (256 * SIZE_1M)
  14. #define SIZE_512M (512 * SIZE_1M)
  15. /* The list must start with an ATAG_CORE node */
  16. #define ATAG_CORE 0x54410001
  17. struct tag_core {
  18. u32 flags; /* bit 0 = read-only */
  19. u32 pagesize;
  20. u32 rootdev;
  21. };
  22. /* it is allowed to have multiple ATAG_MEM nodes */
  23. #define ATAG_MEM 0x54410002
  24. typedef struct {
  25. uint32_t size;
  26. uint32_t start_addr;
  27. } mem_info;
  28. #define ATAG_MEM64 0x54420002
  29. typedef struct {
  30. uint64_t size;
  31. uint64_t start_addr;
  32. } mem64_info;
  33. #define ATAG_EXT_MEM64 0x54430002
  34. typedef struct {
  35. uint64_t size;
  36. uint64_t start_addr;
  37. } ext_mem64_info;
  38. /* command line: \0 terminated string */
  39. #define ATAG_CMDLINE 0x54410009
  40. struct tag_cmdline {
  41. char cmdline[1]; /* this is the minimum size */
  42. };
  43. /* describes where the compressed ramdisk image lives (physical address) */
  44. #define ATAG_INITRD2 0x54420005
  45. struct tag_initrd {
  46. u32 start; /* physical start address */
  47. u32 size; /* size of compressed ramdisk image in bytes */
  48. };
  49. #define ATAG_VIDEOLFB 0x54410008
  50. struct tag_videolfb {
  51. u16 lfb_width;
  52. u16 lfb_height;
  53. u16 lfb_depth;
  54. u16 lfb_linelength;
  55. u32 lfb_base;
  56. u32 lfb_size;
  57. u8 red_size;
  58. u8 red_pos;
  59. u8 green_size;
  60. u8 green_pos;
  61. u8 blue_size;
  62. u8 blue_pos;
  63. u8 rsvd_size;
  64. u8 rsvd_pos;
  65. };
  66. /* boot information */
  67. #define ATAG_BOOT 0x41000802
  68. struct tag_boot {
  69. u32 bootmode;
  70. };
  71. /* imix_r information */
  72. #define ATAG_IMIX 0x41000802
  73. struct tag_imix_r {
  74. u32 bootmode;
  75. };
  76. /*META com port information*/
  77. #define ATAG_META_COM 0x41000803
  78. struct tag_meta_com {
  79. u32 meta_com_type; /* identify meta via uart or usb */
  80. u32 meta_com_id; /* multiple meta need to know com port id */
  81. u32 meta_uart_port; /* identify meta uart port */
  82. };
  83. /*device information*/
  84. #define ATAG_DEVINFO_DATA 0x41000804
  85. #define ATAG_DEVINFO_DATA_SIZE 48
  86. struct tag_devinfo_data {
  87. u32 devinfo_data[ATAG_DEVINFO_DATA_SIZE];
  88. u32 devinfo_data_size;
  89. };
  90. #define ATAG_MDINFO_DATA 0x41000806
  91. struct tag_mdinfo_data {
  92. u8 md_type[4];
  93. };
  94. #define ATAG_VCORE_DVFS_INFO 0x54410007
  95. struct tag_vcore_dvfs_info {
  96. u32 pllgrpreg_size;
  97. u32 freqreg_size;
  98. u32 *low_freq_pll_val;
  99. u32 *low_freq_cha_val;
  100. u32 *low_freq_chb_val;
  101. u32 *high_freq_pll_val;
  102. u32 *high_freq_cha_val;
  103. u32 *high_freq_chb_val;
  104. };
  105. #define ATAG_PTP_INFO 0x54410008
  106. struct tag_ptp_info {
  107. u32 first_volt;
  108. u32 second_volt;
  109. u32 third_volt;
  110. u32 have_550;
  111. };
  112. /* The list ends with an ATAG_NONE node. */
  113. #define ATAG_NONE 0x00000000
  114. extern unsigned *target_atag_nand_data(unsigned *ptr) __attribute__((weak));
  115. extern unsigned *target_atag_partition_data(unsigned *ptr) __attribute__((weak));
  116. extern unsigned *target_atag_boot(unsigned *ptr) __attribute__((weak));
  117. #if defined(MTK_DLPT_SUPPORT)
  118. extern unsigned *target_atag_imix_r(unsigned *ptr) __attribute__((weak));
  119. #endif
  120. extern unsigned *target_atag_devinfo_data(unsigned *ptr) __attribute__((weak));
  121. extern unsigned *target_atag_mem(unsigned *ptr) __attribute__((weak));
  122. extern unsigned *target_atag_meta(unsigned *ptr) __attribute__((weak));
  123. /* todo: give lk strtoul and nuke this */
  124. extern unsigned *target_atag_initrd(unsigned *ptr, ulong initrd_start, ulong initrd_size) __attribute__((weak));
  125. extern unsigned *target_atag_videolfb(unsigned *ptr, size_t buf_size) __attribute__((weak));
  126. extern unsigned *target_atag_mdinfo(unsigned *ptr) __attribute__((weak));
  127. extern void *target_get_scratch_address(void) __attribute__((weak));
  128. extern int platform_atag_append(void *fdt) __attribute__((weak));
  129. extern unsigned int *target_atag_masp_data(unsigned *ptr)__attribute__((weak));
  130. #endif /* __ATAG_H__ */