From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.18787.1628748879413538084 for ; Wed, 11 Aug 2021 23:14:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=DPkJfCmE; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: chasel.chiu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10073"; a="300872521" X-IronPort-AV: E=Sophos;i="5.84,315,1620716400"; d="scan'208";a="300872521" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2021 23:14:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,315,1620716400"; d="scan'208";a="676649753" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga005.fm.intel.com with ESMTP; 11 Aug 2021 23:14:38 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 11 Aug 2021 23:14:37 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 11 Aug 2021 23:14:37 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 11 Aug 2021 23:14:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaInIHKf/YDq1pXAdo95881grmGJy3P7tYQgPja7m94JWh1HiwnxHDECbFcnjcYenHE14p+XkSbVPGKTFCKGHnkmTjSWDDKRK4/9RhU1xgQTltvoRH6JwlGGNNFYH3ASiNJ44qrVW3zwU94G7xA0UYIRdXf3F6Ksjko3KQLH0Pc+N9DhaINpkKw2snPJn0r0BtcJyfRs5wF3ZpDWsK+xUz9+avFZoJKb3SYNsTBclBCXDmbbUo5Ad91Sp4AGnhjipJnxMstTGTglJaPNqZKSDqayna5vn6+fz+f6fdfADBX/bhR4+PP9LXDGBOtZjgE51HZXwyK+RQwtslBRoU2pBg== 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=4n6IdgtrHbLLD286qAXiNWhe/TNvc9ZMhNo6nPOa3x4=; b=HfZPBc+kW66O6U5LgrQlxJTkQ732VH1dlL/mxhJbuTZ+3g5knGuAyTbF3T1dgBwMipI5aEBEIXLYtk+P/fPKCvTlpP+yf0t86njS3WQBIoPBWMzdYJqKOxwSGBFT5l5ebafx8/ldQApeu+6Tv7xgad5+VxsowYQN8MzHWgYBW4fCRQUNuiboWCDlwBkP/Jy5uOXpr65gOlrmc3naXksNBWUcDxNY1rIB0ulFXimoRdHbqUiBS6fSz5T0YKhXrWh3TFbI3CVPE6phGsdabr+PmoK4RTqWIqTci2NJSryuI6gS0+Als9yFw/96KTFnubHvHyeW4x5eZx8wSnPPXUQMrg== 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=4n6IdgtrHbLLD286qAXiNWhe/TNvc9ZMhNo6nPOa3x4=; b=DPkJfCmEuT5OwM98QkulFHNChVpRz2wUEhBlNdk9JtwJY+0/EOz0MlZOH2jMUEerD7BSNYg70ktU+sld6ekBknRaW311nkk1NZHk257HpJUR5csOXE1ZN4GtBGal/GZCTowdI+k7P3iKbNl1QGlZRKayckVnUfzH4bD5JBYqiUM= Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by BN9PR11MB5451.namprd11.prod.outlook.com (2603:10b6:408:100::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.22; Thu, 12 Aug 2021 06:14:31 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::6413:4198:3c40:777f]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::6413:4198:3c40:777f%3]) with mapi id 15.20.4415.014; Thu, 12 Aug 2021 06:14:31 +0000 From: "Chiu, Chasel" To: "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: Michael Kubacki , "Chaganty, Rangasai V" , Benjamin Doron Subject: Re: [edk2-platforms][PATCH v1] KabylakeSiliconPkg/PchPmcLib: Add GetSleepTypeAfterWakeup() Thread-Topic: [edk2-platforms][PATCH v1] KabylakeSiliconPkg/PchPmcLib: Add GetSleepTypeAfterWakeup() Thread-Index: AQHXjxiPfbSHFh5AVEmspI9RnEVCHqtvZFfQ Date: Thu, 12 Aug 2021 06:14:31 +0000 Message-ID: References: <20210812012225.28357-1-nathaniel.l.desimone@intel.com> In-Reply-To: <20210812012225.28357-1-nathaniel.l.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9fac5518-6f8a-4c78-87d6-08d95d5872cd x-ms-traffictypediagnostic: BN9PR11MB5451: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:741; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9c0jzTsFq5V3a4uOWbKruUqN3VcB4yDcJaP4qGY2lTTRYxHzsM816JhYnRtNtD3te5aupUVFqd24UMoEaamOnQdCthMp28fxOPLJebB+MkCtpFx0AhNdBBJqhSLGc4OsZ4hudjsQbHPJVW6fy/eXO8II1zVCzjmzeYokLpZuXbWSdiAN3kBb2Tbh35xbZPPreWG1fikWNh25iYaGw74FI/Rc7agUu8gN0hdEy9nzGIzIzBWr06nX7E+MX73nQxNHxY6KwElptG2wcjuDSRe5bxPJuLab+lc8HvVgYmiH4tPuSgADxpjAKYHRG8qIV1qif7PQCv4yod0Cg9+RjDcEkru16a/U52izOgYIkZMo3DKxHgXlxB6KY+zT0WKm2h3wM1N/BUtJKG1mSMuB6hrgTN1aoiut0TjnQYvR7WYf7di4f3km8kn5niZZe2U7SJecvG9fng2GH/9LiAbMYMz4jJoUceV6OMcEHYduo/jFaZF4ZGd63/L+0Qz+WLc0l9Pu8oHrqGjfTPQMaKTtA5xIwk6Vrx8FwpBr/qAd01qMDSX3Y/dSVoRqIr/T/6saeKPziLKAsCyNemvNygvSg/jL4sw7Il5cL+swwzA0GwV4pg/AgCURpfiPapYLgGLaOSmMWeTcdMk7yun5QSPtF5gOrUwwiuoajML/+1v+n6T/mlEEY2oczswPev4V4/R/qD8rgFQL5p43ZnMF7btR21WogTrIlQtpbzvfz0e2/yWPnY4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(6506007)(53546011)(7696005)(55016002)(186003)(86362001)(8936002)(26005)(38070700005)(5660300002)(38100700002)(316002)(122000001)(110136005)(52536014)(33656002)(4326008)(9686003)(54906003)(83380400001)(8676002)(64756008)(66446008)(71200400001)(66946007)(66476007)(66556008)(76116006)(2906002)(478600001)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wpOWMCHZjNkPuDjh+bG7W4MrmNwuAC7h2kYtH7NWX6mE1D9YcyORVFPfmhw0?= =?us-ascii?Q?NNqmKUaExtt1sQ5TzNdi9jXn0K/ythmUzsI0avrzVCC6nzoa8r/z3vGewVU+?= =?us-ascii?Q?tqsmDH9AeuIMJFje1GsWrVTAIM4ef8/H5y38N4jMLc9V9z3FOb307H6rtEmA?= =?us-ascii?Q?I+Y4v2CO/MpEwA9IkPhtqiNUVz40/CSzVuDBAqcJiyiNt8Mnji7/XMEDfTB7?= =?us-ascii?Q?uFmmYmJHZIbg64/RijVwvtTFVDcG2RC/rnXe2Ritk6VjFljakHD5DxD8bjCy?= =?us-ascii?Q?F52uAWZOY7gZCLKW72bAq/ui655F+bGY/Ac2B4PNl6T+gVDzN/jIHFowKxCL?= =?us-ascii?Q?vpj6/ycox3ab1R/kTfm8Hvl9+Ob/ojNeAPYhK6jxoHiv1rbIjEyurPMXzPDb?= =?us-ascii?Q?dVW9xi3iPUfqMyLaOu7i5eNTlG9Fp2srukwwrnXsHqNfXJNHNyeQksqcYfaE?= =?us-ascii?Q?mDclPaD3Lfyui3v2uVkhpfi5uCSHoc/vFCRdq3KsIP/sOdZLbtAntGCwM1zp?= =?us-ascii?Q?Zn0QnHIt31qVcfnVgILxBih1JoXHKJuMtcKx+CKuN1pWkqWU+efkkZEzHGbZ?= =?us-ascii?Q?HEUAZ1R+z+tADHQ8alfUR25bRO50zeYGHVWOP277IUpKkKxvHQa1YIpr7zEh?= =?us-ascii?Q?IqI0608olPnyRlr+H/T8OOO1NrLd9uuBHKYv1vdGJQ/Lcs/KyJ7pdQl1Dvfn?= =?us-ascii?Q?0v2YNHIMKYh86PioMYbEc1T2Z6a+keVLAC7v6eIUBH2xCH4TPJevCO6XfnS4?= =?us-ascii?Q?SgH7A3AlB0V7kq0Cm4+Ywm+1PlsnGHUC/v8EUIzIZUB7Xr8WEWG+FoodJG8u?= =?us-ascii?Q?NMtalxuRRq+BPgddH7ZV/JeiMKSHbMXANgy96cFjT16hAx6UbFajmmzUA6bA?= =?us-ascii?Q?82z3PRlPVvQGcioCBP6cFoS/aLzBygAG1VAWp43MIZ1fDkAb6NAO2E8bbrr/?= =?us-ascii?Q?DOCYcSoNWC77w6tvmFnSTAZIERMiqwdhSVULElM6OY1hQas2rVyGqD2KX+g4?= =?us-ascii?Q?r8x88BJBNSasmmswCTz3otrfa857vfaCBgRnjL9uGAUjxUCOuVOjK7gQOfnf?= =?us-ascii?Q?6AUOvjgwlLX0V95wrS6wCws66ljtF1nV9RLFIZR8x6DfkyDO+iVzD59L2l77?= =?us-ascii?Q?kLBHy7dnjAcR5V6S/37rxnYjY05NF0gzDTaDNyFLrXLJwq0XdRMYHoRgieGH?= =?us-ascii?Q?sHs+cpF/LvfVLa2pwidEA228btpCxtX83b7YPdDzMb4Y6pmv6hy2rSImzOSg?= =?us-ascii?Q?uyHrXti6nI6N7A37eaLe79iAigqE8QEzDnwwPrEkKJ/5pSoVSqJ5NeTHEd1G?= =?us-ascii?Q?wa0tgyij5ywwRiVOPidUPQ4l?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9fac5518-6f8a-4c78-87d6-08d95d5872cd X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2021 06:14:31.3526 (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: PwM5S6XsXanBCVOiED0nJlJpCBQw5ErBIETLVWp0rXVKTeltPJOmPVWfD7p/tTNWnAImyg1hBBUKMg0G41dWdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5451 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: Desimone, Nathaniel L > Sent: Thursday, August 12, 2021 9:22 AM > To: devel@edk2.groups.io > Cc: Desimone, Nathaniel L ; Michael > Kubacki ; Chiu, Chasel > ; Chaganty, Rangasai V > ; Benjamin Doron > > Subject: [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