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