From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.1183.1589352555568447502 for ; Tue, 12 May 2020 23:49:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: ray.ni@intel.com) IronPort-SDR: 9HpfADOAia71PynS41zvwWlkLOfkJ+iy32CQpm/OTvEx8IIAIb2wLoOLxwxKHTkp38uqle5Hyk HhWruHdX2UhQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 23:49:14 -0700 IronPort-SDR: zhTg/37KQC0Fxfnx6rwAvlJXPHzcLvYYbrYdVWe7S8VUg7r2TSCY+iYr4e6TU8ULIoM8/7I587 oIMOxT+OQwLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,386,1583222400"; d="scan'208";a="298274197" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga008.jf.intel.com with ESMTP; 12 May 2020 23:49:13 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 23:49:13 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 23:49:13 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.210]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.225]) with mapi id 14.03.0439.000; Wed, 13 May 2020 14:49:10 +0800 From: "Ni, Ray" To: "Javeed, Ashraf" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Wu, Hao A" Subject: Re: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/15] MdeModulePkg/PciBusDxe: Enable NoSnoop feature Thread-Topic: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/15] MdeModulePkg/PciBusDxe: Enable NoSnoop feature Thread-Index: AQHWJuYUJe62JSGvi0ytnelqFKTApKig+CeAgASfGFA= Date: Wed, 13 May 2020 06:49:09 +0000 Deferred-Delivery: Wed, 13 May 2020 06:49:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C53AE49@SHSMSX104.ccr.corp.intel.com> References: <20200510161412.13832-1-ashraf.javeed@intel.com> <20200510161412.13832-11-ashraf.javeed@intel.com> In-Reply-To: <20200510161412.13832-11-ashraf.javeed@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Javeed, Ashraf > Sent: Monday, May 11, 2020 12:14 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Wang, Jian J ; Wu,= Hao A > Subject: [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/15] MdeModulePkg/PciBu= sDxe: Enable NoSnoop feature >=20 > REF: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1954 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2194 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2313 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2499 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2500 >=20 > Add the Program phase feature init routine for NoSnoop > PCIe feature. >=20 > Signed-off-by: Ashraf Javeed > Signed-off-by: Ray Ni > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Ray Ni > Cc: Ashraf Javeed > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c | 4 ++++ > MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.c | 51 +++++++++++++++= ++++++++++++++++++++++++++++++++++++ > MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.h | 7 +++++++ > 3 files changed, 62 insertions(+) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c > index 9948e17..6bf06b0 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatureSupport.c > @@ -58,6 +58,8 @@ PCIE_FEATURE_ENTRY mPcieFeatures[] =3D { > TRUE, { TRUE, TRUE }, { NULL, MaxReadR= equestSizeProgram } }, > { OFFSET_OF (EFI_PCI_EXPRESS_PLATFORM_POLICY, RelaxedOrdering), > TRUE, { TRUE, TRUE }, { NULL, RelaxedO= rderingProgram } }, > + { OFFSET_OF (EFI_PCI_EXPRESS_PLATFORM_POLICY, NoSnoop), > + TRUE, { TRUE, TRUE }, { NULL, NoSnoopP= rogram } }, > }; >=20 > /** > @@ -233,6 +235,8 @@ PcieNotifyDeviceState ( > PcieDeviceState.MaxPayloadSize =3D (UINT8)PciIoDevice->PciExpress= Capability.DeviceControl.Bits.MaxPayloadSize; > PcieDeviceState.MaxReadRequestSize =3D (UINT8)PciIoDevice- > >PciExpressCapability.DeviceControl.Bits.MaxReadRequestSize; > PcieDeviceState.RelaxedOrdering =3D (UINT8)PciIoDevice->PciExpress= Capability.DeviceControl.Bits.RelaxedOrdering; > + PcieDeviceState.NoSnoop =3D (UINT8)PciIoDevice->PciExpress= Capability.DeviceControl.Bits.NoSnoop; > + > return mPciePlatformProtocol->NotifyDeviceState ( > mPciePlatformProtocol, > PciIoDevice->Handle, > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.c b/MdeModulePkg= /Bus/Pci/PciBusDxe/PcieFeatures.c > index 5216dac..6c22feb 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.c > @@ -216,3 +216,54 @@ RelaxedOrderingProgram ( > return EFI_SUCCESS; > } >=20 > +/** > + Overrides the PCI Device Control register No-Snoop register field; if > + the hardware value is different than the intended value. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE instance. > + @param Level The level of the PCI device in the heira= rchy. > + Level of root ports is 0. > + @param Context Pointer to feature specific context. > + > + @retval EFI_SUCCESS The data was read from or written to the= PCI device. > + @retval EFI_UNSUPPORTED The address range specified by Offset, W= idth, and Count is not > + valid for the PCI configuration header o= f the PCI controller. > + @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid. > + > +**/ > +EFI_STATUS > +NoSnoopProgram ( > + IN PCI_IO_DEVICE *PciDevice, > + IN UINTN Level, > + IN VOID **Context > + ) > +{ > + ASSERT (*Context =3D=3D NULL); > + > + if (PciDevice->DeviceState.NoSnoop =3D=3D EFI_PCI_EXPRESS_DEVICE_POLIC= Y_NOT_APPLICABLE || > + PciDevice->DeviceState.NoSnoop =3D=3D EFI_PCI_EXPRESS_DEVICE_POLIC= Y_AUTO) { > + return EFI_SUCCESS; > + } > + > + > + if (PciDevice->PciExpressCapability.DeviceControl.Bits.NoSnoop !=3D Pc= iDevice->DeviceState.NoSnoop) { > + DEBUG (( > + DEBUG_INFO, " %a [%02d|%02d|%02d]: %x -> %x\n", > + __FUNCTION__, PciDevice->BusNumber, PciDevice->DeviceNumber, PciDe= vice->FunctionNumber, > + PciDevice->PciExpressCapability.DeviceControl.Bits.NoSnoop, > + PciDevice->DeviceState.NoSnoop > + )); > + PciDevice->PciExpressCapability.DeviceControl.Bits.NoSnoop =3D PciDe= vice->DeviceState.NoSnoop; > + > + return PciDevice->PciIo.Pci.Write ( > + &PciDevice->PciIo, > + EfiPciIoWidthUint16, > + PciDevice->PciExpressCapabilityOffset > + + OFFSET_OF (PCI_CAPABILITY_PCIEXP, De= viceControl), > + 1, > + &PciDevice->PciExpressCapability.Devic= eControl.Uint16 > + ); > + } > + return EFI_SUCCESS; > +} > + > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.h b/MdeModulePkg= /Bus/Pci/PciBusDxe/PcieFeatures.h > index 7d70f06..60b8742 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.h > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PcieFeatures.h > @@ -38,4 +38,11 @@ RelaxedOrderingProgram ( > IN VOID **Context > ); >=20 > +EFI_STATUS > +NoSnoopProgram ( > + IN PCI_IO_DEVICE *PciDevice, > + IN UINTN Level, > + IN VOID **Context > + ); > + > #endif > -- > 2.21.0.windows.1