]>
git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Include/Library/FlashDeviceLib.h
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
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.
15 Flash device library class header file.
17 Flash Device Library common type, MACRO and API definition. The basic idea for
18 this library is to provide API to abstract the different between flash
19 technology (SPI, FWH etc..), flash controller (SPI host controller on
20 ICH, MMIO type access for FWH), flash chip (programming command, method
21 of status checking). This library class can be consumed by drivers or applications
22 such as Firmware Volume Block driver, Flash Update application. These driver
23 can be written in a generic manner so that they are more easy to be
24 ported to other platforms.
26 This library can be build on a set of APIs which can touch flash controller, flash
27 chip directly for a platform with simple flash device configuration.
29 For a platform with complex flash device configuration, this library can be built
30 on the Flash Device Operate Library. Please see the header file for that library
31 class for detailed usage.
35 #ifndef __FLASHDEVICE_LIB_H__
36 #define __FLASHDEVICE_LIB_H__
39 Read NumBytes bytes of data from the address specified by
42 @param[in] PAddress The starting physical address of the read.
43 @param[in,out] NumBytes On input, the number of bytes to read. On output, the number
44 of bytes actually read.
45 @param[out] Buffer The destination data buffer for the read.
47 @retval EFI_SUCCESS. Opertion is successful.
48 @retval EFI_DEVICE_ERROR If there is any device errors.
53 LibFvbFlashDeviceRead (
55 IN OUT UINTN
*NumBytes
,
60 Write NumBytes bytes of data from Buffer to the address specified by
63 @param[in] PAddress The starting physical address of the write.
64 @param[in,out] NumBytes On input, the number of bytes to write. On output,
65 the actual number of bytes written.
66 @param[in] Buffer The source data buffer for the write.
68 @retval EFI_SUCCESS. Opertion is successful.
69 @retval EFI_DEVICE_ERROR If there is any device errors.
74 LibFvbFlashDeviceWrite (
76 IN OUT UINTN
*NumBytes
,
81 Erase the block staring at PAddress.
83 @param[in] PAddress The starting physical address of the region to be erased.
84 @param[in] LbaLength The length of the region to be erased. This parameter is necessary
85 as the physical block size on a flash device could be different than
86 the logical block size of Firmware Volume Block protocol. Erase on
87 flash chip is always performed block by block. Therefore, the ERASE
88 operation to a logical block is converted a number of ERASE operation
89 (or a partial erase) on the hardware.
91 @retval EFI_SUCCESS. Opertion is successful.
92 @retval EFI_DEVICE_ERROR If there is any device errors.
97 LibFvbFlashDeviceBlockErase (
103 Lock or unlock the block staring at PAddress.
105 @param[in] PAddress The starting physical address of region to be (un)locked.
106 @param[in] LbaLength The length of the region to be (un)locked. This parameter is necessary
107 as the physical block size on a flash device could be different than
108 the logical block size of Firmware Volume Block protocol. (Un)Lock on
109 flash chip is always performed block by block. Therefore, the (Un)Lock
110 operation to a logical block is converted a number of (Un)Lock operation
111 (or a partial erase) on the hardware.
112 @param[in] Lock TRUE to lock. FALSE to unlock.
114 @retval EFI_SUCCESS. Opertion is successful.
119 LibFvbFlashDeviceBlockLock (