]> git.proxmox.com Git - mirror_edk2.git/blame - SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
SignedCapsulePkg/PlatformFlashAccessLib: Add NULL instance.
[mirror_edk2.git] / SignedCapsulePkg / Library / PlatformFlashAccessLibNull / PlatformFlashAccessLibNull.c
CommitLineData
f473d9d6
JY
1/** @file\r
2 Platform flash device access library NULL instance.\r
3\r
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiDxe.h>\r
16\r
17#include <Library/BaseMemoryLib.h>\r
18#include <Library/PlatformFlashAccessLib.h>\r
19\r
20UINT64 mInternalFdAddress;\r
21\r
22/**\r
23 Perform flash write opreation.\r
24\r
25 @param[in] FirmwareType The type of firmware.\r
26 @param[in] FlashAddress The address of flash device to be accessed.\r
27 @param[in] FlashAddressType The type of flash device address.\r
28 @param[in] Buffer The pointer to the data buffer.\r
29 @param[in] Length The length of data buffer in bytes.\r
30\r
31 @retval EFI_SUCCESS The operation returns successfully.\r
32 @retval EFI_WRITE_PROTECTED The flash device is read only.\r
33 @retval EFI_UNSUPPORTED The flash device access is unsupported.\r
34 @retval EFI_INVALID_PARAMETER The input parameter is not valid.\r
35**/\r
36EFI_STATUS\r
37EFIAPI\r
38PerformFlashWrite (\r
39 IN PLATFORM_FIRMWARE_TYPE FirmwareType,\r
40 IN EFI_PHYSICAL_ADDRESS FlashAddress,\r
41 IN FLASH_ADDRESS_TYPE FlashAddressType,\r
42 IN VOID *Buffer,\r
43 IN UINTN Length\r
44 )\r
45{\r
46 if (FlashAddressType == FlashAddressTypeRelativeAddress) {\r
47 FlashAddress = FlashAddress + mInternalFdAddress;\r
48 }\r
49 CopyMem((VOID *)(UINTN)(FlashAddress), Buffer, Length);\r
50 return EFI_SUCCESS;\r
51}\r