From nobody Mon Sep 16 19:55:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114056+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705676240773562.8205132383083; Fri, 19 Jan 2024 06:57:20 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=nRbRyBMDQk4BlKiD0jbNpkvLhi8/UoU659KHk9ywrZs=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results: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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705676240; v=1; b=cbBtS4RtT+8CVNbQSEjGC2Y1K2zROCXoktmmCvv3YiXRpQ07cSqIEVfP/DVtyHLQ6Mx0TV+q AsCj3Xucy1v4wINNMEDe0j+p+QwzINz1u0p9ucTLprh5E9o84VED9zJDznN/WlqC1ZF+hAN9cUd 5RuyOWJ/8vifOOYfWxuqtwJw= X-Received: by 127.0.0.2 with SMTP id fd9KYY1788612xMIcotlgOIg; Fri, 19 Jan 2024 06:57:20 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.62]) by mx.groups.io with SMTP id smtpd.web11.5892.1705560666708162757 for ; Wed, 17 Jan 2024 22:51:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l6v4adVMItPbfvi0IjXDjtSnA1a1JbnvTlfiaKGSE0atXRXrq7RlQOcsWLFq1AAp/9ZIXa93LKV1RSdjtBcT8HADpaOb3EiOvODGs4xWWBd/Ieomvg8vtN2NliSDGn2ecDUwkJC4gmDq/o5JDUfq+lk0ASDJYQXpqA0aVYaw5sxMerr/CGyk8NImMwlFK9AKr3NbZEvr3A0sGOHCTK7PHE23qt39PLCss2T1tit7ga1Ye5XDIBTn+qmvNWFo8tOdlCWBB1iaoYyUv6oFttIMRloy8J4iy60/wqV35CVU5BkNKnh3O7QKIXLNycDFYGfksGFM79sdnx+ScPvRhDbw0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1AyxqIXN01v7dB400Qm5ffPKGqW8AWO4oCGROqwds7o=; b=DIyDjVXUagc2/vo13bqZLWWO42Xc1xaWm8QDGz8eLdrS4VJiRY600gPHF01WYouVr/ocLSZ7iW541nPtO2zXq2bXX6k0pkEqTSvfMBhNdA28VcC8CpTtcJo+QN2gUpG+Hz9Va/JDWtqRCZcUqULQTZ4ExTCt0GIMOoEyLVfNBefUySjKJiB1aY2jlwjZG11JxYROWj4I/Gs8a6T3K8vrlqv7muWqlJ0La5y9N9EFEnRiaCmTOxcNIly0DXjpXdqmzfU999F4gMSnkTDU3YUopoemRrga0Hyyz13NqANFrsBFisi9XdSYhgreHLuPmFahRD0NCep5jZg6TPMv4PjMIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) X-Received: from BYAPR08CA0018.namprd08.prod.outlook.com (2603:10b6:a03:100::31) by DM4PR12MB6087.namprd12.prod.outlook.com (2603:10b6:8:b1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23; Thu, 18 Jan 2024 06:51:04 +0000 X-Received: from CO1PEPF000044F5.namprd05.prod.outlook.com (2603:10b6:a03:100:cafe::23) by BYAPR08CA0018.outlook.office365.com (2603:10b6:a03:100::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Thu, 18 Jan 2024 06:51:03 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114056+1787277+3901457@groups.io; helo=mail02.groups.io; 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=SATLEXMB03.amd.com; pr=C X-Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044F5.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Thu, 18 Jan 2024 06:51:03 +0000 X-Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 00:51:02 -0600 X-Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 17 Jan 2024 22:51:02 -0800 X-Received: from SHA-LX-MINGXZHA.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 18 Jan 2024 00:51:00 -0600 From: "duke.zhai via groups.io" To: CC: Eric Xing , Ken Yao , Igniculus Fu , Abner Chang Subject: [edk2-devel] [PATCH 07/33] AMD/VanGoghBoard: Check in PciPlatform Date: Thu, 18 Jan 2024 14:50:20 +0800 Message-ID: <20240118065046.961-8-duke.zhai@amd.com> In-Reply-To: <20240118065046.961-1-duke.zhai@amd.com> References: <20240118065046.961-1-duke.zhai@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F5:EE_|DM4PR12MB6087:EE_ X-MS-Office365-Filtering-Correlation-Id: cea15ec3-bf3f-4234-de91-08dc17f1d6c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: OhJ5G/lSPAM1HrEfM72erIRE0Z7RrIPnDzkDrGTwa/4evVejMRJu8VFIMDxZMR459CUACokguvSmWMW3PCDkmmpuQvei5V+pcEn6yWAe9zVa8nfgx5O0NjHF8WqP6S0UKQELQXeSs7P7dcLMqLUizHYD7U586LGy58wFNqkoBzV0BUa0Gb7VOdxfqBK3cawhPCTXg6WtYXuLkPIOtIguvZfJ62g4UaZLVLNICZgRqRtTH5ZB4BuOtsyh2y5W5sWG9mPbZpnAHuzJFSKTQ3PAPbe/Mkx5cv5801SmuSG3wK4YYJb93PKMIm41Koenx1YnCUVvARdWzApNvMy+x+SEBK6K9DdmBlUtJ4AWCBN6WW1yK4wObk+tcMEBxOiZ73VaLZUOYmL49+jbyEFhlLCauiPyCK3SwA5ie06VNF4qiTcSPC5vRPlAL8O0J+9vOg+4ylew14GxnUISMdy606HWgqIpCuiCh8TaTllGOmBjgSfadBCyjc1HZHSwmYgwo3CiFGwBvAueIsPjfzWvLuoIyHqMoMxRN+VHcGr52/KZQc6MLzmA7322vZoaH4lEhsexFtjX35C2QfiDuAhAVs24w8+iNqj/Ccrj+fCfLo1eVZ5K5rKH6jG59XQf0VJJlITixfLEkRX7GvakG8fkRXHicVLHKBKMubgVo+UwR4GxX9uFZgi0KMIMer9lsaR6LvOvzkVBaNRFe7syUbGKktyDYIqOopo3cSKxvlDA5khf+iMeA9Yk1EYgfcHeJ51rB1zf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2024 06:51:03.6276 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cea15ec3-bf3f-4234-de91-08dc17f1d6c6 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6087 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 Reply-To: devel@edk2.groups.io,duke.zhai@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: H8pMIXdXfW5E4YIXr9PCXOSlx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705676242915100039 Content-Type: text/plain; charset="utf-8" From: Duke Zhai BZ #:4640 BIOS detects current IGPU device ID and install corresponding VBIOS. Inital PciPlatform module to load VBIOS and to provide interface for other option ROMs if necessary. Signed-off-by: Duke Zhai Cc: Eric Xing Cc: Ken Yao Cc: Igniculus Fu Cc: Abner Chang --- .../Include/Protocol/GlobalNvsArea.h | 70 ++++++ .../PciPlatform/CommonHeader.h | 43 ++++ .../PciPlatform/PciPlatform.c | 199 ++++++++++++++++++ .../PciPlatform/PciPlatform.h | 105 +++++++++ .../PciPlatform/PciPlatform.inf | 66 ++++++ 5 files changed, 483 insertions(+) create mode 100644 Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Prot= ocol/GlobalNvsArea.h create mode 100644 Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/= CommonHeader.h create mode 100644 Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/= PciPlatform.c create mode 100644 Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/= PciPlatform.h create mode 100644 Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/= PciPlatform.inf diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/Gl= obalNvsArea.h b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol= /GlobalNvsArea.h new file mode 100644 index 0000000000..0c5077f417 --- /dev/null +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/Include/Protocol/GlobalNvs= Area.h @@ -0,0 +1,70 @@ +/** @file + GlobalNvsArea.h + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ +/* This file includes code originally published under the following licens= e. */ + +/** @file +Definition of the global NVS area protocol. This protocol +publishes the address and format of a global ACPI NVS buffer +used as a communications buffer between SMM code and ASL code. +The format is derived from the ACPI reference code, version 0.95. +Note: Data structures defined in this protocol are not naturally aligned. + +Copyright (c) 2013-2015 Intel Corporation. + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _GLOBAL_NVS_AREA_H_ +#define _GLOBAL_NVS_AREA_H_ + +// +// Includes +// +#define GLOBAL_NVS_DEVICE_ENABLE 1 +#define GLOBAL_NVS_DEVICE_DISABLE 0 + +// +// Global NVS Area Protocol GUID +// +#define EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID \ +{ 0x74e1e48, 0x8132, 0x47a1, {0x8c, 0x2c, 0x3f, 0x14, 0xad, 0x9a, 0x66, 0x= dc} } + +// +// Revision id - Added TPM related fields +// +#define GLOBAL_NVS_AREA_RIVISION_1 1 + +// +// Extern the GUID for protocol users. +// +extern EFI_GUID gEfiGlobalNvsAreaProtocolGuid; + +// +// Global NVS Area definition +// +#pragma pack (1) +typedef struct { + // + // Miscellaneous Dynamic Values, the definitions below need to be matched + // GNVS definitions in Platform.ASL + // + UINT32 TopOfMem; // TOPM + UINT8 NbIoApic; // NAPC + UINT32 PcieBaseAddress; // PCBA + UINT32 PcieBaseLimit; // PCBL +} EFI_GLOBAL_NVS_AREA; +#pragma pack () + +// +// Global NVS Area Protocol +// +typedef struct _EFI_GLOBAL_NVS_AREA_PROTOCOL { + EFI_GLOBAL_NVS_AREA *Area; +} EFI_GLOBAL_NVS_AREA_PROTOCOL; + +#endif diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonH= eader.h b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHead= er.h new file mode 100644 index 0000000000..430d9f51dc --- /dev/null +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/CommonHeader.h @@ -0,0 +1,43 @@ +/** @file + Implements CommonHeader.h + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/* This file includes code originally published under the following licens= e. */ + +/** @file +Common header file shared by all source files. + +This file includes package header files, library classes and protocol, PPI= & GUID definitions. + +Copyright (c) 2013-2015 Intel Corporation. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD = License +which accompanies this distribution. The full text of the license may be = found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. +**/ + +#ifndef __COMMON_HEADER_H_ +#define __COMMON_HEADER_H_ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlat= form.c b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform= .c new file mode 100644 index 0000000000..733d334075 --- /dev/null +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.c @@ -0,0 +1,199 @@ +/** @file + Implements PciPlatform.c + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/* This file includes code originally published under the following licens= e. */ + +/** @file +Registers onboard PCI ROMs with PCI.IO + +Copyright (c) 2013-2015 Intel Corporation. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD = License +which accompanies this distribution. The full text of the license may be = found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. + + +**/ + +#include "CommonHeader.h" + +#include "PciPlatform.h" + +PCI_OPTION_ROM_TABLE mPciOptionRomTable[] =3D { + { ONBOARD_SPH_VIDEO_OPTION_ROM_FILE_GUID, 0x1002, 0x1435 }, + { NULL_ROM_FILE_GUID, 0xffff, 0xffff } +}; + +EFI_PCI_PLATFORM_PROTOCOL mPciPlatform =3D { + PhaseNotify, + PlatformPrepController, + GetPlatformPolicy, + GetPciRom +}; + +EFI_HANDLE mPciPlatformHandle =3D NULL; +EFI_HANDLE mImageHandle =3D NULL; + +EFI_STATUS +EFIAPI +PhaseNotify ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + return EFI_UNSUPPORTED; +} + +EFI_STATUS +EFIAPI +PlatformPrepController ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_HANDLE RootBridge, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, + IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Get PlatformPolicy for VGA IO ALIAS + + @param This Protocol instance pointer. + @param PciPolicy PCI Platform Policy. + + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +GetPlatformPolicy ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + OUT EFI_PCI_PLATFORM_POLICY *PciPolicy + ) +{ + *PciPolicy |=3D EFI_RESERVE_VGA_IO_ALIAS; + return EFI_SUCCESS; +} + +/** + Return a PCI ROM image for the onboard device represented by PciHandle + + @param This Protocol instance pointer. + @param PciHandle PCI device to return the ROM image for. + @param RomImage PCI Rom Image for onboard device + @param RomSize Size of RomImage in bytes + + @retval EFI_SUCCESS - RomImage is valid + @retval EFI_NOT_FOUND - No RomImage + +**/ +EFI_STATUS +EFIAPI +GetPciRom ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE PciHandle, + OUT VOID **RomImage, + OUT UINTN *RomSize + ) +{ + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + UINTN Segment; + UINTN Bus; + UINTN Device; + UINTN Function; + UINT16 VendorId; + UINT16 DeviceId; + UINTN TableIndex; + + Status =3D gBS->HandleProtocol ( + PciHandle, + &gEfiPciIoProtocolGuid, + (VOID **)&PciIo + ); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function); + + PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, 0, 1, &VendorId); + + PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, 2, 1, &DeviceId); + + // + // Loop through table of video option rom descriptions + // + for (TableIndex =3D 0; mPciOptionRomTable[TableIndex].VendorId !=3D 0xff= ff; TableIndex++) { + // + // See if the PCI device specified by PciHandle matches at device in m= PciOptionRomTable + // + if ((VendorId !=3D mPciOptionRomTable[TableIndex].VendorId) || + (DeviceId !=3D mPciOptionRomTable[TableIndex].DeviceId)) + { + continue; + } + + Status =3D GetSectionFromAnyFv ( + &mPciOptionRomTable[TableIndex].FileName, + EFI_SECTION_RAW, + 0, + RomImage, + RomSize + ); + + if (EFI_ERROR (Status)) { + continue; + } + + return EFI_SUCCESS; + } + + return EFI_NOT_FOUND; +} + +/** + + @param ImageHandle Handle of driver image. + @param SystemTable Pointer to system table. + + @retval EFI_STATUS return status of InstallProtocolInterface. + +**/ +EFI_STATUS +EFIAPI +PciPlatformDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + mImageHandle =3D ImageHandle; + + // + // Install on a new handle + // + Status =3D gBS->InstallProtocolInterface ( + &mPciPlatformHandle, + &gEfiPciPlatformProtocolGuid, + EFI_NATIVE_INTERFACE, + &mPciPlatform + ); + + return Status; +} diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlat= form.h b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform= .h new file mode 100644 index 0000000000..95a3e8816c --- /dev/null +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.h @@ -0,0 +1,105 @@ +/** @file + Implements PciPlatform.h + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/* This file includes code originally published under the following licens= e. */ + +/** @file +This code supports a the private implementation +of the Legacy BIOS Platform protocol + +Copyright (c) 2013-2015 Intel Corporation. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD = License +which accompanies this distribution. The full text of the license may be = found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. + + +**/ + +#ifndef PCI_PLATFORM_H_ +#define PCI_PLATFORM_H_ + +#include +#include +// +// Global variables for Option ROMs +// +#define NULL_ROM_FILE_GUID \ +{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0= x00 }} + +#define ONBOARD_SPH_VIDEO_OPTION_ROM_FILE_GUID \ +{ 0xE7D31EB4, 0x90F3, 0x4A14, {0x8A, 0x28, 0x48, 0xD0, 0x47, 0x42, 0xF8, 0= xE1 }} + +typedef struct { + EFI_GUID FileName; + UINT16 VendorId; + UINT16 DeviceId; +} PCI_OPTION_ROM_TABLE; + +EFI_STATUS +EFIAPI +PhaseNotify ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ); + +EFI_STATUS +EFIAPI +PlatformPrepController ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_HANDLE RootBridge, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, + IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ); + +/** + Get PlatformPolicy for VGA IO ALIAS + + @param This Protocol instance pointer. + @param PciPolicy PCI Platform Policy. + + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +GetPlatformPolicy ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + OUT EFI_PCI_PLATFORM_POLICY *PciPolicy + ); + +/** + Return a PCI ROM image for the onboard device represented by PciHandle + + @param This Protocol instance pointer. + @param PciHandle PCI device to return the ROM image for. + @param RomImage PCI Rom Image for onboard device + @param RomSize Size of RomImage in bytes + + @retval EFI_SUCCESS - RomImage is valid + @retval EFI_NOT_FOUND - No RomImage + +**/ +EFI_STATUS +EFIAPI +GetPciRom ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE PciHandle, + OUT VOID **RomImage, + OUT UINTN *RomSize + ); + +#endif diff --git a/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlat= form.inf b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatfo= rm.inf new file mode 100644 index 0000000000..16d46f638a --- /dev/null +++ b/Platform/AMD/VanGoghBoard/ChachaniBoardPkg/PciPlatform/PciPlatform.inf @@ -0,0 +1,66 @@ +## @file +# PCI Platform INF file +# +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +# This file includes code originally published under the following license. +## @file +# Component description file for PciPlatform module. +# +# This driver installs pciplatform protocol to provide access interfaces t= o the onboard pci roms. +# Copyright (c) 2013-2015 Intel Corporation. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BS= D License +# which accompanies this distribution. The full text of the license may b= e found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PciPlatform + FILE_GUID =3D E78AE2BF-D5E8-4846-9B0A-2D54AEC3BAF9 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PciPlatformDriverEntry + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + PciPlatform.c + PciPlatform.h + CommonHeader.h + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + PciLib + PcdLib + DebugLib + UefiRuntimeServicesTableLib + UefiBootServicesTableLib + UefiDriverEntryPoint + DxeServicesLib + +[Guids] + +[Protocols] + gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiPciPlatformProtocolGuid # PROTOCOL ALWAYS_PRODUCED + +[Pcd] + +[Depex] + TRUE -- 2.31.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 (#114056): https://edk2.groups.io/g/devel/message/114056 Mute This Topic: https://groups.io/mt/103831168/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-