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