From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0CF18740049 for ; Wed, 1 May 2024 19:05:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nPgCq+VFP4HMIU/AhZST/ekpv3D1Rr+njKYrnxL7QUM=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1714590351; v=1; b=3p3vw+6u4rStmfw92PF8rZH9K+TiQVM0X9v00rc5j7Jmc4Ym+gTwBtbsVVv8Yr8ogBXG/TBq KQA/K8Wf4GVNYAhx90CmYikOOfTPp8uBQv9BGCoHhaInl/2dgFMSSzZRj7I116IB2uv1E4gMDcH ts/2fpRMD8QFLIQMEXIdSj5in61nDdRoILXK6wkRcqkexete0XpWkFfGsHWA7DqWWNsuOfAlfY+ tO4VSTh/Hzy2kw2OrRbEO+jGT6Trds9dkokNr9ZjR8WpXFPHyJbfQJgo6aECtSLjY8BLSaIgTQk /ov1wrroBqVxZxrxDza1OZhmXPAKql1MpoghgEOckQAYg== X-Received: by 127.0.0.2 with SMTP id qm2tYY7687511xLL0o7BGO9i; Wed, 01 May 2024 12:05:51 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.40]) by mx.groups.io with SMTP id smtpd.web11.5071.1714590350511893485 for ; Wed, 01 May 2024 12:05:50 -0700 X-Received: from SJ0PR05CA0095.namprd05.prod.outlook.com (2603:10b6:a03:334::10) by MN0PR12MB6174.namprd12.prod.outlook.com (2603:10b6:208:3c5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Wed, 1 May 2024 19:05:47 +0000 X-Received: from SJ5PEPF000001CD.namprd05.prod.outlook.com (2603:10b6:a03:334:cafe::2c) by SJ0PR05CA0095.outlook.office365.com (2603:10b6:a03:334::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28 via Frontend Transport; Wed, 1 May 2024 19:05:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001CD.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 1 May 2024 19:05:46 +0000 X-Received: from AUS-BIOSDEV-68.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 1 May 2024 14:05:43 -0500 From: "Chesley, Brit via groups.io" To: CC: Liming Gao , Ray Ni , "Abner Chang" , Abdul Lateef Attar Subject: [edk2-devel] [PATCH v1 4/6] MdeModulePkg:BaseSpiHcPlatformLib: Adding NULL lib instance Date: Wed, 1 May 2024 14:05:25 -0500 Message-ID: <20240501190527.200937-5-brit.chesley@amd.com> In-Reply-To: <20240501190527.200937-1-brit.chesley@amd.com> References: <20240501190527.200937-1-brit.chesley@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CD:EE_|MN0PR12MB6174:EE_ X-MS-Office365-Filtering-Correlation-Id: b6107459-9dde-48fc-a707-08dc6a11b502 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?nxocZWvSBtqalF4CgOgziDsSLalrMkfN9bQbgwB0cgGRqaCOQYrGAUUW+/Dh?= =?us-ascii?Q?PUEGxrjIq767BzhVIzAOGVj0wz8hwNNuCaIfcXbTDBzmH1/pxHnTJ3oaqaVk?= =?us-ascii?Q?LO/HcLvRMMiQfaWFqR12msSHibN1sy5Yo3PDzCF/Kb46sI9WhIVpaALj02E5?= =?us-ascii?Q?Ng/6Lf924Jn7EWszRMzm512ZXDOpgyZQ/Py6T9/biEpbZ0sZiNLqHDkggo+h?= =?us-ascii?Q?G6nztaFK6RiuHemR2PIa/V0S36CLYYUlm0WoyRIPRQJuxGehjg3Z7+xHRF4N?= =?us-ascii?Q?NtonVYMh7c04OuxJguEGs3GzrDTfSANKinL/SlJQyprs1cfqSKkZd+R5ExZU?= =?us-ascii?Q?RUzMv2uJMByjItwiLoRjycgd1rG1Y2EDdP60J182IiUSK1m+VmyF/4ep3XKE?= =?us-ascii?Q?H8KnFAgxTeANktNtnWUKsJWnEUtPGh9ICp8HT02IuSAMp/elg4P0vhYX1CBi?= =?us-ascii?Q?AQILlYqJEEVUIa5Vpz/hjK2K2mNp+UPN5jcGMJ+wixIkvtrhDNQGf5nDio4v?= =?us-ascii?Q?tyxyIlkUzRszX9mqkKsQ6jS87Hv2fhDUmf2RvVepgTQnB15v/DAL19wdw0c+?= =?us-ascii?Q?n8DxALMC3RaoDfJuiPzpUfkQ2K6rkTpgsReJwPAI7dMVFB/JJnxcd0yKd61d?= =?us-ascii?Q?kkHu/JBg5dULH+n2mjpy35A3mtf/JTB3RZipio7mNAInbziiaibpLWLfjlji?= =?us-ascii?Q?Om+NYmBS70zZQa3EfK2WGAJOYqVNgQ8HCqBWJBMm17Vq1Z6aHkuq+iguLxQo?= =?us-ascii?Q?nrsZ7dm7a/w1Yq6FHX86q/VowvZy4dNFnBXWYw+JEw6jeuzMG+FypLrnrByr?= =?us-ascii?Q?aNmGl8ze+gMsZ9+s1BnPipyblcT4B8utDybxRgmkG0Lr5nj/NN/y9JumY0tw?= =?us-ascii?Q?He4ShIu9f+itKuvjJtOYqK/SFTccIPzzqQTUpmPrfwoY9DgU+dtKRLKdTYwe?= =?us-ascii?Q?JS6YPW6R+yzaP3ax2l9/fjwnmSqkMwYWRipVPT/LvXdaIJaHv1shjXmlorwy?= =?us-ascii?Q?F5en39riKrGQ/+tHuqVUaJrlPTKOCBpBZnRZYOzeMbQ8y5QyL7lLiTl2FhOn?= =?us-ascii?Q?El9HorJyahskhI4yzYIN4V4mzACIZa4ENJjmjL3j66GlXqnOTTOuRFELDGVb?= =?us-ascii?Q?ikdK2M1rKk9unKwh0qa8eArHZbT9W9pARNfWsW2JXONl+mobv5pKdK8Klue7?= =?us-ascii?Q?7sU5bW2rLH96OBKp8NztSfpdnbxr30Mgtru5LA9ISbt4wgRKAHrz/lo8H6d4?= =?us-ascii?Q?KUXMW3hPn6ANCeWZfztHeH1GZEBpxAZhZFIbn3l8r9MUIorTBExtkCneDJPt?= =?us-ascii?Q?QuximjH25Ta+7Usmy2iAPssUsw5S4T70+Q62thH3fUqBwxdOc2hEw0/C2k66?= =?us-ascii?Q?aZoKx50rhHZ5H82+IR5vdNTzs2wZ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 19:05:46.2356 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6107459-9dde-48fc-a707-08dc6a11b502 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001CD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6174 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 01 May 2024 12:05:50 -0700 Resent-From: brit.chesley@amd.com Reply-To: devel@edk2.groups.io,brit.chesley@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2e65kb96Y96x0JL4NXDx90yHx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=3p3vw+6u; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io From: Brit Chesley Adding NULL SpiHcPlatformLib instance. This library is responsible for handling the low level details of the SPI host controller. Since this is platform specific this library will be dependent on OEM SPI implementation. The SPI host controller layer will utilize this library for SPI bus transactions. Bugzilla #4753 Cc: Liming Gao Cc: Ray Ni Cc: Abner Chang Cc: Abdul Lateef Attar Signed-off-by: Brit Chesley --- MdeModulePkg/MdeModulePkg.dec | 5 + MdeModulePkg/MdeModulePkg.dsc | 2 + .../BaseSpiHcPlatformLibNull.inf | 33 ++++ .../Include/Library/SpiHcPlatformLib.h | 148 ++++++++++++++++++ .../BaseSpiHcPlatformLibNull.c | 145 +++++++++++++++++ .../BaseSpiHcPlatformLibNull.uni | 11 ++ 6 files changed, 344 insertions(+) create mode 100644 MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHc= PlatformLibNull.inf create mode 100644 MdeModulePkg/Include/Library/SpiHcPlatformLib.h create mode 100644 MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHc= PlatformLibNull.c create mode 100644 MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHc= PlatformLibNull.uni diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 085370eae41a..8a3bcb9aded1 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -169,6 +169,11 @@ [LibraryClasses] # ImagePropertiesRecordLib|Include/Library/ImagePropertiesRecordLib.h =20 + ## @libraryclass Platform SPI Host Controller library which provides = low-level + # control over the SPI hardware + # + SpiHcPlatformLib|Include/Library/SpiHcPlatformLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 33d6f4a1f6a6..177128bdfd3e 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -107,6 +107,7 @@ [LibraryClasses] MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibN= ull.inf VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf IpmiCommandLib|MdeModulePkg/Library/BaseIpmiCommandLibNull/BaseIpmiComma= ndLibNull.inf + SpiHcPlatformLib|MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHc= PlatformLibNull.inf =20 [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -528,6 +529,7 @@ [Components.IA32, Components.X64] MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf + MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNull.i= nf =20 [Components.X64] MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf diff --git a/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatfor= mLibNull.inf b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatf= ormLibNull.inf new file mode 100644 index 000000000000..805f50b89565 --- /dev/null +++ b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNul= l.inf @@ -0,0 +1,33 @@ +## @file +# NULL library for platform SPI Host controller, which should be provided +# by the OEM. +# +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +[Defines] + INF_VERSION =3D 1.27 + BASE_NAME =3D BaseSpiHcPlatformLibNull + FILE_GUID =3D 3C230948-6DF5-4802-8177-967A190579CF + MODULE_TYPE =3D BASE + VERSION_STRING =3D 0.1 + PI_SPECIFICATION_VERSION =3D 0x0001000A + LIBRARY_CLASS =3D SpiHcPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DevicePathLib + UefiLib + +[Sources] + BaseSpiHcPlatformLibNull.c + +[Depex] + TRUE + +[UserExtensions.TianoCore."ExtraFiles"] + BaseSpiHcPlatformLibNull.uni diff --git a/MdeModulePkg/Include/Library/SpiHcPlatformLib.h b/MdeModulePkg= /Include/Library/SpiHcPlatformLib.h new file mode 100644 index 000000000000..c68f7455372c --- /dev/null +++ b/MdeModulePkg/Include/Library/SpiHcPlatformLib.h @@ -0,0 +1,148 @@ +/** @file + + Function declarations for SpiHcPlatformLib + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef PLATFORM_SPI_HC_H_ +#define PLATFORM_SPI_HC_H_ + +#include +#include +#include +#include +#include + +/** + This function reports the details of the SPI Host Controller to the SpiH= c driver. + + @param[out] Attributes The suported attributes of the S= PI host controller + @param[out] FrameSizeSupportMask The suported FrameSizeSupportMas= k of the SPI host controller + @param[out] MaximumTransferBytes The suported MaximumTransferByte= s of the SPI host controller + + @retval EFI_SUCCESS SPI_HOST_CONTROLLER_INSTANCE was allocat= ed properly + @retval EFI_OUT_OF_RESOURCES The SPI_HOST_CONTROLLER_INSTANCE could n= ot be allocated +*/ +EFI_STATUS +EFIAPI +GetPlatformSpiHcDetails ( + OUT UINT32 *Attributes, + OUT UINT32 *FrameSizeSupportMask, + OUT UINT32 *MaximumTransferBytes + ); + +/** + This function reports the device path of SPI host controller. This is ne= eded in order for the SpiBus + to match the correct SPI_BUS to the SPI host controller + + @param[out] DevicePath The device path for this SPI HC is returned in th= is variable + + @retval EFI_SUCCESS +*/ +EFI_STATUS +EFIAPI +GetSpiHcDevicePath ( + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + This is the platform specific Spi Chip select function. + Assert or deassert the SPI chip select. + + This routine is called at TPL_NOTIFY. + Update the value of the chip select line for a SPI peripheral. The SPI b= us + layer calls this routine either in the board layer or in the SPI control= ler + to manipulate the chip select pin at the start and end of a SPI transact= ion. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data stru= cture + describing the SPI peripheral whose chip selec= t pin + is to be manipulated. The routine may access t= he + ChipSelectParameter field to gain sufficient + context to complete the operati on. + @param[in] PinValue The value to be applied to the chip select lin= e of + the SPI peripheral. + + @retval EFI_SUCCESS The chip select was set as requested + @retval EFI_NOT_READY Support for the chip select is not proper= ly + initialized + @retval EFI_INVALID_PARAMETER The ChipSeLect value or its contents are + invalid + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcChipSelect ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN BOOLEAN PinValue + ); + +/** + This function is the platform specific SPI clock function. + Set up the clock generator to produce the correct clock frequency, phase= and + polarity for a SPI chip. + + This routine is called at TPL_NOTIFY. + This routine updates the clock generator to generate the correct frequen= cy + and polarity for the SPI clock. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure= from + which the routine can access the ClockParamete= r, + ClockPhase and ClockPolarity fields. The routi= ne + also has access to the names for the SPI bus a= nd + chip which can be used during debugging. + @param[in] ClockHz Pointer to the requested clock frequency. The = SPI + host controller will choose a supported clock + frequency which is less then or equal to this + value. Specify zero to turn the clock generato= r + off. The actual clock frequency supported by t= he + SPI host controller will be returned. + + @retval EFI_SUCCESS The clock was set up successfully + @retval EFI_UNSUPPORTED The SPI controller was not able to support the + frequency requested by ClockHz + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcClock ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN UINT32 *ClockHz + ); + +/** + This function is the platform specific SPI transaction function + Perform the SPI transaction on the SPI peripheral using the SPI host + controller. + + This routine is called at TPL_NOTIFY. + This routine synchronously returns EFI_SUCCESS indicating that the + asynchronous SPI transaction was started. The routine then waits for + completion of the SPI transaction prior to returning the final transacti= on + status. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION contain= ing + the description of the SPI transaction to per= form. + + @retval EFI_SUCCESS The transaction completed successfully + @retval EFI_BAD_BUFFER_SIZE The BusTransaction->WriteBytes value is inv= alid, + or the BusTransaction->ReadinBytes value is + invalid + @retval EFI_UNSUPPORTED The BusTransaction-> Transaction Type is + unsupported + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcTransaction ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN EFI_SPI_BUS_TRANSACTION *BusTransaction + ); + +#endif // PLATFORM_SPI_HC_SMM_PROTOCOL_H_ diff --git a/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatfor= mLibNull.c b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatfor= mLibNull.c new file mode 100644 index 000000000000..2926e9e248eb --- /dev/null +++ b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNul= l.c @@ -0,0 +1,145 @@ +/** @file + + Null implementation of SpiHcPlatformLib + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include +#include +#include +#include + +/** + This function reports the details of the SPI Host Controller to the SpiH= c driver. + + @param[out] Attributes The suported attributes of the S= PI host controller + @param[out] FrameSizeSupportMask The suported FrameSizeSupportMas= k of the SPI host controller + @param[out] MaximumTransferBytes The suported MaximumTransferByte= s of the SPI host controller + + @retval EFI_UNSUPPORTED +**/ +EFI_STATUS +EFIAPI +GetPlatformSpiHcDetails ( + OUT UINT32 *Attributes, + OUT UINT32 *FrameSizeSupportMask, + OUT UINT32 *MaximumTransferBytes + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This function reports the device path of SPI host controller. This is ne= eded in order for the SpiBus + to match the correct SPI_BUS to the SPI host controller + + @param[out] DevicePath The device path for this SPI HC is returned in th= is variable + + @retval EFI_UNSUPPORTED +**/ +EFI_STATUS +EFIAPI +GetSpiHcDevicePath ( + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This is the platform specific Spi Chip select function. + Assert or deassert the SPI chip select. + + This routine is called at TPL_NOTIFY. + Update the value of the chip select line for a SPI peripheral. The SPI b= us + layer calls this routine either in the board layer or in the SPI control= ler + to manipulate the chip select pin at the start and end of a SPI transact= ion. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data stru= cture + describing the SPI peripheral whose chip selec= t pin + is to be manipulated. The routine may access t= he + ChipSelectParameter field to gain sufficient + context to complete the operati on. + @param[in] PinValue The value to be applied to the chip select lin= e of + the SPI peripheral. + + @retval EFI_UNSUPPORTED + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcChipSelect ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN BOOLEAN PinValue + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This function is the platform specific SPI clock function. + Set up the clock generator to produce the correct clock frequency, phase= and + polarity for a SPI chip. + + This routine is called at TPL_NOTIFY. + This routine updates the clock generator to generate the correct frequen= cy + and polarity for the SPI clock. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure= from + which the routine can access the ClockParamete= r, + ClockPhase and ClockPolarity fields. The routi= ne + also has access to the names for the SPI bus a= nd + chip which can be used during debugging. + @param[in] ClockHz Pointer to the requested clock frequency. The = SPI + host controller will choose a supported clock + frequency which is less then or equal to this + value. Specify zero to turn the clock generato= r + off. The actual clock frequency supported by t= he + SPI host controller will be returned. + + @retval EFI_UNSUPPORTED + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcClock ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN UINT32 *ClockHz + ) +{ + return EFI_UNSUPPORTED; +} + +/** + This function is the platform specific SPI transaction function + Perform the SPI transaction on the SPI peripheral using the SPI host + controller. + + This routine is called at TPL_NOTIFY. + This routine synchronously returns EFI_SUCCESS indicating that the + asynchronous SPI transaction was started. The routine then waits for + completion of the SPI transaction prior to returning the final transacti= on + status. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION contain= ing + the description of the SPI transaction to per= form. + + @retval EFI_UNSUPPORTED + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcTransaction ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN EFI_SPI_BUS_TRANSACTION *BusTransaction + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatfor= mLibNull.uni b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatf= ormLibNull.uni new file mode 100644 index 000000000000..82fa02c31d58 --- /dev/null +++ b/MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNul= l.uni @@ -0,0 +1,11 @@ + +// /** @file +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US "Null SPI Host controller library" --=20 2.42.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118476): https://edk2.groups.io/g/devel/message/118476 Mute This Topic: https://groups.io/mt/105849133/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-