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