]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/GnuGenBootSector/FatFormat.h
MdePkg: Add two PcdApi for Patch VOID* PCD set operation.
[mirror_edk2.git] / BaseTools / Source / C / GnuGenBootSector / FatFormat.h
1 /** @file
2
3 Fat file system structure and definition.
4
5 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this 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_BPB_H_
17 #define _FAT_BPB_H_
18
19 #include "CommonLib.h"
20
21 #pragma pack(1)
22
23 typedef struct {
24 //
25 // Fat common field
26 //
27 UINT8 BS_jmpBoot[3];
28 CHAR8 BS_OEMName[8];
29 UINT16 BPB_BytsPerSec;
30 UINT8 BPB_SecPerClus;
31 UINT16 BPB_RsvdSecCnt;
32 UINT8 BPB_NumFATs;
33 UINT16 BPB_RootEntCnt;
34 UINT16 BPB_TotSec16;
35 UINT8 BPB_Media;
36 UINT16 BPB_FATSz16;
37 UINT16 BPB_SecPerTrk;
38 UINT16 BPB_NumHeads;
39 UINT32 BPB_HiddSec;
40 UINT32 BPB_TotSec32;
41
42 //
43 // Fat12/16 specific field
44 //
45 UINT8 BS_DrvNum;
46 UINT8 BS_Reserved1;
47 UINT8 BS_BootSig;
48 UINT32 BS_VolID;
49 CHAR8 BS_VolLab[11];
50 CHAR8 BS_FilSysType[8];
51
52 //
53 // Boot Code and Data
54 //
55 UINT8 Reserved[448];
56
57 //
58 // Fat common signature - 0xAA55
59 //
60 UINT16 Signature;
61 } FAT12_16_BPB_STRUCT;
62
63 typedef struct {
64 //
65 // Fat common field
66 //
67 UINT8 BS_jmpBoot[3];
68 CHAR8 BS_OEMName[8];
69 UINT16 BPB_BytsPerSec;
70 UINT8 BPB_SecPerClus;
71 UINT16 BPB_RsvdSecCnt;
72 UINT8 BPB_NumFATs;
73 UINT16 BPB_RootEntCnt;
74 UINT16 BPB_TotSec16;
75 UINT8 BPB_Media;
76 UINT16 BPB_FATSz16;
77 UINT16 BPB_SecPerTrk;
78 UINT16 BPB_NumHeads;
79 UINT32 BPB_HiddSec;
80 UINT32 BPB_TotSec32;
81
82 //
83 // Fat32 specific field
84 //
85 UINT32 BPB_FATSz32;
86 UINT16 BPB_ExtFlags;
87 UINT16 BPB_FSVer;
88 UINT32 BPB_RootClus;
89 UINT16 BPB_FSInfo;
90 UINT16 BPB_BkBootSec;
91 UINT8 BPB_Reserved[12];
92 UINT8 BS_DrvNum;
93 UINT8 BS_Reserved1;
94 UINT8 BS_BootSig;
95 UINT32 BS_VolID;
96 CHAR8 BS_VolLab[11];
97 CHAR8 BS_FilSysType[8];
98
99 //
100 // Boot Code and Data
101 //
102 UINT8 Reserved[420];
103
104 //
105 // Fat common signature - 0xAA55
106 //
107 UINT16 Signature;
108 } FAT32_BPB_STRUCT;
109
110 typedef union {
111 FAT12_16_BPB_STRUCT Fat12_16;
112 FAT32_BPB_STRUCT Fat32;
113 } FAT_BPB_STRUCT;
114
115 typedef enum {
116 FatTypeUnknown,
117 FatTypeFat12,
118 FatTypeFat16,
119 FatTypeFat32,
120 FatTypeMax
121 } FAT_TYPE;
122
123 typedef struct {
124 CHAR8 DIR_Name[11];
125 UINT8 DIR_Attr;
126 UINT8 DIR_NTRes;
127 UINT8 DIR_CrtTimeTenth;
128 UINT16 DIR_CrtTime;
129 UINT16 DIR_CrtDate;
130 UINT16 DIR_LstAccDate;
131 UINT16 DIR_FstClusHI;
132 UINT16 DIR_WrtTime;
133 UINT16 DIR_WrtDate;
134 UINT16 DIR_FstClusLO;
135 UINT32 DIR_FileSize;
136 } FAT_DIRECTORY_ENTRY;
137
138 #pragma pack()
139
140 #define FAT_MAX_FAT12_CLUSTER 0xFF5
141 #define FAT_MAX_FAT16_CLUSTER 0xFFF5
142
143 #define FAT_BS_SIGNATURE 0xAA55
144 #define FAT_BS_BOOTSIG 0x29
145 #define FAT_BS_JMP1 0xEB
146 #define FAT_BS_JMP2 0xE9
147 #define FAT_FILSYSTYPE "FAT "
148 #define FAT12_FILSYSTYPE "FAT12 "
149 #define FAT16_FILSYSTYPE "FAT16 "
150 #define FAT32_FILSYSTYPE "FAT32 "
151
152 #endif