Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/stand/efi/include/efifs.h
34866 views
1
#ifndef _EFI_FS_H
2
#define _EFI_FS_H
3
4
/*++
5
6
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
7
This software and associated documentation (if any) is furnished
8
under a license and may only be used or copied in accordance
9
with the terms of the license. Except as permitted by such
10
license, no part of this software or documentation may be
11
reproduced, stored in a retrieval system, or transmitted in any
12
form or by any means without the express written consent of
13
Intel Corporation.
14
15
Module Name:
16
17
efifs.h
18
19
Abstract:
20
21
EFI File System structures
22
23
24
25
Revision History
26
27
--*/
28
29
30
//
31
// EFI Partition header (normally starts in LBA 1)
32
//
33
34
#define EFI_PARTITION_SIGNATURE 0x5053595320494249
35
#define EFI_PARTITION_REVISION 0x00010001
36
#define MIN_EFI_PARTITION_BLOCK_SIZE 512
37
#define EFI_PARTITION_LBA 1
38
39
typedef struct _EFI_PARTITION_HEADER {
40
EFI_TABLE_HEADER Hdr;
41
UINT32 DirectoryAllocationNumber;
42
UINT32 BlockSize;
43
EFI_LBA FirstUsableLba;
44
EFI_LBA LastUsableLba;
45
EFI_LBA UnusableSpace;
46
EFI_LBA FreeSpace;
47
EFI_LBA RootFile;
48
EFI_LBA SecutiryFile;
49
} EFI_PARTITION_HEADER;
50
51
52
//
53
// File header
54
//
55
56
#define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249
57
#define EFI_FILE_HEADER_REVISION 0x00010000
58
#define EFI_FILE_STRING_SIZE 260
59
60
typedef struct _EFI_FILE_HEADER {
61
EFI_TABLE_HEADER Hdr;
62
UINT32 Class;
63
UINT32 LBALOffset;
64
EFI_LBA Parent;
65
UINT64 FileSize;
66
UINT64 FileAttributes;
67
EFI_TIME FileCreateTime;
68
EFI_TIME FileModificationTime;
69
EFI_GUID VendorGuid;
70
CHAR16 FileString[EFI_FILE_STRING_SIZE];
71
} EFI_FILE_HEADER;
72
73
74
//
75
// Return the file's first LBAL which is in the same
76
// logical block as the file header
77
//
78
79
#define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset))
80
81
#define EFI_FILE_CLASS_FREE_SPACE 1
82
#define EFI_FILE_CLASS_EMPTY 2
83
#define EFI_FILE_CLASS_NORMAL 3
84
85
86
//
87
// Logical Block Address List - the fundemental block
88
// description structure
89
//
90
91
#define EFI_LBAL_SIGNATURE 0x4c41424c20494249
92
#define EFI_LBAL_REVISION 0x00010000
93
94
typedef struct _EFI_LBAL {
95
EFI_TABLE_HEADER Hdr;
96
UINT32 Class;
97
EFI_LBA Parent;
98
EFI_LBA Next;
99
UINT32 ArraySize;
100
UINT32 ArrayCount;
101
} EFI_LBAL;
102
103
// Array size
104
#define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \
105
(((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL))
106
107
//
108
// Logical Block run-length
109
//
110
111
typedef struct {
112
EFI_LBA Start;
113
UINT64 Length;
114
} EFI_RL;
115
116
//
117
// Return the run-length structure from an LBAL header
118
//
119
120
#define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize))
121
122
#endif
123
124