36 UINT32 VolDescriptorLba;
48 if (ParentBlockDevNo > PEI_FAT_MAX_BLOCK_DEVICE - 1) {
53 ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);
59 if (ParentBlockDev->BlockSize != 2048) {
70 VolDescriptorLba = 15;
77 VolDescriptorLba += 1;
78 if (VolDescriptorLba > ParentBlockDev->LastBlock) {
89 ParentBlockDev->BlockSize,
92 if (EFI_ERROR (Status)) {
99 if ((VolDescriptor->Unknown.
Type == CDVOL_TYPE_END) ||
112 if (VolDescriptor->Unknown.
Type == CDVOL_TYPE_CODED) {
132 if (Lba > ParentBlockDev->LastBlock) {
140 ParentBlockDev->BlockSize,
143 if (EFI_ERROR (Status)) {
156 CheckBuffer = (UINT16 *)Catalog;
157 for (Index = 0; Index <
sizeof (
ELTORITO_CATALOG) /
sizeof (UINT16); Index += 1) {
158 Check += CheckBuffer[Index];
161 if ((Check & 0xFFFF) != 0) {
166 for (Index = 1; Index < MaxIndex; Index += 1) {
175 if ((Catalog->
Boot.
Indicator != ELTORITO_ID_SECTION_BOOTABLE) || (Catalog->
Boot.Lba == 0)) {
180 SectorCount = Catalog->
Boot.SectorCount;
182 switch (Catalog->
Boot.MediaType) {
183 case ELTORITO_NO_EMULATION:
184 SubBlockSize = ParentBlockDev->BlockSize;
185 SectorCount = Catalog->
Boot.SectorCount;
188 case ELTORITO_HARD_DISK:
191 case ELTORITO_12_DISKETTE:
192 SectorCount = 0x50 * 0x02 * 0x0F;
195 case ELTORITO_14_DISKETTE:
196 SectorCount = 0x50 * 0x02 * 0x12;
199 case ELTORITO_28_DISKETTE:
200 SectorCount = 0x50 * 0x02 * 0x24;
205 SubBlockSize = ParentBlockDev->BlockSize;
209 if (SectorCount < 2) {
210 SectorCount = (VolSpaceSize > ParentBlockDev->LastBlock + 1) ? (UINT32)(ParentBlockDev->LastBlock - Catalog->
Boot.Lba + 1) : (UINT32)(VolSpaceSize - Catalog->
Boot.Lba);
216 if (PrivateData->BlockDeviceCount < PEI_FAT_MAX_BLOCK_DEVICE) {
219 BlockDev = &(PrivateData->BlockDevice[PrivateData->BlockDeviceCount]);
221 BlockDev->BlockSize = SubBlockSize;
222 BlockDev->LastBlock = SectorCount - 1;
223 BlockDev->IoAlign = ParentBlockDev->IoAlign;
224 BlockDev->Logical =
TRUE;
225 BlockDev->PartitionChecked =
FALSE;
226 BlockDev->StartingPos =
MultU64x32 (Catalog->
Boot.Lba, ParentBlockDev->BlockSize);
227 BlockDev->ParentDevNo = ParentBlockDevNo;
229 PrivateData->BlockDeviceCount++;
234 ParentBlockDev->PartitionChecked =
TRUE;
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define CDVOL_ELTORITO_ID
EFI_STATUS FatReadBlock(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN BlockDeviceNo, IN EFI_PEI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
BOOLEAN FatFindEltoritoPartitions(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo)
UINT32 VolSpaceSize[2]
the number of Logical Blocks
struct CDROM_VOLUME_DESCRIPTOR::@204 BootRecordVolume
CHAR8 SystemId[32]
"EL TORITO SPECIFICATION"
UINT8 EltCatalog[4]
Absolute pointer to first sector of Boot Catalog.
struct CDROM_VOLUME_DESCRIPTOR::@205 PrimaryVolume
struct ELTORITO_CATALOG::@207 Catalog
struct ELTORITO_CATALOG::@208 Boot
UINT8 Indicator
Must be 01.