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.web09.640.1635453985174440906 for ; Thu, 28 Oct 2021 13:46:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=dkx7zRuN; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (c-73-27-179-174.hsd1.fl.comcast.net [73.27.179.174]) by linux.microsoft.com (Postfix) with ESMTPSA id 74770208F4E9; Thu, 28 Oct 2021 13:46:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 74770208F4E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1635453985; bh=7BeMo2iVocsb4xNm4jJJrtf1DYBQ0wub6fOzlrga3uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dkx7zRuNVi5Oc4HJVWsGHewfMwMAa61X/WcYitzP/K0S7ZEg6HJUg5TqeQ1bxXLMK Kcp8/bPhWqXuFHg0ul9D3/oywZ/mgHxargWg/bTRaVYhDIccZgRogTztM2Q8dMa6mx va7eF18Qm24PBMkPuLHX/cxi/CEr3CS5ocsVz8VA= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [PATCH v6 33/52] PurleyOpenBoardPkg: Add SpiFlashCommonLib.h Date: Thu, 28 Oct 2021 16:43:07 -0400 Message-Id: <20211028204326.645-34-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211028204326.645-1-mikuback@linux.microsoft.com> References: <20211028204326.645-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