]> git.proxmox.com Git - mirror_edk2.git/blob - SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SignedCapsulePkg / Include / Library / PlatformFlashAccessLib.h
1 /** @file
2 Platform flash device access library.
3
4 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __PLATFORM_FLASH_ACCESS_LIB_H__
10 #define __PLATFORM_FLASH_ACCESS_LIB_H__
11
12 #include <Protocol/FirmwareManagement.h>
13
14 typedef enum {
15 FlashAddressTypeRelativeAddress,
16 FlashAddressTypeAbsoluteAddress,
17 } FLASH_ADDRESS_TYPE;
18
19 //
20 // Type 0 ~ 0x7FFFFFFF is defined in this library.
21 // Type 0x80000000 ~ 0xFFFFFFFF is reserved for OEM.
22 //
23 typedef enum {
24 PlatformFirmwareTypeSystemFirmware,
25 PlatformFirmwareTypeNvRam,
26 } PLATFORM_FIRMWARE_TYPE;
27
28 /**
29 Perform flash write operation.
30
31 @param[in] FirmwareType The type of firmware.
32 @param[in] FlashAddress The address of flash device to be accessed.
33 @param[in] FlashAddressType The type of flash device address.
34 @param[in] Buffer The pointer to the data buffer.
35 @param[in] Length The length of data buffer in bytes.
36
37 @retval EFI_SUCCESS The operation returns successfully.
38 @retval EFI_WRITE_PROTECTED The flash device is read only.
39 @retval EFI_UNSUPPORTED The flash device access is unsupported.
40 @retval EFI_INVALID_PARAMETER The input parameter is not valid.
41 **/
42 EFI_STATUS
43 EFIAPI
44 PerformFlashWrite (
45 IN PLATFORM_FIRMWARE_TYPE FirmwareType,
46 IN EFI_PHYSICAL_ADDRESS FlashAddress,
47 IN FLASH_ADDRESS_TYPE FlashAddressType,
48 IN VOID *Buffer,
49 IN UINTN Length
50 );
51
52 /**
53 Perform flash write operation with progress indicator. The start and end
54 completion percentage values are passed into this function. If the requested
55 flash write operation is broken up, then completion percentage between the
56 start and end values may be passed to the provided Progress function. The
57 caller of this function is required to call the Progress function for the
58 start and end completion percentage values. This allows the Progress,
59 StartPercentage, and EndPercentage parameters to be ignored if the requested
60 flash write operation can not be broken up
61
62 @param[in] FirmwareType The type of firmware.
63 @param[in] FlashAddress The address of flash device to be accessed.
64 @param[in] FlashAddressType The type of flash device address.
65 @param[in] Buffer The pointer to the data buffer.
66 @param[in] Length The length of data buffer in bytes.
67 @param[in] Progress A function used report the progress of the
68 firmware update. This is an optional parameter
69 that may be NULL.
70 @param[in] StartPercentage The start completion percentage value that may
71 be used to report progress during the flash
72 write operation.
73 @param[in] EndPercentage The end completion percentage value that may
74 be used to report progress during the flash
75 write operation.
76
77 @retval EFI_SUCCESS The operation returns successfully.
78 @retval EFI_WRITE_PROTECTED The flash device is read only.
79 @retval EFI_UNSUPPORTED The flash device access is unsupported.
80 @retval EFI_INVALID_PARAMETER The input parameter is not valid.
81 **/
82 EFI_STATUS
83 EFIAPI
84 PerformFlashWriteWithProgress (
85 IN PLATFORM_FIRMWARE_TYPE FirmwareType,
86 IN EFI_PHYSICAL_ADDRESS FlashAddress,
87 IN FLASH_ADDRESS_TYPE FlashAddressType,
88 IN VOID *Buffer,
89 IN UINTN Length,
90 IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress OPTIONAL,
91 IN UINTN StartPercentage,
92 IN UINTN EndPercentage
93 );
94
95 #endif