2 Decode a hard disk partitioned with the GPT scheme in the UEFI 2.0
5 Copyright (c) 2006 - 2011, 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
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.
17 #include "Partition.h"
20 Install child handles if the Handle supports GPT partition structure.
22 @param[in] BlockIo Parent BlockIo interface.
23 @param[in] DiskIo Disk Io protocol.
24 @param[in] Lba The starting Lba of the Partition Table
25 @param[out] PartHeader Stores the partition table that is read
27 @retval TRUE The partition table is valid
28 @retval FALSE The partition table is not valid
32 PartitionValidGptTable (
33 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
34 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
36 OUT EFI_PARTITION_TABLE_HEADER
*PartHeader
40 Check if the CRC field in the Partition table header is valid
41 for Partition entry array.
43 @param[in] BlockIo Parent BlockIo interface
44 @param[in] DiskIo Disk Io Protocol.
45 @param[in] PartHeader Partition table header structure
47 @retval TRUE the CRC is valid
48 @retval FALSE the CRC is invalid
52 PartitionCheckGptEntryArrayCRC (
53 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
54 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
55 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
60 Restore Partition Table to its alternate place
61 (Primary -> Backup or Backup -> Primary).
63 @param[in] BlockIo Parent BlockIo interface.
64 @param[in] DiskIo Disk Io Protocol.
65 @param[in] PartHeader Partition table header structure.
67 @retval TRUE Restoring succeeds
68 @retval FALSE Restoring failed
72 PartitionRestoreGptTable (
73 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
74 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
75 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
80 Restore Partition Table to its alternate place.
81 (Primary -> Backup or Backup -> Primary)
83 @param[in] PartHeader Partition table header structure
84 @param[in] PartEntry The partition entry array
85 @param[out] PEntryStatus the partition entry status array
86 recording the status of each partition
90 PartitionCheckGptEntry (
91 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
,
92 IN EFI_PARTITION_ENTRY
*PartEntry
,
93 OUT EFI_PARTITION_ENTRY_STATUS
*PEntryStatus
98 Checks the CRC32 value in the table header.
100 @param MaxSize Max Size limit
101 @param Size The size of the table
102 @param Hdr Table to check
104 @return TRUE CRC Valid
105 @return FALSE CRC Invalid
109 PartitionCheckCrcAltSize (
112 IN OUT EFI_TABLE_HEADER
*Hdr
117 Checks the CRC32 value in the table header.
119 @param MaxSize Max Size limit
120 @param Hdr Table to check
122 @return TRUE CRC Valid
123 @return FALSE CRC Invalid
129 IN OUT EFI_TABLE_HEADER
*Hdr
134 Updates the CRC32 value in the table header.
136 @param Size The size of the table
137 @param Hdr Table to update
141 PartitionSetCrcAltSize (
143 IN OUT EFI_TABLE_HEADER
*Hdr
148 Updates the CRC32 value in the table header.
150 @param Hdr Table to update
155 IN OUT EFI_TABLE_HEADER
*Hdr
159 Install child handles if the Handle supports GPT partition structure.
161 @param[in] This Calling context.
162 @param[in] Handle Parent Handle.
163 @param[in] DiskIo Parent DiskIo interface.
164 @param[in] BlockIo Parent BlockIo interface.
165 @param[in] BlockIo2 Parent BlockIo2 interface.
166 @param[in] DevicePath Parent Device Path.
168 @retval EFI_SUCCESS Valid GPT disk.
169 @retval EFI_MEDIA_CHANGED Media changed Detected.
170 @retval other Not a valid GPT disk.
174 PartitionInstallGptChildHandles (
175 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
176 IN EFI_HANDLE Handle
,
177 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
178 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
179 IN EFI_BLOCK_IO2_PROTOCOL
*BlockIo2
,
180 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
186 MASTER_BOOT_RECORD
*ProtectiveMbr
;
187 EFI_PARTITION_TABLE_HEADER
*PrimaryHeader
;
188 EFI_PARTITION_TABLE_HEADER
*BackupHeader
;
189 EFI_PARTITION_ENTRY
*PartEntry
;
190 EFI_PARTITION_ENTRY
*Entry
;
191 EFI_PARTITION_ENTRY_STATUS
*PEntryStatus
;
193 EFI_STATUS GptValidStatus
;
194 HARDDRIVE_DEVICE_PATH HdDev
;
197 ProtectiveMbr
= NULL
;
198 PrimaryHeader
= NULL
;
203 BlockSize
= BlockIo
->Media
->BlockSize
;
204 LastBlock
= BlockIo
->Media
->LastBlock
;
205 MediaId
= BlockIo
->Media
->MediaId
;
207 DEBUG ((EFI_D_INFO
, " BlockSize : %d \n", BlockSize
));
208 DEBUG ((EFI_D_INFO
, " LastBlock : %lx \n", LastBlock
));
210 GptValidStatus
= EFI_NOT_FOUND
;
213 // Allocate a buffer for the Protective MBR
215 ProtectiveMbr
= AllocatePool (BlockSize
);
216 if (ProtectiveMbr
== NULL
) {
217 return EFI_NOT_FOUND
;
221 // Read the Protective MBR from LBA #0
223 Status
= DiskIo
->ReadDisk (
230 if (EFI_ERROR (Status
)) {
231 GptValidStatus
= Status
;
236 // Verify that the Protective MBR is valid
238 for (Index
= 0; Index
< MAX_MBR_PARTITIONS
; Index
++) {
239 if (ProtectiveMbr
->Partition
[Index
].BootIndicator
== 0x00 &&
240 ProtectiveMbr
->Partition
[Index
].OSIndicator
== PMBR_GPT_PARTITION
&&
241 UNPACK_UINT32 (ProtectiveMbr
->Partition
[Index
].StartingLBA
) == 1
246 if (Index
== MAX_MBR_PARTITIONS
) {
251 // Allocate the GPT structures
253 PrimaryHeader
= AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER
));
254 if (PrimaryHeader
== NULL
) {
258 BackupHeader
= AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER
));
259 if (BackupHeader
== NULL
) {
264 // Check primary and backup partition tables
266 if (!PartitionValidGptTable (BlockIo
, DiskIo
, PRIMARY_PART_HEADER_LBA
, PrimaryHeader
)) {
267 DEBUG ((EFI_D_INFO
, " Not Valid primary partition table\n"));
269 if (!PartitionValidGptTable (BlockIo
, DiskIo
, LastBlock
, BackupHeader
)) {
270 DEBUG ((EFI_D_INFO
, " Not Valid backup partition table\n"));
273 DEBUG ((EFI_D_INFO
, " Valid backup partition table\n"));
274 DEBUG ((EFI_D_INFO
, " Restore primary partition table by the backup\n"));
275 if (!PartitionRestoreGptTable (BlockIo
, DiskIo
, BackupHeader
)) {
276 DEBUG ((EFI_D_INFO
, " Restore primary partition table error\n"));
279 if (PartitionValidGptTable (BlockIo
, DiskIo
, BackupHeader
->AlternateLBA
, PrimaryHeader
)) {
280 DEBUG ((EFI_D_INFO
, " Restore backup partition table success\n"));
283 } else if (!PartitionValidGptTable (BlockIo
, DiskIo
, PrimaryHeader
->AlternateLBA
, BackupHeader
)) {
284 DEBUG ((EFI_D_INFO
, " Valid primary and !Valid backup partition table\n"));
285 DEBUG ((EFI_D_INFO
, " Restore backup partition table by the primary\n"));
286 if (!PartitionRestoreGptTable (BlockIo
, DiskIo
, PrimaryHeader
)) {
287 DEBUG ((EFI_D_INFO
, " Restore backup partition table error\n"));
290 if (PartitionValidGptTable (BlockIo
, DiskIo
, PrimaryHeader
->AlternateLBA
, BackupHeader
)) {
291 DEBUG ((EFI_D_INFO
, " Restore backup partition table success\n"));
296 DEBUG ((EFI_D_INFO
, " Valid primary and Valid backup partition table\n"));
299 // Read the EFI Partition Entries
301 PartEntry
= AllocatePool (PrimaryHeader
->NumberOfPartitionEntries
* PrimaryHeader
->SizeOfPartitionEntry
);
302 if (PartEntry
== NULL
) {
303 DEBUG ((EFI_D_ERROR
, "Allocate pool error\n"));
307 Status
= DiskIo
->ReadDisk (
310 MultU64x32(PrimaryHeader
->PartitionEntryLBA
, BlockSize
),
311 PrimaryHeader
->NumberOfPartitionEntries
* (PrimaryHeader
->SizeOfPartitionEntry
),
314 if (EFI_ERROR (Status
)) {
315 GptValidStatus
= Status
;
316 DEBUG ((EFI_D_ERROR
, " Partition Entry ReadDisk error\n"));
320 DEBUG ((EFI_D_INFO
, " Partition entries read block success\n"));
322 DEBUG ((EFI_D_INFO
, " Number of partition entries: %d\n", PrimaryHeader
->NumberOfPartitionEntries
));
324 PEntryStatus
= AllocateZeroPool (PrimaryHeader
->NumberOfPartitionEntries
* sizeof (EFI_PARTITION_ENTRY_STATUS
));
325 if (PEntryStatus
== NULL
) {
326 DEBUG ((EFI_D_ERROR
, "Allocate pool error\n"));
331 // Check the integrity of partition entries
333 PartitionCheckGptEntry (PrimaryHeader
, PartEntry
, PEntryStatus
);
336 // If we got this far the GPT layout of the disk is valid and we should return true
338 GptValidStatus
= EFI_SUCCESS
;
341 // Create child device handles
343 for (Index
= 0; Index
< PrimaryHeader
->NumberOfPartitionEntries
; Index
++) {
344 Entry
= (EFI_PARTITION_ENTRY
*) ((UINT8
*) PartEntry
+ Index
* PrimaryHeader
->SizeOfPartitionEntry
);
345 if (CompareGuid (&Entry
->PartitionTypeGUID
, &gEfiPartTypeUnusedGuid
) ||
346 PEntryStatus
[Index
].OutOfRange
||
347 PEntryStatus
[Index
].Overlap
||
348 PEntryStatus
[Index
].OsSpecific
351 // Don't use null EFI Partition Entries, Invalid Partition Entries or OS specific
357 ZeroMem (&HdDev
, sizeof (HdDev
));
358 HdDev
.Header
.Type
= MEDIA_DEVICE_PATH
;
359 HdDev
.Header
.SubType
= MEDIA_HARDDRIVE_DP
;
360 SetDevicePathNodeLength (&HdDev
.Header
, sizeof (HdDev
));
362 HdDev
.PartitionNumber
= (UINT32
) Index
+ 1;
363 HdDev
.MBRType
= MBR_TYPE_EFI_PARTITION_TABLE_HEADER
;
364 HdDev
.SignatureType
= SIGNATURE_TYPE_GUID
;
365 HdDev
.PartitionStart
= Entry
->StartingLBA
;
366 HdDev
.PartitionSize
= Entry
->EndingLBA
- Entry
->StartingLBA
+ 1;
367 CopyMem (HdDev
.Signature
, &Entry
->UniquePartitionGUID
, sizeof (EFI_GUID
));
369 DEBUG ((EFI_D_INFO
, " Index : %d\n", (UINT32
) Index
));
370 DEBUG ((EFI_D_INFO
, " Start LBA : %lx\n", (UINT64
) HdDev
.PartitionStart
));
371 DEBUG ((EFI_D_INFO
, " End LBA : %lx\n", (UINT64
) Entry
->EndingLBA
));
372 DEBUG ((EFI_D_INFO
, " Partition size: %lx\n", (UINT64
) HdDev
.PartitionSize
));
373 DEBUG ((EFI_D_INFO
, " Start : %lx", MultU64x32 (Entry
->StartingLBA
, BlockSize
)));
374 DEBUG ((EFI_D_INFO
, " End : %lx\n", MultU64x32 (Entry
->EndingLBA
, BlockSize
)));
376 Status
= PartitionInstallChildHandle (
383 (EFI_DEVICE_PATH_PROTOCOL
*) &HdDev
,
387 CompareGuid(&Entry
->PartitionTypeGUID
, &gEfiPartTypeSystemPartGuid
)
391 DEBUG ((EFI_D_INFO
, "Prepare to Free Pool\n"));
394 if (ProtectiveMbr
!= NULL
) {
395 FreePool (ProtectiveMbr
);
397 if (PrimaryHeader
!= NULL
) {
398 FreePool (PrimaryHeader
);
400 if (BackupHeader
!= NULL
) {
401 FreePool (BackupHeader
);
403 if (PartEntry
!= NULL
) {
404 FreePool (PartEntry
);
406 if (PEntryStatus
!= NULL
) {
407 FreePool (PEntryStatus
);
410 return GptValidStatus
;
414 Install child handles if the Handle supports GPT partition structure.
416 @param[in] BlockIo Parent BlockIo interface.
417 @param[in] DiskIo Disk Io protocol.
418 @param[in] Lba The starting Lba of the Partition Table
419 @param[out] PartHeader Stores the partition table that is read
421 @retval TRUE The partition table is valid
422 @retval FALSE The partition table is not valid
426 PartitionValidGptTable (
427 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
428 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
430 OUT EFI_PARTITION_TABLE_HEADER
*PartHeader
435 EFI_PARTITION_TABLE_HEADER
*PartHdr
;
438 BlockSize
= BlockIo
->Media
->BlockSize
;
439 MediaId
= BlockIo
->Media
->MediaId
;
440 PartHdr
= AllocateZeroPool (BlockSize
);
442 if (PartHdr
== NULL
) {
443 DEBUG ((EFI_D_ERROR
, "Allocate pool error\n"));
447 // Read the EFI Partition Table Header
449 Status
= DiskIo
->ReadDisk (
452 MultU64x32 (Lba
, BlockSize
),
456 if (EFI_ERROR (Status
)) {
461 if ((PartHdr
->Header
.Signature
!= EFI_PTAB_HEADER_ID
) ||
462 !PartitionCheckCrc (BlockSize
, &PartHdr
->Header
) ||
463 PartHdr
->MyLBA
!= Lba
465 DEBUG ((EFI_D_INFO
, "Invalid efi partition table header\n"));
470 CopyMem (PartHeader
, PartHdr
, sizeof (EFI_PARTITION_TABLE_HEADER
));
471 if (!PartitionCheckGptEntryArrayCRC (BlockIo
, DiskIo
, PartHeader
)) {
476 DEBUG ((EFI_D_INFO
, " Valid efi partition table header\n"));
482 Check if the CRC field in the Partition table header is valid
483 for Partition entry array.
485 @param[in] BlockIo Parent BlockIo interface
486 @param[in] DiskIo Disk Io Protocol.
487 @param[in] PartHeader Partition table header structure
489 @retval TRUE the CRC is valid
490 @retval FALSE the CRC is invalid
494 PartitionCheckGptEntryArrayCRC (
495 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
496 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
497 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
506 // Read the EFI Partition Entries
508 Ptr
= AllocatePool (PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
);
510 DEBUG ((EFI_D_ERROR
, " Allocate pool error\n"));
514 Status
= DiskIo
->ReadDisk (
516 BlockIo
->Media
->MediaId
,
517 MultU64x32(PartHeader
->PartitionEntryLBA
, BlockIo
->Media
->BlockSize
),
518 PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
,
521 if (EFI_ERROR (Status
)) {
526 Size
= PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
;
528 Status
= gBS
->CalculateCrc32 (Ptr
, Size
, &Crc
);
529 if (EFI_ERROR (Status
)) {
530 DEBUG ((EFI_D_ERROR
, "CheckPEntryArrayCRC: Crc calculation failed\n"));
537 return (BOOLEAN
) (PartHeader
->PartitionEntryArrayCRC32
== Crc
);
542 Restore Partition Table to its alternate place
543 (Primary -> Backup or Backup -> Primary).
545 @param[in] BlockIo Parent BlockIo interface.
546 @param[in] DiskIo Disk Io Protocol.
547 @param[in] PartHeader Partition table header structure.
549 @retval TRUE Restoring succeeds
550 @retval FALSE Restoring failed
554 PartitionRestoreGptTable (
555 IN EFI_BLOCK_IO_PROTOCOL
*BlockIo
,
556 IN EFI_DISK_IO_PROTOCOL
*DiskIo
,
557 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
562 EFI_PARTITION_TABLE_HEADER
*PartHdr
;
570 BlockSize
= BlockIo
->Media
->BlockSize
;
571 MediaId
= BlockIo
->Media
->MediaId
;
573 PartHdr
= AllocateZeroPool (BlockSize
);
575 if (PartHdr
== NULL
) {
576 DEBUG ((EFI_D_ERROR
, "Allocate pool error\n"));
580 PEntryLBA
= (PartHeader
->MyLBA
== PRIMARY_PART_HEADER_LBA
) ? \
581 (PartHeader
->LastUsableLBA
+ 1) : \
582 (PRIMARY_PART_HEADER_LBA
+ 1);
584 CopyMem (PartHdr
, PartHeader
, sizeof (EFI_PARTITION_TABLE_HEADER
));
586 PartHdr
->MyLBA
= PartHeader
->AlternateLBA
;
587 PartHdr
->AlternateLBA
= PartHeader
->MyLBA
;
588 PartHdr
->PartitionEntryLBA
= PEntryLBA
;
589 PartitionSetCrc ((EFI_TABLE_HEADER
*) PartHdr
);
591 Status
= DiskIo
->WriteDisk (
594 MultU64x32 (PartHdr
->MyLBA
, (UINT32
) BlockSize
),
598 if (EFI_ERROR (Status
)) {
602 Ptr
= AllocatePool (PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
);
604 DEBUG ((EFI_D_ERROR
, " Allocate pool error\n"));
605 Status
= EFI_OUT_OF_RESOURCES
;
609 Status
= DiskIo
->ReadDisk (
612 MultU64x32(PartHeader
->PartitionEntryLBA
, (UINT32
) BlockSize
),
613 PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
,
616 if (EFI_ERROR (Status
)) {
620 Status
= DiskIo
->WriteDisk (
623 MultU64x32(PEntryLBA
, (UINT32
) BlockSize
),
624 PartHeader
->NumberOfPartitionEntries
* PartHeader
->SizeOfPartitionEntry
,
635 if (EFI_ERROR (Status
)) {
643 Restore Partition Table to its alternate place.
644 (Primary -> Backup or Backup -> Primary)
646 @param[in] PartHeader Partition table header structure
647 @param[in] PartEntry The partition entry array
648 @param[out] PEntryStatus the partition entry status array
649 recording the status of each partition
653 PartitionCheckGptEntry (
654 IN EFI_PARTITION_TABLE_HEADER
*PartHeader
,
655 IN EFI_PARTITION_ENTRY
*PartEntry
,
656 OUT EFI_PARTITION_ENTRY_STATUS
*PEntryStatus
661 EFI_PARTITION_ENTRY
*Entry
;
665 DEBUG ((EFI_D_INFO
, " start check partition entries\n"));
666 for (Index1
= 0; Index1
< PartHeader
->NumberOfPartitionEntries
; Index1
++) {
667 Entry
= (EFI_PARTITION_ENTRY
*) ((UINT8
*) PartEntry
+ Index1
* PartHeader
->SizeOfPartitionEntry
);
668 if (CompareGuid (&Entry
->PartitionTypeGUID
, &gEfiPartTypeUnusedGuid
)) {
672 StartingLBA
= Entry
->StartingLBA
;
673 EndingLBA
= Entry
->EndingLBA
;
674 if (StartingLBA
> EndingLBA
||
675 StartingLBA
< PartHeader
->FirstUsableLBA
||
676 StartingLBA
> PartHeader
->LastUsableLBA
||
677 EndingLBA
< PartHeader
->FirstUsableLBA
||
678 EndingLBA
> PartHeader
->LastUsableLBA
680 PEntryStatus
[Index1
].OutOfRange
= TRUE
;
684 if ((Entry
->Attributes
& BIT1
) != 0) {
686 // If Bit 1 is set, this indicate that this is an OS specific GUID partition.
688 PEntryStatus
[Index1
].OsSpecific
= TRUE
;
691 for (Index2
= Index1
+ 1; Index2
< PartHeader
->NumberOfPartitionEntries
; Index2
++) {
692 Entry
= (EFI_PARTITION_ENTRY
*) ((UINT8
*) PartEntry
+ Index2
* PartHeader
->SizeOfPartitionEntry
);
693 if (CompareGuid (&Entry
->PartitionTypeGUID
, &gEfiPartTypeUnusedGuid
)) {
697 if (Entry
->EndingLBA
>= StartingLBA
&& Entry
->StartingLBA
<= EndingLBA
) {
699 // This region overlaps with the Index1'th region
701 PEntryStatus
[Index1
].Overlap
= TRUE
;
702 PEntryStatus
[Index2
].Overlap
= TRUE
;
708 DEBUG ((EFI_D_INFO
, " End check partition entries\n"));
713 Updates the CRC32 value in the table header.
715 @param Hdr Table to update
720 IN OUT EFI_TABLE_HEADER
*Hdr
723 PartitionSetCrcAltSize (Hdr
->HeaderSize
, Hdr
);
728 Updates the CRC32 value in the table header.
730 @param Size The size of the table
731 @param Hdr Table to update
735 PartitionSetCrcAltSize (
737 IN OUT EFI_TABLE_HEADER
*Hdr
743 gBS
->CalculateCrc32 ((UINT8
*) Hdr
, Size
, &Crc
);
749 Checks the CRC32 value in the table header.
751 @param MaxSize Max Size limit
752 @param Hdr Table to check
754 @return TRUE CRC Valid
755 @return FALSE CRC Invalid
761 IN OUT EFI_TABLE_HEADER
*Hdr
764 return PartitionCheckCrcAltSize (MaxSize
, Hdr
->HeaderSize
, Hdr
);
769 Checks the CRC32 value in the table header.
771 @param MaxSize Max Size limit
772 @param Size The size of the table
773 @param Hdr Table to check
775 @return TRUE CRC Valid
776 @return FALSE CRC Invalid
780 PartitionCheckCrcAltSize (
783 IN OUT EFI_TABLE_HEADER
*Hdr
794 // If header size is 0 CRC will pass so return FALSE here
799 if ((MaxSize
!= 0) && (Size
> MaxSize
)) {
800 DEBUG ((EFI_D_ERROR
, "CheckCrc32: Size > MaxSize\n"));
804 // clear old crc from header
809 Status
= gBS
->CalculateCrc32 ((UINT8
*) Hdr
, Size
, &Crc
);
810 if (EFI_ERROR (Status
)) {
811 DEBUG ((EFI_D_ERROR
, "CheckCrc32: Crc calculation failed\n"));
824 DEBUG ((EFI_D_ERROR
, "CheckCrc32: Crc check failed\n"));
828 return (BOOLEAN
) (OrgCrc
== Crc
);