]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/RuntimeDxe/Crc32.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / RuntimeDxe / Crc32.c
1 /** @file
2 This file implements CalculateCrc32 Boot Services as defined in
3 Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.
4
5 This Boot Services is in the Runtime Driver because this service is
6 also required by SetVirtualAddressMap() when the EFI System Table and
7 EFI Runtime Services Table are converted from physical address to
8 virtual addresses. This requires that the 32-bit CRC be recomputed.
9
10 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12
13 **/
14
15 #include <Uefi.h>
16 #include <Library/BaseLib.h>
17
18 /**
19 Calculate CRC32 for target data.
20
21 @param Data The target data.
22 @param DataSize The target data size.
23 @param CrcOut The CRC32 for target data.
24
25 @retval EFI_SUCCESS The CRC32 for target data is calculated successfully.
26 @retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not
27 calculated.
28
29 **/
30 EFI_STATUS
31 EFIAPI
32 RuntimeDriverCalculateCrc32 (
33 IN VOID *Data,
34 IN UINTN DataSize,
35 OUT UINT32 *CrcOut
36 )
37 {
38 if ((Data == NULL) || (DataSize == 0) || (CrcOut == NULL)) {
39 return EFI_INVALID_PARAMETER;
40 }
41
42 *CrcOut = CalculateCrc32 (Data, DataSize);
43 return EFI_SUCCESS;
44 }