1 /** @file 2 Platform flash device access library. 3 4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 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. 12 13 **/ 14 15 16 #ifndef __PLATFORM_FLASH_ACCESS_LIB_H__ 17 #define __PLATFORM_FLASH_ACCESS_LIB_H__ 18 19 typedef enum { 20 FlashAddressTypeRelativeAddress, 21 FlashAddressTypeAbsoluteAddress, 22 } FLASH_ADDRESS_TYPE; 23 24 // 25 // Type 0 ~ 0x7FFFFFFF is defined in this library. 26 // Type 0x80000000 ~ 0xFFFFFFFF is reserved for OEM. 27 // 28 typedef enum { 29 PlatformFirmwareTypeSystemFirmware, 30 PlatformFirmwareTypeNvRam, 31 } PLATFORM_FIRMWARE_TYPE; 32 33 /** 34 Perform flash write opreation. 35 36 @param[in] FirmwareType The type of firmware. 37 @param[in] FlashAddress The address of flash device to be accessed. 38 @param[in] FlashAddressType The type of flash device address. 39 @param[in] Buffer The pointer to the data buffer. 40 @param[in] Length The length of data buffer in bytes. 41 42 @retval EFI_SUCCESS The operation returns successfully. 43 @retval EFI_WRITE_PROTECTED The flash device is read only. 44 @retval EFI_UNSUPPORTED The flash device access is unsupported. 45 @retval EFI_INVALID_PARAMETER The input parameter is not valid. 46 **/ 47 EFI_STATUS 48 EFIAPI 49 PerformFlashWrite ( 50 IN PLATFORM_FIRMWARE_TYPE FirmwareType, 51 IN EFI_PHYSICAL_ADDRESS FlashAddress, 52 IN FLASH_ADDRESS_TYPE FlashAddressType, 53 IN VOID *Buffer, 54 IN UINTN Length 55 ); 56 57 #endif 58