summaryrefslogtreecommitdiffstats
path: root/FatPkg/FatPei/FatLiteFmt.h
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2011-07-01 00:37:55 +0000
committerJordan Justen <jordan.l.justen@intel.com>2016-04-06 23:22:43 -0700
commit2f4dfa84ac56d84935e086e91f292134b8074984 (patch)
tree0a3da68cb84d922bf32943e67e61ce688fe57d28 /FatPkg/FatPei/FatLiteFmt.h
parent43ba7907426032e0ed6033d95545f8f7c28c44bd (diff)
downloadedk2-2f4dfa84ac56d84935e086e91f292134b8074984.tar.gz
edk2-2f4dfa84ac56d84935e086e91f292134b8074984.tar.bz2
edk2-2f4dfa84ac56d84935e086e91f292134b8074984.zip
FatPkg: Add FAT PEIM
Signed-off-by: jljusten Reviewed-by: mdkinney (based on FatPkg commit bead7f219277e063ed28589de8ddd01cf180c1a8) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'FatPkg/FatPei/FatLiteFmt.h')
-rw-r--r--FatPkg/FatPei/FatLiteFmt.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/FatPkg/FatPei/FatLiteFmt.h b/FatPkg/FatPei/FatLiteFmt.h
new file mode 100644
index 0000000000..d4f26f3540
--- /dev/null
+++ b/FatPkg/FatPei/FatLiteFmt.h
@@ -0,0 +1,144 @@
+/** @file
+ FAT format data structures
+
+Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+
+This program and the accompanying materials are licensed and made available
+under the terms and conditions of the BSD License which accompanies this
+distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _FAT_FMT_H_
+#define _FAT_FMT_H_
+
+//
+// Definitions
+//
+#define FAT_ATTR_READ_ONLY 0x01
+#define FAT_ATTR_HIDDEN 0x02
+#define FAT_ATTR_SYSTEM 0x04
+#define FAT_ATTR_VOLUME_ID 0x08
+#define FAT_ATTR_DIRECTORY 0x10
+#define FAT_ATTR_ARCHIVE 0x20
+#define FAT_ATTR_LFN (FAT_ATTR_READ_ONLY | FAT_ATTR_HIDDEN | FAT_ATTR_SYSTEM | FAT_ATTR_VOLUME_ID)
+
+#define FAT_CLUSTER_SPECIAL ((-1 &~0xF) | 0x7)
+#define FAT_CLUSTER_FREE 0
+#define FAT_CLUSTER_RESERVED (FAT_CLUSTER_SPECIAL)
+#define FAT_CLUSTER_BAD (FAT_CLUSTER_SPECIAL)
+#define FAT_CLUSTER_LAST (-1)
+
+#define DELETE_ENTRY_MARK 0xE5
+#define EMPTY_ENTRY_MARK 0x00
+
+#define FAT_CLUSTER_FUNCTIONAL(Cluster) (((Cluster) == 0) || ((Cluster) >= FAT_CLUSTER_SPECIAL))
+#define FAT_CLUSTER_END_OF_CHAIN(Cluster) ((Cluster) > (FAT_CLUSTER_SPECIAL))
+
+//
+// Directory Entry
+//
+#pragma pack(1)
+
+typedef struct {
+ UINT16 Day : 5;
+ UINT16 Month : 4;
+ UINT16 Year : 7; // From 1980
+} FAT_DATE;
+
+typedef struct {
+ UINT16 DoubleSecond : 5;
+ UINT16 Minute : 6;
+ UINT16 Hour : 5;
+} FAT_TIME;
+
+typedef struct {
+ FAT_TIME Time;
+ FAT_DATE Date;
+} FAT_DATE_TIME;
+
+typedef struct {
+ CHAR8 FileName[11]; // 8.3 filename
+ UINT8 Attributes;
+ UINT8 CaseFlag;
+ UINT8 CreateMillisecond; // (creation milliseconds - ignored)
+ FAT_DATE_TIME FileCreateTime;
+ FAT_DATE FileLastAccess;
+ UINT16 FileClusterHigh; // >= FAT32
+ FAT_DATE_TIME FileModificationTime;
+ UINT16 FileCluster;
+ UINT32 FileSize;
+} FAT_DIRECTORY_ENTRY;
+
+#pragma pack()
+//
+// Boot Sector
+//
+#pragma pack(1)
+
+typedef struct {
+
+ UINT8 Ia32Jump[3];
+ CHAR8 OemId[8];
+
+ UINT16 SectorSize;
+ UINT8 SectorsPerCluster;
+ UINT16 ReservedSectors;
+ UINT8 NoFats;
+ UINT16 RootEntries; // < FAT32, root dir is fixed size
+ UINT16 Sectors;
+ UINT8 Media; // (ignored)
+ UINT16 SectorsPerFat; // < FAT32
+ UINT16 SectorsPerTrack; // (ignored)
+ UINT16 Heads; // (ignored)
+ UINT32 HiddenSectors; // (ignored)
+ UINT32 LargeSectors; // => FAT32
+ UINT8 PhysicalDriveNumber; // (ignored)
+ UINT8 CurrentHead; // holds boot_sector_dirty bit
+ UINT8 Signature; // (ignored)
+ CHAR8 Id[4];
+ CHAR8 FatLabel[11];
+ CHAR8 SystemId[8];
+
+} PEI_FAT_BOOT_SECTOR;
+
+typedef struct {
+
+ UINT8 Ia32Jump[3];
+ CHAR8 OemId[8];
+
+ UINT16 SectorSize;
+ UINT8 SectorsPerCluster;
+ UINT16 ReservedSectors;
+ UINT8 NoFats;
+ UINT16 RootEntries; // < FAT32, root dir is fixed size
+ UINT16 Sectors;
+ UINT8 Media; // (ignored)
+ UINT16 SectorsPerFat; // < FAT32
+ UINT16 SectorsPerTrack; // (ignored)
+ UINT16 Heads; // (ignored)
+ UINT32 HiddenSectors; // (ignored)
+ UINT32 LargeSectors; // Used if Sectors==0
+ UINT32 LargeSectorsPerFat; // FAT32
+ UINT16 ExtendedFlags; // FAT32 (ignored)
+ UINT16 FsVersion; // FAT32 (ignored)
+ UINT32 RootDirFirstCluster; // FAT32
+ UINT16 FsInfoSector; // FAT32
+ UINT16 BackupBootSector; // FAT32
+ UINT8 Reserved[12]; // FAT32 (ignored)
+ UINT8 PhysicalDriveNumber; // (ignored)
+ UINT8 CurrentHead; // holds boot_sector_dirty bit
+ UINT8 Signature; // (ignored)
+ CHAR8 Id[4];
+ CHAR8 FatLabel[11];
+ CHAR8 SystemId[8];
+
+} PEI_FAT_BOOT_SECTOR_EX;
+
+#pragma pack()
+
+#endif