SignedCapsulePkg/Include: Add PlatformFlashAccessLib header.
authorJiewen Yao <>
Wed, 21 Sep 2016 01:37:01 +0000 (09:37 +0800)
committerJiewen Yao <>
Tue, 8 Nov 2016 14:40:52 +0000 (22:40 +0800)
This library is used to abstract platform flash access.
This library is consumed by a capsule update module.
It may cover SystemFirmware region and/or non-SystemFirmware region.

Cc: Feng Tian <>
Cc: Star Zeng <>
Cc: Michael D Kinney <>
Cc: Liming Gao <>
Cc: Chao Zhang <>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <>
Reviewed-by: Liming Gao <>
Reviewed-by: Michael Kinney <>
Tested-by: Michael Kinney <>
SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h [new file with mode: 0644]

diff --git a/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h b/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
new file mode 100644 (file)
index 0000000..0a8858e
--- /dev/null
@@ -0,0 +1,57 @@
+/** @file\r
+  Platform flash device access library.\r
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+typedef enum {\r
+  FlashAddressTypeRelativeAddress,\r
+  FlashAddressTypeAbsoluteAddress,\r
+// Type 0 ~ 0x7FFFFFFF is defined in this library.\r
+// Type 0x80000000 ~ 0xFFFFFFFF is reserved for OEM.\r
+typedef enum {\r
+  PlatformFirmwareTypeSystemFirmware,\r
+  PlatformFirmwareTypeNvRam,\r
+  Perform flash write opreation.\r
+  @param[in] FirmwareType      The type of firmware.\r
+  @param[in] FlashAddress      The address of flash device to be accessed.\r
+  @param[in] FlashAddressType  The type of flash device address.\r
+  @param[in] Buffer            The pointer to the data buffer.\r
+  @param[in] Length            The length of data buffer in bytes.\r
+  @retval EFI_SUCCESS           The operation returns successfully.\r
+  @retval EFI_WRITE_PROTECTED   The flash device is read only.\r
+  @retval EFI_UNSUPPORTED       The flash device access is unsupported.\r
+  @retval EFI_INVALID_PARAMETER The input parameter is not valid.\r
+PerformFlashWrite (\r
+  IN PLATFORM_FIRMWARE_TYPE       FirmwareType,\r
+  IN EFI_PHYSICAL_ADDRESS         FlashAddress,\r
+  IN FLASH_ADDRESS_TYPE           FlashAddressType,\r
+  IN VOID                         *Buffer,\r
+  IN UINTN                        Length\r
+  );\r