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.web09.42768.1629222643298080575 for ; Tue, 17 Aug 2021 10:50:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=BJEkD519; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10079"; a="279899157" X-IronPort-AV: E=Sophos;i="5.84,329,1620716400"; d="scan'208";a="279899157" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 10:50:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,329,1620716400"; d="scan'208";a="520579324" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by FMSMGA003.fm.intel.com with ESMTP; 17 Aug 2021 10:50:42 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 17 Aug 2021 10:50:41 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 17 Aug 2021 10:50:41 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 17 Aug 2021 10:50:41 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) 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.2242.10; Tue, 17 Aug 2021 10:50:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TvvpCHnTzJ/aq8r+OXOwgX5QDvA+PV7WHHbYcCdvds/75BfpmGaQAVpnQkwN4CYNfw87176twiqDtmKA1AJZ6FKp7qLIIAxEIEBe21inDw16ujEHYsIJnCaKyBHMPhUgA7hiH479fULqGc64lLaicmucuGbPMzgM10ViZs7DIYsiCy1TosTAA53XnDmsdd/hpVA2e/PUGYRWgpQVV2B14xQWGZ164t5ntG4jcSr0ZBNpK8YUqSFL8DpeAXL7+mw3XCaukzbins4BHft89xmX4/509Uaw9woGsNj2a22hQjwgbhGNyLmH2lBKtFsdmBXAyXL44d7Dg2y63dxv9m1t4A== 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-SenderADCheck; bh=WPlihdUwukNhZ2RZr0KnXkfSS/CDD5Xdh2KQIPhTaHI=; b=XgB6XB+Iv+MLBCDASYxJB2+tMIh+/9dFl6ONTNlj0zFLSQsjZFwtqWXqGCtq4HeaDfsKG4joNa4WvkXXi9pld6TnS4c+DZEtHMTIxBGQXcVGGRuYmlAZya2j3+NQvACUG7doUx3/pyR8eAZ0P60/bkWqA0tOYXwrBFEPJ1H9do74fIzOXLsAT97Bj7urJ2ZczEJVKel9sKZvnPRR9K0f/C2a7wJ9kIgbIyZyDGMiJHMw9oQOHsRxYk+FGwrMShr4U0I5WBzILun7pmjNt7H7sidZLcrAz1tSYRKvRAwnjW99LzMSwGm2sEfSk1GCBLL8/SxF1wYpmQDzsC4yzrW3JQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WPlihdUwukNhZ2RZr0KnXkfSS/CDD5Xdh2KQIPhTaHI=; b=BJEkD519ZLd/wsC33R5QdmlNnrb71xOQtbEipXL4RfSTz3tHAc5bqbwmrc5I8sD6VEbY2EiMSrHG+UtL/WnNaOTIRsdeVZXTK5rd+d7CQlu9MExtsqF+jpqUNbdI2LiOEjoMxZvAZhZaQBxyYvnAwl0TKVu3J3UCI87CVOoF+zk= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by MWHPR11MB1920.namprd11.prod.outlook.com (2603:10b6:300:107::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Tue, 17 Aug 2021 17:50:37 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7%5]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 17:50:37 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Desimone, Nathaniel L" CC: Michael Kubacki , "Chiu, Chasel" , "Chaganty, Rangasai V" , Benjamin Doron Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeSiliconPkg/PchPmcLib: Add GetSleepTypeAfterWakeup() Thread-Topic: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeSiliconPkg/PchPmcLib: Add GetSleepTypeAfterWakeup() Thread-Index: AQHXjxiRV6c75XLABESMFloUH8CzcKt4AmkQ Date: Tue, 17 Aug 2021 17:50:36 +0000 Message-ID: References: <169A6A8AFE09D4DA.28384@groups.io> In-Reply-To: <169A6A8AFE09D4DA.28384@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2e1f9384-a6bb-4de3-412f-08d961a78538 x-ms-traffictypediagnostic: MWHPR11MB1920: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:158; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gpCpP8nKWrCbOvE4qNQv997iclMOXuVzYjLVuVMZSgT3oPEJn7ZNUW79ANireBIAmQh7e7+8w38P2CKB/z4NFdAMUvahAkKq9cBbjVa1BShCwKfPlJyCUWifEjA6wuE06fATyg5OlNzPQxirmOnwHDL46F7rPWXybknHwJH/04xtnD2fG7MG0QG/qA1zrV5/xRLRID4eY8vttmfw+z05g12x6ZCrEXq2iNrN9Uh4FRe6ctnifnaGm8BEX2EqybQ2M4nt7k3glLRMpFL7M1IHX/OaRn4UX+qkX4VBILmuKbXQjvMmrAqn8I9SaEE1hIOmT0A/unJO8Iyp3uBqy5D2WdmwKfj7E3pwqb4SuSAIFi+fSV9rLDHl4UclKb+1tUV/BG2W1f8QbK81FRIrIlwP85Cdl8QcbICdRsUn59r8p+XWj3Lm9yBRelAJe2Wn+HLBVg4mnXK8JK7k5Z3BWKrPSEs9zYWJIkxvxaOHkHhouj0d4BqcikVHmOw8V+vXwb1CUjR/wgAlvZzRS/SDmJ1iDOaxLKqJbmqFIf2sySTvrNjkxoiVICciLYhqGj4PGs4GaRHmwJKqTPGxy6YaMNGnhl1XveDLrIyuDvGbtxGMUxJX5oGhcg51T9D0APs6kHfDVp8oBRT+c3YnPUsoLozhBqlvAGqyJaIKvFrm+Q3PZcudQXFZ0a3HI5xBT7pKJFVWhqBVRUYcUx+RD3Y1dajMUNeALS7kU8te/kP0/212np51vcLrGhVH0uc+vzWVVX37ZYJ6gPXqHvfNFJHxIsUzIvxElf20d2hblNI7FmcPFJehDuYtqAFKYgD5Q7Jg/TasmdgQKoMPoUTd6DWyy/dnB2w6zWLutRUFdg3UwmBBFb8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(136003)(376002)(39860400002)(366004)(396003)(122000001)(5660300002)(83380400001)(76116006)(86362001)(8676002)(33656002)(8936002)(38100700002)(2906002)(66946007)(38070700005)(66556008)(66476007)(66446008)(64756008)(54906003)(478600001)(71200400001)(52536014)(316002)(966005)(110136005)(4326008)(9686003)(186003)(26005)(55016002)(7696005)(53546011)(6506007)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?fYblvjumwvnkv0JQ5qkI6HcHwJRHW+otmNDFLOR8HfimKNuFWAm9erOIrc6+?= =?us-ascii?Q?Lk1AeSlVBgmI+hczJphoay0wVcWfCqTny6p6lHCmNDRGKadiXZSq+KanQrs0?= =?us-ascii?Q?LNefz4/KLEFQqQDKScvMfdBO4EE7ixp7rLZf0hEd7CY5gSszURSnM0k+dNPD?= =?us-ascii?Q?sbsXS5WJFmYNCihySz+fl1b8jw3NFICHtkn8/gkMPm/JmQLV7/073HCuIBdK?= =?us-ascii?Q?nbmkifWwU0miPs6II1Nd+U1UDAg7Sv/YRuyJeIXNuYFZ1Z5jmRMj6D2Z2+tq?= =?us-ascii?Q?IR7XPAgm5z7vUNGLS/tDiZIfJ3HfipAca9zJF58IIsFMiQMPugAkRQtjzLi7?= =?us-ascii?Q?OsBFfe9C0hA9HDb7qFDq61DQU1k2BN1PfBzvbAynNB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b/1kjCfVM77mmKEYtvJM0IbNJEVw7CrM161NM?= =?us-ascii?Q?aGY8gW4V9q3eXvNy7xvNIIjc?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e1f9384-a6bb-4de3-412f-08d961a78538 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 17:50:37.0345 (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: wf/ebahw9nSPc37SHiE61qSSxTnx3wRtesOLNENMtRsfxMUZCoyqSAhcmi8MdUEmxfDWzBtbtUEizAvuKkKuTlPQd9+9mp9KGDSLAr55bbY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1920 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed: https://github.com/tianocore/edk2-platforms/commit/d410a0a > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Nate > DeSimone > Sent: Wednesday, August 11, 2021 6:22 PM > To: devel@edk2.groups.io > Cc: Desimone, Nathaniel L ; Michael > Kubacki ; Chiu, Chasel > ; Chaganty, Rangasai V > ; Benjamin Doron > > Subject: [edk2-devel] [edk2-platforms][PATCH v1] > KabylakeSiliconPkg/PchPmcLib: Add GetSleepTypeAfterWakeup() >=20 > From: Michael Kubacki >=20 > Adds the capability to get the system sleep type after wakeup to PchPmcLi= b > in KabylakeSiliconPkg. >=20 > This is needed by platforms to determine the Sx resume state. >=20 > Cc: Chasel Chiu > Cc: Sai Chaganty > Cc: Nate DeSimone > Cc: Benjamin Doron > Signed-off-by: Michael Kubacki > --- >=20 > Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PchPmc > Lib.c | 54 ++++++++++++++++++++ > Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchPmcLib.h > | 15 ++++++ >=20 > Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PeiDxeS > mmPchPmcLib.inf | 4 ++ > 3 files changed, 73 insertions(+) >=20 > diff --git > a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PchP > mcLib.c > b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PchP > mcLib.c > index 790af0a7a1..3c9c4c2a2d 100644 > --- > a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PchP > mcLib.c > +++ > b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/Pc > +++ hPmcLib.c > @@ -128,3 +128,57 @@ PchIsRtcBatteryGood ( > } > return FALSE; > } > + > +/** > + Returns the sleep type after system wakeup. > + > + @param[out] SleepType Sleep type to be returned. > + > + @retval TRUE A wake event occurred without power failure. > + @retval FALSE Power failure occurred or not a wakeup. > + > +**/ > +BOOLEAN > +EFIAPI > +GetSleepTypeAfterWakeup ( > + OUT UINT32 *SleepType > + ) > +{ > + UINT16 Pm1Sts; > + UINT32 Pm1Cnt; > + UINTN PmcBaseAddress; > + > + PmcBaseAddress =3D MmPciBase ( > + DEFAULT_PCI_BUS_NUMBER_PCH, > + PCI_DEVICE_NUMBER_PCH_PMC, > + PCI_FUNCTION_NUMBER_PCH_PMC > + ); > + > + /// > + /// Read the ACPI registers > + /// > + Pm1Sts =3D IoRead16 (PcdGet16 (PcdAcpiBaseAddress) + > + R_PCH_ACPI_PM1_STS); Pm1Cnt =3D IoRead32 (PcdGet16 > + (PcdAcpiBaseAddress) + R_PCH_ACPI_PM1_CNT); > + > + /// > + /// Get sleep type if a wake event occurred and there is no power > + failure and reset /// if ((Pm1Sts & B_PCH_ACPI_PM1_STS_WAK) !=3D 0) { > + if ((MmioRead16 (PmcBaseAddress + R_PCH_PMC_GEN_PMCON_B) & > (B_PCH_PMC_GEN_PMCON_B_RTC_PWR_STS | > B_PCH_PMC_GEN_PMCON_B_PWR_FLR)) =3D=3D 0) { > + *SleepType =3D Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP; > + > + return TRUE; > + } else { > + /// > + /// Clear Wake Status (WAK_STS) and Sleep Type (SLP_TYP) > + /// > + IoWrite16 (PcdGet16 (PcdAcpiBaseAddress) + R_PCH_ACPI_PM1_STS, > B_PCH_ACPI_PM1_STS_WAK); > + Pm1Cnt &=3D ~B_PCH_ACPI_PM1_CNT_SLP_TYP; > + IoWrite32 (PcdGet16 (PcdAcpiBaseAddress) + R_PCH_ACPI_PM1_CNT, > + Pm1Cnt); > + > + return FALSE; > + } > + } > + > + return FALSE; > +} > diff --git a/Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchPmcL= ib.h > b/Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchPmcLib.h > index ec98e07100..f84606d31c 100644 > --- a/Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchPmcLib.h > +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/Include/Library/PchPmcLib.h > @@ -41,4 +41,19 @@ PchIsRtcBatteryGood ( > VOID > ); >=20 > +/** > + Returns the sleep type after system wakeup. > + > + @param[out] SleepType Sleep type to be returned. > + > + @retval TRUE A wake event occurred without power failure. > + @retval FALSE Power failure occurred or not a wakeup. > + > +**/ > +BOOLEAN > +EFIAPI > +GetSleepTypeAfterWakeup ( > + OUT UINT32 *SleepType > + ); > + > #endif // _PCH_PMC_LIB_H_ > diff --git > a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PeiDx > eSmmPchPmcLib.inf > b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PeiDx > eSmmPchPmcLib.inf > index 8b46a59b67..1e6103f4ca 100644 > --- > a/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/PeiDx > eSmmPchPmcLib.inf > +++ > b/Silicon/Intel/KabylakeSiliconPkg/Pch/Library/PeiDxeSmmPchPmcLib/Pe > +++ iDxeSmmPchPmcLib.inf > @@ -33,5 +33,9 @@ MdePkg/MdePkg.dec > KabylakeSiliconPkg/SiPkg.dec >=20 >=20 > +[Pcd] > +gSiPkgTokenSpaceGuid.PcdAcpiBaseAddress > + > + > [Sources] > PchPmcLib.c > -- > 2.29.2.windows.2 >=20 >=20 >=20 >=20 >=20