From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.81469.1673598418180419040 for ; Fri, 13 Jan 2023 00:26:58 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=RISGJy7T; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673598418; x=1705134418; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=408oU90HVUkPel7x4vyiHs8yQ0z+R6/D6qP9YpKyJRc=; b=RISGJy7T/xVL3CAk0f6qvZciR7ocKlydhYxnO5b3IIknSaDwE0bg2eUv C2E17CinO3JHZcFQR+74P8uImdCOBFUJR2KI+4buMkAexEnR9yCUzvril cTruQQNeAL56ymp/cVtfFlSrKyJ7fSdUdIsBfqoNnSOUVl+sWmcN5/kNM v5RKncSFTOTznsxdF3Vv4P6jxXUtNjDEsWvOFgjlKR/pAxZCjG3LHemf9 8UWVVwgNIzkhfE1Ubd8CiVMQJnHepT0XcQ5gsF53muWmZTC5YjjnSxjNY /H2aE+n24uiiBOror5RZIgs6pGAFAZfynbDEiHOpVFVGwseqbFRONN9rY Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="324006258" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="324006258" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 00:26:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="782078184" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="782078184" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP; 13 Jan 2023 00:26:32 -0800 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.2507.16; Fri, 13 Jan 2023 00:26:32 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) 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.2507.16; Fri, 13 Jan 2023 00:26:31 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.2507.16 via Frontend Transport; Fri, 13 Jan 2023 00:26:31 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.177) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Fri, 13 Jan 2023 00:26:31 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bJNOZJRI+obvYXVxvmBdwQEBrGZgtMBrHECYO5jO/WrbL723KvMgq0sl7MxUfu9+absoxx91yx8nxlj9coZKY/O4ziMpnbXrpPXGu0zkRh7oT4iC6E6chuVHugVpe3zhPkaebBb8hu1xmI3Rr3WVlwvDzjp6JUfELW8gZxzWNAui7hhEuakP8tvWE+WM3V+njtZR46MaHh+JPNd08RgStWmzHgvflVdRUG8h5E1tztqNr9eAQ8ltO0HFqj69nUuFcZpG/VTBNfVRru4bfMk6F+E7YqciDPpsgkXBbzV9sbOAmvn9YRVAp8akFFEAA5G7/VLn1TkIKFfhI+5le1PlIA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E1BIB3gwqjtkJU94FXtYjkZpy+gUg1FgEsTCkiRvCr4=; b=BBivFW8xi8hQCz5n3T8nDV8juVNuT4GIymXhsz7pzSGIpRJDe2dycMaYIbmokUbYD9DXMoPbr0LEFjRzak+aBXyebNZmcDU1PTqccbIl5Nu16JE0terQuoLmbYGCH0cCjUczZhRLv+7NJEWHlKUg8NXQFCAsenkVzO+6aNki+zJa2jmvy3QHQE33f4mJLK53dX1DiXkjAVL6njpRt0nymQms49T2PA9+GK9O+riD6VE6dUxUrFJtJWKdb/zHRmTcAJFqwWa9OLiuhU8PVtwOyoBFnFikf4gsdv+XGG13y+GdUm7MMiJOWT61jmodeiXlsXMdRZJgfuEEC+KQ+Bq2xg== 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 Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by PH7PR11MB7513.namprd11.prod.outlook.com (2603:10b6:510:270::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.19; Fri, 13 Jan 2023 08:26:29 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::40d5:cf74:7d27:e4e6]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::40d5:cf74:7d27:e4e6%7]) with mapi id 15.20.5986.019; Fri, 13 Jan 2023 08:26:29 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "abner.chang@amd.com" CC: "Ni, Ray" , Garrett Kirkendall , Kuei-Hung Lin Subject: Re: [edk2-devel] [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Topic: [edk2-devel] [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Index: AQHZJWpPpWSUHuaBr0iGtLV7Tdjsra6acgrA Date: Fri, 13 Jan 2023 08:26:29 +0000 Message-ID: References: <20230111031008.1476-1-abner.chang@amd.com> <20230111031008.1476-3-abner.chang@amd.com> In-Reply-To: <20230111031008.1476-3-abner.chang@amd.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB4025:EE_|PH7PR11MB7513:EE_ x-ms-office365-filtering-correlation-id: 563d13df-d12f-4981-4e2b-08daf53fdeae x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PtkUtr65GDs0fib6o358juDuHpPwgBaczCFBVPpKzJ3pcC38Lx2hpEtpdvI9GrjIa+AywUrr+Dqu790v5WqgzSIadjjPrV5IRxcK0gzTXV/IzK3WbompfenSMT3rIl8klHNQ9zgTkroYB/EwR20Fejwl7BKGmjkCB/G1kRln+5FQjmcCdHRQnHL5dEJ9rr76fEo5jz3j92Y1GvXlij/2vHf0XpiNszMNcvbevsRsqUGpqrnPBa7zpDKvbu2ayAX+KcilDqbWjX4VV9zcJvqauCxEbA54OXl3eqUdk6VnRoiBwcu8AXgP5/E1i9EijBQlOm5VPQcejME9yAbIqTVY8E5nNw/pzZ0SN2KrGe8/okMqvJ57785073vB+cZ1wNtOCx4IbsGPdf9msBCbe8uKPB3fVIhEUiHGE4BC9Yyw7laoPVENKePPf7D+AFV1rgBtiQhjlRW1n0UJSjRWyXc44Qo+0uFZg6Wc+3NGu6JiXTgPjYujOrcGWJwlZTUxmc/WD2Y+mrpEaItfHR3IUyVFV0wGpQVk5+M6htXzHdUUjq93jHlcC+CC3DYrRKDY/hgg9zZMmKwWTzXzM9hiSNhFzG9iX2mRD9MKtoWwgroooOGHZr5jV+HOxzbiBfRaiKSaogHdKB96lJwpoxmIJFgVSMlvbi22A7hyuBqSKyoV4Ic2+XBSNXieG8jt8ikraMWkugP4gjQPZ/Xvwcxe3OIKMhuUjH5hYVpZK8YrmkfYhDfCJEKABnTDqu4a+8Y1wDKtnOe5PkyicQz5ygUwExHW3Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(376002)(396003)(346002)(366004)(39860400002)(451199015)(9686003)(7696005)(71200400001)(66899015)(19627235002)(966005)(186003)(26005)(478600001)(110136005)(66446008)(53546011)(66946007)(76116006)(66556008)(316002)(54906003)(6506007)(8676002)(64756008)(66476007)(4326008)(33656002)(55016003)(38100700002)(8936002)(52536014)(5660300002)(41300700001)(86362001)(83380400001)(122000001)(82960400001)(2906002)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?XXZhEEwd/S6nUQOJsNwxNNY746RPgRmYDyJFYzFVeaAhsMRdqBmavsk//l7E?= =?us-ascii?Q?4xC4J5uhUMvK9RzINvSkzhghYosiv3M7cqUBxuxj62Ikxa7hls/WSCadUSv3?= =?us-ascii?Q?1MYphK3HXoZD+ByAcnXn8M7sGJMAwrA1HkL1/K2Cs17rQNdD7STXkoptIsJo?= =?us-ascii?Q?WW2uF9o3d+Ybbfenna3pNr0aXutdbUufhMLzsxMi/3atAdzy95PLe8lR1/qq?= =?us-ascii?Q?3baSkNqabzwdgUqWq0kYSQTP+KIKam0gXYL/89w2jsXVhR9qqNtb4G7/4fbY?= =?us-ascii?Q?4TQu4uUTa0Nrx11UU6u9Fb6Vd0o2uRMWSp3xX3QSIYOvx6TNkPjBe3qYLfvh?= =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IOxDDb7k43oGq8KK4mmvXo9HTC3rZCEK?= =?us-ascii?Q?ggNGy/Yj95NkRTfIMNBfO6Nr567VhSuy+i1aJoNv9oKnH0oXbPmpSap1xMSp?= =?us-ascii?Q?QW6NnTqkutiVaRlvITLWhQEaQwxQznUEq9GJd4XbFxcmmWckG0DwXOb7pvxM?= =?us-ascii?Q?eAvbsy4UfCbOt1rmxB/cRyFCul8GK0iO10dxPBOW81ilpQRVu2tqJjcmcjTq?= =?us-ascii?Q?+7Mf15Ac0gfluoU3CbmSygmEt5gzA8n6uemDWT1k5llpe54RIuGFuvVxuskS?= =?us-ascii?Q?CTv8Sr67TQc2GXNyR6H90qIiBsBqFctAm6jO0Nk8LtX4l6pieKhUNtIdm5w8?= =?us-ascii?Q?6u8RrkRnBisnbfDy2ujDKnt8gAswJ84AhVUe3d2j?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 563d13df-d12f-4981-4e2b-08daf53fdeae X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jan 2023 08:26:29.3744 (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: XZ5d9CGjuKLm8KlKPDzDg8dhJ2RTkXsFXghTJmRzyCyOHssgTdm6WsmQ3zO0/kowZYr4pePN1IzH5gy3IfqYdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7513 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao A Wu Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chang, > Abner via groups.io > Sent: Wednesday, January 11, 2023 11:10 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Ni, Ray ; Garrett > Kirkendall ; Abner Chang > ; Kuei-Hung Lin > Subject: [edk2-devel] [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciP= ei > memory block >=20 > From: Abner Chang >=20 > Unlink the XhciPei memory block when it has been freed. >=20 > Signed-off-by: Jiangang He > Cc: Hao A Wu > Cc: Ray Ni > Cc: Garrett Kirkendall > Cc: Abner Chang > Cc: Kuei-Hung Lin > --- > MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 31 > +++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > index c64b38fcfc8..e779a311388 100644 > --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on > gPeiUsbControllerPpiGuid > which is used to enable recovery function from USB Drivers. >=20 > Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
> +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -365,6 +366,32 @@ UsbHcInitMemPool ( > return Pool; > } >=20 > +/** > + Unlink the memory block from the pool's list. > + > + @param Head The block list head of the memory's pool. > + @param BlockToUnlink The memory block to unlink. > + > +**/ > +VOID > +UsbHcUnlinkMemBlock ( > + IN USBHC_MEM_BLOCK *Head, > + IN USBHC_MEM_BLOCK *BlockToUnlink > + ) > +{ > + USBHC_MEM_BLOCK *Block; > + > + ASSERT ((Head !=3D NULL) && (BlockToUnlink !=3D NULL)); > + > + for (Block =3D Head; Block !=3D NULL; Block =3D Block->Next) { > + if (Block->Next =3D=3D BlockToUnlink) { > + Block->Next =3D BlockToUnlink->Next; > + BlockToUnlink->Next =3D NULL; > + break; > + } > + } > +} > + > /** > Release the memory management pool. >=20 > @@ -386,7 +413,7 @@ UsbHcFreeMemPool ( > // first block. > // > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Head= ->Next) { > - // UsbHcUnlinkMemBlock (Pool->Head, Block); > + UsbHcUnlinkMemBlock (Pool->Head, Block); > UsbHcFreeMemBlock (Pool, Block); > } >=20 > @@ -532,7 +559,7 @@ UsbHcFreeMem ( > // Release the current memory block if it is empty and not the head > // > if ((Block !=3D Head) && UsbHcIsMemBlockEmpty (Block)) { > - // UsbHcUnlinkMemBlock (Head, Block); > + UsbHcUnlinkMemBlock (Head, Block); > UsbHcFreeMemBlock (Pool, Block); > } > } > -- > 2.37.1.windows.1 >=20 >=20 >=20 >=20 >=20