]> git.proxmox.com Git - mirror_edk2.git/blob - FatPkg/FatPei/FatLiteFmt.h
MdeModulePkg: Add UdfDxe to the dsc file
[mirror_edk2.git] / FatPkg / FatPei / FatLiteFmt.h
1 /** @file
2 FAT format data structures
3
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef _FAT_FMT_H_
17 #define _FAT_FMT_H_
18
19 //
20 // Definitions
21 //
22 #define FAT_ATTR_READ_ONLY 0x01
23 #define FAT_ATTR_HIDDEN 0x02
24 #define FAT_ATTR_SYSTEM 0x04
25 #define FAT_ATTR_VOLUME_ID 0x08
26 #define FAT_ATTR_DIRECTORY 0x10
27 #define FAT_ATTR_ARCHIVE 0x20
28 #define FAT_ATTR_LFN (FAT_ATTR_READ_ONLY | FAT_ATTR_HIDDEN | FAT_ATTR_SYSTEM | FAT_ATTR_VOLUME_ID)
29
30 #define FAT_CLUSTER_SPECIAL ((MAX_UINT32 &~0xF) | 0x7)
31 #define FAT_CLUSTER_FREE 0
32 #define FAT_CLUSTER_RESERVED (FAT_CLUSTER_SPECIAL)
33 #define FAT_CLUSTER_BAD (FAT_CLUSTER_SPECIAL)
34 #define FAT_CLUSTER_LAST (-1)
35
36 #define DELETE_ENTRY_MARK 0xE5
37 #define EMPTY_ENTRY_MARK 0x00
38
39 #define FAT_CLUSTER_FUNCTIONAL(Cluster) (((Cluster) == 0) || ((Cluster) >= FAT_CLUSTER_SPECIAL))
40 #define FAT_CLUSTER_END_OF_CHAIN(Cluster) ((Cluster) > (FAT_CLUSTER_SPECIAL))
41
42 //
43 // Directory Entry
44 //
45 #pragma pack(1)
46
47 typedef struct {
48 UINT16 Day : 5;
49 UINT16 Month : 4;
50 UINT16 Year : 7; // From 1980
51 } FAT_DATE;
52
53 typedef struct {
54 UINT16 DoubleSecond : 5;
55 UINT16 Minute : 6;
56 UINT16 Hour : 5;
57 } FAT_TIME;
58
59 typedef struct {
60 FAT_TIME Time;
61 FAT_DATE Date;
62 } FAT_DATE_TIME;
63
64 typedef struct {
65 CHAR8 FileName[11]; // 8.3 filename
66 UINT8 Attributes;
67 UINT8 CaseFlag;
68 UINT8 CreateMillisecond; // (creation milliseconds - ignored)
69 FAT_DATE_TIME FileCreateTime;
70 FAT_DATE FileLastAccess;
71 UINT16 FileClusterHigh; // >= FAT32
72 FAT_DATE_TIME FileModificationTime;
73 UINT16 FileCluster;
74 UINT32 FileSize;
75 } FAT_DIRECTORY_ENTRY;
76
77 #pragma pack()
78 //
79 // Boot Sector
80 //
81 #pragma pack(1)
82
83 typedef struct {
84
85 UINT8 Ia32Jump[3];
86 CHAR8 OemId[8];
87
88 UINT16 SectorSize;
89 UINT8 SectorsPerCluster;
90 UINT16 ReservedSectors;
91 UINT8 NoFats;
92 UINT16 RootEntries; // < FAT32, root dir is fixed size
93 UINT16 Sectors;
94 UINT8 Media; // (ignored)
95 UINT16 SectorsPerFat; // < FAT32
96 UINT16 SectorsPerTrack; // (ignored)
97 UINT16 Heads; // (ignored)
98 UINT32 HiddenSectors; // (ignored)
99 UINT32 LargeSectors; // => FAT32
100 UINT8 PhysicalDriveNumber; // (ignored)
101 UINT8 CurrentHead; // holds boot_sector_dirty bit
102 UINT8 Signature; // (ignored)
103 CHAR8 Id[4];
104 CHAR8 FatLabel[11];
105 CHAR8 SystemId[8];
106
107 } PEI_FAT_BOOT_SECTOR;
108
109 typedef struct {
110
111 UINT8 Ia32Jump[3];
112 CHAR8 OemId[8];
113
114 UINT16 SectorSize;
115 UINT8 SectorsPerCluster;
116 UINT16 ReservedSectors;
117 UINT8 NoFats;
118 UINT16 RootEntries; // < FAT32, root dir is fixed size
119 UINT16 Sectors;
120 UINT8 Media; // (ignored)
121 UINT16 SectorsPerFat; // < FAT32
122 UINT16 SectorsPerTrack; // (ignored)
123 UINT16 Heads; // (ignored)
124 UINT32 HiddenSectors; // (ignored)
125 UINT32 LargeSectors; // Used if Sectors==0
126 UINT32 LargeSectorsPerFat; // FAT32
127 UINT16 ExtendedFlags; // FAT32 (ignored)
128 UINT16 FsVersion; // FAT32 (ignored)
129 UINT32 RootDirFirstCluster; // FAT32
130 UINT16 FsInfoSector; // FAT32
131 UINT16 BackupBootSector; // FAT32
132 UINT8 Reserved[12]; // FAT32 (ignored)
133 UINT8 PhysicalDriveNumber; // (ignored)
134 UINT8 CurrentHead; // holds boot_sector_dirty bit
135 UINT8 Signature; // (ignored)
136 CHAR8 Id[4];
137 CHAR8 FatLabel[11];
138 CHAR8 SystemId[8];
139
140 } PEI_FAT_BOOT_SECTOR_EX;
141
142 #pragma pack()
143
144 #endif