efifs.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #ifndef _EFI_FS_H
  2. #define _EFI_FS_H
  3. /*++
  4. Copyright (c) 1998 Intel Corporation
  5. Module Name:
  6. efifs.h
  7. Abstract:
  8. EFI File System structures
  9. Revision History
  10. --*/
  11. //
  12. // EFI Partition header (normaly starts in LBA 1)
  13. //
  14. #define EFI_PARTITION_SIGNATURE 0x5053595320494249
  15. #define EFI_PARTITION_REVISION 0x00010001
  16. #define MIN_EFI_PARTITION_BLOCK_SIZE 512
  17. #define EFI_PARTITION_LBA 1
  18. typedef struct _EFI_PARTITION_HEADER {
  19. EFI_TABLE_HEADER Hdr;
  20. UINT32 DirectoryAllocationNumber;
  21. UINT32 BlockSize;
  22. EFI_LBA FirstUsableLba;
  23. EFI_LBA LastUsableLba;
  24. EFI_LBA UnusableSpace;
  25. EFI_LBA FreeSpace;
  26. EFI_LBA RootFile;
  27. EFI_LBA SecutiryFile;
  28. } EFI_PARTITION_HEADER;
  29. //
  30. // File header
  31. //
  32. #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249
  33. #define EFI_FILE_HEADER_REVISION 0x00010000
  34. #define EFI_FILE_STRING_SIZE 260
  35. typedef struct _EFI_FILE_HEADER {
  36. EFI_TABLE_HEADER Hdr;
  37. UINT32 Class;
  38. UINT32 LBALOffset;
  39. EFI_LBA Parent;
  40. UINT64 FileSize;
  41. UINT64 FileAttributes;
  42. EFI_TIME FileCreateTime;
  43. EFI_TIME FileModificationTime;
  44. EFI_GUID VendorGuid;
  45. CHAR16 FileString[EFI_FILE_STRING_SIZE];
  46. } EFI_FILE_HEADER;
  47. //
  48. // Return the file's first LBAL which is in the same
  49. // logical block as the file header
  50. //
  51. #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset))
  52. #define EFI_FILE_CLASS_FREE_SPACE 1
  53. #define EFI_FILE_CLASS_EMPTY 2
  54. #define EFI_FILE_CLASS_NORMAL 3
  55. //
  56. // Logical Block Address List - the fundemental block
  57. // description structure
  58. //
  59. #define EFI_LBAL_SIGNATURE 0x4c41424c20494249
  60. #define EFI_LBAL_REVISION 0x00010000
  61. typedef struct _EFI_LBAL {
  62. EFI_TABLE_HEADER Hdr;
  63. UINT32 Class;
  64. EFI_LBA Parent;
  65. EFI_LBA Next;
  66. UINT32 ArraySize;
  67. UINT32 ArrayCount;
  68. } EFI_LBAL;
  69. // Array size
  70. #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \
  71. (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL))
  72. //
  73. // Logical Block run-length
  74. //
  75. typedef struct {
  76. EFI_LBA Start;
  77. UINT64 Length;
  78. } EFI_RL;
  79. //
  80. // Return the run-length structure from an LBAL header
  81. //
  82. #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize))
  83. #endif