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.

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