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