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