From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.170.1627960715010350388 for ; Mon, 02 Aug 2021 20:18:35 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=EFX3TiDf; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 7C6E4209DD55; Mon, 2 Aug 2021 19:41:11 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7C6E4209DD55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1627958471; bh=7BeMo2iVocsb4xNm4jJJrtf1DYBQ0wub6fOzlrga3uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFX3TiDf9xUKvKwDLy81ClcVaCEi7TWMkn4YTyd3fjZLHioYBDNcdFPZBD6zjw3Pg BIMuGpCAE6uYV4XLWvSIBQbRovV7/Nq7JgTTIuZBDDkZNuWh6bDViD1wgLla0SN73D Ltp6pgryJODu3YgtVZM1Yy+5trBPrN5t+NEzhgRY= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [edk2-platforms][PATCH v5 33/46] PurleyOpenBoardPkg: Add SpiFlashCommonLib.h Date: Mon, 2 Aug 2021 22:39:01 -0400 Message-Id: <20210803023914.1569-34-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20210803023914.1569-1-mikuback@linux.microsoft.com> References: <20210803023914.1569-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307 Adds the header file to PurleyOpenBoardPkg since it was removed from MinPlatformPkg. Cc: Isaac Oram Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Michael Kubacki --- Platform/Intel/WhitleyOpenBoardPkg/Include/Library/SpiFlashCommonLib.h |= 98 ++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/SpiFlashC= ommonLib.h b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/SpiFlashC= ommonLib.h new file mode 100644 index 000000000000..ef62ba238d71 --- /dev/null +++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/SpiFlashCommonLi= b.h @@ -0,0 +1,98 @@ +/** @file + The header file includes the common header files, defines + internal structure and functions used by SpiFlashCommonLib. + + Copyright (c) 2019 Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SPI_FLASH_COMMON_LIB_H__ +#define __SPI_FLASH_COMMON_LIB_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SECTOR_SIZE_4KB 0x1000 // Common 4kBytes sector size +/** + Enable block protection on the Serial Flash device. + + @retval EFI_SUCCESS Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. + +**/ +EFI_STATUS +EFIAPI +SpiFlashLock ( + VOID + ); + +/** + Read NumBytes bytes of data from the address specified by + PAddress into Buffer. + + @param[in] Address The starting physical address of the rea= d. + @param[in,out] NumBytes On input, the number of bytes to read. O= n output, the number + of bytes actually read. + @param[out] Buffer The destination data buffer for the read= . + + @retval EFI_SUCCESS Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. + +**/ +EFI_STATUS +EFIAPI +SpiFlashRead ( + IN UINTN Address, + IN OUT UINT32 *NumBytes, + OUT UINT8 *Buffer + ); + +/** + Write NumBytes bytes of data from Buffer to the address specified by + PAddresss. + + @param[in] Address The starting physical address of the w= rite. + @param[in,out] NumBytes On input, the number of bytes to write= . On output, + the actual number of bytes written. + @param[in] Buffer The source data buffer for the write. + + @retval EFI_SUCCESS Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. + +**/ +EFI_STATUS +EFIAPI +SpiFlashWrite ( + IN UINTN Address, + IN OUT UINT32 *NumBytes, + IN UINT8 *Buffer + ); + +/** + Erase the block starting at Address. + + @param[in] Address The starting physical address of the block= to be erased. + This library assume that caller garantee t= hat the PAddress + is at the starting address of this block. + @param[in] NumBytes On input, the number of bytes of the logic= al block to be erased. + On output, the actual number of bytes eras= ed. + + @retval EFI_SUCCESS. Opertion is successful. + @retval EFI_DEVICE_ERROR If there is any device errors. + +**/ +EFI_STATUS +EFIAPI +SpiFlashBlockErase ( + IN UINTN Address, + IN UINTN *NumBytes + ); + +#endif --=20 2.28.0.windows.1