fsp_fv.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* SPDX-License-Identifier: Intel */
  2. /*
  3. * Copyright (C) 2013, Intel Corporation
  4. * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
  5. */
  6. #ifndef __FSP_FV___
  7. #define __FSP_FV___
  8. /* Value of EFI_FV_FILE_ATTRIBUTES */
  9. #define EFI_FV_FILE_ATTR_ALIGNMENT 0x0000001F
  10. #define EFI_FV_FILE_ATTR_FIXED 0x00000100
  11. #define EFI_FV_FILE_ATTR_MEMORY_MAPPED 0x00000200
  12. /* Attributes bit definitions */
  13. #define EFI_FVB2_READ_DISABLED_CAP 0x00000001
  14. #define EFI_FVB2_READ_ENABLED_CAP 0x00000002
  15. #define EFI_FVB2_READ_STATUS 0x00000004
  16. #define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
  17. #define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
  18. #define EFI_FVB2_WRITE_STATUS 0x00000020
  19. #define EFI_FVB2_LOCK_CAP 0x00000040
  20. #define EFI_FVB2_LOCK_STATUS 0x00000080
  21. #define EFI_FVB2_STICKY_WRITE 0x00000200
  22. #define EFI_FVB2_MEMORY_MAPPED 0x00000400
  23. #define EFI_FVB2_ERASE_POLARITY 0x00000800
  24. #define EFI_FVB2_READ_LOCK_CAP 0x00001000
  25. #define EFI_FVB2_READ_LOCK_STATUS 0x00002000
  26. #define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
  27. #define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
  28. #define EFI_FVB2_ALIGNMENT 0x001F0000
  29. #define EFI_FVB2_ALIGNMENT_1 0x00000000
  30. #define EFI_FVB2_ALIGNMENT_2 0x00010000
  31. #define EFI_FVB2_ALIGNMENT_4 0x00020000
  32. #define EFI_FVB2_ALIGNMENT_8 0x00030000
  33. #define EFI_FVB2_ALIGNMENT_16 0x00040000
  34. #define EFI_FVB2_ALIGNMENT_32 0x00050000
  35. #define EFI_FVB2_ALIGNMENT_64 0x00060000
  36. #define EFI_FVB2_ALIGNMENT_128 0x00070000
  37. #define EFI_FVB2_ALIGNMENT_256 0x00080000
  38. #define EFI_FVB2_ALIGNMENT_512 0x00090000
  39. #define EFI_FVB2_ALIGNMENT_1K 0x000A0000
  40. #define EFI_FVB2_ALIGNMENT_2K 0x000B0000
  41. #define EFI_FVB2_ALIGNMENT_4K 0x000C0000
  42. #define EFI_FVB2_ALIGNMENT_8K 0x000D0000
  43. #define EFI_FVB2_ALIGNMENT_16K 0x000E0000
  44. #define EFI_FVB2_ALIGNMENT_32K 0x000F0000
  45. #define EFI_FVB2_ALIGNMENT_64K 0x00100000
  46. #define EFI_FVB2_ALIGNMENT_128K 0x00110000
  47. #define EFI_FVB2_ALIGNMENT_256K 0x00120000
  48. #define EFI_FVB2_ALIGNMENT_512K 0x00130000
  49. #define EFI_FVB2_ALIGNMENT_1M 0x00140000
  50. #define EFI_FVB2_ALIGNMENT_2M 0x00150000
  51. #define EFI_FVB2_ALIGNMENT_4M 0x00160000
  52. #define EFI_FVB2_ALIGNMENT_8M 0x00170000
  53. #define EFI_FVB2_ALIGNMENT_16M 0x00180000
  54. #define EFI_FVB2_ALIGNMENT_32M 0x00190000
  55. #define EFI_FVB2_ALIGNMENT_64M 0x001A0000
  56. #define EFI_FVB2_ALIGNMENT_128M 0x001B0000
  57. #define EFI_FVB2_ALIGNMENT_256M 0x001C0000
  58. #define EFI_FVB2_ALIGNMENT_512M 0x001D0000
  59. #define EFI_FVB2_ALIGNMENT_1G 0x001E0000
  60. #define EFI_FVB2_ALIGNMENT_2G 0x001F0000
  61. struct fv_blkmap_entry {
  62. /* The number of sequential blocks which are of the same size */
  63. u32 num_blocks;
  64. /* The size of the blocks */
  65. u32 length;
  66. };
  67. /* Describes the features and layout of the firmware volume */
  68. struct fv_header {
  69. /*
  70. * The first 16 bytes are reserved to allow for the reset vector of
  71. * processors whose reset vector is at address 0.
  72. */
  73. u8 zero_vec[16];
  74. /*
  75. * Declares the file system with which the firmware volume
  76. * is formatted.
  77. */
  78. struct efi_guid fs_guid;
  79. /*
  80. * Length in bytes of the complete firmware volume, including
  81. * the header.
  82. */
  83. u64 fv_len;
  84. /* Set to EFI_FVH_SIGNATURE */
  85. u32 sign;
  86. /*
  87. * Declares capabilities and power-on defaults for the firmware
  88. * volume.
  89. */
  90. u32 attr;
  91. /* Length in bytes of the complete firmware volume header */
  92. u16 hdr_len;
  93. /*
  94. * A 16-bit checksum of the firmware volume header.
  95. * A valid header sums to zero.
  96. */
  97. u16 checksum;
  98. /*
  99. * Offset, relative to the start of the header, of the extended
  100. * header (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is
  101. * no extended header.
  102. */
  103. u16 ext_hdr_off;
  104. /* This field must always be set to zero */
  105. u8 reserved[1];
  106. /*
  107. * Set to 2. Future versions of this specification may define new
  108. * header fields and will increment the Revision field accordingly.
  109. */
  110. u8 rev;
  111. /*
  112. * An array of run-length encoded FvBlockMapEntry structures.
  113. * The array is terminated with an entry of {0,0}.
  114. */
  115. struct fv_blkmap_entry block_map[1];
  116. };
  117. #define EFI_FVH_SIGNATURE SIGNATURE_32('_', 'F', 'V', 'H')
  118. /* Firmware Volume Header Revision definition */
  119. #define EFI_FVH_REVISION 0x02
  120. /* Extension header pointed by ExtHeaderOffset of volume header */
  121. struct fv_ext_header {
  122. /* firmware volume name */
  123. struct efi_guid fv_name;
  124. /* Size of the rest of the extension header including this structure */
  125. u32 ext_hdr_size;
  126. };
  127. #endif