You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
3.6 KiB

  1. /*
  2. * ifdtool - dump Intel Firmware Descriptor information
  3. *
  4. * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #define IFDTOOL_VERSION "1.2"
  18. enum ifd_version {
  19. IFD_VERSION_1,
  20. IFD_VERSION_2,
  21. };
  22. /* port from flashrom */
  23. enum ich_chipset {
  24. CHIPSET_ICH_UNKNOWN,
  25. CHIPSET_ICH,
  26. CHIPSET_ICH2345,
  27. CHIPSET_ICH6,
  28. CHIPSET_POULSBO, /* SCH U* */
  29. CHIPSET_TUNNEL_CREEK, /* Atom E6xx */
  30. CHIPSET_CENTERTON, /* Atom S1220 S1240 S1260 */
  31. CHIPSET_ICH7,
  32. CHIPSET_ICH8,
  33. CHIPSET_ICH9,
  34. CHIPSET_ICH10,
  35. CHIPSET_5_SERIES_IBEX_PEAK,
  36. CHIPSET_6_SERIES_COUGAR_POINT,
  37. CHIPSET_7_SERIES_PANTHER_POINT,
  38. CHIPSET_8_SERIES_LYNX_POINT,
  39. CHIPSET_BAYTRAIL, /* Actually all with Silvermont architecture:
  40. * Bay Trail, Avoton/Rangeley
  41. */
  42. CHIPSET_8_SERIES_LYNX_POINT_LP,
  43. CHIPSET_8_SERIES_WELLSBURG,
  44. CHIPSET_9_SERIES_WILDCAT_POINT,
  45. CHIPSET_9_SERIES_WILDCAT_POINT_LP,
  46. CHIPSET_100_SERIES_SUNRISE_POINT, /* also 6th/7th gen Core i/o (LP)
  47. * variants
  48. */
  49. CHIPSET_C620_SERIES_LEWISBURG,
  50. };
  51. enum platform {
  52. PLATFORM_APL,
  53. PLATFORM_CNL,
  54. PLATFORM_GLK,
  55. PLATFORM_ICL,
  56. PLATFORM_SKLKBL,
  57. };
  58. #define LAYOUT_LINELEN 80
  59. enum spi_frequency {
  60. SPI_FREQUENCY_20MHZ = 0,
  61. SPI_FREQUENCY_33MHZ = 1,
  62. SPI_FREQUENCY_48MHZ = 2,
  63. SPI_FREQUENCY_50MHZ_30MHZ = 4,
  64. SPI_FREQUENCY_17MHZ = 6,
  65. };
  66. enum component_density {
  67. COMPONENT_DENSITY_512KB = 0,
  68. COMPONENT_DENSITY_1MB = 1,
  69. COMPONENT_DENSITY_2MB = 2,
  70. COMPONENT_DENSITY_4MB = 3,
  71. COMPONENT_DENSITY_8MB = 4,
  72. COMPONENT_DENSITY_16MB = 5,
  73. COMPONENT_DENSITY_32MB = 6,
  74. COMPONENT_DENSITY_64MB = 7,
  75. COMPONENT_DENSITY_UNUSED = 0xf
  76. };
  77. // flash descriptor
  78. typedef struct {
  79. uint32_t flvalsig;
  80. uint32_t flmap0;
  81. uint32_t flmap1;
  82. uint32_t flmap2;
  83. } __attribute__((packed)) fdbar_t;
  84. // regions
  85. #define MAX_REGIONS 9
  86. #define MAX_REGIONS_OLD 5
  87. enum flash_regions {
  88. REGION_DESC,
  89. REGION_BIOS,
  90. REGION_ME,
  91. REGION_GBE,
  92. REGION_PDR,
  93. REGION_EC = 8,
  94. };
  95. typedef struct {
  96. uint32_t flreg[MAX_REGIONS];
  97. } __attribute__((packed)) frba_t;
  98. // component section
  99. typedef struct {
  100. uint32_t flcomp;
  101. uint32_t flill;
  102. uint32_t flpb;
  103. } __attribute__((packed)) fcba_t;
  104. // pch strap
  105. #define MAX_PCHSTRP 18
  106. typedef struct {
  107. uint32_t pchstrp[MAX_PCHSTRP];
  108. } __attribute__((packed)) fpsba_t;
  109. /*
  110. * WR / RD bits start at different locations within the flmstr regs, but
  111. * otherwise have identical meaning.
  112. */
  113. #define FLMSTR_WR_SHIFT_V1 24
  114. #define FLMSTR_WR_SHIFT_V2 20
  115. #define FLMSTR_RD_SHIFT_V1 16
  116. #define FLMSTR_RD_SHIFT_V2 8
  117. // master
  118. typedef struct {
  119. uint32_t flmstr1;
  120. uint32_t flmstr2;
  121. uint32_t flmstr3;
  122. uint32_t flmstr4;
  123. uint32_t flmstr5;
  124. } __attribute__((packed)) fmba_t;
  125. // processor strap
  126. typedef struct {
  127. uint32_t data[8];
  128. } __attribute__((packed)) fmsba_t;
  129. // ME VSCC
  130. typedef struct {
  131. uint32_t jid;
  132. uint32_t vscc;
  133. } vscc_t;
  134. typedef struct {
  135. // Actual number of entries specified in vtl
  136. /* FIXME: Rationale for the limit of 8.
  137. * AFAICT it's 127, cf. flashrom's ich_descriptors_tool). */
  138. vscc_t entry[8];
  139. } vtba_t;
  140. typedef struct {
  141. int base, limit, size;
  142. } region_t;
  143. struct region_name {
  144. const char *pretty;
  145. const char *terse;
  146. const char *filename;
  147. };