X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FCore%2FRuntimeDxe%2FCrc32.c;h=a6fe77fa349b0bdf42237518c149ac04f30ca915;hb=0677cc4925d580f7016ac092dc591be0ebe03495;hp=910738eb5215772e45cb03396270b00e5a112ca0;hpb=f2abdc918bc19de53fe612458bf6c26298b65c1c;p=mirror_edk2.git
diff --git a/MdeModulePkg/Core/RuntimeDxe/Crc32.c b/MdeModulePkg/Core/RuntimeDxe/Crc32.c
index 910738eb52..a6fe77fa34 100644
--- a/MdeModulePkg/Core/RuntimeDxe/Crc32.c
+++ b/MdeModulePkg/Core/RuntimeDxe/Crc32.c
@@ -1,38 +1,40 @@
-/*++
+/** @file
+ This file implements CalculateCrc32 Boot Services as defined in
+ Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. 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.
+ This Boot Services is in the Runtime Driver because this service is
+ also required by SetVirtualAddressMap() when the EFI System Table and
+ EFI Runtime Services Table are converted from physical address to
+ virtual addresses. This requires that the 32-bit CRC be recomputed.
-Module Name:
+Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+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
- Crc32.c
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Abstract:
+**/
- CalculateCrc32 Boot Services as defined in DXE CIS.
- This Boot Services is in the Runtime Driver because this service is
- also required by SetVirtualAddressMap() when the EFI System Table and
- EFI Runtime Services Table are converted from physical address to
- virtual addresses. This requires that the 32-bit CRC be recomputed.
+#include
-Revision History:
+UINT32 mCrcTable[256];
---*/
+/**
+ Calculate CRC32 for target data.
-//
-// The package level header files this module uses
-//
-#include
+ @param Data The target data.
+ @param DataSize The target data size.
+ @param CrcOut The CRC32 for target data.
-UINT32 mCrcTable[256];
+ @retval EFI_SUCCESS The CRC32 for target data is calculated successfully.
+ @retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not
+ calculated.
+**/
EFI_STATUS
EFIAPI
RuntimeDriverCalculateCrc32 (
@@ -40,25 +42,6 @@ RuntimeDriverCalculateCrc32 (
IN UINTN DataSize,
OUT UINT32 *CrcOut
)
-/*++
-
-Routine Description:
-
- Calculate CRC32 for target data
-
-Arguments:
-
- Data - The target data.
- DataSize - The target data size.
- CrcOut - The CRC32 for target data.
-
-Returns:
-
- EFI_SUCCESS - The CRC32 for target data is calculated successfully.
- EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not
- calculated.
-
---*/
{
UINT32 Crc;
UINTN Index;
@@ -77,33 +60,26 @@ Returns:
return EFI_SUCCESS;
}
-STATIC
-UINT32
-ReverseBits (
- UINT32 Value
- )
-/*++
-
-Routine Description:
-
- Reverse bits for 32bit data.
-Arguments:
+/**
+ This internal function reverses bits for 32bit data.
- Value - the data to be reversed.
+ @param Value The data to be reversed.
-Returns:
+ @return Data reversed.
- UINT32 data reversed.
-
---*/
+**/
+UINT32
+ReverseBits (
+ UINT32 Value
+ )
{
UINTN Index;
UINT32 NewValue;
NewValue = 0;
for (Index = 0; Index < 32; Index++) {
- if (Value & (1 << Index)) {
+ if ((Value & (1 << Index)) != 0) {
NewValue = NewValue | (1 << (31 - Index));
}
}
@@ -111,25 +87,14 @@ Returns:
return NewValue;
}
+/**
+ Initialize CRC32 table.
+
+**/
VOID
RuntimeDriverInitializeCrc32Table (
VOID
)
-/*++
-
-Routine Description:
-
- Initialize CRC32 table.
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
{
UINTN TableEntry;
UINTN Index;
@@ -138,7 +103,7 @@ Returns:
for (TableEntry = 0; TableEntry < 256; TableEntry++) {
Value = ReverseBits ((UINT32) TableEntry);
for (Index = 0; Index < 8; Index++) {
- if (Value & 0x80000000) {
+ if ((Value & 0x80000000) != 0) {
Value = (Value << 1) ^ 0x04c11db7;
} else {
Value = Value << 1;