From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.115]) by mx.groups.io with SMTP id smtpd.web11.70245.1684083704616016693 for ; Sun, 14 May 2023 10:01:44 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@amperemail.onmicrosoft.com header.s=selector1-amperemail-onmicrosoft-com header.b=SH0QwevK; spf=pass (domain: os.amperecomputing.com, ip: 40.107.93.115, mailfrom: tinhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcPrPaBIhBWJXvHmxRZKG5gUhCPKJl+4Hzk1t+EkyB0drbkA5ZyFvzPgUtmFPIPM08aXTFLYT3N+0DQzIOqvC9reER0cHLxRdn5NXkh0j6hvBcTFkFjuRimjoKV/Qy8Zmhel5G03OhmtTgMWPZ3V2Gze7D8wRy2qnY9VWnBm8HEP6f1zNFN+X97z12xsbGw/zOcu2mViU8TwFzhPOJavWMFAMP+FiQBqFbxaLQj0a8hx9flKFXoe54xKGXHR4YQazh4hcFkqRUOeUnZNMEYDJQ3O8p1QCF7OgdsohdgFRi5o2dhhzcv1DN3T51c5XTWw2ux+nq+C8TuLFMS1Gh+lPA== 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=o7RqwhMi+TL76FJxOYkMHVrYqQzL5bjM3DNsxxUJ5tE=; b=XcIe/7BEYu13oPb2SqS1BZLEg1kT17B6zAdDgjWM11ATEr5MkRL592xvTgcbpqOlPdAXa3QWTGg6rpaDUZBOQDHKgvaGIDW51PTn912YMrzaFkzx5PZtPxUtqomA1nbKbMEgZVXzDhb04gtpYiQmUGuyDG/CP15bGPwFfKp5biNRUMYt4SNN4hR2UfZU+2UqUjsvqTrH9hqLtr5D7AZsJlOf/HqAIbpQvYYE9R6jvl30zel0DhCpwo8BEt0qmeHGtpzhpjngbQjOjhP0d0KfIclukBG8eL7O4jOEnMXT5OiXA9a2sJhaA+++T6DttHP+NLaEQAx51sTDAMeGV5eGvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-amperemail-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o7RqwhMi+TL76FJxOYkMHVrYqQzL5bjM3DNsxxUJ5tE=; b=SH0QwevKfDJ3GEaEtqrq8oH2QRs7IfI9A4orvM3TX51k6ttgTcX8MOD+t/EpJe20nMndJQY4NXN9sVEypxNEL3z1K4bQnTNiqvFw0OIJ2QOX78hslYs8v0LDFAivc68GguaGsaul0Gyb1Nw4W/lYP9QTipjfveuMU3pOB9WettM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amperemail.onmicrosoft.com; Received: from DM5PR0102MB3336.prod.exchangelabs.com (2603:10b6:4:9f::11) by DM5PR01MB3228.prod.exchangelabs.com (2603:10b6:3:fc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Sun, 14 May 2023 17:01:39 +0000 Received: from DM5PR0102MB3336.prod.exchangelabs.com ([fe80::fefc:e2a9:e823:fe42]) by DM5PR0102MB3336.prod.exchangelabs.com ([fe80::fefc:e2a9:e823:fe42%6]) with mapi id 15.20.6387.020; Sun, 14 May 2023 17:01:39 +0000 Message-ID: <4fb4d4c0-e529-c776-6e0d-a91c932261d9@amperemail.onmicrosoft.com> Date: Mon, 15 May 2023 00:01:30 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiOsWdt: IPMI OS Watchdog timer Driver To: devel@edk2.groups.io, abner.chang@amd.com Cc: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Tinh Nguyen References: <20230512040649.384-1-abner.chang@amd.com> From: "Tinh Nguyen" In-Reply-To: <20230512040649.384-1-abner.chang@amd.com> X-ClientProxiedBy: SI1PR02CA0030.apcprd02.prod.outlook.com (2603:1096:4:1f4::8) To DM5PR0102MB3336.prod.exchangelabs.com (2603:10b6:4:9f::11) Return-Path: tinhnguyen@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3336:EE_|DM5PR01MB3228:EE_ X-MS-Office365-Filtering-Correlation-Id: f2037b79-7cff-4031-e7fe-08db549ce277 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9GRVDP148z8t+5oghgAesu9ukkQzUIbBqUvmMhDg0Z9Lk/rvXPNjPBOC5A4R5nSTaioZUVN2YHwaNVWv8Z9yb/TGYbyS2JFLOCps+uLGZATn+dNOHZLPA4mJVuAI5FzSfBFH9r7+VZzK4yMuyR8kKq7zWxBhJ4LPykFnCW4wKfAlKfMYIUsibvIPT0ui4CH2N0mKrL3dKGyAtA0vKlYwd7lK+dV6YNoR0+5GuaF4t1+A/gtpEkt/OIAr6dJ0w9pk8SgStFB9GR0xsPCqaDgTeCYD8A5wJ5fYCj/P7vnsBAAMI8HMr9R6+R8LJvrrsRrtp3iG4qbW44nXZ60HnBNNM7sVskZ84osSciY7AKFI3c4mfbNwKymagmRGGabTfUK332+yRYFK06fsMbDA+CreWjF/3qkXg25KtLWnvyJBasm/L5C3OHPkcHNs7EzGs2igBKq+Rsxh6IJ729/LsEDTQ8wc3JvMswHDE9hRm7nMir4ctcWm+D1Z7VDSW+cMac2cKLXbsDbL+bW1qN1hwjRRkZqLl5BNSZAUlJLZyNxBKwuuiZ1uCgQcxBlZ1v6IvdbLwHRLOGdiT3+BbOTTgKODCScAOt0ya9m0vnoVndmAfuBXJ4/1zwDIBdn/yMoUt0zD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3336.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(4636009)(39840400004)(396003)(376002)(346002)(366004)(136003)(451199021)(54906003)(19627235002)(478600001)(66556008)(66476007)(4326008)(66946007)(107886003)(6666004)(6486002)(316002)(2906002)(8936002)(8676002)(41300700001)(5660300002)(26005)(83170400001)(31696002)(38100700002)(2616005)(42882007)(83380400001)(186003)(53546011)(6512007)(6506007)(31686004)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VU0wR3N0TUlLcUM3OWFUd1hxYW1pUGdpVkJJWkRERnVmWngxMXkwNTAwYStw?= =?utf-8?B?TmR3TkZOWUJ5bU1yMTQwamZTWTVEbzd4WmFxRHB5OHlCK1ZyRXhGT3dBMEVP?= =?utf-8?B?ZXpYMkx0bUNyK21aZHBwc1BHWmZpVVhWRjZvYld3Z2VNemNGZXlIZHNMRWVU?= =?utf-8?B?T202QVZLRDRzazcrRFJlYjNPbjViWDhYbFYxWjNyYm5yMHZ6N2pqdWJsMUdP?= =?utf-8?B?R0JRdVV3QXU5Zm1BRnRIa0pLeXBBcUFEL1dmWENsUzREL1R4b2dZaVFPcU1r?= =?utf-8?B?dVhxQVM0WlpVYVF4UWVncVlpMHJSTjY2bWd1ZUdPSTcxV25JRUxSUXJ4UVJm?= =?utf-8?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hXQW5oVDlSYlNLTEE2?= =?utf-8?Q?bwSAaSYgM1kZX0ueraX5dn8=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2037b79-7cff-4031-e7fe-08db549ce277 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3336.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2023 17:01:39.7365 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2NZRk9Zq+BWiPOl8fo98yDyvHrBewjC3+bBlWTJdbM3GQJ3NEP+EHUmc7Z2vCaCuhlZrRaZSRvFuhgN/5/jWTbyqJdlRhSwpliVD7WtupHmkmoxN6vp691dQBRgY96xf X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB3228 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reviewed-by: Tinh Nguyen Regards, - Tinh On 12/05/2023 11:06, Chang, Abner via groups.io wrote: > From: Abner Chang > > IpmiOsWdt is cloned from > edk2-platforms/Features/Intel/OutOfBandManagement/ > IpmiFeaturePkg/OsWdt 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/OsWdt > 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/IpmiOsWdt/OsWdt.inf | 33 ++++++ > .../Universal/IpmiOsWdt/OsWdt.c | 112 ++++++++++++++++++ > 2 files changed, 145 insertions(+) > create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > create mode 100644 Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > > diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > new file mode 100644 > index 0000000000..b5af3b25e1 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.inf > @@ -0,0 +1,33 @@ > +### @file > +# Component description file for IPMI OS watch dog timer driver. > +# > +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +### > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = OsWdt > + FILE_GUID = BA4FD21F-8443-4017-8D13-70EC92F4BD4C > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + ENTRY_POINT = DriverInit > + > +[Sources] > + OsWdt.c > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + DebugLib > + IpmiCommandLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + UefiLib > + > +[Depex] > + TRUE > diff --git a/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > new file mode 100644 > index 0000000000..e2bbd95b83 > --- /dev/null > +++ b/Features/ManageabilityPkg/Universal/IpmiOsWdt/OsWdt.c > @@ -0,0 +1,112 @@ > +/** @file > + IPMI Os watchdog timer Driver. > + > +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +BOOLEAN mOsWdtFlag = FALSE; > + > +EFI_EVENT mExitBootServicesEvent; > + > +/*++ > + > +Routine Description: > + Enable the OS Boot Watchdog Timer. > + Is called only on legacy or EFI OS boot. > + > +Arguments: > + Event - Event type > + *Context - Context for the event > + > +Returns: > + None > + > +--*/ > +VOID > +EFIAPI > +EnableEfiOsBootWdtHandler ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; > + UINT8 CompletionCode; > + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; > + static BOOLEAN OsWdtEventHandled = FALSE; > + > + DEBUG ((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n")); > + > + // > + // Make sure it processes once only. And proceess it only if OsWdtFlag==TRUE; > + // > + if (OsWdtEventHandled || !mOsWdtFlag) { > + return; > + } > + > + OsWdtEventHandled = TRUE; > + > + Status = IpmiGetWatchdogTimer (&GetWatchdogTimer); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + ZeroMem (&SetWatchdogTimer, sizeof (SetWatchdogTimer)); > + // > + // Just flip the Timer Use bit. This should release the timer. > + // > + SetWatchdogTimer.TimerUse.Bits.TimerRunning = 1; > + SetWatchdogTimer.TimerUse.Bits.TimerUse = IPMI_WATCHDOG_TIMER_OS_LOADER; > + SetWatchdogTimer.TimerActions.Uint8 = IPMI_WATCHDOG_TIMER_ACTION_HARD_RESET; > + SetWatchdogTimer.TimerUseExpirationFlagsClear &= ~BIT4; > + SetWatchdogTimer.TimerUseExpirationFlagsClear |= BIT1 | BIT2; > + SetWatchdogTimer.InitialCountdownValue = 600; // 100ms / count > + > + Status = IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); > + return; > +} > + > +/*++ > + > +Routine Description: > + This is the standard EFI driver point. This function intitializes > + the private data required for creating ASRR Driver. > + > +Arguments: > + As required for DXE driver enrty routine. > + ImageHandle - ImageHandle of the loaded driver > + SystemTable - Pointer to the System Table > + > +Returns: > + @retval EFI_SUCCESS Protocol successfully started and installed. > + @retval EFI_OUT_OF_RESOURCES The event could not be allocated. > + > +--*/ > +EFI_STATUS > +EFIAPI > +DriverInit ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + Status = gBS->CreateEvent ( > + EVT_SIGNAL_EXIT_BOOT_SERVICES, > + TPL_NOTIFY, > + EnableEfiOsBootWdtHandler, > + NULL, > + &mExitBootServicesEvent > + ); > + > + return Status; > +}