From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.12684.1684466864674468150 for ; Thu, 18 May 2023 20:27:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bQdX8aZo; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684466863; x=1716002863; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jw8un+zm53sSKE+hBlq7xNvTHvTmi5JXeecGGpeAZbo=; b=bQdX8aZocXz8ojSwiIKmbSsTiodXh0yh0ex0m75Wi88+0TurQK8coT75 Qz+IFIDnGBeM6Q5wr+12H13ZcL4hhdCzwXrzGw6N5Y7PS9V9OkmTd2wsI cRuKjoIBXTzfhvWrzJfJfVIJWWDfZXmwfMFzvSpgQvnVR44X7xhqA7ulD i+/x6W2jJ5JLEVzCodI2e8B7cttFlXO3KO+w9jre01mN4xVI0orlLwZXX qzrlyIihWR3fJldkB/kcoJw1lK8W3Y/ktJJvHF10WEBbIsO9Fb12iuH3w HfZTEtH+WBAYutYgYCGFQ51D+bTu+Vhr4M1ZBMhFO6WMu0laEW4X/zROZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="417958872" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="417958872" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 20:27:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="705432824" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="705432824" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga007.fm.intel.com with ESMTP; 18 May 2023 20:27:43 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 18 May 2023 20:27:42 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 18 May 2023 20:27:42 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 18 May 2023 20:27:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lp+Xnsv32xSnHr+ds4myqALEHRg7s4pUGXSUdoYdAvQQMo/xsmw90sNCBlPOz124ObBjhj+Q98JQJAi7y4q3+KHit3lJEsF9DyGnuV40EZEkw9UrOIBhGnKlQ5I6GcmpfYVs4BbOab7pkpZERzzHW0k2qKPy9l1cYqPvErLWOJrficXcWVzMlpuVkJTLRb6ViEKeFSaBY26L5m64w48JiJ8RiFm1eD+ZeekQfoCSlXOmHJ7OzjpSQxZPcd/YhqCQXQ5EA4OTLn+dxLUhzPopfTx1BH9DPPV5En2euDpc60/TA0vYx5arcpNeZ/+/HwGQz/ZjJgeO0BcinElTdLJFXg== 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=ztnLzwD1mRtrC9SdS+rBRXTAnkumPdGdxeiW/G1BCYU=; b=CQlwFly0pKU47jXNFYFhC/n4R8mhDlt93rJxjYm1ehS/DbDo1gUQ+VIk7RWubeQTkLEvzc6goWTMkLHbKCzrS/azO5rR3KNR/oQ23iflcCIzLSjTErC38fk+OfnLcCnnWUJkT7ikRy4gBWcFT/SXWpK3pviqQuSoI0eqJ5Tn+mzsoGHLIEqUR1FmxQAshmoyQF+ubx2BJWSswzRLyG7E+AKhx60Jd/8QfHO/pnrj6R05esG72hKLrF7nkadSmQ6srXHRKK84YY31ixaiW9q8w42PB7HXblpFwxrf1Mt5LUEQ9u3CWiwv5IK61zesw9asJ6DSdbtVbrAYMFwUiK6P3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by CYYPR11MB8306.namprd11.prod.outlook.com (2603:10b6:930:c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19; Fri, 19 May 2023 03:27:40 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::6979:a90f:e224:41c5%4]) with mapi id 15.20.6387.030; Fri, 19 May 2023 03:27:40 +0000 From: "Isaac Oram" To: "devel@edk2.groups.io" , "abner.chang@amd.com" CC: Abdul Lateef Attar , Nickle Wang , Tinh Nguyen Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI BMC ACPI Driver Thread-Topic: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb: IPMI BMC ACPI Driver Thread-Index: AQHZhbKMPrJOyGLN5U+WWKx6YCmb7q9g90Hg Date: Fri, 19 May 2023 03:27:40 +0000 Message-ID: References: <20230513154919.1873-1-abner.chang@amd.com> In-Reply-To: <20230513154919.1873-1-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB5801:EE_|CYYPR11MB8306:EE_ x-ms-office365-filtering-correlation-id: 7069cef4-cd19-4a91-c9b4-08db5818ffff x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TOQbTIZG+n4UzUb0TXmbXaVVPO949sE2Z8AGa/RfsN1AsUqUBOjOKPG0rFa+M5pyEfgvo1emCOW61kgdZBeHsUdLctE36ZZs0oj2WbQTS23JwvWnl/gH8PTy5DDsgq7siz0UPTgfxPoJg4xGUCP/aGiIIWI9bTw0aPRAPCaFTxPk+bK0/F4DOZ1or1eEzvBnY+1Hs5bMZiR/zwzBu5L1ehX2Zm4Ba294d0DzF4uD/aNxNhks6SJjGC9revvVYTcDXR/2nJ4agtaLpUfGfeWHr9pyXxAU/wXrvwOQM6BaUpyQbvC6fVslq261ZqZ62UNL21sAVZ1U4SPv8NTGowduDjHHIY33XJjxh+9IgJtEyMKcmUCcbDA5vRvr5IXw3nMRgmDJ50lyr/zcQ7vqqWC7S5VfnKnoCoLPqnA5qbmHYa2wn9YBM7BjaeWsA1FYjZoUN+VXLbYttT+O1z6fJJengkkB/fQJv8jV0kJ99yNShzhZqbI5Zyf6TkzSGmG+we+Qqc3sSWRGG63qjQVO8FPBiJR7oqstZAjxKNR0ZdxrSxPEQfXnYbyE2PoqUm0uTsap1LicGYKBUAAU/4XUBQSuDq4ek4p+8kNQYoBbyjATnbCxXRjhP8gXipy8M3B3DOgLh+ma1PC2fjJM6sCrTpNRNVudv2ZLxMxp0SE9ltr2agk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(396003)(376002)(346002)(39860400002)(366004)(451199021)(30864003)(8936002)(2906002)(316002)(478600001)(52536014)(41300700001)(8676002)(4326008)(19627235002)(54906003)(110136005)(66899021)(71200400001)(66476007)(64756008)(76116006)(66946007)(66556008)(66446008)(5660300002)(7696005)(966005)(53546011)(6506007)(9686003)(26005)(122000001)(186003)(82960400001)(38100700002)(55016003)(83380400001)(38070700005)(86362001)(33656002)(127784003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?llQG4rxZt3VqFl1y4rVnnsqC/uvC/QBuTib4XE3Y7iEYPHH0uLyscu19X8y3?= =?us-ascii?Q?QYbC7y5SPEEXrKJ676Fx9DVcyjARHLTOJsmv3TyJw3hJl8NDBpkom4kay4yP?= =?us-ascii?Q?DhPqC8AUdXGK/609/a+N1Zb6SViV1WHUay17QSOYrNzbqI/2sKL8MWn8kFpt?= =?us-ascii?Q?xhiCcZip1HtBoM4IfwRqM8Z49QStbn8LpvrVKA8+yZOXCAMPjJl6mQP7KenK?= =?us-ascii?Q?W+R4UKecon48QOlciPrpXV9DcP/gItftsOzRfJVvGzCAR/0HAF4pnPcDHhRI?= =?us-ascii?Q?6+STU835I/9ZBZcmO8D9l9thpClHKRtCpfsZ6eMdlTAJhKY2TW0TxTSsWOZ1?= =?us-ascii?Q?7r0gcDBGr9tO09078YffjHE23PIEbAfKjiGJ7iO4TuePVWba7YVDaWv6pjp3?= =?us-ascii?Q?jJg/bDXObKjy7/Elia4yrpulYljLdUIqqxijaQlotxC0o+xOZGgrGE9zRP8O?= =?us-ascii?Q?qHpOG3yabLqHBOVMYPWQZuOAVSCdi4WrmsKNxDrj4PgjHJUFxlHUGFCcB9ZJ?= =?us-ascii?Q?83aK9+q7AZlyUDgNRrIrFyJKgeHlB5dSuYjo0mZxqyHgvw8f7ZuNbZldFJCj?= =?us-ascii?Q?n3f8iINpS9xYmFz6JHJIYwl1mHbJygd4B7qsdD83/4ZmgoeBnTPrvl40DmIH?= =?us-ascii?Q?QyG/6/UxlroSNrMYQjJU+xr9QF2djnk2UNVg6Yk30SQEpS+Dq2C1Mnej/xC3?= =?us-ascii?Q?aOX2ZXuEx/1mEmqChop4Cf5gTkSeK0gDOpXWvOf8hV6yk00T3ySnNhgl5HbH?= =?us-ascii?Q?fgC1Y2DKiVHXyYMNk+bR42Kl/qnZ0bxhRA889pR9VebaQG2Umsw0rat3E3lc?= =?us-ascii?Q?6gCTUfhaxgX0YvQ2y0BJvBMdr1PPIzPt6/395c0hES3WeKfVpdepe9KkXCR6?= =?us-ascii?Q?WLsMsx7vneO3qKBmV+cxf6rgXTDD2nZQhGDKgtqgshshGj8mxt9u5OHEwA3b?= =?us-ascii?Q?r9DB+lftWiMCqrv3FD0cL59i6u2SQ1tbgl1/UV5q8C/3FU4KRG7kLUi7jQQw?= =?us-ascii?Q?j4E0vrbGkh+lIu/PKNt+IHVhK2NSQvTeSJoWnQpFk4FXBotqqqEBd1x112s9?= =?us-ascii?Q?K0P0aPi6UoR2LttcPFOp8wfnleTzRKqnrQH1GS0mxaWE+Del0eJ7xbcZyV+j?= =?us-ascii?Q?IRnjzl/GIQhxA4z/9reVrNjXBaoTEEEwpyQL74pjwoMsFmdyZfaOKpgec5gx?= =?us-ascii?Q?vpaURyLJl1oUppFmXThOXiZTgkbNY+ePgiAeUc0fPcItDSlwXoXp+ULC/Z07?= =?us-ascii?Q?yu07mYnuzil2ZbACxBQVNMppgoBr9JspIFejBm+eRBjGMK8b6OuaEkU3YZVO?= =?us-ascii?Q?RA/jNjj20BR2gsC+MwMwgBOWXNYFlIctgsI8ql/CHCvA5m4WpzNEo37YguDf?= =?us-ascii?Q?3GQxnCVZqSRExD0sFl7ahJddfogI3uUyAq0533JPKaI6+Zcz8huWfRxE91Ai?= =?us-ascii?Q?tY02vCOUZ5gybQBh//wVBgoC1YmMcwIAbL8fOM6KDMIrwvDcx6vSDiJtbBp9?= =?us-ascii?Q?2oU/MmIDp2YCOF4PtTYhIGaw0ByODQ//l275QMg8XD1AdJptTeFI1CzqoPUe?= =?us-ascii?Q?QaCL1KM0ArxmfHucMWTQdSHVa46DkMX1pzDr3w5V?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7069cef4-cd19-4a91-c9b4-08db5818ffff X-MS-Exchange-CrossTenant-originalarrivaltime: 19 May 2023 03:27:40.0441 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Aq3EN+GZ6Iidt0WmE1apiE1eDFar3xNx73Nqnsz8+bLJq8abbmZfXpuzH0dwuv1PWOGEdlFX7cNFngmqummzEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR11MB8306 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Isaac Oram You could consider changing "INTEL" and ('M', 'S', 'F', 'T') to more generi= c placeholders. But that is also something that could be looked at separat= ely and more widely.=20 -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chang, Abner= via groups.io Sent: Saturday, May 13, 2023 8:49 AM To: devel@edk2.groups.io Cc: Oram, Isaac W ; Abdul Lateef Attar ; Nickle Wang ; Tinh Nguyen Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFrb:= IPMI BMC ACPI Driver From: Abner Chang IpmiBmcAcpi is cloned from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg/BmcAcpi in order to consolidate edk2 system manageability support in one place. Uncustify is applied to C files and no functionalities are changed in this = patch. We will still keep the one under IpmiFeaturePkg/BmcAcpi until the reference= to this instance are removed from platforms. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Tinh Nguyen --- .../Universal/IpmiBmcAcpi/BmcAcpi.inf | 47 ++++ .../Universal/IpmiBmcAcpi/BmcAcpi.c | 264 ++++++++++++++++++ .../Universal/IpmiBmcAcpi/BmcSsdt/BmcSsdt.asl | 28 ++ .../IpmiBmcAcpi/BmcSsdt/IpmiOprRegions.asi | 58 ++++ 4 files changed, 397 insertions(+) create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi= .inf create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi= .c create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt= /BmcSsdt.asl create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt= /IpmiOprRegions.asi diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.inf b/= Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.inf new file mode 100644 index 0000000000..a21c5b9b35 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.inf @@ -0,0 +1,47 @@ +### @file +# Component description file for BMC ACPI. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights=20 +reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # ### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BmcAcpi + FILE_GUID =3D 09E3B4BE-F731-4903-AAE6-BD5D573B6140 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D BmcAcpiEntryPoint + +[Sources] + BmcAcpi.c + BmcSsdt/BmcSsdt.asl + +[Packages] + ManageabilityPkg/ManageabilityPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid + gEfiAcpiTableProtocolGuid + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + +[Depex] + gEfiAcpiTableProtocolGuid + +[BuildOptions] + *_*_*_ASL_FLAGS =3D -oi diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.c b/Fe= atures/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.c new file mode 100644 index 0000000000..cf066dd095 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcAcpi.c @@ -0,0 +1,264 @@ +/** @file + IPMI BMC ACPI. + + Copyright (c) 2018 - 2019, Intel Corporation. All rights=20 + reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +// +// Statements that include other header files // #include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include #include=20 + #include + +#ifndef EFI_ACPI_CREATOR_ID +#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T') #endif=20 +#ifndef EFI_ACPI_CREATOR_REVISION #define EFI_ACPI_CREATOR_REVISION =20 +0x0100000D #endif + +/** + + Locate the first instance of a protocol. If the protocol requested=20 + is an FV protocol, then it will return the first FV that contains the=20 + ACPI table storage file. + + @param [in] Protocol The protocol to find. + @param [in] Instance Return pointer to the first instance of the protoc= ol. + @param [in] Type The type of protocol to locate. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The protocol could not be located. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to find the= protocol. + +**/ +EFI_STATUS +LocateSupportProtocol ( + IN EFI_GUID *Protocol, + OUT VOID **Instance, + IN UINT32 Type + ) +{ + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + EFI_FV_FILETYPE FileType; + UINT32 FvStatus =3D 0; + EFI_FV_FILE_ATTRIBUTES Attributes; + UINTN Size; + UINTN Index; + + Status =3D gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL,=20 + &NumberOfHandles, &HandleBuffer); if (EFI_ERROR (Status)) { + return Status; + } + + // + // Looking for FV with ACPI storage file // for (Index =3D 0; Index <= =20 + NumberOfHandles; Index++) { + Status =3D gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instanc= e); + ASSERT (!EFI_ERROR (Status)); + + if (!Type) { + // + // Not looking for the FV protocol, so find the first instance of th= e + // protocol. There should not be any errors because our handle buff= er + // should always contain at least one or LocateHandleBuffer would ha= ve + // returned not found. + // + break; + } + + // + // See if it has the ACPI storage file + // + Status =3D ((EFI_FIRMWARE_VOLUME2_PROTOCOL *)(*Instance))->ReadFile ( + *Instance, + &gEfiCaller= IdGuid, + NULL, + &Size, + &FileType, + &Attributes= , + &FvStatus + ); + + // + // If we found it, then we are done + // + if (!EFI_ERROR (Status)) { + break; + } + } + + gBS->FreePool (HandleBuffer); + return Status; +} + +/** + Update ACPI SSDT for BMC IPMI KCS device + + @param [in] Table Pointer to ACPI SSDT + + @retval EFI_SUCCESS SSDT is updated according to PCD settings **/=20 +EFI_STATUS UpdateDeviceSsdtTable ( + IN OUT EFI_ACPI_COMMON_HEADER *Table + ) +{ + EFI_ACPI_DESCRIPTION_HEADER *TableHeader =3D NULL; + UINT64 TempOemTableId; + UINT8 *DataPtr; + EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc; + + TableHeader =3D (EFI_ACPI_DESCRIPTION_HEADER *)Table; + + // + // Update the OEMID and OEM Table ID. + // + CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof=20 + (TableHeader->OemId)); TempOemTableId =3D PcdGet64=20 + (PcdAcpiDefaultOemTableId); CopyMem (&TableHeader->OemTableId, &TempOemT= ableId, sizeof (UINT64)); + TableHeader->CreatorId =3D EFI_ACPI_CREATOR_ID; + TableHeader->CreatorRevision =3D EFI_ACPI_CREATOR_REVISION; + + // + // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2) // DEBUG ((DEBUG_INFO,=20 + "UpdateDeviceSsdtTable - IPMI\n")); for (DataPtr =3D (UINT8 *)(Table += =20 + 1); + DataPtr < (UINT8 *)((UINT8 *)Table + Table->Length - 4); + DataPtr++) + { + if (CompareMem (DataPtr, "_CRS", 4) =3D=3D 0) { + DataPtr +=3D 4; // Skip _CRS + ASSERT (*DataPtr =3D=3D AML_BUFFER_OP); + DataPtr++; // Skip AML_BUFFER_OP + ASSERT ((*DataPtr & (BIT7|BIT6)) =3D=3D 0); + DataPtr++; // Skip PkgLength - 0xD + ASSERT ((*DataPtr) =3D=3D AML_BYTE_PREFIX); + DataPtr++; // Skip BufferSize OpCode + DataPtr++; // Skip BufferSize - 0xA + IoRsc =3D (VOID *)DataPtr; + ASSERT (IoRsc->Header.Bits.Type =3D=3D ACPI_SMALL_ITEM_FLAG); + ASSERT (IoRsc->Header.Bits.Name =3D=3D ACPI_SMALL_IO_PORT_DESCRIPTOR= _NAME); + ASSERT (IoRsc->Header.Bits.Length =3D=3D sizeof (EFI_ACPI_IO_PORT_DE= SCRIPTOR) - sizeof (ACPI_SMALL_RESOURCE_HEADER)); + DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <=3D 0x%04x= \n", IoRsc->BaseAddressMin, PcdGet16 (PcdIpmiKcsIoBaseAddress))); + IoRsc->BaseAddressMin =3D PcdGet16 (PcdIpmiKcsIoBaseAddress); + IoRsc->BaseAddressMax =3D PcdGet16 (PcdIpmiKcsIoBaseAddress); + } + } + + return EFI_SUCCESS; +} + +/** + + Entry point for Acpi platform driver. + + @param [in] ImageHandle A handle for the image that is initializing thi= s driver. + @param [in] SystemTable A pointer to the EFI system table. + + @retval EFI_SUCCESS Driver initialized successfully. + @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded. + @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources. + +**/ +EFI_STATUS +EFIAPI +BmcAcpiEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_STATUS AcpiStatus; + + EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; + INTN Instance =3D 0; + EFI_ACPI_COMMON_HEADER *CurrentTable =3D NULL; + UINTN TableHandle =3D 0; + UINT32 FvStatus; + UINT32 Size; + + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + UINTN TableSize; + + // + // Find the AcpiTable protocol + // + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID= =20 + **)&AcpiTable); if (EFI_ERROR (Status)) { + return EFI_ABORTED; + } + + // + // Locate the firmware volume protocol // Status =3D=20 + LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOID=20 + **)&FwVol, 1); if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D EFI_SUCCESS; + Instance =3D 0; + + // + // Read tables from the storage file. + // + while (!EFI_ERROR (Status)) { + CurrentTable =3D NULL; + + Status =3D FwVol->ReadSection ( + FwVol, + &gEfiCallerIdGuid, + EFI_SECTION_RAW, + Instance, + (VOID **)&CurrentTable, + (UINTN *)&Size, + &FvStatus + ); + if (!EFI_ERROR (Status)) { + // + // Perform any table specific updates. + // + AcpiStatus =3D UpdateDeviceSsdtTable (CurrentTable); + if (!EFI_ERROR (AcpiStatus)) { + TableHandle =3D 0; + TableSize =3D ((EFI_ACPI_DESCRIPTION_HEADER *)CurrentTable)->Len= gth; + ASSERT (Size >=3D TableSize); + + Status =3D AcpiTable->InstallAcpiTable ( + AcpiTable, + CurrentTable, + TableSize, + &TableHandle + ); + + ASSERT_EFI_ERROR (Status); + } + + // + // Increment the instance + // + Instance++; + } + } + + return EFI_SUCCESS; +} diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/BmcSsd= t.asl b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/BmcSsdt.asl new file mode 100644 index 0000000000..8157d744c8 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/BmcSsdt.as +++ l @@ -0,0 +1,28 @@ +/** @file + BMC ACPI SSDT. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock ( + "BmcSsdt.aml", + "SSDT", + 0x02, // SSDT revision. + // A Revision field value greater than or equal to 2 sig= nifies that integers + // declared within the Definition Block are to be evalua= ted as 64-bit values + "INTEL", // OEM ID (6 byte string), same as PcdAcpiDefaultOemId d= efined in MdeModulePkg.dec + "BMCACPI", // OEM table ID (8 byte string) + 0x0 // OEM version of DSDT table (4 byte Integer) + ) +{ + + External(\_SB.PC00.LPC0, DeviceObj) + + Scope (\_SB.PC00.LPC0) + { + #include "IpmiOprRegions.asi" + } + +} diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/IpmiOp= rRegions.asi b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/Ipmi= OprRegions.asi new file mode 100644 index 0000000000..ffd6af3944 --- /dev/null +++ b/Features/ManageabilityPkg/Universal/IpmiBmcAcpi/BmcSsdt/IpmiOprReg +++ ions.asi @@ -0,0 +1,58 @@ +/** @file + IPMI ACPI SSDT. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(IPMC) +{ + // Config DWord, modified during POST + // Bit definitions are the same as PPMFlags: + // [00] =3D Plug and Play BMC Detection enabled in setup + // [31:01] =3D Reserved =3D 0 + + Name(ECFL, 0x80000000) + + // Return the interface specification revision + Method(_SRV) + { + // IPMI Specification Revision v2.0 + Return(0x0200) + } + + Method(_STA, 0) + { + // + // Assume OK + // + Store (0xF, Local0) + + Return(Local0) + + // Bit 0 - Set if the device is present. + // Bit 1 - Set if the device is enabled and decoding its resources= . + // Bit 2 - Set if the device should be shown in the UI. + // Bit 3 - Set if the device is functioning properly (cleared if t= he device failed its diagnostics). + // Bit 4 - Set if the battery is present. + // Bit 5 - Reserved (must be cleared). + } // end of _STA + + // Return the x86 resources consumed by BMC + Name(_CRS, ResourceTemplate() + { + // Uses 8-bit ports 0xCA2-0xCA5 + IO(Decode16, 0xCA2, 0xCA2, 0, 2) + }) + + Name(_HID, "IPI0001") // IPMI device + Name(_IFT, 0x1) // KCS system interface type + Name(_STR, Unicode("IPMI_KCS")) + + Name(_UID, 0) // First interface. + + +} // end of Device(IPMC) + + -- 2.37.1.windows.1