]>
Commit | Line | Data |
---|---|---|
04714cef GD |
1 | /** @file\r |
2 | Flash device library class header file.\r | |
3 | \r | |
4 | Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
04714cef GD |
9 | #ifndef FLASHDEVICE_LIB_H_\r |
10 | #define FLASHDEVICE_LIB_H_\r | |
11 | \r | |
12 | /**\r | |
13 | Read NumBytes bytes of data from the address specified by\r | |
14 | PAddress into Buffer.\r | |
15 | \r | |
16 | @param[in] PAddress The starting physical address of the read.\r | |
17 | @param[in,out] NumBytes On input, the number of bytes to read. On output, the number\r | |
18 | of bytes actually read.\r | |
19 | @param[out] Buffer The destination data buffer for the read.\r | |
20 | \r | |
21 | @retval EFI_SUCCESS. Opertion is successful.\r | |
22 | @retval EFI_DEVICE_ERROR If there is any device errors.\r | |
23 | \r | |
24 | **/\r | |
25 | EFI_STATUS\r | |
26 | EFIAPI\r | |
27 | LibFvbFlashDeviceRead (\r | |
e5efcf8b MK |
28 | IN UINTN PAddress,\r |
29 | IN OUT UINTN *NumBytes,\r | |
30 | OUT UINT8 *Buffer\r | |
04714cef GD |
31 | );\r |
32 | \r | |
04714cef GD |
33 | /**\r |
34 | Write NumBytes bytes of data from Buffer to the address specified by\r | |
35 | PAddresss.\r | |
36 | \r | |
37 | @param[in] PAddress The starting physical address of the write.\r | |
38 | @param[in,out] NumBytes On input, the number of bytes to write. On output,\r | |
39 | the actual number of bytes written.\r | |
40 | @param[in] Buffer The source data buffer for the write.\r | |
41 | \r | |
42 | @retval EFI_SUCCESS. Opertion is successful.\r | |
43 | @retval EFI_DEVICE_ERROR If there is any device errors.\r | |
44 | \r | |
45 | **/\r | |
46 | EFI_STATUS\r | |
47 | EFIAPI\r | |
48 | LibFvbFlashDeviceWrite (\r | |
e5efcf8b MK |
49 | IN UINTN PAddress,\r |
50 | IN OUT UINTN *NumBytes,\r | |
51 | IN UINT8 *Buffer\r | |
04714cef GD |
52 | );\r |
53 | \r | |
04714cef GD |
54 | /**\r |
55 | Erase the block starting at PAddress.\r | |
56 | \r | |
57 | @param[in] PAddress The starting physical address of the region to be erased.\r | |
58 | @param[in] LbaLength The length of the region to be erased. This parameter is necessary\r | |
59 | as the physical block size on a flash device could be different than\r | |
60 | the logical block size of Firmware Volume Block protocol. Erase on\r | |
61 | flash chip is always performed block by block. Therefore, the ERASE\r | |
62 | operation to a logical block is converted a number of ERASE operation\r | |
63 | (or a partial erase) on the hardware.\r | |
64 | \r | |
65 | @retval EFI_SUCCESS. Opertion is successful.\r | |
66 | @retval EFI_DEVICE_ERROR If there is any device errors.\r | |
67 | \r | |
68 | **/\r | |
69 | EFI_STATUS\r | |
70 | EFIAPI\r | |
71 | LibFvbFlashDeviceBlockErase (\r | |
e5efcf8b MK |
72 | IN UINTN PAddress,\r |
73 | IN UINTN LbaLength\r | |
74 | );\r | |
04714cef GD |
75 | \r |
76 | /**\r | |
77 | Lock or unlock the block starting at PAddress.\r | |
78 | \r | |
79 | @param[in] PAddress The starting physical address of region to be (un)locked.\r | |
80 | @param[in] LbaLength The length of the region to be (un)locked. This parameter is necessary\r | |
81 | as the physical block size on a flash device could be different than\r | |
82 | the logical block size of Firmware Volume Block protocol. (Un)Lock on\r | |
83 | flash chip is always performed block by block. Therefore, the (Un)Lock\r | |
84 | operation to a logical block is converted a number of (Un)Lock operation\r | |
85 | (or a partial erase) on the hardware.\r | |
86 | @param[in] Lock TRUE to lock. FALSE to unlock.\r | |
87 | \r | |
88 | @retval EFI_SUCCESS. Opertion is successful.\r | |
89 | \r | |
90 | **/\r | |
91 | EFI_STATUS\r | |
92 | EFIAPI\r | |
93 | LibFvbFlashDeviceBlockLock (\r | |
e5efcf8b MK |
94 | IN UINTN PAddress,\r |
95 | IN UINTN LbaLength,\r | |
96 | IN BOOLEAN Lock\r | |
97 | );\r | |
04714cef GD |
98 | \r |
99 | PHYSICAL_ADDRESS\r | |
100 | EFIAPI\r | |
101 | LibFvbFlashDeviceMemoryMap (\r | |
e5efcf8b | 102 | );\r |
04714cef GD |
103 | \r |
104 | #endif\r |