]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/GenBootsector/fat.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / GenBootsector / fat.h
1 /*++
2
3 Copyright 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 fat.h
15
16 Abstract:
17
18 Revision History
19
20 --*/
21
22 #ifndef _FAT_BPB_H_
23 #define _FAT_BPB_H_
24
25 #include "Tiano.h"
26
27 #pragma pack(1)
28
29 typedef struct {
30 //
31 // Fat common field
32 //
33 UINT8 BS_jmpBoot[3];
34 CHAR8 BS_OEMName[8];
35 UINT16 BPB_BytsPerSec;
36 UINT8 BPB_SecPerClus;
37 UINT16 BPB_RsvdSecCnt;
38 UINT8 BPB_NumFATs;
39 UINT16 BPB_RootEntCnt;
40 UINT16 BPB_TotSec16;
41 UINT8 BPB_Media;
42 UINT16 BPB_FATSz16;
43 UINT16 BPB_SecPerTrk;
44 UINT16 BPB_NumHeads;
45 UINT32 BPB_HiddSec;
46 UINT32 BPB_TotSec32;
47
48 //
49 // Fat12/16 specific field
50 //
51 UINT8 BS_DrvNum;
52 UINT8 BS_Reserved1;
53 UINT8 BS_BootSig;
54 UINT32 BS_VolID;
55 CHAR8 BS_VolLab[11];
56 CHAR8 BS_FilSysType[8];
57
58 //
59 // Boot Code and Data
60 //
61 UINT8 Reserved[448];
62
63 //
64 // Fat common signature - 0xAA55
65 //
66 UINT16 Signature;
67 } FAT12_16_BPB_STRUCT;
68
69 typedef struct {
70 //
71 // Fat common field
72 //
73 UINT8 BS_jmpBoot[3];
74 CHAR8 BS_OEMName[8];
75 UINT16 BPB_BytsPerSec;
76 UINT8 BPB_SecPerClus;
77 UINT16 BPB_RsvdSecCnt;
78 UINT8 BPB_NumFATs;
79 UINT16 BPB_RootEntCnt;
80 UINT16 BPB_TotSec16;
81 UINT8 BPB_Media;
82 UINT16 BPB_FATSz16;
83 UINT16 BPB_SecPerTrk;
84 UINT16 BPB_NumHeads;
85 UINT32 BPB_HiddSec;
86 UINT32 BPB_TotSec32;
87
88 //
89 // Fat32 specific field
90 //
91 UINT32 BPB_FATSz32;
92 UINT16 BPB_ExtFlags;
93 UINT16 BPB_FSVer;
94 UINT32 BPB_RootClus;
95 UINT16 BPB_FSInfo;
96 UINT16 BPB_BkBootSec;
97 UINT8 BPB_Reserved[12];
98 UINT8 BS_DrvNum;
99 UINT8 BS_Reserved1;
100 UINT8 BS_BootSig;
101 UINT32 BS_VolID;
102 CHAR8 BS_VolLab[11];
103 CHAR8 BS_FilSysType[8];
104
105 //
106 // Boot Code and Data
107 //
108 UINT8 Reserved[420];
109
110 //
111 // Fat common signature - 0xAA55
112 //
113 UINT16 Signature;
114 } FAT32_BPB_STRUCT;
115
116 typedef union {
117 FAT12_16_BPB_STRUCT Fat12_16;
118 FAT32_BPB_STRUCT Fat32;
119 } FAT_BPB_STRUCT;
120
121 typedef enum {
122 FatTypeUnknown,
123 FatTypeFat12,
124 FatTypeFat16,
125 FatTypeFat32,
126 FatTypeMax
127 } FAT_TYPE;
128
129 typedef struct {
130 CHAR8 DIR_Name[11];
131 UINT8 DIR_Attr;
132 UINT8 DIR_NTRes;
133 UINT8 DIR_CrtTimeTenth;
134 UINT16 DIR_CrtTime;
135 UINT16 DIR_CrtDate;
136 UINT16 DIR_LstAccDate;
137 UINT16 DIR_FstClusHI;
138 UINT16 DIR_WrtTime;
139 UINT16 DIR_WrtDate;
140 UINT16 DIR_FstClusLO;
141 UINT32 DIR_FileSize;
142 } FAT_DIRECTORY_ENTRY;
143
144 #pragma pack()
145
146 #define FAT_MAX_FAT12_CLUSTER 0xFF5
147 #define FAT_MAX_FAT16_CLUSTER 0xFFF5
148
149 #define FAT_BS_SIGNATURE 0xAA55
150 #define FAT_BS_BOOTSIG 0x29
151 #define FAT_BS_JMP1 0xEB
152 #define FAT_BS_JMP2 0xE9
153 #define FAT_FILSYSTYPE "FAT "
154 #define FAT12_FILSYSTYPE "FAT12 "
155 #define FAT16_FILSYSTYPE "FAT16 "
156 #define FAT32_FILSYSTYPE "FAT32 "
157
158 #endif