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.

127 lines
2.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. #define IFDTOOL_VERSION "1.2"
  17. enum ifd_version {
  18. IFD_VERSION_1,
  19. IFD_VERSION_2,
  20. };
  21. enum platform {
  22. PLATFORM_APL,
  23. PLATFORM_CNL,
  24. PLATFORM_GLK,
  25. PLATFORM_SKLKBL,
  26. };
  27. #define LAYOUT_LINELEN 80
  28. enum spi_frequency {
  29. SPI_FREQUENCY_20MHZ = 0,
  30. SPI_FREQUENCY_33MHZ = 1,
  31. SPI_FREQUENCY_48MHZ = 2,
  32. SPI_FREQUENCY_50MHZ_30MHZ = 4,
  33. SPI_FREQUENCY_17MHZ = 6,
  34. };
  35. enum component_density {
  36. COMPONENT_DENSITY_512KB = 0,
  37. COMPONENT_DENSITY_1MB = 1,
  38. COMPONENT_DENSITY_2MB = 2,
  39. COMPONENT_DENSITY_4MB = 3,
  40. COMPONENT_DENSITY_8MB = 4,
  41. COMPONENT_DENSITY_16MB = 5,
  42. COMPONENT_DENSITY_32MB = 6,
  43. COMPONENT_DENSITY_64MB = 7,
  44. COMPONENT_DENSITY_UNUSED = 0xf
  45. };
  46. // flash descriptor
  47. typedef struct {
  48. uint32_t flvalsig;
  49. uint32_t flmap0;
  50. uint32_t flmap1;
  51. uint32_t flmap2;
  52. uint8_t reserved[0xefc - 0x20];
  53. uint32_t flumap1;
  54. } __attribute__((packed)) fdbar_t;
  55. // regions
  56. #define MAX_REGIONS 9
  57. #define MAX_REGIONS_OLD 5
  58. typedef struct {
  59. uint32_t flreg[MAX_REGIONS];
  60. } __attribute__((packed)) frba_t;
  61. // component section
  62. typedef struct {
  63. uint32_t flcomp;
  64. uint32_t flill;
  65. uint32_t flpb;
  66. } __attribute__((packed)) fcba_t;
  67. // pch strap
  68. #define MAX_PCHSTRP 18
  69. typedef struct {
  70. uint32_t pchstrp[MAX_PCHSTRP];
  71. } __attribute__((packed)) fpsba_t;
  72. /*
  73. * WR / RD bits start at different locations within the flmstr regs, but
  74. * otherwise have identical meaning.
  75. */
  76. #define FLMSTR_WR_SHIFT_V1 24
  77. #define FLMSTR_WR_SHIFT_V2 20
  78. #define FLMSTR_RD_SHIFT_V1 16
  79. #define FLMSTR_RD_SHIFT_V2 8
  80. // master
  81. typedef struct {
  82. uint32_t flmstr1;
  83. uint32_t flmstr2;
  84. uint32_t flmstr3;
  85. uint32_t flmstr4;
  86. uint32_t flmstr5;
  87. } __attribute__((packed)) fmba_t;
  88. // processor strap
  89. typedef struct {
  90. uint32_t data[8];
  91. } __attribute__((packed)) fmsba_t;
  92. // ME VSCC
  93. typedef struct {
  94. uint32_t jid;
  95. uint32_t vscc;
  96. } vscc_t;
  97. typedef struct {
  98. // Actual number of entries specified in vtl
  99. vscc_t entry[8];
  100. } vtba_t;
  101. typedef struct {
  102. int base, limit, size;
  103. } region_t;
  104. struct region_name {
  105. const char *pretty;
  106. const char *terse;
  107. const char *filename;
  108. };