From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.10846.1581107387454915169 for ; Fri, 07 Feb 2020 12:29:47 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: ashraf.javeed@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2020 12:29:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,414,1574150400"; d="scan'208";a="430949032" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 07 Feb 2020 12:29:47 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 7 Feb 2020 12:29:47 -0800 Received: from bgsmsx110.gar.corp.intel.com (10.223.4.212) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 7 Feb 2020 12:29:46 -0800 Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.155]) by BGSMSX110.gar.corp.intel.com ([169.254.11.43]) with mapi id 14.03.0439.000; Sat, 8 Feb 2020 01:59:43 +0530 From: "Javeed, Ashraf" To: "devel@edk2.groups.io" , "Javeed, Ashraf" CC: "Wang, Jian J" , "Wu, Hao A" , "Ni, Ray" Subject: Re: [edk2-devel] [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/12] PciBusDxe: New PCI Express feature Extended Tag Thread-Topic: [edk2-devel] [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/12] PciBusDxe: New PCI Express feature Extended Tag Thread-Index: AQHV3fIgNoRoc5oop0OIyqJmdDsceKgQLqOQ Date: Fri, 7 Feb 2020 20:29:42 +0000 Message-ID: <95C5C2B113DE604FB208120C742E9824579AB058@BGSMSX101.gar.corp.intel.com> References: <20200207200447.10536-1-ashraf.javeed@intel.com> <15F137861A640F9F.15938@groups.io> In-Reply-To: <15F137861A640F9F.15938@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDRjZDY1YWMtODE1Ny00MGIzLTg4MTktMWJjOGZhZjUzMzhhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUGFtbzdDVnFiS0tlM25cL1RXVUpmOGpUMFpGZmI1Nm81YzllaW02RTQxelZIWXk5azZWZXFZU1FQbFAwc0RveFQifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.223.10.10] MIME-Version: 1.0 Return-Path: ashraf.javeed@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch can also be viewed in the following repo:- https://github.com/ashrafj/edk2-staging/commit/f0d81499e79e4521630a76ae241= de6def9aa03b5 Thanks Ashraf > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Javeed, > Ashraf > Sent: Saturday, February 8, 2020 1:35 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A = ; > Ni, Ray > Subject: [edk2-devel] [edk2-staging/UEFI_PCI_ENHANCE-2 PATCH 10/12] > PciBusDxe: New PCI Express feature Extended Tag >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2499 >=20 > This code change enables the PCI Express feature Extended Tag, in compli= ance > with the PCI Express Base Specification 5, and uses the device policy un= der the > following conditions: > (1) As per the PCI Express Base Specification, all the devices under the > root bridge has to be set to a common applicable value > (2) The 5b or 8b Extended Tag capability is defined in the Device Capabi= - > lity register, and the 10b requester as well as completer is defined > in the Device Capability 2 register > (3) The Extended Tag device policy would be overruled for any device if > it does not match with its device capabilities register > (4) In case of multiple device policies, due to multiple devices under > the root bridge, the lowest applicable value will be programmed for > all the devices > (5) There is no Extended Tag disable state; hence the default would be > 5b or 8b depending upon device HW-state. The 10b requester is disabl= ed > by default; hence any device policy request of 10b shall lead to 10b > Requester enable state from root bridge to all end devices; if all t= he > devices support 10b Requester as well as the completer capability. I= n > this scenario, the default state of 5b/8b Extended Tag state in Devi= ce > Control register is ignored as 10b capable devices should be able to > handle lower size Extended Tag packet IDs autonomously. >=20 > This programming of Extended Tag, gets the device-specific platform poli= cy > using the new PCI Express Platform Protocol interface (ECR version 0.8),= defined > in the below feature request:- > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1954 >=20 > Signed-off-by: Ashraf Javeed > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Ray Ni > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h | 1 + > MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.c | 278 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++ > MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.h | 50 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c | 15 > ++++++++++++++- > MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h | 4 ++++ > MdeModulePkg/Bus/Pci/PciBusDxe/PciPlatformSupport.c | 36 > ++++++++++++++++++++++++++++++++++++ > 6 files changed, 383 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h > index 7e43a26..6a6f648 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h > @@ -297,6 +297,7 @@ struct _PCI_IO_DEVICE { > PCI_FEATURE_POLICY SetupCTO; > EFI_PCI_EXPRESS_ATOMIC_OP SetupAtomicOp; > BOOLEAN SetupLtr; > + UINT8 SetupExtTag; > }; >=20 > #define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \ diff --git > a/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.c > index 63a243b..eaef3d3 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.c > @@ -1240,3 +1240,281 @@ ProgramLtr ( > return Status; > } >=20 > +/** > + The main routine to setup the PCI Express feature Extended Tag as per > +the > + device-specific platform policy, as well as in complaince with the > +PCI Express > + Base specification Revision 5. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE. > + @param PciExpressConfigurationTable pointer to > + PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > + > + @retval EFI_SUCCESS setup of PCI feature LTR is suc= cessful. > +**/ > +EFI_STATUS > +SetupExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > +*PciExpressConfigurationTable > + ) > +{ > + PCI_REG_PCIE_DEVICE_CAPABILITY2 DeviceCap2; > + PCI_REG_PCIE_DEVICE_CAPABILITY DeviceCap; > + EFI_PCI_EXPRESS_EXTENDED_TAG PciExpressExtendedTag; > + > + DeviceCap.Uint32 =3D > + PciDevice->PciExpressCapabilityStructure.DeviceCapability.Uint32; > + DeviceCap2.Uint32 =3D > + PciDevice->PciExpressCapabilityStructure.DeviceCapability2.Uint32; > + // > + // The PCI Express feature Extended Tag has to be maintained common > + from a // root bridge device to all its child devices. > + // The Device Capability 2 register is used to determine the 10b > + Extended Tag // capability of a device. The device capability > + register is used to determine // 5b/8b Extended Tag capability of a > + device // if (DeviceCap2.Bits.TenBitTagCompleterSupported & > + DeviceCap2.Bits.TenBitTagRequesterSupported) { > + // > + // device supports the 10b Extended Tag capability > + // > + PciExpressExtendedTag =3D EFI_PCI_EXPRESS_EXTENDED_TAG_10BIT; > + } else { > + if (DeviceCap.Bits.ExtendedTagField) { > + PciExpressExtendedTag =3D EFI_PCI_EXPRESS_EXTENDED_TAG_8BIT; > + } else { > + PciExpressExtendedTag =3D EFI_PCI_EXPRESS_EXTENDED_TAG_5BIT; > + } > + } > + if (PciDevice->SetupExtTag =3D=3D EFI_PCI_EXPRESS_EXTENDED_TAG_AUTO) = { > + PciDevice->SetupExtTag =3D PciExpressExtendedTag; } // // in cas= e > + of PCI Bridge and its child devices // if > + (PciExpressConfigurationTable) { > + // > + // align the Extended Tag value as per the device supported value > + // > + PciExpressConfigurationTable->ExtendedTag =3D MIN ( > + PciExpressExtendedTag= , > + PciExpressConfigurati= onTable->ExtendedTag > + ); > + // > + // check for any invalid platform policy request for the device; if= true than > + // align with the device capability value. Else align as per platfo= rm request > + // > + if (PciDevice->SetupExtTag > PciExpressConfigurationTable->Extended= Tag) { > + // > + // setup the device Extended Tag to common value supported by all= the > devices > + // > + PciDevice->SetupExtTag =3D PciExpressConfigurationTable->Extended= Tag; > + } > + // > + // if the platform policy is to downgrade the device's Extended Tag= value > than > + // all the other devices in the PCI tree including the root bridge = will be align > + // with this device override value > + // > + if (PciDevice->SetupExtTag < PciExpressConfigurationTable->Extended= Tag) { > + PciExpressConfigurationTable->ExtendedTag =3D PciDevice->SetupExt= Tag; > + } > + } else { > + // > + // in case of RCiEP devices or the bridge device without any child,= overrule > + // the Extended Tag device policy if it does not match with its cap= ability > + // > + PciDevice->SetupExtTag =3D MIN ( > + PciDevice->SetupExtTag, > + PciExpressExtendedTag > + ); > + } > + > + DEBUG (( > + DEBUG_INFO, > + "ExtTag: %d [cap:%d],", > + PciDevice->SetupExtTag, > + PciExpressExtendedTag > + )); > + return EFI_SUCCESS; > +} > + > +/** > + Additional routine to setup the PCI Express feature Extended Tag in > +complaince > + with the PCI Express Base specification Revision, a common value for > +all the > + devices in the PCI hierarchy. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE. > + @param PciExpressConfigurationTable pointer to > + PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > + > + @retval EFI_SUCCESS setup of PCI feature LTR is suc= cessful. > +**/ > +EFI_STATUS > +AlignExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > +*PciExpressConfigurationTable > + ) > +{ > + if (PciExpressConfigurationTable) { > + // > + // align the Extended Tag value to a common value among all the dev= ices > + // > + PciDevice->SetupExtTag =3D MIN ( > + PciDevice->SetupExtTag, > + PciExpressConfigurationTable->ExtendedTag > + ); > + } > + > + DEBUG (( > + DEBUG_INFO, > + "ExtTag: %d,", > + PciDevice->SetupExtTag > + )); > + return EFI_SUCCESS; > +} > + > +/** > + Program the PCI Device Control 2 register for 10b Extended Tag value, > +or the > + Device Control register for 5b/8b Extended Tag value. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE instance= . > + > + @retval EFI_SUCCESS The data was read from or written to th= e PCI > device. > + @retval EFI_UNSUPPORTED The address range specified by Offset, = Width, > and Count is not > + valid for the PCI configuration header = of the PCI controller. > + @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid. > + > +**/ > +EFI_STATUS > +ProgramExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN VOID *PciExFeatureConfiguration > + ) > +{ > + PCI_REG_PCIE_DEVICE_CONTROL DevCtl; > + PCI_REG_PCIE_DEVICE_CONTROL2 DevCtl2; > + UINT32 Offset; > + UINT32 Offset2; > + BOOLEAN OverrideDevCtl; > + BOOLEAN OverrideDevCtl2; > + EFI_STATUS Status; > + EFI_TPL OldTpl; > + > + // > + // read the Device Control register for the Extended Tag Field Enable > + // > + DevCtl.Uint16 =3D 0; > + Offset =3D PciDevice->PciExpressCapabilityOffset + > + OFFSET_OF (PCI_CAPABILITY_PCIEXP, DeviceControl); Status > + =3D PciDevice->PciIo.Pci.Read ( > + &PciDevice->PciIo, > + EfiPciIoWidthUint16, > + Offset, > + 1, > + &DevCtl.Uint16 > + ); > + ASSERT (Status =3D=3D EFI_SUCCESS); > + > + OverrideDevCtl =3D FALSE; > + // > + // read the Device COntrol 2 register for the 10-Bit Tag Requester > + Enable // > + DevCtl2.Uint16 =3D 0; > + Offset2 =3D PciDevice->PciExpressCapabilityOffset + > + OFFSET_OF (PCI_CAPABILITY_PCIEXP, DeviceControl2); > + Status =3D PciDevice->PciIo.Pci.Read ( > + &PciDevice->PciIo, > + EfiPciIoWidthUint16, > + Offset2, > + 1, > + &DevCtl2.Uint16 > + ); > + ASSERT (Status =3D=3D EFI_SUCCESS); > + > + OverrideDevCtl2 =3D FALSE; > + > + if (PciDevice->SetupExtTag =3D=3D EFI_PCI_EXPRESS_EXTENDED_TAG_5BIT) = { > + if (DevCtl.Bits.ExtendedTagField) { > + DevCtl.Bits.ExtendedTagField =3D 0; > + OverrideDevCtl =3D TRUE; > + } > + > + if (DevCtl2.Bits.TenBitTagRequesterEnable) { > + DevCtl2.Bits.TenBitTagRequesterEnable =3D 0; > + OverrideDevCtl2 =3D TRUE; > + } > + } > + if (PciDevice->SetupExtTag =3D=3D EFI_PCI_EXPRESS_EXTENDED_TAG_8BIT) = { > + if (!DevCtl.Bits.ExtendedTagField) { > + DevCtl.Bits.ExtendedTagField =3D 1; > + OverrideDevCtl =3D TRUE; > + } > + if (DevCtl2.Bits.TenBitTagRequesterEnable) { > + DevCtl2.Bits.TenBitTagRequesterEnable =3D 0; > + OverrideDevCtl2 =3D TRUE; > + } > + } > + if (PciDevice->SetupExtTag =3D=3D EFI_PCI_EXPRESS_EXTENDED_TAG_10BIT)= { > + if (!DevCtl2.Bits.TenBitTagRequesterEnable) { > + DevCtl2.Bits.TenBitTagRequesterEnable =3D 1; > + OverrideDevCtl2 =3D TRUE; > + } > + } > + > + if (OverrideDevCtl) { > + > + DEBUG (( DEBUG_INFO, "ExtTag=3D%d,", DevCtl.Bits.ExtendedTagField))= ; > + > + // > + // Raise TPL to high level to disable timer interrupt while the wri= te operation > completes > + // > + OldTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); > + > + Status =3D PciDevice->PciIo.Pci.Write ( > + &PciDevice->PciIo, > + EfiPciIoWidthUint16, > + Offset, > + 1, > + &DevCtl.Uint16 > + ); > + // > + // Restore TPL to its original level > + // > + gBS->RestoreTPL (OldTpl); > + > + if (!EFI_ERROR(Status)) { > + PciDevice->PciExpressCapabilityStructure.DeviceControl.Uint16 =3D > DevCtl.Uint16; > + } else { > + ReportPciWriteError (PciDevice->BusNumber, PciDevice->DeviceNumbe= r, > PciDevice->FunctionNumber, Offset); > + } > + } else { > + DEBUG (( DEBUG_INFO, "no ExtTag (%d),", > + DevCtl.Bits.ExtendedTagField)); } > + > + if (OverrideDevCtl2) { > + > + DEBUG (( DEBUG_INFO, "10bExtTag=3D%d,", > + DevCtl2.Bits.TenBitTagRequesterEnable)); > + > + // > + // Raise TPL to high level to disable timer interrupt while the wri= te operation > completes > + // > + OldTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); > + > + Status =3D PciDevice->PciIo.Pci.Write ( > + &PciDevice->PciIo, > + EfiPciIoWidthUint16, > + Offset2, > + 1, > + &DevCtl2.Uint16 > + ); > + // > + // Restore TPL to its original level > + // > + gBS->RestoreTPL (OldTpl); > + > + if (!EFI_ERROR(Status)) { > + PciDevice->PciExpressCapabilityStructure.DeviceControl2.Uint16 = =3D > DevCtl2.Uint16; > + } else { > + ReportPciWriteError (PciDevice->BusNumber, PciDevice->DeviceNumbe= r, > PciDevice->FunctionNumber, Offset2); > + } > + } else { > + DEBUG (( DEBUG_INFO, "no 10bExtTag (%d),", > + DevCtl2.Bits.TenBitTagRequesterEnable)); > + } > + > + return Status; > +} > + > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.h > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.h > index 374fe49..1cfca54 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.h > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciExpressFeatures.h > @@ -243,4 +243,54 @@ ProgramLtr ( > IN VOID *PciExFeatureConfiguration > ); >=20 > +/** > + The main routine to setup the PCI Express feature Extended Tag as per > +the > + device-specific platform policy, as well as in complaince with the > +PCI Express > + Base specification Revision 5. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE. > + @param PciFeaturesConfigurationTable pointer to > + PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > + > + @retval EFI_SUCCESS setup of PCI feature LTR is suc= cessful. > +**/ > +EFI_STATUS > +SetupExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > +*PciFeaturesConfigurationTable > + ); > + > +/** > + Additional routine to setup the PCI Express feature Extended Tag in > +complaince > + with the PCI Express Base specification Revision, a common value for > +all the > + devices in the PCI hierarchy. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE. > + @param PciFeaturesConfigurationTable pointer to > + PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > + > + @retval EFI_SUCCESS setup of PCI feature LTR is suc= cessful. > +**/ > +EFI_STATUS > +AlignExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE > +*PciFeaturesConfigurationTable > + ); > + > +/** > + Program the PCI Device Control 2 register for 10b Extended Tag value, > +or the > + Device Control register for 5b/8b Extended Tag value. > + > + @param PciDevice A pointer to the PCI_IO_DEVICE instance= . > + > + @retval EFI_SUCCESS The data was read from or written to th= e PCI > device. > + @retval EFI_UNSUPPORTED The address range specified by Offset, = Width, > and Count is not > + valid for the PCI configuration header = of the PCI controller. > + @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid. > + > +**/ > +EFI_STATUS > +ProgramExtTag ( > + IN PCI_IO_DEVICE *PciDevice, > + IN VOID *PciExFeatureConfiguration > + ); > + > #endif > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c > index bdeb0d2..58d3780 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c > @@ -38,7 +38,7 @@ EFI_PCI_EXPRESS_PLATFORM_POLICY > mPciExpressPlatformPolicy =3D { > // > // support for PCI Express feature - Extended Tag > // > - FALSE, > + TRUE, > // > // support for PCI Express feature - Relax Order > // > @@ -140,6 +140,15 @@ PCI_EXPRESS_FEATURE_INITIALIZATION_POINT > mPciExpressFeatureInitializationList[] > }, > { > PciExpressFeatureProgramPhase, PciExpressLtr, Program= Ltr > + }, > + { > + PciExpressFeatureSetupPhase, PciExpressExtTag, SetupEx= tTag > + }, > + { > + PciExpressFeatureEntendedSetupPhase, PciExpressExtTag, AlignEx= tTag > + }, > + { > + PciExpressFeatureProgramPhase, PciExpressExtTag, Program= ExtTag > } > }; >=20 > @@ -675,6 +684,10 @@ CreatePciRootBridgeDeviceNode ( > // tree > // > PciConfigTable->AtomicOpRoutingSupported =3D TRUE; > + // > + // start by assuming the Extended Tag is 10b Requester capable > + // > + PciConfigTable->ExtendedTag =3D > EFI_PCI_EXPRESS_EXTENDED_TAG_10BIT; > } >=20 > RootBridgeNode->PciExFeaturesConfigurationTable =3D PciConfigTable; = diff -- > git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h > index 5dded7c..c7cc7e5 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h > @@ -94,6 +94,10 @@ struct > _PCI_EXPRESS_FEATURES_CONFIGURATION_TABLE { > // the AtomicOp of the EP device > // > BOOLEAN AtomicOpRoutingSupported; > + // > + // to configure a common extended tag size for all the childs of a > + root port // > + UINT8 ExtendedTag; > }; >=20 > // > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciPlatformSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciPlatformSupport.c > index 83b3aa7..98d9875 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciPlatformSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciPlatformSupport.c > @@ -368,6 +368,12 @@ SetupDefaultPciExpressDevicePolicy ( >=20 > PciDevice->SetupLtr =3D FALSE; >=20 > + if (mPciExpressPlatformPolicy.ExtTag) { > + PciDevice->SetupExtTag =3D EFI_PCI_EXPRESS_EXTENDED_TAG_AUTO; > + } else { > + PciDevice->SetupExtTag =3D EFI_PCI_EXPRESS_NOT_APPLICABLE; } > + > } >=20 > /** > @@ -502,6 +508,15 @@ GetPciExpressDevicePolicy ( > PciDevice->SetupLtr =3D FALSE; > } >=20 > + // > + // set the device-specifci policy for the PCI Express feature Exten= ded Tag > + // > + if (mPciExpressPlatformPolicy.ExtTag) { > + PciDevice->SetupExtTag =3D PciExpressDevicePolicy.DeviceCtlExtTag= ; > + } else { > + PciDevice->SetupExtTag =3D EFI_PCI_EXPRESS_NOT_APPLICABLE; > + } > + >=20 > DEBUG (( > DEBUG_INFO, > @@ -668,6 +683,19 @@ GetPciExpressCto ( > return EFI_PCI_EXPRESS_NOT_APPLICABLE; } >=20 > +EFI_PCI_EXPRESS_EXTENDED_TAG > +GetPciExpressExtTag ( > + IN PCI_IO_DEVICE *PciDevice > + ) > +{ > + if (PciDevice- > >PciExpressCapabilityStructure.DeviceControl2.Bits.TenBitTagRequesterEna= ble) > { > + return EFI_PCI_EXPRESS_EXTENDED_TAG_10BIT; > + } else if (PciDevice- > >PciExpressCapabilityStructure.DeviceControl.Bits.ExtendedTagField) { > + return EFI_PCI_EXPRESS_EXTENDED_TAG_8BIT; > + } else { > + return EFI_PCI_EXPRESS_EXTENDED_TAG_5BIT; > + } > +} >=20 > /** > Notifies the platform about the current PCI Express state of the devi= ce. > @@ -768,6 +796,14 @@ PciExpressPlatformNotifyDeviceState ( > PciExDeviceConfiguration.DeviceCtl2LTR =3D > EFI_PCI_EXPRESS_NOT_APPLICABLE; > } >=20 > + // > + // get the device-specific state for the PCie Extended Tag in the > + function // if (mPciExpressPlatformPolicy.ExtTag) { > + PciExDeviceConfiguration.DeviceCtlExtTag =3D GetPciExpressExtTag > + (PciDevice); } else { > + PciExDeviceConfiguration.DeviceCtlExtTag =3D > + EFI_PCI_EXPRESS_NOT_APPLICABLE; } >=20 > if (mPciExPlatformProtocol !=3D NULL) { > return mPciExPlatformProtocol->NotifyDeviceState ( > -- > 2.21.0.windows.1 >=20 >=20 >=20