From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 26CD92095AE79 for ; Fri, 25 Aug 2017 06:32:17 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Aug 2017 06:34:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,425,1498546800"; d="scan'208";a="304365460" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 25 Aug 2017 06:34:26 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 25 Aug 2017 06:34:26 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 25 Aug 2017 06:34:26 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.183]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Fri, 25 Aug 2017 21:34:24 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [PATCH 3/3] IntelSiliconPkg/PlatformVTdSample: update ExceptionDevice Thread-Index: AQHTHYYNnx14Y7UOpkqTXUwFvRhnAKKVEm5Q Date: Fri, 25 Aug 2017 13:34:24 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A996C08@shsmsx102.ccr.corp.intel.com> References: <1503646846-1036-1-git-send-email-jiewen.yao@intel.com> <1503646846-1036-4-git-send-email-jiewen.yao@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B91DB90@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B91DB90@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 3/3] IntelSiliconPkg/PlatformVTdSample: update ExceptionDevice X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 13:32:17 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. Typical copy-paste issue. Thanks to correct me. > -----Original Message----- > From: Zeng, Star > Sent: Friday, August 25, 2017 5:39 PM > To: Yao, Jiewen ; edk2-devel@lists.01.org > Cc: Zeng, Star > Subject: RE: [PATCH 3/3] IntelSiliconPkg/PlatformVTdSample: update > ExceptionDevice >=20 > PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT is used in > mExceptionPciDeviceIdList, that is wrong and should be > PLATFORM_EXCEPTION_PCI_DEVICE_ID_STRUCT. > Others are good to me. Reviewed-by: Star Zeng >=20 > +PLATFORM_EXCEPTION_PCI_DEVICE_ID_STRUCT mExceptionPciDeviceIdList[] > =3D > +{ > + { > + { > + > EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_PCI_DEVICE_ID, > + sizeof(PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT) >=20 >=20 > Thanks, > Star > -----Original Message----- > From: Yao, Jiewen > Sent: Friday, August 25, 2017 3:41 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star > Subject: [PATCH 3/3] IntelSiliconPkg/PlatformVTdSample: update > ExceptionDevice >=20 > Add sample for device scope based exception list and PCI vendor id based > exception list. >=20 > Cc: Star Zeng > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > --- > IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c | 80 > +++++++++++++++++--- > 1 file changed, 70 insertions(+), 10 deletions(-) >=20 > diff --git a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c > b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c > index f181b94..95e0f3a 100644 > --- a/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c > +++ b/IntelSiliconPkg/PlatformVTdSampleDxe/PlatformVTdSampleDxe.c > @@ -27,6 +27,8 @@ > #include > #include >=20 > +#include > + > typedef struct { > ACPI_EXTENDED_HID_DEVICE_PATH I2cController; > UINT8 HidStr[8]; > @@ -137,10 +139,57 @@ PLATFORM_PCI_BRIDGE_DEVICE_PATH > mPlatformPciBridgeDevicePath =3D { > PLATFORM_END_ENTIRE > }; >=20 > -EDKII_PLATFORM_VTD_DEVICE_INFO mExceptionDeviceList[] =3D { > +#pragma pack(1) > + > +typedef struct { > + EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO ExceptionDeviceInfo; > + EDKII_PLATFORM_VTD_DEVICE_SCOPE DeviceScope; > + EFI_ACPI_DMAR_PCI_PATH PciBridge; > + EFI_ACPI_DMAR_PCI_PATH PciDevice; > +} PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT; > + > +typedef struct { > + EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO ExceptionDeviceInfo; > + EDKII_PLATFORM_VTD_PCI_DEVICE_ID PciDeviceId; > +} PLATFORM_EXCEPTION_PCI_DEVICE_ID_STRUCT; > + > +#pragma pack() > + > +PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT > mExceptionDeviceScopeList[] =3D { > { > - 0x0, // Segment > - {{0x00, 0x00, 0x02}} // Function, Device, Bus > + { > + > EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_DEVICE_SCOPE, > + sizeof(PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT) > + }, // ExceptionDeviceInfo > + { > + 0, // > SegmentNumber > + { > + EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_ENDPOINT, // Type > + sizeof(EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER) + > + 2 * sizeof(EFI_ACPI_DMAR_PCI_PATH), // Length > + 0, // > Reserved2 > + 0, // > EnumerationId > + 0, // > StartBusNumber > + }, > + }, // > DeviceScope > + { 0x1C, 1 }, // PciBridge > + { 0x0, 0 }, // PciDevice > + }, > +}; > + > +PLATFORM_EXCEPTION_PCI_DEVICE_ID_STRUCT mExceptionPciDeviceIdList[] > =3D > +{ > + { > + { > + > EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_PCI_DEVICE_ID, > + sizeof(PLATFORM_EXCEPTION_DEVICE_SCOPE_STRUCT) > + }, // ExceptionDeviceInfo > + { > + 0x8086, // > VendorId > + 0x9D2F, // DeviceId > + 0x21, // > RevisionId > + 0x8086, // > SubsystemVendorId > + 0x7270, // > SubsystemDeviceId > + }, > }, > }; >=20 > @@ -269,6 +318,7 @@ PlatformVTdGetDeviceId ( > @param[in] This The protocol instance pointer. > @param[out] DeviceInfoCount The count of the list of DeviceInfo. > @param[out] DeviceInfo A callee allocated buffer to hold a = list > of DeviceInfo. > + Each DeviceInfo pointer points to > EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO. >=20 > @retval EFI_SUCCESS The DeviceInfoCount and DeviceInfo are > returned. > @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo i= s > NULL. > @@ -280,7 +330,7 @@ EFIAPI > PlatformVTdGetExceptionDeviceList ( > IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This, > OUT UINTN *DeviceInfoCount, > - OUT EDKII_PLATFORM_VTD_DEVICE_INFO **DeviceInfo > + OUT VOID **DeviceInfo > ) > { > DEBUG ((DEBUG_VERBOSE, "PlatformVTdGetExceptionDeviceList\n")); > @@ -289,13 +339,23 @@ PlatformVTdGetExceptionDeviceList ( > return EFI_INVALID_PARAMETER; > } >=20 > - *DeviceInfo =3D AllocateZeroPool (sizeof(mExceptionDeviceList)); > - if (*DeviceInfo =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - CopyMem (*DeviceInfo, mExceptionDeviceList, > sizeof(mExceptionDeviceList)); > + if (0) { > + *DeviceInfo =3D AllocateZeroPool (sizeof(mExceptionDeviceScopeList))= ; > + if (*DeviceInfo =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + CopyMem (*DeviceInfo, mExceptionDeviceScopeList, > + sizeof(mExceptionDeviceScopeList)); > + > + *DeviceInfoCount =3D ARRAY_SIZE(mExceptionDeviceScopeList); > + } else { > + *DeviceInfo =3D AllocateZeroPool (sizeof(mExceptionPciDeviceIdList))= ; > + if (*DeviceInfo =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + CopyMem (*DeviceInfo, mExceptionPciDeviceIdList, > + sizeof(mExceptionPciDeviceIdList)); >=20 > - *DeviceInfoCount =3D ARRAY_SIZE(mExceptionDeviceList); > + *DeviceInfoCount =3D ARRAY_SIZE(mExceptionPciDeviceIdList); > + } >=20 > return EFI_SUCCESS; > } > -- > 2.7.4.windows.1