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.web11.873.1635459042464596285 for ; Thu, 28 Oct 2021 15:10:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=TOiZ3vX5; 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 A4A9B208F4E9; Thu, 28 Oct 2021 15:10:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A4A9B208F4E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1635459042; bh=S7So8qcuQIjgvmzwFNtZzkK0Mh+sGm4kPqdmwEgHQQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOiZ3vX5wlk12JYI+EQ2nyjvjh1qdTUdtmVrfDUfEYg3Y7Hko06XvXwLsEU2mzgvF jrB48BBdQZWBQI6aLhZMyWiqV754phj6qe4Gf1UAbud/I4bYoK/12RdiTnv1H1Voxh t8UiT9CY1VnV9zSiNnTJHITN7LKB7RD8D3lJLTqc= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Benjamin Doron Subject: [PATCH v6 46/52] KabylakeOpenBoardPkg/PeiSerialPortLibSpiFlash: Update for new SPI PPI API Date: Thu, 28 Oct 2021 18:08:40 -0400 Message-Id: <20211028220846.753-11-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211028220846.753-1-mikuback@linux.microsoft.com> References: <20211028220846.753-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 Updates usage of gPchSpiPpiGuid to use the new interface that identifies SPI flash regions by GUID. Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Michael Kubacki Reviewed-by: Chasel Chiu Tested-by: Benjamin Doron --- Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlash/Pei= SerialPortLibSpiFlash.c | 46 ++++++++++---------- Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlash/Pei= SerialPortLibSpiFlash.inf | 3 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLib= SpiFlash/PeiSerialPortLibSpiFlash.c b/Platform/Intel/KabylakeOpenBoardPkg= /Library/PeiSerialPortLibSpiFlash/PeiSerialPortLibSpiFlash.c index fc48bdc6fccb..17fa328add1c 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlas= h/PeiSerialPortLibSpiFlash.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlas= h/PeiSerialPortLibSpiFlash.c @@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #include -#include +#include #include #include #include @@ -24,29 +24,29 @@ typedef struct { /** Returns a pointer to the PCH SPI PPI. =20 - @return Pointer to PCH_SPI_PPI If an instance of the PCH SPI PPI is= found + @return Pointer to PCH_SPI2_PPI If an instance of the PCH SPI PPI is= found @return NULL If an instance of the PCH SPI PPI is= not found =20 **/ -PCH_SPI_PPI * +PCH_SPI2_PPI * GetSpiPpi ( VOID ) { EFI_STATUS Status; - PCH_SPI_PPI *PchSpiPpi; + PCH_SPI2_PPI *PchSpi2Ppi; =20 Status =3D PeiServicesLocatePpi ( - &gPchSpiPpiGuid, + &gPchSpi2PpiGuid, 0, NULL, - (VOID **) &PchSpiPpi + (VOID **) &PchSpi2Ppi ); if (EFI_ERROR (Status)) { return NULL; } =20 - return PchSpiPpi; + return PchSpi2Ppi; } =20 /** @@ -67,7 +67,7 @@ SerialPortWrite ( EFI_STATUS Status; EFI_HOB_GUID_TYPE *GuidHob; SPI_FLASH_DEBUG_CONTEXT *Context; - PCH_SPI_PPI *PchSpiPpi; + PCH_SPI2_PPI *PchSpi2Ppi; UINT32 BytesWritten; UINT32 SourceBufferOffset; UINT32 NvMessageAreaSize; @@ -89,19 +89,19 @@ SerialPortWrite ( if (Context =3D=3D NULL || Context->CurrentWriteOffset >=3D NvMessageA= reaSize) { return 0; } - PchSpiPpi =3D GetSpiPpi (); - if (PchSpiPpi =3D=3D NULL) { + PchSpi2Ppi =3D GetSpiPpi (); + if (PchSpi2Ppi =3D=3D NULL) { return 0; } =20 if ((Context->CurrentWriteOffset + NumberOfBytes) / NvMessageAreaSize = > 0) { LinearOffset =3D (UINT32) (FixedPcdGet32 (PcdFlashNvDebugMessageBase= ) - FixedPcdGet32 (PcdFlashAreaBaseAddress)); - Status =3D PchSpiPpi->FlashErase ( - PchSpiPpi, - FlashRegionBios, - LinearOffset, - NvMessageAreaSize - ); + Status =3D PchSpi2Ppi->FlashErase ( + PchSpi2Ppi, + &gFlashRegionBiosGuid, + LinearOffset, + NvMessageAreaSize + ); if (!EFI_ERROR (Status)) { Context->CurrentWriteOffset =3D 0; } else { @@ -116,13 +116,13 @@ SerialPortWrite ( =20 LinearOffset =3D (FixedPcdGet32 (PcdFlashNvDebugMessageBase) + Context= ->CurrentWriteOffset) - FixedPcdGet32 (PcdFlashAreaBaseAddress); =20 - Status =3D PchSpiPpi->FlashWrite ( - PchSpiPpi, - FlashRegionBios, - LinearOffset, - BytesWritten, - (UINT8 *) &Buffer[SourceBufferOffset] - ); + Status =3D PchSpi2Ppi->FlashWrite ( + PchSpi2Ppi, + &gFlashRegionBiosGuid, + LinearOffset, + BytesWritten, + (UINT8 *) &Buffer[SourceBufferOffset] + ); if (!EFI_ERROR (Status)) { Context->CurrentWriteOffset +=3D BytesWritten; return BytesWritten; diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLib= SpiFlash/PeiSerialPortLibSpiFlash.inf b/Platform/Intel/KabylakeOpenBoardP= kg/Library/PeiSerialPortLibSpiFlash/PeiSerialPortLibSpiFlash.inf index b959cd1f4612..651bf93faf62 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlas= h/PeiSerialPortLibSpiFlash.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/PeiSerialPortLibSpiFlas= h/PeiSerialPortLibSpiFlash.inf @@ -40,9 +40,10 @@ [Sources] PeiSerialPortLibSpiFlash.c =20 [Ppis] - gPchSpiPpiGuid + gPchSpi2PpiGuid =20 [Guids] + gFlashRegionBiosGuid gSpiFlashDebugHobGuid =20 [Pcd] --=20 2.28.0.windows.1