From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.81]) by mx.groups.io with SMTP id smtpd.web10.69258.1661770681070236492 for ; Mon, 29 Aug 2022 03:58:02 -0700 Authentication-Results: mx.groups.io; dkim=fail, err=mail: missing word in phrase: charset not supported: "big5"; spf=pass (domain: ami.com, ip: 40.107.92.81, mailfrom: richardho@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guu9+pOLMOdJD6lN4Ql574JlUAcY2aLdnXYGsJYfYoQi6T1GyMWhpDEi+OF9lEj1NDusn4SeJ17atQmzbxsJiDXxpUkCEUZ1MqtwsbpEfl7pIFIHZGtqWuOS7B2PI93GJWP7GuNRIzjNdAIAOEBcHxQuUmIwLBHo6ZqMMFj54zDBMTz2phjq4SxcWy+mLdE+aErWz8IWLwTCP8TEHdx+z58XbNqt7hQohZR+3qXHG//71Fu9cI1VU4KHNxMi7TKqsVDaVyfKROeL2B8bB4qqf3Yl7f9AyX3c5gt29n1bTqb0gLJ8m8CjrHh3CZ3zl0XFUgZPKeBRPfhzuV2ExHkukg== 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=xHoEbYicFmeDs6Med0Za2YMsQlTTmcn5CbspUzmUxr0=; b=Y3i36LI3Kjs0Kz0BqzjMpbXqzeWPlKKKwY3Ct6Mms+TiGCrb9FKhgSD4ywW7YuzIKbcBW2bYny+IaZuA0A7tvdTUob8QRWMDFkOk3KCTLBvKMg04IuxlNP5r4NvdKBW1vsXakNffBMKx4vX/LUOb4QJhKu8EfsQpTcx+wqsWC4d+yZudM13/yRYjZ6Vba6/kph/eKfEeBwT+o6+tm/goUeaR61M882w8ORBilcwVKHXtl4DcdJEdergtxpxwmh6V9EUEWN9Ha7LXHZNXbMVhHJsBAU16oib+qTvoV10PAGmaXUXqw4aP0dvor75duxWHDYQZw66fR3vn4ekJKfsSVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ami.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xHoEbYicFmeDs6Med0Za2YMsQlTTmcn5CbspUzmUxr0=; b=bBmp8VV5Nz2Iq68YZwtp25EM/nNJoLvVIR3CUaFSH46Jf9YODbWLB+aejIPouPYTphnpYikV6mPn/Lc0yleTw7eEazCrg+FJ0Fyn/YKA3ukchUU2fbFtn1JBDpHpqVf1LIO6A2JgybZX4tBdRaoTQY1UnxQEkbBIfwflXdhVjlE= Received: from DM5PR10MB1660.namprd10.prod.outlook.com (2603:10b6:4:6::13) by BYAPR10MB3703.namprd10.prod.outlook.com (2603:10b6:a03:122::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Mon, 29 Aug 2022 10:57:41 +0000 Received: from DM5PR10MB1660.namprd10.prod.outlook.com ([fe80::d52b:e905:f4fb:2b52]) by DM5PR10MB1660.namprd10.prod.outlook.com ([fe80::d52b:e905:f4fb:2b52%9]) with mapi id 15.20.5566.021; Mon, 29 Aug 2022 10:57:41 +0000 From: =?UTF-8?B?UmljaGFyZEhvIFvkvZXmmI7lv6Bd?= To: Pedro Falcato , edk2-devel-groups-io CC: =?big5?B?VG9ueUxvIFvDuar3qlFd?= Subject: Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support Thread-Topic: [EXTERNAL] Re: [edk2-devel] [PATCH] UsbNetworkPkg: add USB network devices support Thread-Index: AQHYs6x4ElMw2IqYrU6YvTTIdSb01q22YJWAgAAAcoCAD2NEkA== Date: Mon, 29 Aug 2022 10:57:40 +0000 Message-ID: References: <20220819091703.247-1-richardho@ami.com> In-Reply-To: Accept-Language: zh-TW, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ami.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 517bed9e-90c0-475d-3cfd-08da89ad4b30 x-ms-traffictypediagnostic: BYAPR10MB3703:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 14kwBETvRgbiXS76aW7CJ7sF+YsUmLuqzPILGY3whpSgltT3zvRMA1qKQdy/QEBKvUos4G1u6Q5rGMFn18K8WkLbx4H58c5gkI3LJnA2Q26twGNuJ3/pAL7b4zUCm7JhyvQpP83CDM9lZX+b/0kSHVC9LuHy3Dzgp30CnjygnsPYpLwSfiPEjTsM1rICI+p1zP2+nf6FeH2Ij1DUQIn6+fUO/4gk3VU+g/Svt1ACkb3H94uSlPYJPYrrlntyEkqYjjEf+IJCJtBah788tevfhkNxXkYMp3gnjikThj2RNZoInYexMHfQlZaeEkwS9JZe9b4+xU9sO8XFuAbQ/GmORA5GOTrVqoB+I31BY4t5imnS7op6N06slbXB88y+6zzacy9dZDemAznuTtbmUeZP2hrIKQVa6Xd2ljVoIqOaG3gWaezK/WxGDD42exmYJ+mDjUyWbv/93PnbDKOIrxeOUNS/5H+mnd+glbgM45mPbJPiT4Wm/24S1IP8lAaU0ZPFqGy0DD3MCgAy+u1RysBD9HINUzvP4KyNzXOfCnlcBX/hWJi28Z726snAqI3zWquN8fiRhXnFNRhyJBN/B5P/CZgKKYb/QiapU7gM7eTwxQuRxiq0cmS3mH1qOzMD79q4xQ9dp/6wQOyTRWqBlBI7PCDFceJ+z1JKwemE7urHEHGmwT8PrYULcOilwZGhOc8l65AH02jU/XuS7ac5XQMMgwW+RNlExiMsmjArjN0UBYdds10gzBOUCgM3q0nk7evtK/ZoFduPaP+CiJnH4Jj8Y8TyOnX9yu+wr+a8ikVDtM2m3b9d24hvzWhQBel3q0BCD9HP1q2cevXyWJQnsh7IxN3uear9UA76Oxh/hcMD9+M= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1660.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(39850400004)(136003)(346002)(396003)(376002)(64756008)(19627235002)(8676002)(966005)(110136005)(66946007)(66556008)(66476007)(66446008)(4326008)(316002)(76116006)(71200400001)(86362001)(5660300002)(8936002)(478600001)(9326002)(52536014)(166002)(41300700001)(85182001)(38070700005)(83380400001)(6506007)(53546011)(122000001)(7696005)(9686003)(2906002)(30864003)(26005)(38100700002)(55016003)(40140700001)(186003)(33656002)(559001)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?big5?B?bVN6VEVNTWdzTXQyUXR2MjE0MnU3dWM4Z0pjazBJaTB3QTJvUGJadlRITkt6bmJl?= =?big5?B?c21EKzZDbVdnbGcwQW1lOWFmeEJvekJzMUlJUUR1ZmV6RzBBa0UrcG5YYUNBZDFF?= =?big5?B?L1I0SG1QbnN4dWthNWV4RDVydXN5RmMxY1JyR2lEcW9XZXRBbkpWZjMxdnVQd25p?= =?big5?B?U2RrMmlwenBCQkJuNWxlSFhERGVYcEtaMWZzeFV5SXM4WVZUUlFUY1ErTDZZblV3?= =?big5?B?QnNBMWVna05rMTJqWitHTVlxNnFFR3NkbU9CSk1tNFZCQjZSbFgzbHlGeU1xUGVU?= =?big5?B?aWcrVlpROHRMOWx1b3NlUWtGT0lyZGo5bStVR3NhMDBibklWcVhLK2JYQmRYcGJq?= =?big5?B?YytjQ09DeFh2RmRXWFpBRnRuc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?= =?big5?B?WnVTMHlMNGF0SUdFS0Y0aE00QW03NHVWcm5XemtVS3oxYzJZb3FjOVJlaTlRUGQw?= =?big5?B?eCtOQUxMdklIU0dFTDE5Z0JRWEE0UExLRnlVcHlKUXhYRmhTSWRFcDg1ak9hM29O?= =?big5?B?VjVFRWdxZU5aRUUraGZIb3crRFhPakZLaUYxbmRzVmVLMTZ2dnJvamxRbERoR2JU?= =?big5?B?bVd6cWRoZFRNSzF2eXdrVFNsT1paUDIwcEtJMGNZMkR2WFBkeEFoeFRQOWp0K1ZK?= =?big5?B?QWZtZTF0dUtmb0p1eHBhK0c0SkZDTkx1cVZ6RGhwMFVIUlJzL3BsdEtuc1BxTkF5?= =?big5?B?M1V3WTNrSy8xbytORXpsMUc2MEt3MFQvQ0tpMWdWREE0VmJPVTJCNVJMVk9lb3gy?= =?big5?B?RWxobjE4NDhpY2ZYMHdpaWR2OGlINjdjSHBBelp1WkNBWFUxVVJNZDZCUFQzNHA4?= =?big5?B?VVo2RVRaWU5kanRINzhzem9Rc1JYR2tLNWh1bTdYRHhQamhVNVMwdkZzUEF3QWF2?= =?big5?B?eEdkTFVXYTVSY0tIRW9DblFMaTV6N0E0c3J0WE8wZTd4Vy9aVldzZkhMSERIbTF4?= =?big5?B?OXdVamlYd1J6ZHVYYzRVRkhMZGJIaXBvOE1RaFZWOS9FaGlubkVCc3RZZzU5dm4v?= =?big5?B?cTR3UG8zZnQ5QjVUNU44eE9qMmJFZ0F3am9qd3RPMm1JcWgxRzBhRmdMa0twSjFK?= =?big5?B?dHVxdVRySnphcFcycjhFQjIzdVdYYVhHV3p6ZitsNVAxaDJScUswaUtGUXJkK0NN?= =?big5?Q?Fbs2S9B5hflQPqHG?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1660.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 517bed9e-90c0-475d-3cfd-08da89ad4b30 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2022 10:57:41.0146 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gyCorVu8ST/C9BLfG1N5VcsABfQGZciba4eGjgdrtQ6SRhLk27jNlS9CP9/arPvk6b+QC/WIYjahXNpERXu9RA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3703 Content-Language: zh-TW Content-Type: multipart/alternative; boundary="_000_DM5PR10MB1660C39610362F92EE374C2EB0769DM5PR10MB1660namp_" --_000_DM5PR10MB1660C39610362F92EE374C2EB0769DM5PR10MB1660namp_ Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: base64 SGkgUGVkcm8sDQpJIHdpbGwgbW9kaWZ5IGxpY2Vuc2UgYW5kIGFkZCBtb3JlIENDIG5leHQuDQpU aGFua3MsDQpSaWNoYXJkDQoNCkZyb206IFBlZHJvIEZhbGNhdG8gPHBlZHJvLmZhbGNhdG9AZ21h aWwuY29tPg0KU2VudDogMjAyMqZ+OKTrMTmk6SAxMTo1NiBQTQ0KVG86IGVkazItZGV2ZWwtZ3Jv dXBzLWlvIDxkZXZlbEBlZGsyLmdyb3Vwcy5pbz47IFJpY2hhcmRIbyBbpvOp+qm+XSA8UmljaGFy ZEhvQGFtaS5jb20+DQpDYzogVG9ueUxvIFvDuar3qlFdIDxUb255TG9AYW1pLmNvbT4NClN1Ympl Y3Q6IFtFWFRFUk5BTF0gUmU6IFtlZGsyLWRldmVsXSBbUEFUQ0hdIFVzYk5ldHdvcmtQa2c6IGFk ZCBVU0IgbmV0d29yayBkZXZpY2VzIHN1cHBvcnQNCg0KDQoqKkNBVVRJT046IFRoZSBlLW1haWwg YmVsb3cgaXMgZnJvbSBhbiBleHRlcm5hbCBzb3VyY2UuIFBsZWFz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IDB4 MTkNCg0KKyNkZWZpbmUgVVNCX0VUSF9YTUlUX1VOREVSUlVOICAgICAgICAgICAweDFBDQoNCisj ZGVmaW5lIFVTQl9FVEhfWE1JVF9IRUFSVEJFQVRfRkFJTFVSRSAgMHgxQg0KDQorI2RlZmluZSBV U0JfRVRIX1hNSVRfVElNRVNfQ1JTX0xPU1QgICAgIDB4MUMNCg0KKyNkZWZpbmUgVVNCX0VUSF9Y TUlUX0xBVEVfQ09MTElTSU9OUyAgICAweDFEDQoNCisNCg0KKy8vIE5JQyBJbmZvcm1hdGlvbg0K DQordHlwZWRlZiBzdHJ1Y3Qgew0KDQorICBVSU5UMzIgICAgICAgICAgICAgICAgICAgIFNpZ25h dHVyZTsNCg0KKyAgVVNCX0VUSEVSTkVUX1BST1RPQ09MICAgICAqVXNiRXRoOw0KDQorICBVSU5U MTYgICAgICAgICAgICAgICAgICAgIEludGVycnVwT3BGbGFnOw0KDQorICBVSU5UNjQgICAgICAg ICAgICAgICAgICAgIE1hcHBlZEFkZHI7DQoNCisgIFBYRV9NQUNfQUREUiAgICAgICAgICAgICAg TWNhc3RMaXN0W01BWF9NQ0FTVF9BRERSRVNTX0NOVF07DQoNCisgIFVJTlQ4ICAgICAgICAgICAg ICAgICAgICAgTWNhc3RDb3VudDsNCg0KKyAgVUlOVDY0ICAgICAgICAgICAgICAgICAgICBNZWRp YUhlYWRlcltNQVhfWE1JVF9CVUZGRVJTXTsNCg0KKyAgVUlOVDggICAgICAgICAgICAgICAgICAg ICBUeEJ1ZmZlckNvdW50Ow0KDQorICBVSU5UMTYgICAgICAgICAgICAgICAgICAgIFN0YXRlOw0K DQorICBCT09MRUFOICAgICAgICAgICAgICAgICAgIENhblRyYW5zbWl0Ow0KDQorICBCT09MRUFO ICAgICAgICAgICAgICAgICAgIENhblJlY2VpdmU7DQoNCisgIFVJTlQxNiAgICAgICAgICAgICAg ICAgICAgUmVjZWl2ZVN0YXR1czsNCg0KKyAgVUlOVDggICAgICAgICAgICAgICA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cmVxdWVzdGluZywgYW5kIGl0IG11c3QgbWF0Y2ggb25lIG9mIHRoZQ0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZXMgc3BlY2lmaWVkIGluIFN1cHBv cnRlZExhbmd1YWdlcy4gVGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51 bWJlciBvZiBsYW5ndWFnZXMgc3VwcG9ydGVkIGJ5IGEgZHJpdmVyIGlzIHVwDQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHRvIHRoZSBkcml2ZXIgd3JpdGVyLiBMYW5ndWFnZSBp cyBzcGVjaWZpZWQNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW4gUkZDIDQ2 NDYgb3IgSVNPIDYzOS0yIGxhbmd1YWdlIGNvZGUgZm9ybWF0Lg0KDQorICBAcGFyYW1bb3V0XSBE cml2ZXJOYW1lICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIFVuaWNvZGUgc3RyaW5nIHRvIHJldHVy bi4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhpcyBVbmljb2RlIHN0cmlu ZyBpcyB0aGUgbmFtZSBvZiB0aGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ZHJpdmVyIHNwZWNpZmllZCBieSBUaGlzIGluIHRoZSBsYW5ndWFnZQ0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZWQgYnkgTGFuZ3VhZ2UuDQoNCisNCg0KKyAgQHJl dHZhbCBFRklfU1VDQ0VTUyAgICAgICAgICAgVGhlIFVuaWNvZGUgc3RyaW5nIGZvciB0aGUgRHJp dmVyIHNwZWNpZmllZCBieQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaGlz IGFuZCB0aGUgbGFuZ3VhZ2Ugc3BlY2lmaWVkIGJ5IExhbmd1YWdlIHdhcw0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5lZCBpbiBEcml2ZXJOYW1lLg0KDQorICBAcmV0 dmFsIEVGSV9JTlZBTElEX1BBUkFNRVRFUiBMYW5ndWFnZSBpcyBOVUxMLg0KDQorICBAcmV0dmFs IEVGSV9JTlZBTElEX1BBUkFNRVRFUiBEcml2ZXJOYW1lIGlzIE5VTEwuDQoNCisgIEByZXR2YWwg RUZJX1VOU1VQUE9SVEVEICAgICAgIFRoZSBkcml2ZXIgc3BlY2lmaWVkIGJ5IFRoaXMgZG9lcyBu b3Qgc3VwcG9ydA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGUgbGFuZ3Vh Z2Ugc3BlY2lmaWVkIGJ5IExhbmd1YWdlLg0KDQorDQoNCisqKi8NCg0KK0VGSV9TVEFUVVMNCg0K K0VGSUFQSQ0KDQorTmV0d29ya0NvbW1vbkNvbXBvbmVudE5hbWVHZXREcml2ZXJOYW1lICgNCg0K KyAgSU4gIEVGSV9DT01QT05FTlRfTkFNRV9QUk9UT0NPTCAgKlRoaXMsDQoNCisgIElOICBDSEFS OCAgICAgICAgICAgICAgICAgICAgICAgICpMYW5ndWFnZSwNCg0KKyAgT1VUIENIQVIxNiAgICAg ICAgICAgICAgICAgICAgICAgKipEcml2ZXJOYW1lDQoNCisgICkNCg0KK3sNCg0KKyAgcmV0dXJu IExvb2t1cFVuaWNvZGVTdHJpbmcyICgNCg0KKyAgICAgICAgICAgTGFuZ3VhZ2UsDQoNCisgICAg ICAgICAgIFRoaXMtPlN1cHBvcnRlZExhbmd1YWdlcywNCg0KKyAgICAgICAgICAgZ05ldHdvcmtD b21tb25Ecml2ZXJOYW1lVGFibGUsDQoNCisgICAgICAgICAgIERyaXZlck5hbWUsDQoNCisgICAg ICAgICAgIChCT09MRUFOKShUaGlzID09ICZnTmV0d29ya0NvbW1vbkNvbXBvbmVudE5hbWUpDQoN CisgICAgICAgICAgICk7DQoNCit9DQoNCisNCg0KKy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VybmVkLg0KDQorDQoNCisgIEBwYXJhbVtpbl0gIFRoaXMgICAg ICAgICAgICAgIEEgcG9pbnRlciB0byB0aGUgRUZJX0NPTVBPTkVOVF9OQU1FMl9QUk9UT0NPTCBv cg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFRklfQ09NUE9ORU5UX05BTUVf UFJPVE9DT0wgaW5zdGFuY2UuDQoNCisgIEBwYXJhbVtpbl0gIENvbnRyb2xsZXIgICAgICAgIFRo ZSBoYW5kbGUgb2YgYSBjb250cm9sbGVyIHRoYXQgdGhlIGRyaXZlcg0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZWQgYnkgVGhpcyBpcyBtYW5hZ2luZy4gIFRoaXMg aGFuZGxlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpZmllcyB0aGUg Y29udHJvbGxlciB3aG9zZSBuYW1lIGlzIHRvIGJlDQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHJldHVybmVkLg0KDQorICBAcGFyYW1baW5dICBDaGlsZEhhbmRsZSAgICAgICBU aGUgaGFuZGxlIG9mIHRoZSBjaGlsZCBjb250cm9sbGVyIHRvIHJldHJpZXZlDQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBuYW1lIG9mLiAgVGhpcyBpcyBhbiBvcHRpb25h bCBwYXJhbWV0ZXIgdGhhdA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXkg YmUgTlVMTC4gIEl0IHdpbGwgYmUgTlVMTCBmb3IgZGV2aWNlDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGRyaXZlcnMuICBJdCB3aWxsIGFsc28gYmUgTlVMTCBmb3IgYSBidXMg ZHJpdmVycw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0IHdpc2ggdG8g cmV0cmlldmUgdGhlIG5hbWUgb2YgdGhlIGJ1cw0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBjb250cm9sbGVyLiAgSXQgd2lsbCBub3QgYmUgTlVMTCBmb3IgYSBidXMNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJpdmVyIHRoYXQgd2lzaGVzIHRvIHJldHJp ZXZlIHRoZSBuYW1lIG9mIGENCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hp bGQgY29udHJvbGxlci4NCg0KKyAgQHBhcmFtW2luXSAgTGFuZ3VhZ2UgICAgICAgICAgQSBwb2lu dGVyIHRvIGEgTnVsbC10ZXJtaW5hdGVkIEFTQ0lJIHN0cmluZw0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBhcnJheSBpbmRpY2F0aW5nIHRoZSBsYW5ndWFnZS4gIFRoaXMgaXMg dGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlIG9mIHRoZSBk cml2ZXIgbmFtZSB0aGF0IHRoZSBjYWxsZXIgaXMNCg0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcmVxdWVzdGluZywgYW5kIGl0IG11c3QgbWF0Y2ggb25lIG9mIHRoZQ0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZXMgc3BlY2lmaWVkIGluIFN1cHBv cnRlZExhbmd1YWdlcy4gVGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51 bWJlciBvZiBsYW5ndWFnZXMgc3VwcG9ydGVkIGJ5IGEgZHJpdmVyIGlzIHVwDQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHRvIHRoZSBkcml2ZXIgd3JpdGVyLiBMYW5ndWFnZSBp cyBzcGVjaWZpZWQgaW4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUkZDIDQ2 NDYgb3IgSVNPIDYzOS0yIGxhbmd1YWdlIGNvZGUgZm9ybWF0Lg0KDQorICBAcGFyYW1bb3V0XSBD b250cm9sbGVyTmFtZSAgICBBIHBvaW50ZXIgdG8gdGhlIFVuaWNvZGUgc3RyaW5nIHRvIHJldHVy bi4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhpcyBVbmljb2RlIHN0cmlu ZyBpcyB0aGUgbmFtZSBvZiB0aGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg Y29udHJvbGxlciBzcGVjaWZpZWQgYnkgQ29udHJvbGxlckhhbmRsZSBhbmQNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgQ2hpbGRIYW5kbGUgaW4gdGhlIGxhbmd1YWdlIHNwZWNp ZmllZCBieQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYW5ndWFnZSBmcm9t IHRoZSBwb2ludCBvZiB2aWV3IG9mIHRoZSBkcml2ZXINCg0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgc3BlY2lmaWVkIGJ5IFRoaXMuDQoNCisNCg0KKyAgQHJldHZhbCBFRklfU1VD Q0VTUyAgICAgICAgICAgVGhlIFVuaWNvZGUgc3RyaW5nIGZvciB0aGUgdXNlciByZWFkYWJsZSBu YW1lIGluDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBsYW5ndWFnZSBz cGVjaWZpZWQgYnkgTGFuZ3VhZ2UgZm9yIHRoZQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBkcml2ZXIgc3BlY2lmaWVkIGJ5IFRoaXMgd2FzIHJldHVybmVkIGluDQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIERyaXZlck5hbWUuDQoNCisgIEByZXR2YWwgRUZJ X0lOVkFMSURfUEFSQU1FVEVSIENvbnRyb2xsZXJIYW5kbGUgaXMgbm90IGEgdmFsaWQgRUZJX0hB TkRMRS4NCg0KKyAgQHJ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AgICAgICAgICBD aGlsZEhhbmRsZSAgICAgICAgT1BUSU9OQUwsDQoNCisgIElOICBDSEFSOCAgICAgICAgICAgICAg ICAgICAgICAgICpMYW5ndWFnZSwNCg0KKyAgT1VUIENIQVIxNiAgICAgICAgICAgICAgICAgICAg ICAgKipDb250cm9sbGVyTmFtZQ0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAg ICAgICAgICAgIFN0YXR1czsNCg0KKyAgQ0hBUjE2ICAgICAgICAgICAgICAgICAgICAgKkhhbmRs ZU5hbWU7DQoNCisgIEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgICpVc2JJbyA9IE5VTEw7DQoN CisgIEVGSV9VU0JfREVWSUNFX0RFU0NSSVBUT1IgIERldkRlc2M7DQoNCisNCg0KKyAgaWYgKCFM YW5ndWFnZSB8fCAhQ29udHJvbGxlck5hbWUpIHsNCg0KKyAgICByZXR1cm4gRUZJX0lOVkFMSURf UEFSQU1FVEVSOw0KDQorICB9DQoNCisNCg0KKyAgaWYgKENoaWxkSGFuZGxlID09IE5VTEwpIHsN Cg0KKyAgICByZXR1cm4gRUZJX1VOU1VQUE9SVEVEOw0KDQorICB9DQoNCisNCg0KKyAgLy8NCg0K KyAgLy8gTWFrZSBzdXJlIHRoaXMgZHJpdmVyIGlzIGN1cnJlbnRseSBtYW5hZ2luZyBDb250cm9s bGVySGFuZGxlDQoNCisgIC8vDQoNCisgIFN0YXR1cyA9IEVmaVRlc3RNYW5hZ2VkRGV2aWNlICgN Cg0KKyAgICAgICAgICAgICBDb250cm9sbGVyLA0KDQorICAgICAgICAgICAgIGdOZXR3b3JrQ29t bW9uRHJpdmVyQmluZGluZy5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICZn VXNiRXRoUHJvdG9jb2xHdWlkDQoNCisgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJP UiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBTd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JOYW1lVGFibGUgIT0gTlVMTCkgew0KDQorICAgICAgRnJlZVVuaWNvZGVTdHJpbmdU YWJsZSAoZ05ldHdvcmtDb21tb25Db250cm9sbGVyTmFtZVRhYmxlKTsNCg0KKyAgICAgIGdOZXR3 b3JrQ29tbW9uQ29udHJvbGxlck5hbWVUYWJsZSA9IE5VTEw7DQoNCisgICAgfQ0KDQorDQoNCisg ICAgU3RhdHVzID0gQWRkVW5pY29kZVN0cmluZzIgKA0KDQorICAgICAgICAgICAgICAgImVuZyIs DQoNCisgICAgICAgICAgICAgICBnTmV0d29ya0NvbW1vbkNvbXBvbmVudE5hbWUuU3VwcG9ydGVk TGFuZ3VhZ2VzLA0KDQorICAgICAgICAgICAgICAgJmdOZXR3b3JrQ29tbW9uQ29udHJvbGxlck5h bWVUYWJsZSwNCg0KKyAgICAgICAgICAgICAgIEhhbmRsZU5hbWUsDQoNCisgICAgICAgICAgICAg ICBUUlVFDQoNCisgICAgICAgICAgICAgICApOw0KDQorICAgIGlmIChFRklfRVJST1IgKFN0YXR1 cykpIHsNCg0KKyAgICAgIHJldHVybiBTdGF0dXM7DQoNCisgICAgfQ0KDQorDQoNCisgICAgU3Rh dHVzID0gQWRkVW5pY29kZVN0cmluZzIgKA0KDQorICAgICAgICAgICAgICAgImVuIiwNCg0KKyAg ICAgICAgICAgICAgIGdOZXR3b3JrQ29tbW9uQ29tcG9uZW50TmFtZTIuU3VwcG9ydGVkTGFuZ3Vh Z2VzLA0KDQorICAgICAgICAgICAgICAgJmdOZXR3b3JrQ29tbW9uQ29udHJvbGxlck5hbWVUYWJs ZSwNCg0KKyAgICAgICAgICAgICAgIEhhbmRsZU5hbWUsDQoNCisgICAgICAgICAgICAgICBGQUxT RQ0KDQorICAgICAgICAgICAgICAgKTsNCg0KKyAgICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7 DQoNCisgICAgICByZXR1cm4gU3RhdHVzOw0KDQorICAgIH0NCg0KKw0KDQorICAgIHJldHVybiBM b29r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gKERldmljZVBhdGgsIChDSEFSOCAqKUVuZE5vZGUsIHNpemVv ZiAoRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MKSk7DQoNCisNCg0KKyAgcmV0dXJuIEVGSV9TVUND RVNTOw0KDQorfQ0KDQorDQoNCisvKioNCg0KKyAgTmV0d29yayBDb21tb24gRHJpdmVyIEJpbmRp bmcgU3VwcG9ydC4NCg0KKw0KDQorICBAcGFyYW1baW5dICBUaGlzICAgICAgICAgICAgICAgICAg ICBQcm90b2NvbCBpbnN0YW5jZSBwb2ludGVyLg0KDQorICBAcGFyYW1baW5dICBDb250cm9sbGVy SGFuZGxlICAgICAgICBIYW5kbGUgb2YgZGV2aWNlIHRvIHRlc3QuDQoNCisgIEBwYXJhbVtpbl0g IFJlbWFpbmluZ0RldmljZVBhdGggICAgIE9wdGlvbmFsIHBhcmFtZXRlciB1c2UgdG8gcGljayBh IHNwZWNpZmljIGNoaWxkDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGRldmljZSB0byBzdGFydC4NCg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAg ICAgICAgICBUaGlzIGRyaXZlciBzdXBwb3J0cyB0aGlzIGRldmljZS4NCg0KKyAgQHJldHZhbCBF RklfQUxSRUFEWV9TVEFSVEVEICAgICAgICAgVGhpcyBkcml2ZXIgaXMgYWxyZWFkeSBydW5uaW5n IG9uIHRoaXMgZGV2aWNlLg0KDQorICBAcmV0dmFsIG90aGVyICAgICAgICAgICAgICAgICAgICAg ICBUaGlzIGRyaXZlciBkb2VzIG5vdCBzdXBwb3J0IHRoaXMgZGV2aWNlLg0KDQorDQoNCisqKi8N Cg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorTmV0d29ya0NvbW1vblN1cHBvcnRlZCAoDQoN CisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoNCisgIElOIEVGSV9I QU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgSU4gRUZJX0RF VklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQorICApDQoNCit7 DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgU3RhdHVzOw0KDQorICBVU0JfRVRIRVJORVRf UFJPVE9DT0wgICpVc2JFdGg7DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5PcGVuUHJvdG9jb2wg KA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAg ICAgICAgICZnVXNiRXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgKFZPSUQg KiopJlVzYkV0aCwNCg0KKyAgICAgICAgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5k bGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAg ICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfQllfRFJJVkVSDQoNCisgICAgICAgICAgICAgICAg ICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAgcmV0dXJuIFN0YXR1 czsNCg0KKyAgfQ0KDQorDQoNCisgIGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAgICBD b250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisg ICAgICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgQ29udHJvbGxl ckhhbmRsZQ0KDQorICAgICAgICAgKTsNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0K DQorLyoqDQoNCisgIE5ldHdvcmsgQ29tbW9uIERyaXZlciBCaW5kaW5nIFN0YXJ0Lg0KDQorDQoN CisgIEBwY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VySGFuZGxlLA0KDQorICBJTiBF RklfREVWSUNFX1BBVEhfUFJPVE9DT0wgICAgICpSZW1haW5pbmdEZXZpY2VQYXRoDQoNCisgICkN Cg0KK3sNCg0KKyAgRUZJX1NUQVRVUyAgICAgICAgICAgICAgICBTdGF0dXM7DQoNCisgIEVGSV9E RVZJQ0VfUEFUSF9QUk9UT0NPTCAgKlVzYkV0aFBhdGg7DQoNCisgIFVTQl9FVEhFUk5FVF9QUk9U T0NPTCAgICAgKlVzYkV0aDsNCg0KKyAgRUZJX01BQ19BRERSRVNTICAgICAgICAgICBNYWNBZGRy ZXNzOw0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEJ1bGtEYXRhU2l6ZTsNCg0KKyAg TklDX0RFVklDRSAgICAgICAgICAgICAgICAqTmljRGV2aWNlOw0KDQorICBVSU5UOCAgICAgICAg ICAgICAgICAgICAgICpUbXBQeGVQb2ludGVyID0gTlVMTDsNCg0KKw0KDQorICBTdGF0dXMgPSBn QlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxl LA0KDQorICAgICAgICAgICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAg ICAgICAgICAgICAoVk9JRCAqKikmVXNiRXRoLA0KDQorICAgICAgICAgICAgICAgICAgVGhpcy0+ RHJpdmVyQmluZGluZ0hhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5k bGUsDQoNCisgICAgICAgICAgICAgICAgICBFRklfT1BFTl9QUk9UT0NPTF9CWV9EUklWRVINCg0K KyAgICAgICAgICAgICAgICAgICk7DQoNCisgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0K KyAgICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5PcGVu UHJvdG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvb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ICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICZn RWZpRGV2aWNlUGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgVGhpcy0+RHJpdmVyQmlu ZGluZ0hhbmRsZSwNCg0KKyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAg ICApOw0KDQorICAgIGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAgICAgIENvbnRyb2xs ZXJIYW5kbGUsDQoNCisgICAgICAgICAgICZnVXNiRXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAg ICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICBDb250cm9sbGVy SGFuZGxlDQoNCisgICAgICAgICAgICk7DQoNCisgICAgcmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0K DQorDQoNCisgIE5pY0RldmljZSA9IEFsbG9jYXRlWmVyb1Bvb2wgKHNpemVvZiAoTklDX0RFVklD RSkpOw0KDQorICBpZiAoIU5pY0RldmljZSkgew0KDQorICAgIGdCUy0+Q2xvc2VQcm90b2NvbCAo DQoNCisgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICZnRWZpRGV2 aWNlUGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgVGhpcy0+RHJpdmVyQmluZGluZ0hh bmRsZSwNCg0KKyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAgICApOw0K DQorICAgIGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAgICAgIENvbnRyb2xsZXJIYW5k bGUsDQoNCisgICAgICAgICAgICZnVXNiRXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICBU aGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxl DQoNCisgICAgICAgICAgICk7DQoNCisgICAgcmV0dXJuIEVGSV9PVVRfT0ZfUkVTT1VSQ0VTOw0K DQorICB9DQoNCisNCg0KKyAgLy8gZm9yIGFsaWdubWVudCBhZGp1c3RtZW50DQoNCisgIGlmIChn UHhlID09IE5VTEwpIHsNCg0KKyAgICBUbXBQeGVQb2ludGVyID0gQWxsb2NhdGVaZXJvUG9vbCAo c2l6ZW9mIChQWEVfU1dfVU5ESSkgKyAxNik7DQoNCisgICAgaWYgKCFUbXBQeGVQb2ludGVyKSB7 DQoNCisgICAgICBpZiAoTmljRGV2aWNlICE9IE5VTEwpIHsNCg0KKyAgICAgICAgZ0JTLT5GcmVl UG9vbCAoTmljRGV2aWNlKTsNCg0KKyAgICAgIH0NCg0KKw0KDQorICAgICAgZ0JTLT5DbG9zZVBy b3RvY29sICgNCg0KKyAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAg ICAgICZnRWZpRGV2aWNlUGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICBUaGlzLT5E cml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUNCg0K KyAgICAgICAgICAgICApOw0KDQorICAgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAg ICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICZnVXNiRXRoUHJvdG9j b2xHdWlkLA0KDQorICAgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisg ICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAgICAgICk7DQoNCisNCg0K KyAgICAgIHJldHVybiBFRklfT1VUX09GX1JFU09VUkNFUzsNCg0KKyAgICB9IGVsc2Ugew0KDQor ICAgICAgLy8gY2hlY2sgZm9yIHBhcmFncmFwaCBhbGlnbm1lbnQgaGVyZQ0KDQorICAgICAgaWYg KCgoVUlOVE4pVG1wUHhlUG9pbnRlciAmIDB4MEYpICE9IDApIHsNCg0KKyAgICAgICAgZ1B4ZSA9 IChQWEVfU1dfVU5ESSAqKShUbXBQeGVQb2ludGVyICsgOCk7DQoNCisgICAgICB9IGVsc2Ugew0K DQorICAgICAgICBnUHhlID0gKFBYRV9TV19VTkRJICopVG1wUHhlUG9pbnRlcjsNCg0KKyAgICAg IH0NCg0KKw0KDQorICAgICAgaWYgKCFnUHhlKSB7DQoNCisgICAgICAgIGlmIChOaWNEZXZpY2Ug IT0gTlVMTCkgew0KDQorICAgICAgICAgIGdCUy0+RnJlZVBvb2wgKE5pY0RldmljZSk7DQoNCisg ICAgICAgIH0NCg0KKw0KDQorICAgICAgICBnQlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAg ICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICZnRWZpRGV2aWNl UGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdI YW5kbGUsDQoNCisgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlDQoNCisgICAgICAgICAg ICAgICApOw0KDQorICAgICAgICBnQlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAgICAgICAg ICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICZnVXNiRXRoUHJvdG9jb2xH dWlkLA0KDQorICAgICAgICAgICAgICAgVGhpcy0+RHJpdmVyQmluZGluZ0hhbmRsZSwNCg0KKyAg ICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgICAgICAgICAgICAgICk7DQoNCisg ICAgICAgIHJldHVybiBFRklfT1VUX09GX1JFU09VUkNFUzsNCg0KKyAgICAgIH0NCg0KKw0KDQor ICAgICAgUHhlU3RydWN0SW5pdCAoZ1B4ZSk7DQoNCisgICAgfQ0KDQorICB9DQoNCisNCg0KKyAg TmljRGV2aWNl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T5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0K DQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlDQoNCisgICAgICAgICAgICk7DQoNCisgICAg Z0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0K KyAgICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgIFRoaXMtPkRy aXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAg ICAgICAgICAgKTsNCg0KKw0KDQorICAgIGlmIChUbXBQeGVQb2ludGVyICE9IE5VTEwpIHsNCg0K KyAgICAgIGdCUy0+RnJlZVBvb2wgKFRtcFB4ZVBvaW50ZXIpOw0KDQorICAgIH0NCg0KKw0KDQor ICAgIGlmIChOaWNEZXZpY2UgIT0gTlVMTCkgew0KDQorICAgICAgZ0JTLT5GcmVlUG9vbCAoTmlj RGV2aWNlKTsNCg0KKyAgICB9DQoNCisNCg0KKyAgICByZXR1cm4gRUZJX0RFVklDRV9FUlJPUjsN Cg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1cyA9IENyZWF0ZU1hY0RldmljZVBhdGggKA0KDQorICAg ICAgICAgICAgICZOaWNEZXZpY2UtPkRldlBhdGgsDQoNCisgICAgICAgICAgICAgVXNiRXRoUGF0 aCwNCg0KKyAgICAgICAgICAgICAmTmljRGV2aWNlLT5OaWNJbmZvDQoNCisgICAgICAgICAgICAg KTsNCg0KKw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAgVXBkYXRlTmlj TnVtIChOVUxMLCBnUHhlKTsNCg0KKyAgICBpZiAoVG1wUHhlUG9pbnRlciAhPSBOVUxMKSB7DQoN CisgICAgICBnQlMtPkZyZWVQb29sIChUbXBQeGVQb2ludGVyKTsNCg0KKyAgICB9DQoNCisgIH0N Cg0KKw0KDQorICBOaWNEZXZ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FUVVFU1QpKTsNCg0KKw0KDQorICBT dGF0dXMgPSBVc2JFdGgtPlVzYkV0aEludGVycnVwdCAoVXNiRXRoLCBUUlVFLCBORVRXT1JLX0NP TU1PTl9QT0xMSU5HX0lOVEVSVkFMLCAmTmljRGV2aWNlLT5OaWNJbmZvLlJlcXVlc3QpOw0KDQor ICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMpOw0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+SW5z dGFsbE11bHRpcGxlUHJvdG9jb2xJbnRlcmZhY2VzICgNCg0KKyAgICAgICAgICAgICAgICAgICZO aWNEZXZpY2UtPkRldmljZUhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpTmV0d29y a0ludGVyZmFjZUlkZW50aWZpZXJQcm90b2NvbEd1aWRfMzEsDQoNCisgICAgICAgICAgICAgICAg ICAmTmljRGV2aWNlLT5OaWlQcm90b2NvbCwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpRGV2 aWNlUGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgICAgIE5pY0RldmljZS0+RGV2 UGF0aCwNCg0KKyAgICAgICAgICAgICAgICAgIE5VTEwNCg0KKyAgICAgICAgICAgICAgICAgICk7 DQoNCisNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIGlmIChOaWNEZXZp Y2UtPk5paVByb3RvY29sLklmTnVtIDwgTUFYX0xBTl9JTlRFUkZBQ0UpIHsNCg0KKyAgICAgIGdM YW5EZXZpY2VMaXN0W05pY0RldmljZS0+TmlpUHJvdG9jb2wuSWZOdW1dID0gTlVMTDsNCg0KKyAg ICB9DQoNCisNCg0KKyAgICBnQlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAgICAgICBDb250 cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAmZ0VmaURldmljZVBhdGhQcm90b2NvbEd1aWQs DQoNCisgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAg IENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgICAgICAgICAgKTsNCg0KKyAgICBnQlMtPkNsb3NlUHJv dG9jb2wgKA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAm Z1VzYkV0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgVGhpcy0+RHJpdmVyQmluZGluZ0hh bmRsZSwNCg0KKyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAgICApOw0K DQorDQoNCisgICAgaWYgKFRtcFB4ZVBvaW50ZXIgIT0gTlVMTCkgew0KDQorICAgICAgZ0JTLT5G cmVlUG9vbCAoVG1wUHhlUG9pbnRlcik7DQoNCisgICAgfQ0KDQorDQoNCisgICAgaWYgKE5pY0Rl dmljZS0+RGV2UGF0aCAhPSBOVUxMKSB7DQoNCisgICAgICBnQlMtPkZyZWVQb29sIChOaWNEZXZp Y2UtPkRldlBhdGgpOw0KDQorICAgIH0NCg0KKw0KDQorICAgIGlmIChOaWNEZXZpY2UgIT0gTlVM TCkgew0KDQorICAgICAgZ0JTLT5GcmVlUG9vbCAoTmljRGV2aWNlKTsNCg0KKyAgICB9DQoNCisN Cg0KKyAgICByZXR1cm4gRUZJX0RFVklDRV9FUlJPUjsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1 cyA9IGdCUy0+T3BlblByb3RvY29sICgNCg0KKyAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJI YW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICAmZ1VzYkV0aFByb3RvY29sR3VpZCwNCg0KKyAg ICAgICAgICAgICAgICAgIChWT0lEICoqKSZVc2JFdGgsDQoNCisgICAgICAgICAgICAgICAgICBU aGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgTmljRGV2aWNl LT5EZXZpY2VIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBFRklfT1BFTl9QUk9UT0NPTF9C WV9DSElMRF9DT05UUk9MTEVSDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorDQoNCisgIHJl dHVybiBTdGF0dXM7DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBOZXR3b3JrIENvbW1vbiBEcml2 ZXIgQmluZGluZyBTdG9wLg0KDQorDQoNCisgIEBwYXJhbVtpbl0gIFRoaXMgICAgICAgICAgICAg ICAgICBQcm90b2NvbCBpbnN0YW5jZSBwb2ludGVyLg0KDQorICBAcGFyYW1baW5dICBDb250cm9s bGVySGFuZGxlICAgICAgSGFuZGxlIG9mIGRldmljZSB0byBzdG9wIGRyaXZlciBvbg0KDQorICBA cGFyYW1baW5dICBOdW1iZXJPZkNoaWxkcmVuICAgICAgTnVtYmVyIG9mIEhhbmRsZXMgaW4gQ2hp bGRIYW5kbGVCdWZmZXIuIElmIG51bWJlciBvZg0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgY2hpbGRyZW4gaXMgemVybyBzdG9wIHRoZSBlbnRpcmUgYnVzIGRyaXZlci4N Cg0KKyAgQHBhcmFtW2luXSAgQ2hpbGRIYW5kbGVCdWZmZXIgICAgIExpc3Qgb2YgQ2hpbGQgSGFu ZGxlcyB0byBTdG9wLg0KDQorDQoNCisgIEByZXR2YWwgRUZJX1NVQ0NFU1MgICAgICAgICAgICAg ICBUaGlzIGRyaXZlciBpcyByZW1vdmVkIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgQHJldHZhbCBv dGhlciAgICAgICAgICAgICAgICAgICAgIFRoaXMgZHJpdmVyIHdhcyBub3QgcmVtb3ZlZCBmcm9t IHRoaXMgZGV2aWNlDQoNCisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitO ZXR3b3JrQ29tbW9uRHJpdmVyU3RvcCAoDQoNCisgIElOICBFRklfRFJJVkVSX0JJTkRJTkdfUFJP VE9DT0wgICpUaGlzLA0KDQorICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDb250 cm9sbGVySGFuZGxlLA0KDQorICBJTiAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICBOdW1i ZXJPZkNoaWxkcmVuLA0KDQorICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICAqQ2hp bGRIYW5kbGVCdWZmZXINCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVTICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgU3RhdHVzOw0KDQorICBCT09MRUFOICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgQWxsQ2hpbGRyZW5TdG9wcGVkOw0KDQorICBVSU5UTiAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXg7DQoNCisgIFVTQl9FVEhFUk5F VF9QUk9UT0NPTCAgICAgICAgICAgICAgICAgICAgICAqVXNiRXRoOw0KDQorICBOSUNfREVWSUNF ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKk5pY0RldmljZTsNCg0KKyAgRUZJX05F VFdPUktfSU5URVJGQUNFX0lERU5USUZJRVJfUFJPVE9DT0wgICpOaWlQcm90b2NvbDsNCg0KKw0K DQorICBpZiAoTnVtYmVyT2ZDaGlsZHJlbiA9PSAwKSB7DQoNCisgICAgU3RhdHVzID0gZ0JTLT5P cGVuUHJvdG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0K DQorICAgICAgICAgICAgICAgICAgICAmZ0VmaU5ldHdvcmtJbnRlcmZhY2VJZGVudGlmaWVyUHJv dG9jb2xHdWlkXzMxLA0KDQorICAgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmTmlpUHJvdG9j b2wsDQoNCisgICAgICAgICAgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoN CisgICAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAg ICAgICAgIEVGSV9PUEVOX1BST1RPQ09MX0dFVF9QUk9UT0NPTA0KDQorICAgICAgICAgICAgICAg ICAgICApOw0KDQorDQoNCisgICAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgICAg Z0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0K DQorICAgICAgICAgICAgICZnRWZpRGV2aWNlUGF0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAg ICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgIENvbnRyb2xs ZXJIYW5kbGUNCg0KKyAgICAgICAgICAgICApOw0KDQorICAgICAgZ0JTLT5DbG9zZVByb3RvY29s ICgNCg0KKyAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICZn VXNiRXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdI YW5kbGUsDQoNCisgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAgICAg ICk7DQoNCisgICAgICByZXR1cm4gRUZJX1NVQ0NFU1M7DQoNCisgICAgfQ0KDQorDQoNCisgICAg TmljRGV2aWNlID0gVU5ESV9ERVZfRlJPTV9USElTIChOaWlQcm90b2NvbCk7DQoNCisgICAgU3Rh dHVzICAgID0gZ0JTLT5Vbmluc3RhbGxNdWx0aXBsZVByb3RvY29sSW50ZXJmYWNlcyAoDQoNCisg ICAgICAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAg ICAgICAgICAgICZnRWZpTmV0d29ya0ludGVyZmFjZUlkZW50aWZpZXJQcm90b2NvbEd1aWRfMzEs DQoNCisgICAgICAgICAgICAgICAgICAgICAgICZOaWNEZXZpY2UtPk5paVByb3RvY29sLA0KDQor ICAgICAgICAgICAgICAgICAgICAgICAmZ0VmaURldmljZVBhdGhQcm90b2NvbEd1aWQsDQoNCisg ICAgICAgICAgICAgICAgICAgICAgIE5pY0RldmljZS0+RGV2UGF0aCwNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgTlVMTA0KDQorICAgICAgICAgICAgICAgICAgICAgICApOw0KDQorICAgIGlm IChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgIHJldHVybiBTdGF0dXM7DQoNCisgICAg fQ0KDQorDQoNCisgICAgZ0JTLT5GcmVlUG9vbCAoTmljRGV2aWNlLT5EZXZQYXRoKTsNCg0KKyAg ICBnQlMtPkZyZWVQb29sIChOaWNEZXZpY2UpOw0KDQorDQoNCisgICAgZ0JTLT5DbG9zZVByb3Rv Y29sICgNCg0KKyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgJmdF ZmlEZXZpY2VQYXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5k aW5nSGFuZGxlLA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlDQoNCisgICAgICAgICAg ICk7DQoNCisgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZSwNCg0KKyAgICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAg ICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgIENvbnRyb2xsZXJI YW5kbGUNCg0KKyAgICAgICAgICAgKTsNCg0KKyAgICByZXR1cm4gRUZJX1NVQ0NFU1M7DQoNCisg IH0NCg0KKw0KDQorICBBbGxDaGlsZHJlblN0b3BwZWQgPSBUUlVFOw0KDQorDQoNCisgIGZvciAo SW5kZXggPSAwOyBJbmRleCA8IE51bWJlck9mQ2hpbGRyZW47IEluZGV4KyspIHsNCg0KKyAgICBT dGF0dXMgPSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICAgIENoaWxk SGFuZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAgICAgICAgICAgICAgICAgICAgJmdFZmlOZXR3b3Jr SW50ZXJmYWNlSWRlbnRpZmllclByb3RvY29sR3VpZF8zMSwNCg0KKyAgICAgICAgICAgICAgICAg ICAgKFZPSUQgKiopJk5paVByb3RvY29sLA0KDQorICAgICAgICAgICAgICAgICAgICBUaGlzLT5E cml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFu ZGxlLA0KDQorICAgICAgICAgICAgICAgICAgICBFRklfT1BFTl9QUk9UT0NPTF9HRVRfUFJPVE9D T0wNCg0KKyAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICBpZiAoRUZJX0VSUk9SIChTdGF0 dXMpKSB7DQoNCisgICAgICBBbGxDaGlsZHJlblN0b3BwZWQgPSBGQUxTRTsNCg0KKyAgICAgIGNv bnRpbnVlOw0KDQorICAgIH0NCg0KKw0KDQorICAgIE5pY0RldmljZSA9IFVORElfREVWX0ZST01f VEhJUyAoTmlpUHJvdG9jb2wpOw0KDQorDQoNCisgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0K KyAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgJmdVc2JFdGhQcm90 b2NvbEd1aWQsDQoNCisgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisg ICAgICAgICAgIENoaWxkSGFuZGxlQnVmZmVyW0luZGV4XQ0KDQorICAgICAgICAgICApOw0KDQor DQoNCisgICAgU3RhdHVzID0gZ0JTLT5Vbmluc3RhbGxNdWx0aXBsZVByb3RvY29sSW50ZXJmYWNl cyAoDQoNCisgICAgICAgICAgICAgICAgICAgIENoaWxkSGFuZGxlQnVmZmVyW0luZGV4XSwNCg0K KyAgICAgICAgICAgICAgICAgICAgJmdFZmlOZXR3b3JrSW50ZXJmYWNlSWRlbnRpZmllclByb3Rv Y29sR3VpZF8zMSwNCg0KKyAgICAgICAgICAgICAgICAgICAgJk5pY0RldmljZS0+TmlpUHJvdG9j b2wsDQoNCisgICAgICAgICAgICAgICAgICAgICZnRWZpRGV2aWNlUGF0aFByb3RvY29sR3VpZCwN Cg0KKyAgICAgICAgICAgICAgICAgICAgTmljRGV2aWNlLT5EZXZQYXRoLA0KDQorICAgICAgICAg ICAgICAgICAgICBOVUxMDQoNCisgICAgICAgICAgICAgICAgICAgICk7DQoNCisgICAgaWYgKEVG SV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgICAgU3RhdHVzID0gZ0JTLT5PcGVuUHJvdG9jb2wg KA0KDQorICAgICAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAg ICAgICAgICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAg ICAgICAgKFZPSUQgKiopJlVzYkV0aCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICBUaGlzLT5E cml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgICAgIENoaWxkSGFuZGxl QnVmZmVyW0luZGV4XSwNCg0KKyAgICAgICAgICAgICAgICAgICAgICBFRklfT1BFTl9QUk9UT0NP TF9CWV9DSElMRF9DT05UUk9MTEVSDQoNCisgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAg ICB9IGVsc2Ugew0KDQorICAgICAgZ0JTLT5GcmVlUG9vbCAoTmljRGV2aWNlLT5EZXZQYXRoKTsN Cg0KKyAgICAgIGdCUy0+RnJlZVBvb2wgKE5pY0RldmljZSk7DQoNCisgICAgfQ0KDQorICB9DQoN CisNCg0KKyAgaWYgKCFBbGxDaGlsZHJlblN0b3BwZWQpIHsNC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AgICAgICAgICAgICAgICAw DQoNCisNCg0KKyNkZWZpbmUgVU5ESV9ERVZfU0lHTkFUVVJFICBTSUdOQVRVUkVfMzIoJ3UnLCdu JywnZCcsJ2knKQ0KDQorI2RlZmluZSBVTkRJX0RFVl9GUk9NX1RISVMoYSkgIENSKGEsIE5JQ19E RVZJQ0UsIE5paVByb3RvY29sLCBVTkRJX0RFVl9TSUdOQVRVUkUpDQoNCisjZGVmaW5lIFVORElf REVWX0ZST01fTklDKGEpICAgQ1IoYSwgTklDX0RFVklDRSwgTmljSW5mbywgVU5ESV9ERVZfU0lH TkFUVVJFKQ0KDQorDQoNCisjcHJhZ21hIHBhY2soMSkNCg0KK3R5cGVkZWYgc3RydWN0IHsNCg0K KyAgVUlOVDggICAgIERlc3RBZGRyW1BYRV9IV0FERFJfTEVOX0VUSEVSXTsNCg0KKyAgVUlOVDgg ICAgIFNyY0FkZHJbUFhFX0hXQUREUl9MRU5fRVRIRVJdOw0KDQorICBVSU5UMTYgICAgUHJvdG9j b2w7DQoNCit9IEV0aGVybmV0SGVhZGVyOw0KDQorI3ByYWdtYSBwYWNrKCkNCg0KKw0KDQordHlw ZWRlZiBzdHJ1Y3Qgew0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBTaWduYXR1cmU7DQoNCisgIEVGSV9ORVRXT1JLX0lOVEVSRkFDRV9JREVOVElGSUVS X1BST1RPQ09MICAgIE5paVByb3RvY29sOw0KDQorICBFRklfSEFORExFICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBEZXZpY2VIYW5kbGU7DQoNCisgIEVGSV9ERVZJQ0VfUEFUSF9Q Uk9UT0NPTCAgICAgICAgICAgICAgICAgICAgICpCYXNlRGV2UGF0aDsNCg0KKyAgRUZJX0RFVklD RV9QQVRIX1BST1RPQ09MICAgICAgICAgICAgICAgICAgICAgKkRldlBhdGg7DQoNCisgIE5JQ19E QVRBICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5pY0luZm87DQoNCit9IE5J Q19ERVZJQ0U7DQoNCisNCg0KK3R5cGVkZWYgVk9JRCAoKkFQSV9GVU5DKSgNCg0KKyAgUFhFX0NE QiAqLA0KDQorICBOSUNfREFUQSAqDQoNCisgICk7DQoNCisNCg0KK2V4dGVybiBQWEVfU1dfVU5E SSAgICAgICAgICAgICAgICAgICAqZ1B4ZTsNCg0KK2V4dGVybiBOSUNfREVWSUNFICAgICAgICAg ICAgICAgICAgICAqZ0xhbkRldmljZUxpc3RbTUFYX0xBTl9JTlRFUkZBQ0VdOw0KDQorZXh0ZXJu IEVGSV9DT01QT05FTlRfTkFNRTJfUFJPVE9DT0wgIGdOZXR3b3JrQ29tbW9uQ29tcG9uZW50TmFt ZTI7DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorTmV0d29ya0NvbW1vblN1cHBv cnRlZCAoDQoNCisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoNCisg IElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAg SU4gRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQor ICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK05ldHdvcmtDb21tb25Ecml2 ZXJTdGFydCAoDQoNCisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoN CisgIElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0K KyAgSU4gRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0K DQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK05ldHdvcmtDb21tb25E cml2ZXJTdG9wICgNCg0KKyAgSU4gIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMs DQoNCisgIElOICBFRklfSEFORExFICAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUs DQoNCisgIElOICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAgIE51bWJlck9mQ2hpbGRyZW4s DQoNCisgIElOICBFRklfSEFORExFICAgICAgICAgICAgICAgICAgICpDaGlsZEhhbmRsZUJ1ZmZl cg0KDQorICApOw0KDQorDQoNCitWT0lEDQoNCitQeGVTdHJ1Y3RJbml0ICgNCg0KKyAgT1VUIFBY RV9TV19VTkRJICAqUHhlU3cNCg0KKyAgKTsNCg0KKw0KDQorVk9JRA0KDQorVXBkYXRlTmljTnVt ICgNCg0KKyAgSU4gICAgICBOSUNfREFUQSAgICAgKk5pYywNCg0KKyAgSU4gT1VUICBQWEVfU1df VU5ESSAgKlB4ZVN3DQoNCisgICk7DQoNCisNCg0KK1ZPSUQNCg0KK1VuZGlBcGlFbnRyeSAoDQoN CisgIElOICBVSU5UNjQgIENkYg0KDQorICApOw0KDQorDQoNCitVSU5UTg0KDQorTWFwSXQgKA0K DQorICBJTiBOSUNfREFUQSAgKk5pYywNCg0KKyAgSU4gVUlOVDY0ICAgIE1lbUFkZHIsDQoNCisg IElOIFVJTlQzMiAgICBTaXplLA0KDQorICBJTiBVSU5UMzIgICAgRGlyZWN0aW9uLA0KDQorICBP VVQgVUlOVDY0ICAgTWFwcGVkQWRkcg0KDQorICApOw0KDQorDQoNCitWT0lEDQoNCitVbk1hcEl0 ICgNCg0KKyAgSU4gTklDX0RBVEEgICpOaWMsDQoNCisgIElOIFVJTlQ2NCAgICBNZW1BZGRyLA0K DQorICBJTiBVSU5UMzIgICAgU2l6ZSwNCg0KKyAgSU4gVUlOVDMyICAgIERpcmVjdGlvbiwNCg0K KyAgSU4gVUlOVDY0ICAgIE1hcHBlZEFkZHINCg0KKyAgKTsNCg0KKw0KDQorVk9JRA0KDQorVW5k aUdldFN0YXRlICgNCg0KKyAgSU4gIFBYRV9DREIgICAqQ2RiLA0KDQorICBJTiAgTklDX0RBVEEg ICpOaWMNCg0KKyAgKTsNCg0KKw0KDQorVk9JRA0KDQorVW5kaVN0YXJ0ICgNCg0KKyAgSU4gIFBY RV9DREIgICAqQ2RiLA0KDQorICBJTiAgTklDX0RBVEEgICpOaWMNCg0KKyAgKTsNCg0KKw0KDQor Vk9JRA0KDQorVW5kaVN0b3AgKA0KDQorICBJTiAgUFhFX0NEQiAgICpDZGIsDQoNCisgIElOICBO SUNfREFUQSAgKk5pYw0KDQorICApOw0KDQorDQoNCitWT0lEDQoNCitVbmRpR2V0SW5pdEluZm8g KA0KDQorICBJTiAgUFhFX0NEQiAgICpDZGIsDQoNCisgIElOICBOSUNfREFUQSAgKk5pYw0KDQor ICApOw0KDQorDQoNCitWT0lEDQoNCitVbmRpR2V0Q29uZmlnSW5mbyAoDQoNCisgIElOICBQWEVf Q0RCICAgKkNkYiwNCg0KKyAgSU4gIE5JQ19EQVRBICAqTmljDQoNCisgICk7DQoNCisNCg0KK1ZP SUQNCg0KK1VuZGlJbml0aWFsaXplICgNCg0KKyAgSU4gICAgICBQWEVfQ0RCICAgKkNkYiwNCg0K KyAgSU4gT1VUICBOSUNfREFUQSAgKk5pYw0KDQorICApOw0KDQorDQoNCitWT0lEDQoNCitVbmRp UmVzZXQgKA0KDQorICBJTiAgUFhFX0NEQiAgICpDZGIsDQoNCisgIElOICBOSUNfREFUQSAgKk5p Yw0KDQorICApOw0KDQorDQoNCitWT0lEDQoNCitVbmRpU2h1dGRvd24gKA0KDQorICBJTiAgICAg IFBYRV9DREIgICAqQ2RiLA0KDQorICBJTiBPVVQgIE5JQ19EQVRBICAqTmljDQoNCisgICk7DQoN CisNCg0KK1ZPSUQNCg0KK1VuZGlJbnRlcnJ1cHRFbmFibGUgKA0KDQorICBJTiAgUFhFX0NEQiAg ICpDZGIsDQoNCisgIElOICBOSUNfREFUQSAgKk5pYw0KD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KSB7DQoNCisgICAg ICBDZGItPlN0YXRGbGFncyA9IFBYRV9TVEFURkxBR1NfQ09NTUFORF9GQUlMRUQ7DQoNCisgICAg fQ0KDQorICB9DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBTZXQgUFhFIHJlY2VpdmUgZmlsdGVy Lg0KDQorDQoNCisgIEBwYXJhbVtpbl0gIE5pYyAgICAgICAgIEEgcG9pbnRlciB0byB0aGUgTmV0 d29yayBpbnRlcmZhY2UgY29udHJvbGxlciBkYXRhLg0KDQorICBAcGFyYW1baW5dICBTZXRGaWx0 ZXIgICBQWEUgcmVjZWl2ZSBmaWx0ZXINCg0KKyAgQHBhcmFtW2luXSAgQ3BiQWRkciAgICAgQ29t bWFuZCBQYXJhbWV0ZXIgQmxvY2sgQWRkcmVzcw0KDQorICBAcGFyYW1baW5dICBDcGJTaXplICAg ICBDb21tYW5kIFBhcmFtZXRlciBCbG9jayBTaXplDQoNCisNCg0KKyoqLw0KDQorVUlOVDE2DQoN CitTZXRmaWx0ZXIgKA0KDQorICBJTiAgTklDX0RBVEEgICpOaWMsDQoNCisgIElOICBVSU5UMTYg ICAgU2V0RmlsdGVyLA0KDQorICBJTiAgVUlOVDY0ICAgIENwYkFkZHIsDQoNCisgIElOICBVSU5U MzIgICAgQ3BiU2l6ZQ0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAg ICAgICAgU3RhdHVzOw0KDQorICBVSU5UOCAgICAgICAgICAgICAgICAgICAgICAgICpNY2FzdExp c3Q7DQoNCisgIFVJTlQ4ICAgICAgICAgICAgICAgICAgICAgICAgQ291bnQgPSAwOw0KDQorICBV SU5UOCAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4MTsNCg0KKyAgVUlOVDggICAgICAgICAg ICAgICAgICAgICAgICBJbmRleDI7DQoNCisgIFBYRV9DUEJfUkVDRUlWRV9GSUxURVJTICAgICAg KkNwYiA9IChQWEVfQ1BCX1JFQ0VJVkVfRklMVEVSUy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tYXRj aCBvbmUgb2YgdGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdl cyBzcGVjaWZpZWQgaW4gU3VwcG9ydGVkTGFuZ3VhZ2VzLiBUaGUNCg0KKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgbnVtYmVyIG9mIGxhbmd1YWdlcyBzdXBwb3J0ZWQgYnkgYSBkcml2 ZXIgaXMgdXANCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG8gdGhlIGRyaXZl ciB3cml0ZXIuIExhbmd1YWdlIGlzIHNwZWNpZmllZA0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBpbiBSRkMgNDY0NiBvciBJU08gNjM5LTIgbGFuZ3VhZ2UgY29kZSBmb3JtYXQu DQoNCisgIEBwYXJhbVtvdXRdIERyaXZlck5hbWUgICAgICAgIEEgcG9pbnRlciB0byB0aGUgVW5p Y29kZSBzdHJpbmcgdG8gcmV0dXJuLg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBUaGlzIFVuaWNvZGUgc3RyaW5nIGlzIHRoZSBuYW1lIG9mIHRoZQ0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBkcml2ZXIgc3BlY2lmaWVkIGJ5IFRoaXMgaW4gdGhlIGxhbmd1 YWdlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpZmllZCBieSBMYW5n dWFnZS4NCg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgICBUaGUgVW5pY29k ZSBzdHJpbmcgZm9yIHRoZSBEcml2ZXIgc3BlY2lmaWVkIGJ5DQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFRoaXMgYW5kIHRoZSBsYW5ndWFnZSBzcGVjaWZpZWQgYnkgTGFuZ3Vh Z2Ugd2FzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybmVkIGluIERy aXZlck5hbWUuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIExhbmd1YWdlIGlz IE5VTEwuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIERyaXZlck5hbWUgaXMg TlVMTC4NCg0KKyAgQHJldHZhbCBFRklfVU5TVVBQT1JURUQgICAgICAgVGhlIGRyaXZlciBzcGVj aWZpZWQgYnkgVGhpcyBkb2VzIG5vdCBzdXBwb3J0DQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHRoZSBsYW5ndWFnZSBzcGVjaWZpZWQgYnkgTGFuZ3VhZ2UuDQoNCisNCg0KKyoq Lw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JFY21Db21wb25lbnROYW1lR2V0RHJp dmVyTmFtZSAoDQoNCisgIElOICBFRklfQ09NUE9ORU5UX05BTUVfUFJPVE9DT0wgICpUaGlzLA0K DQorICBJTiAgQ0hBUjggICAgICAgICAgICAgICAgICAgICAgICAqTGFuZ3VhZ2UsDQoNCisgIE9V VCBDSEFSMTYgICAgICAgICAgICAgICAgICAgICAgICoqRHJpdmVyTmFtZQ0KDQorICApDQoNCit7 DQoNCisgIHJldHVybiBMb29rdXBVbmljb2RlU3RyaW5nMiAoDQoNCisgICAgICAgICAgIExhbmd1 YWdlLA0KDQorICAgICAgICAgICBUaGlzLT5TdXBwb3J0ZWRMYW5ndWFnZXMsDQoNCisgICAgICAg ICAgIGdVc2JFY21Ecml2ZXJOYW1lVGFibGUsDQoNCisgICAgICAgICAgIERyaXZlck5hbWUsDQoN CisgICAgICAgICAgIChCT09MRUFOKShUaGlzID09ICZnVXNiRWNtQ29tcG9uZW50TmFtZSkNCg0K KyAgICAgICAgICAgKTsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFJldHJpZXZlcyBhIFVuaWNv ZGUgc3RyaW5nIHRoYXQgaXMgdGhlIHVzZXIgcmVh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U5UX05BTUUyX1BST1RPQ09MIG9y DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVGSV9DT01QT05FTlRfTkFNRV9Q Uk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFtW2luXSAgQ29udHJvbGxlciAgICAgICAgVGhl IGhhbmRsZSBvZiBhIGNvbnRyb2xsZXIgdGhhdCB0aGUgZHJpdmVyDQoNCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNwZWNpZmllZCBieSBUaGlzIGlzIG1hbmFnaW5nLiAgVGhpcyBo YW5kbGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lmaWVzIHRoZSBj b250cm9sbGVyIHdob3NlIG5hbWUgaXMgdG8gYmUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcmV0dXJuZWQuDQoNCisgIEBwYXJhbVtpbl0gIENoaWxkSGFuZGxlICAgICAgIFRo ZSBoYW5kbGUgb2YgdGhlIGNoaWxkIGNvbnRyb2xsZXIgdG8gcmV0cmlldmUNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdGhlIG5hbWUgb2YuICBUaGlzIGlzIGFuIG9wdGlvbmFs IHBhcmFtZXRlciB0aGF0DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heSBi ZSBOVUxMLiAgSXQgd2lsbCBiZSBOVUxMIGZvciBkZXZpY2UNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgZHJpdmVycy4gIEl0IHdpbGwgYWxzbyBiZSBOVUxMIGZvciBhIGJ1cyBk cml2ZXJzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQgd2lzaCB0byBy ZXRyaWV2ZSB0aGUgbmFtZSBvZiB0aGUgYnVzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGNvbnRyb2xsZXIuICBJdCB3aWxsIG5vdCBiZSBOVUxMIGZvciBhIGJ1cw0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcml2ZXIgdGhhdCB3aXNoZXMgdG8gcmV0cmll dmUgdGhlIG5hbWUgb2YgYQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGls ZCBjb250cm9sbGVyLg0KDQorICBAcGFyYW1baW5dICBMYW5ndWFnZSAgICAgICAgICBBIHBvaW50 ZXIgdG8gYSBOdWxsLXRlcm1pbmF0ZWQgQVNDSUkgc3RyaW5nDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGFycmF5IGluZGljYXRpbmcgdGhlIGxhbmd1YWdlLiAgVGhpcyBpcyB0 aGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2Ugb2YgdGhlIGRy aXZlciBuYW1lIHRoYXQgdGhlIGNhbGxlciBpcw0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICByZXF1ZXN0aW5nLCBhbmQgaXQgbXVzdCBtYXRjaCBvbmUgb2YgdGhlDQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlcyBzcGVjaWZpZWQgaW4gU3VwcG9y dGVkTGFuZ3VhZ2VzLiBUaGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVt YmVyIG9mIGxhbmd1YWdlcyBzdXBwb3J0ZWQgYnkgYSBkcml2ZXIgaXMgdXANCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdG8gdGhlIGRyaXZlciB3cml0ZXIuIExhbmd1YWdlIGlz IHNwZWNpZmllZCBpbg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRkMgNDY0 NiBvciBJU08gNjM5LTIgbGFuZ3VhZ2UgY29kZSBmb3JtYXQuDQoNCisgIEBwYXJhbVtvdXRdIENv bnRyb2xsZXJOYW1lICAgIEEgcG9pbnRlciB0byB0aGUgVW5pY29kZSBzdHJpbmcgdG8gcmV0dXJu Lg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaGlzIFVuaWNvZGUgc3RyaW5n IGlzIHRoZSBuYW1lIG9mIHRoZQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBj b250cm9sbGVyIHNwZWNpZmllZCBieSBDb250cm9sbGVySGFuZGxlIGFuZA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBDaGlsZEhhbmRsZSBpbiB0aGUgbGFuZ3VhZ2Ugc3BlY2lm aWVkIGJ5DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExhbmd1YWdlIGZyb20g dGhlIHBvaW50IG9mIHZpZXcgb2YgdGhlIGRyaXZlcg0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBzcGVjaWZpZWQgYnkgVGhpcy4NCg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVUND RVNTICAgICAgICAgICBUaGUgVW5pY29kZSBzdHJpbmcgZm9yIHRoZSB1c2VyIHJlYWRhYmxlIG5h bWUgaW4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIGxhbmd1YWdlIHNw ZWNpZmllZCBieSBMYW5ndWFnZSBmb3IgdGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyB3YXMgcmV0dXJuZWQgaW4NCg0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgRHJpdmVyTmFtZS4NCg0KKyAgQHJldHZhbCBFRklf SU5WQUxJRF9QQVJBTUVURVIgQ29udHJvbGxlckhhbmRsZSBpcyBub3QgYSB2YWxpZCBFRklfSEFO RExFLg0KDQorICBAcmV0dmFsIEVGSV9JTlZBTElEX1BBUkFNRVRFUiBDaGlsZEhhbmRsZSBpcyBu b3QgTlVMTCBhbmQgaXQgaXMgbm90IGEgdmFsaWQNCg0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgRUZJX0hBTkRMRS4NCg0KKyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIg TGFuZ3VhZ2UgaXMgTlVMTC4NCg0KKyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIgQ29u dHJvbGxlck5hbWUgaXMgTlVMTC4NCg0KKyAgQHJldHZhbCBFRklfVU5TVVBQT1JURUQgICAgICAg VGhlIGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyBpcyBub3QgY3VycmVudGx5DQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnaW5nIHRoZSBjb250cm9sbGVyIHNwZWNpZmll ZCBieQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxl IGFuZCBDaGlsZEhhbmRsZS4NCg0KKyAgQHJldHZhbCBFRklfVU5TVVBQT1JURUQgICAgICAgVGhl IGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyBkb2VzIG5vdCBzdXBwb3J0DQoNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHRoZSBsYW5ndWFnZSBzcGVjaWZpZWQgYnkgTGFuZ3VhZ2Uu DQoNCisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JFY21Db21wb25l bnROYW1lR2V0Q29udHJvbGxlck5hbWUgKA0KDQorICBJTiBFRklfQ09NUE9ORU5UX05BTUVfUFJP VE9DT0wgICpUaGlzLA0KDQorICBJTiBFRklfSEFORExFICAgICAgICAgICAgICAgICAgIENvbnRy b2xsZXIsDQoNCisgIElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ2hpbGRIYW5kbGUg ICAgICAgIE9QVElPTkFMLA0KDQorICBJTiBDSEFSOCAgICAgICAgICAgICAgICAgICAgICAgICpM YW5ndWFnZSwNCg0KKyAgT1VUIEN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KDQorICBJTiBFRklfREVWSUNFX1BBVEhfUFJPVE9DT0wgICAgICpSZW1h aW5pbmdEZXZpY2VQYXRoDQoNCisgICkNCg0KK3sNCg0KKyAgRUZJX1NUQVRVUyAgICAgICAgICAg U3RhdHVzOw0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAqVXNiSW8gPSBOVUxMOw0KDQorDQoN CisgIFN0YXR1cyA9IGdCUy0+T3BlblByb3RvY29sICgNCg0KKyAgICAgICAgICAgICAgICAgIENv bnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xH dWlkLA0KDQorICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVzYklvLA0KDQorICAgICAgICAg ICAgICAgICAgVGhpcy0+RHJpdmVyQmluZGluZ0hhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAg IENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBFRklfT1BFTl9QUk9UT0NP TF9CWV9EUklWRVINCg0KKyAgICAgICAgICAgICAgICAgICk7DQoNCisgIGlmIChFRklfRVJST1Ig KFN0YXR1cykpIHsNCg0KKyAgICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAgU3Rh dHVzID0gSXNTdXBwb3J0ZWREZXZpY2UgKFVzYklvKSA/IEVGSV9TVUNDRVNTIDogRUZJX1VOU1VQ UE9SVEVEOw0KDQorDQoNCisgIGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAgICBDb250 cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAg ICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICBDb250cm9sbGVy SGFuZGxlDQoNCisgICAgICAgICApOw0KDQorICByZXR1cm4gU3RhdHVzOw0KDQorfQ0KDQorDQoN CisvKioNCg0KKyAgQ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CwNCg0KKyAgSU4gT1VUICBFRklfSEFORExFICAgICAgICAgICAg ICAgICpVc2JDZGNEYXRhSGFuZGxlDQoNCisgICkNCg0KK3sNCg0KKyAgRUZJX1NUQVRVUyAgICAg ICAgICAgICAgICAgICAgU3RhdHVzOw0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICAg ICBJbmRleDsNCg0KKyAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAgSGFuZGxlQ291bnQ7 DQoNCisgIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgICpIYW5kbGVCdWZmZXI7DQoNCisg IEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgICAgICpVc2JJbzsNCg0KKyAgRUZJX1VTQl9JTlRF UkZBQ0VfREVTQ1JJUFRPUiAgSW50ZXJmYWNlOw0KDQorICBFRklfREVWSUNFX1BBVEhfUFJPVE9D T0wgICAgICAqVXNiQ2RjRGF0YVBhdGg7DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5Mb2NhdGVI YW5kbGVCdWZmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgQnlQcm90b2NvbCwNCg0KKyAgICAg ICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAg ICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgJkhhbmRsZUNvdW50LA0KDQorICAgICAgICAg ICAgICAgICAgJkhhbmRsZUJ1ZmZlcg0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYg KEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBGQUxTRTsNCg0KKyAgfQ0KDQor DQoNCisgIGZvciAoSW5kZXggPSAwOyBJbmRleCA8IEhhbmRsZUNvdW50OyBJbmRleCsrKSB7DQoN CisgICAgU3RhdHVzID0gZ0JTLT5IYW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAg ICAgIEhhbmRsZUJ1ZmZlcltJbmRleF0sDQoNCisgICAgICAgICAgICAgICAgICAgICZnRWZpVXNi SW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAgIChWT0lEICoqKSZVc2JJbw0K DQorICAgICAgICAgICAgICAgICAgICApOw0KDQorICAgIEFTU0VSVF9FRklfRVJST1IgKFN0YXR1 cyk7DQoNCisNCg0KKyAgICBTdGF0dXMgPSBVc2JJby0+VXNiR2V0SW50ZXJmYWNlRGVzY3JpcHRv ciAoVXNiSW8sICZJbnRlcmZhY2UpOw0KDQorICAgIEFTU0VSVF9FRklfRVJST1IgKFN0YXR1cyk7 DQoNCisNCg0KKyAgICBpZiAoKEludGVyZmFjZS5JbnRlcmZhY2VDbGFzcyA9PSBVU0JfQ0RDX0RB VEFfQ0xBU1MpICYmDQoNCisgICAgICAgIChJbnRlcmZhY2UuSW50ZXJmYWNlU3ViQ2xhc3MgPT0g VVNCX0NEQ19EQVRBX1NVQkNMQVNTKSAmJg0KDQorICAgICAgICAoSW50ZXJmYWNlLkludGVyZmFj ZVByb3RvY29sID09IFVTQl9OT19DTEFTU19QUk9UT0NPTCkpDQoNCisgICAgew0KDQorICAgICAg U3RhdHVzID0gZ0JTLT5IYW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICAgICAg SGFuZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAmZ0VmaURldmlj ZVBhdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVz YkNkY0RhdGFQYXRoDQoNCisgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICAgIGlmIChF RklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgICAgY29udGludWU7DQoNCisgICAgICB9DQoN CisNCg0KKyAgICAgIFN0YXR1cyA9IElzU2FtZURldmljZSAoVXNiRXRoUGF0aCwgVXNiQ2RjRGF0 YVBhdGgpOw0KDQorICAgICAgaWYgKCFFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgICAg Q29weU1lbSAoVXNiQ2RjRGF0YUhhbmRsZSwgJkhhbmRsZUJ1ZmZlcltJbmRleF0sIHNpemVvZiAo RUZJX0hBTkRMRSkpOw0KDQorICAgICAgICBnQlMtPkZyZWVQb29sIChIYW5kbGVCdWZmZXIpOw0K DQorICAgICAgICByZXR1cm4gVFJVRTsNCg0KKyAgICAgIH0NCg0KKyAgICB9DQoNCisgIH0NCg0K Kw0KDQorICBnQlMtPkZyZWVQb29sIChIYW5kbGVCdWZmZXIpOw0KDQorICByZXR1cm4gRkFMU0U7 DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBDYWxsIEJhY2sgRnVuY3Rpb24uDQoNCisNCg0KKyAg QHBhcmFtW2luXSAgRXZlbnQgICAgICAgRXZlbnQgd2hvc2Ugbm90aWZpY2F0aW9uIGZ1bmN0aW9u IGlzIGJlaW5nIGludm9rZWQuDQoNCisgIEBwYXJhbVtpbl0gIENvbnRleHQgICAgIFRoZSBwb2lu dGVyIHRvIHRoZSBub3RpZmljYXRpb24gZnVuY3Rpb24ncyBjb250ZXh0LA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICB3aGljaCBpcyBpbXBsZW1lbnRhdGlvbi1kZXBlbmRlbnQuDQoNCisN Cg0KKyoqLw0KDQorVk9JRA0KDQorRUZJQVBJDQoNCitDYWxsYmFja0Z1bmN0aW9uICgNCg0KKyAg SU4gRUZJX0VWRU5UICBFdmVudCwNCg0KKyAgSU4gVk9JRCAgICAgICAqQ29udGV4dA0KDQorICAp DQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAg VUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXg7DQoNCisgIFVJTlROICAgICAgICAg ICAgICAgICAgICAgICAgIEhhbmRsZUNvdW50Ow0KDQorICBFRklfSEFORExFICAgICAgICAgICAg ICAgICAgICAqSGFuZGxlQnVmZmVyOw0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAgICAgICAg ICAqVXNiSW87DQoNCisgIEVGSV9VU0JfSU5URVJGQUNFX0RFU0NSSVBUT1IgIEludGVyZmFjZTsN Cg0KKw0KDQorICBTdGF0dXMgPSBnQlMtPkxvY2F0ZUhhbmRsZUJ1ZmZlciAoDQoNCisgICAgICAg ICAgICAgICAgICBCeVByb3RvY29sLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1By b3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgICAgIE5VTEwsDQoNCisgICAgICAgICAgICAg ICAgICAmSGFuZGxlQ291bnQsDQoNCisgICAgICAgICAgICAgICAgICAmSGFuZGxlQnVmZmVyDQoN CisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoN CisgICAgcmV0dXJuOw0KDQorICB9DQoNCisNCg0KKyAgZm9yIChJbmRleCA9IDA7IEluZGV4IDwg SGFuZGxlQ291bnQ7IEluZGV4KyspIHsNCg0KKyAgICBTdGF0dXMgPSBnQlMtPkhhbmRsZVByb3Rv Y29sICgNCg0KKyAgICAgICAgICAgICAgICAgICAgSGFuZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAg ICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAg ICAgICAgICAgKFZPSUQgKiopJlVzYklvDQoNCisgICAgICAgICAgICAgICAgICAgICk7DQoNCisg ICAgQVNTRVJUX0VGSV9FUlJPUiAoU3RhdHVzKTsNCg0KKw0KDQorICAgIFN0YXR1cyA9IFVzYklv LT5Vc2JHZXRJbnRlcmZhY2VEZXNjcmlwdG9yIChVc2JJbywgJkludGVyZmFjZSk7DQoNCisgICAg QVNTRVJUX0VGSV9FUlJPUiAoU3RhdHVzKTsNCg0KKw0KDQorICAgIGlmICgoSW50ZXJmYW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VSUk9SICAgICAgICAgICAgVGhpcyBkcml2ZXIgY291bGQgbm90IGJl IHN0YXJ0ZWQgZHVlIHRvIGEgZGV2aWNlIGVycm9yDQoNCisgIEByZXR2YWwgRUZJX09VVF9PRl9S RVNPVVJDRVMgICAgICAgIFRoZSBkcml2ZXIgY291bGQgbm90IGluc3RhbGwgc3VjY2Vzc2Z1bGx5 IGR1ZSB0byBhIGxhY2sgb2YgcmVzb3VyY2VzLg0KDQorICBAcmV0dmFsIG90aGVyICAgICAgICAg ICAgICAgICAgICAgICBUaGlzIGRyaXZlciBkb2VzIG5vdCBzdXBwb3J0IHRoaXMgZGV2aWNlDQoN CisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JFY21Ecml2ZXJTdGFy dCAoDQoNCisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoNCisgIElO IEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgSU4g RUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQorICAp DQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAg Vk9JRCAgICAgICAgICAgICAgICAgICAgICAgICAgKlJlZzsNCg0KKyAgRUZJX0VWRU5UICAgICAg ICAgICAgICAgICAgICAgRXZlbnQ7DQoNCisgIFVTQl9FVEhFUk5FVF9EUklWRVIgICAgICAgICAg ICpVc2JFdGhEcml2ZXI7DQoNCisgIEVGSV9ERVZJQ0VfUEFUSF9QUk9UT0NPTCAgICAgICpVc2JF dGhQYXRoOw0KDQorICBFRklfSEFORExFICAgICAgICAgICAgICAgICAgICBVc2JDZGNEYXRhSGFu ZGxlOw0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAgICAgICAgICAqVXNiSW87DQoNCisgIEVG SV9VU0JfSU5URVJGQUNFX0RFU0NSSVBUT1IgIEludGVyZmFjZTsNCg0KKw0KDQorICBTdGF0dXMg PSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFu ZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAg ICAgICAgICAgICAgICAgIChWT0lEICoqKSZVc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgIFRo aXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVy SGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfQllfRFJJVkVS DQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7 DQoNCisgICAgcmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+ T3BlblByb3RvY29sICgNCg0KKyAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoN CisgICAgICAgICAgICAgICAgICAmZ0VmaURldmljZVBhdGhQcm90b2NvbEd1aWQsDQoNCisgICAg ICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiRXRoUGF0aCwNCg0KKyAgICAgICAgICAgICAgICAg IFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9s bGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfR0VUX1BS T1RPQ09MDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0 dXMpKSB7DQoNCisgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgQ29udHJv bGxlckhhbmRsZSwNCg0KKyAgICA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l9FVEhFUk5F VF9EUklWRVIpKTsNCg0KKyAgaWYgKCFVc2JFdGhEcml2ZXIpIHsNCg0KKyAgICBnQlMtPkNsb3Nl UHJvdG9jb2wgKA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAg ICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5k aW5nSGFuZGxlLA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlDQoNCisgICAgICAgICAg ICk7DQoNCisgICAgcmV0dXJuIEVGSV9PVVRfT0ZfUkVTT1VSQ0VTOw0KDQorICB9DQoNCisNCg0K KyAgU3RhdHVzID0gTG9hZEFsbERlc2NyaXB0b3IgKFVzYklvLCAmVXNiRXRoRHJpdmVyLT5Db25m aWcpOw0KDQorICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMpOw0KDQorDQoNCisgIEdldEVuZHBv aW50IChVc2JJbywgVXNiRXRoRHJpdmVyKTsNCg0KKw0KDQorICBTdGF0dXMgPSBVc2JJby0+VXNi R2V0SW50ZXJmYWNlRGVzY3JpcHRvciAoVXNiSW8sICZJbnRlcmZhY2UpOw0KDQorICBBU1NFUlRf RUZJX0VSUk9SIChTdGF0dXMpOw0KDQorDQoNCisgIFVzYkV0aERyaXZlci0+U2lnbmF0dXJlICAg ICAgICAgICAgICAgICAgICAgICAgICA9IFVTQl9FVEhFUk5FVF9TSUdOQVRVUkU7DQoNCisgIFVz YkV0aERyaXZlci0+TnVtT2ZJbnRlcmZhY2UgICAgICAgICAgICAgICAgICAgICA9IEludGVyZmFj ZS5JbnRlcmZhY2VOdW1iZXI7DQoNCisgIFVzYkV0aERyaXZlci0+VXNiQ2RjRGF0YUhhbmRsZSAg ICAgICAgICAgICAgICAgICA9IFVzYkNkY0RhdGFIYW5kbGU7DQoNCisgIFVzYkV0aERyaXZlci0+ VXNiSW8gICAgICAgICAgICAgICAgICAgICAgICAgIC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yaXZlci0+VXNiRXRoLkdldFVzYkV0 aFBvZXdyUGF0dGVybkZpbHRlciA9IEdldFVzYkV0aFBvd2VyRmlsdGVyOw0KDQorICBVc2JFdGhE cml2ZXItPlVzYkV0aC5TZXRVc2JFdGhQYWNrZXRGaWx0ZXIgICAgICAgPSBTZXRVc2JFdGhQYWNr ZXRGaWx0ZXI7DQoNCisgIFVzYkV0aERyaXZlci0+VXNiRXRoLkdldFVzYkV0aFN0YXRpc3RpYyAg ICAgICAgICA9IEdldFVzYkV0aFN0YXRpc3RpYzsNCg0KKw0KDQorICBTdGF0dXMgPSBnQlMtPklu c3RhbGxQcm90b2NvbEludGVyZmFjZSAoDQoNCisgICAgICAgICAgICAgICAgICAmQ29udHJvbGxl ckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnVXNiRXRoUHJvdG9jb2xHdWlkLA0KDQor ICAgICAgICAgICAgICAgICAgRUZJX05BVElWRV9JTlRFUkZBQ0UsDQoNCisgICAgICAgICAgICAg ICAgICAmKFVzYkV0aERyaXZlci0+VXNiRXRoKQ0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0K KyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIGdCUy0+Q2xvc2VQcm90b2NvbCAo DQoNCisgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICZnRWZpVXNi SW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUs DQoNCisgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgICAgICAgICAgKTsNCg0KKyAg ICBnQlMtPkZyZWVQb29sIChVc2JFdGhEcml2ZXIpOw0KDQorICAgIHJldHVybiBTdGF0dXM7DQoN CisgIH0NCg0KKw0KDQorICByZXR1cm4gU3RhdHVzOw0KDQorfQ0KDQorDQoNCisvKioNCg0KKyAg VVNCIEVDTSBEcml2ZXIgQmluZ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IYW5kbGVC dWZmZXINCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVTICAgICAgICAgICAgIFN0YXR1czsN Cg0KKyAgVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVXNiRXRoUHJvdG9jb2w7DQoNCisgIFVTQl9F VEhFUk5FVF9EUklWRVIgICAgKlVzYkV0aERyaXZlcjsNCg0KKw0KDQorICBTdGF0dXMgPSBnQlMt Pk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0K DQorICAgICAgICAgICAgICAgICAgJmdVc2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAg ICAgICAgICAoVk9JRCAqKikmVXNiRXRoUHJvdG9jb2wsDQoNCisgICAgICAgICAgICAgICAgICBU aGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIEVGSV9PUEVOX1BST1RPQ09MX0dFVF9QUk9U T0NPTA0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVz KSkgew0KDQorICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICBVc2JFdGhEcml2 ZXIgPSBVU0JfRVRIRVJORVRfREVWX0ZST01fVEhJUyAoVXNiRXRoUHJvdG9jb2wpOw0KDQorDQoN CisgIFN0YXR1cyA9IGdCUy0+VW5pbnN0YWxsUHJvdG9jb2xJbnRlcmZhY2UgKA0KDQorICAgICAg ICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnVXNi RXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgVXNiRXRoUHJvdG9jb2wNCg0K KyAgICAgICAgICAgICAgICAgICk7DQoNCisgIGlmIChFRklfRVJST1IgKFN0YX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0Ow0KDQorfSBCSVRfTUFQOw0KDQorDQoNCitleHRlcm4g RUZJX0NPTVBPTkVOVF9OQU1FMl9QUk9UT0NPTCAgZ1VzYkVjbUNvbXBvbmVudE5hbWUyOw0KDQor DQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYkVjbURyaXZlclN1cHBvcnRlZCAoDQoN CisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoNCisgIElOIEVGSV9I QU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgSU4gRUZJX0RF VklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQorICApOw0KDQor DQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYkVjbURyaXZlclN0YXJ0ICgNCg0KKyAg SU4gRUZJX0RSSVZFUl9CSU5ESU5HX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4gRUZJX0hBTkRM RSAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICBJTiBFRklfREVWSUNF X1BBVEhfUFJPVE9DT0wgICAgICpSZW1haW5pbmdEZXZpY2VQYXRoDQoNCisgICk7DQoNCisNCg0K K0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorVXNiRWNtRHJpdmVyU3RvcCAoDQoNCisgIElOICBF RklfRFJJVkVSX0JJTkRJTkdfUFJPVE9DT0wgICpUaGlzLA0KDQorICBJTiAgRUZJX0hBTkRMRSAg ICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICBJTiAgVUlOVE4gICAgICAg ICAgICAgICAgICAgICAgICBOdW1iZXJPZkNoaWxkcmVuLA0KDQorICBJTiAgRUZJX0hBTkRMRSAg ICAgICAgICAgICAgICAgICAqQ2hpbGRIYW5kbGVCdWZmZXINCg0KKyAgKTsNCg0KKw0KDQorRUZJ X1NUQVRVUw0KDQorTG9hZEFsbERlc2NyaXB0b3IgKA0KDQorICBJTiAgRUZJX1VTQl9JT19QUk9U T0NPTCAgICAgICAgKlVzYklvLA0KDQorICBPVVQgRUZJX1VTQl9DT05GSUdfREVTQ1JJUFRPUiAg KipDb25maWdEZXNjDQoNCisgICk7DQoNCisNCg0KK0JPT0xFQU4NCg0KK05leHREZXNjcmlwdG9y ICgNCg0KKyAgSU4gRUZJX1VTQl9DT05GSUdfREVTQ1JJUFRPUiAgKkRlc2MsDQoNCisgIElOIE9V VCBVSU5UTiAgICAgICAgICAgICAgICAgICpPZmZzZXQNCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NU QVRVUw0KDQorR2V0RnVuY3Rpb25hbERlc2NyaXB0b3IgKA0KDQorICBJTiAgRUZJX1VTQl9DT05G SUdfREVTQ1JJUFRPUiAgKkNvbmZpZywNCg0KKyAgSU4gIFVJTlQ4ICAgICAgICAgICAgICAgICAg ICAgIEZ1bkRlc2NyaXB0b3JUeXBlLA0KDQorICBPVVQgVk9JRCAgICAgICAgICAgICAgICAgICAg ICAgKkRhdGFCdWZmZXINCg0KKyAgKTsNCg0KKw0KDQorVk9JRA0KDQorR2V0RW5kcG9pbnQgKA0K DQorICBJTiAgICAgIEVGSV9VU0JfSU9fUFJPVE9DT0wgICpVc2JJbywNCg0KKyAgSU4gT1VUICBV U0JfRVRIRVJORVRfRFJJVkVSICAqVXNiRXRoRHJpdmVyDQoNCisgICk7DQoNCisNCg0KK0VGSV9T VEFUVVMNCg0KK0VGSUFQSQ0KDQorVXNiRXRoUmVjZWl2ZSAoDQoNCisgIElOICAgICBQWEVfQ0RC ICAgICAgICAgICAgICAgICpDZGIsDQoNCisgIElOICAgICBVU0JfRVRIRVJORVRfUFJPVE9DT0wg ICpUaGlzLA0KDQorICBJTiBPVVQgVk9JRCAgICAgICAgICAgICAgICAgICAqUGFja2V0LA0KDQor ICBJTiBPVVQgVUlOVE4gICAgICAgICAgICAgICAgICAqUGFja2V0TGVuZ3RoDQoNCisgICk7DQoN CisNCg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorVXNiRXRoVHJhbnNtaXQgKA0KDQorICBJ TiAgICAgIFBYRV9DREIgICAgICAgICAgICAgICAgKkNkYiwNCg0KKyAgSU4gICAgICBVU0JfRVRI RVJORVRfUFJPVE9DT0wgICpUaGlzLA0KDQorICBJTiAgICAgIFZPSUQgICAgICAgICAgICAgICAg ICAgKlBhY2tldCwNCg0KKyAgSU4gT1VUICBVSU5UTiAgICAgICAgICAgICAgICAgICpQYWNrZXRM ZW5ndGgNCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JFdGhJ bnRlcnJ1cHQgKA0KDQorICBJTiBVU0JfRVRIRVJORVRfUFJPVE9DT0wgICAqVGhpcywNCg0KKyAg SU4gQk9PTEVBTiAgICAgICAgICAgICAgICAgSXNOZXdUcmFuc2ZlciwNCg0KKyAgSU4gVUlOVE4g ICAgICAgICAgICAgICAgICAgUG9sbGluZ0ludGVydmFsLA0KDQorICBJTiBFRklfVVNCX0RFVklD RV9SRVFVRVNUICAqUmVxdWVzdA0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklB UEkNCg0KK0ludGVycnVwdENhbGxiYWNrICgNCg0KKyAgSU4gIFZPSUQgICAgKkRhdGEsDQoNCisg IElOICBVSU5UTiAgIERhdGFMZW5ndGgsDQoNCisgIElOICBWT0lEICAgICpDb250ZXh0LA0KDQor ICBJTiAgVUlOVDMyICBTdGF0dXMNCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorRUZJ QVBJDQoNCitHZXRVc2JFdGhNYWNBZGRyZXNzICgNCg0KKyAgSU4gIFVTQl9FVEhFUk5FVF9QUk9U T0NPTCAgKlRoaXMsDQoNCisgIE9VVCBFRklfTUFDX0FERFJFU1MgICAgICAgICpNYWNBZGRyZXNz DQoNCisgICk7DQoNCisNCg0KK0VGSV9T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QoNCisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorTG9hZEFsbERlc2NyaXB0b3IgKA0K DQorICBJTiAgRUZJX1VTQl9JT19QUk9UT0NPTCAgICAgICAgKlVzYklvLA0KDQorICBPVVQgRUZJ X1VTQl9DT05GSUdfREVTQ1JJUFRPUiAgKipDb25maWdEZXNjDQoNCisgICkNCg0KK3sNCg0KKyAg RUZJX1NUQVRVUyAgICAgICAgICAgICAgICAgU3RhdHVzOw0KDQorICBVSU5UMzIgICAgICAgICAg ICAgICAgICAgICBUcmFuc1N0YXR1czsNCg0KKyAgRUZJX1VTQl9DT05GSUdfREVTQ1JJUFRPUiAg VG1wOw0KDQorDQoNCisgIFN0YXR1cyA9IFVzYklvLT5Vc2JHZXRDb25maWdEZXNjcmlwdG9yIChV c2JJbywgJlRtcCk7DQoNCisgIEFTU0VSVF9FRklfRVJST1IgKFN0YXR1cyk7DQoNCisNCg0KKyAg U3RhdHVzID0gZ0JTLT5BbGxvY2F0ZVBvb2wgKEVmaUJvb3RTZXJ2aWNlc0RhdGEsIFRtcC5Ub3Rh bExlbmd0aCwgKFZPSUQgKiopQ29uZmlnRGVzYyk7DQoNCisgIEFTU0VSVF9FRklfRVJST1IgKFN0 YXR1cyk7DQoNCisNCg0KKyAgU3RhdHVzID0gVXNiR2V0RGVzY3JpcHRvciAoDQoNCisgICAgICAg ICAgICAgVXNiSW8sDQoNCisgICAgICAgICAgICAgVVNCX0RFU0NfVFlQRV9DT05GSUcgPDwgOCB8 IChUbXAuQ29uZmlndXJhdGlvblZhbHVlIC0gMSksICAgICAgICAgICAgICAgICAgIC8vIHplcm8g YmFzZWQNCg0KKyAgICAgICAgICAgICAwLA0KDQorICAgICAgICAgICAgIFRtcC5Ub3RhbExlbmd0 aCwNCg0KKyAgICAgICAgICAgICAqQ29uZmlnRGVzYywNCg0KKyAgICAgICAgICAgICAmVHJhbnNT dGF0dXMNCg0KKyAgICAgICAgICAgICApOw0KDQorICByZXR1cm4gU3R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ICAgIEZ1bkRlc2NyaXB0b3JUeXBlLA0KDQorICBPVVQgVk9JRCAgICAg ICAgICAgICAgICAgICAgICAgKkRhdGFCdWZmZXINCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RB VFVTICAgICAgICAgICAgICAgICAgICBTdGF0dXMgPSBFRklfTk9UX0ZPVU5EOw0KDQorICBVSU5U TiAgICAgICAgICAgICAgICAgICAgICAgICBPZmZzZXQ7DQoNCisgIEVGSV9VU0JfSU5URVJGQUNF X0RFU0NSSVBUT1IgICpJbnRlcmZhY2U7DQoNCisNCg0KKyAgZm9yIChPZmZzZXQgPSAwOyBOZXh0 RGVzY3JpcHRvciAoQ29uZmlnLCAmT2Zmc2V0KTspIHsNCg0KKyAgICBJbnRlcmZhY2UgPSAoRUZJ X1VTQl9JTlRFUkZBQ0VfREVTQ1JJUFRPUiAqKSgoVUlOVDggKilDb25maWcgKyBPZmZzZXQpOw0K DQorICAgIGlmIChJbnRlcmZhY2UtPkRlc2NyaXB0b3JUeXBlID09IENTX0lOVEVSRkFDRSkgew0K DQorICAgICAgaWYgKCgoVVNCX0hFQURFUl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSktPkRl c2NyaXB0b3JTdWJ0eXBlID09IEZ1bkRlc2NyaXB0b3JUeXBlKSB7DQoNCisgICAgICAgIHN3aXRj aCAoRnVuRGVzY3JpcHRvclR5cGUpIHsNCg0KKyAgICAgICAgICBjYXNlIEhFQURFUl9GVU5fREVT Q1JJUFRPUjoNCg0KKyAgICAgICAgICAgIENvcHlNZW0gKA0KDQorICAgICAgICAgICAgICBEYXRh QnVmZmVyLA0KDQorICAgICAgICAgICAgICAoVVNCX0hFQURFUl9GVU5fREVTQ1JJUFRPUiAqKUlu dGVyZmFjZSwNCg0KKyAgICAgICAgICAgICAgc2l6ZW9mIChVU0JfSEVBREVSX0ZVTl9ERVNDUklQ VE9SKQ0KDQorICAgICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUND RVNTOw0KDQorICAgICAgICAgIGNhc2UgVU5JT05fRlVOX0RFU0NSSVBUT1I6DQoNCisgICAgICAg ICAgICBDb3B5TWVtICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAgICAg ICAgICAgKFVTQl9VTklPTl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAgICAgICAg ICAgICAgKChVU0JfVU5JT05fRlVOX0RFU0NSSVBUT1IgKilJbnRlcmZhY2UpLT5GdW5jdGlvbkxl bmd0aA0KDQorICAgICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUND RVNTOw0KDQorICAgICAgICAgIGNhc2UgRVRIRVJORVRfRlVOX0RFU0NSSVBUT1I6DQoNCisgICAg ICAgICAgICBDb3B5TWVtICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAg ICAgICAgICAgKFVTQl9FVEhFUk5FVF9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAg ICAgICAgICAgICAgc2l6ZW9mIChVU0JfRVRIRVJORVRfRlVOX0RFU0NSSVBUT1IpDQoNCisgICAg ICAgICAgICAgICk7DQoNCisgICAgICAgICAgICByZXR1cm4gRUZJX1NVQ0NFU1M7DQoNCisgICAg ICAgICAgZGVmYXVsdDoNCg0KKyAgICAgICAgICAgIFN0YXR1cyA9IEVGSV9VTlNVUFBPUlRFRDsN Cg0KKyAgICAgICAgICAgIGJyZWFrOw0KDQorICAgICAgICB9DQoNCisgICAgICB9DQoNCisgICAg fQ0KDQorICB9DQoNCisNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0KDQorLyoqDQoN CisgIEdldCBVU0IgRXRoZXJuZXQgSU8gZW5kcG9pbnQgYW5kIFVTQiBDREMgZGF0YSBJTyBlbmRw b2ludC4NCg0KKw0KDQorICBAcGFyYW1baW5dICAgICAgVXNiSW8gICAgICA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2sgb2YgcmVzb3VyY2VzLg0K DQorICBAcmV0dmFsIEVGSV9USU1FT1VUICAgICAgICAgICBUaGUgY29udHJvbCB0cmFuc2ZlciBm YWlscyBkdWUgdG8gdGltZW91dC4NCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitFRklB UEkNCg0KK1VzYkV0aFJlY2VpdmUgKA0KDQorICBJTiAgICAgUFhFX0NEQiAgICAgICAgICAgICAg ICAqQ2RiLA0KDQorICBJTiAgICAgVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAg SU4gT1VUIFZPSUQgICAgICAgICAgICAgICAgICAgKlBhY2tldCwNCg0KKyAgSU4gT1VUIFVJTlRO ICAgICAgICAgICAgICAgICAgKlBhY2tldExlbmd0aA0KDQorICApDQoNCit7DQoNCisgIEVGSV9T VEFUVVMgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVVNCX0VUSEVSTkVUX0RSSVZFUiAgKlVzYkV0 aERyaXZlcjsNCg0KKyAgRUZJX1VTQl9JT19QUk9UT0NPTCAgKlVzYklvOw0KDQorICBVSU5UMzIg ICAgICAgICAgICAgICBUcmFuc1N0YXR1czsNCg0KKw0KDQorICBVc2JFdGhEcml2ZXIgPSBVU0Jf RVRIRVJORVRfREVWX0ZST01fVEhJUyAoVGhpcyk7DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5I YW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBVc2JFdGhEcml2ZXItPlVzYkNk Y0RhdGFIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlk LA0KDQorICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVzYklvDQoNCisgICAgICAgICAgICAg ICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAgcmV0dXJuIFN0 YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIGlmIChVc2JFdGhEcml2ZXItPkJ1bGtJbkVuZHBvaW50 ID09IDApIHsNCg0KKyAgICBHZXRFbmRwb2ludCAoVXNiSW8sIFVzYkV0aERyaXZlcik7DQoNCisg IH0NCg0KKw0KDQorICBTdGF0dXMgPSBVc2JJby0+VXNiQnVsa1RyYW5zZmVyICgNCg0KKyAgICAg ICAgICAgICAgICAgICAgVXNiSW8sDQoNCisgICAgICAgICAgICAgICAgICAgIFVzYkV0aERyaXZl ci0+QnVsa0luRW5kcG9pbnQsDQoNCisgICAgICAgICAgICAgICAgICAgIFBhY2tldCwNCg0KKyAg ICAgICAgICAgICAgICAgICAgUGFja2V0TGVuZ3RoLA0KDQorICAgICAgICAgICAgICAgICAgICBV U0JfRVRIRVJORVRfQlVMS19USU1FT1VULA0KDQorICAgICAgICAgICAgICAgICAgICAmVHJhbnNT dGF0dXMNCg0KKyAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0K K30NCg0KKw0KDQorLyoqDQoNCisgIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCB0byBtYW5hZ2UgYSBV U0IgZGV2aWNlIHdpdGggdGhlIGJ1bGsgdHJhbnNmZXIgcGlwZS4gVGhlIGVuZHBvaW50IGlzIEJ1 bGsgb3V0Lg0KDQorDQoNCisgIEBwYXJhbVtpbl0gICAgICBDZGIgICAgICAgICAgIEEgcG9pbnRl ciB0byB0aGUgY29tbWFuZCBkZXNjcmlwdG9yIGJsb2NrLg0KDQorICBAcGFyYW1baW5dICAgICAg VGhpcyAgICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIFVTQl9FVEhFUk5FVF9QUk9UT0NPTCBpbnN0 YW5jZS4NCg0KKyAgQHBhcmFtW2luXSAgICAgIFBhY2tldCAgICAgICAgQSBwb2ludGVyIHRvIHRo ZSBidWZmZXIgb2YgZGF0YSB0aGF0IHdpbGwgYmUgdHJhbnNtaXR0ZWQgdG8gVVNCDQoNCisgICAg ICAgICAgICAgICAgICA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QorICBFRklfU1RBVFVTICAgICAgICAg ICBTdGF0dXM7DQoNCisgIFVTQl9FVEhFUk5FVF9EUklWRVIgICpVc2JFdGhEcml2ZXI7DQoNCisg IEVGSV9VU0JfSU9fUFJPVE9DT0wgICpVc2JJbzsNCg0KKyAgVUlOVDMyICAgICAgICAgICAgICAg VHJhbnNTdGF0dXM7DQoNCisNCg0KKyAgVXNiRXRoRHJpdmVyID0gVVNCX0VUSEVSTkVUX0RFVl9G Uk9NX1RISVMgKFRoaXMpOw0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJvdG9jb2wg KA0KDQorICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5Vc2JDZGNEYXRhSGFuZGxlLA0K DQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAgICAg ICAgICAgICAgIChWT0lEICoqKSZVc2JJbw0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAg aWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0N Cg0KKw0KDQorICBpZiAoVXNiRXRoRHJpdmVyLT5CdWxrT3V0RW5kcG9pbnQgPT0gMCkgew0KDQor ICAgIEdldEVuZHBvaW50IChVc2JJbywgVXNiRXRoRHJpdmVyKTsNCg0KKyAgfQ0KDQorDQoNCisg IFN0YXR1cyA9IFVzYklvLT5Vc2JCdWxrVHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAg ICBVc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5CdWxrT3V0RW5k cG9pbnQsDQoNCisgICAgICAgICAgICAgICAgICAgIFBhY2tldCwNCg0KKyAgICAgICAgICAgICAg ICAgICAgUGFja2V0TGVuZ3RoLA0KDQorICAgICAgICAgICAgICAgICAgICBVU0JfRVRIRVJORVRf QlVMS19USU1FT1VULA0KDQorICAgICAg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Lw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitV c2JFdGhJbnRlcnJ1cHQgKA0KDQorICBJTiBVU0JfRVRIRVJORVRfUFJPVE9DT0wgICAqVGhpcywN Cg0KKyAgSU4gQk9PTEVBTiAgICAgICAgICAgICAgICAgSXNOZXdUcmFuc2ZlciwNCg0KKyAgSU4g VUlOVE4gICAgICAgICAgICAgICAgICAgUG9sbGluZ0ludGVydmFsLA0KDQorICBJTiBFRklfVVNC X0RFVklDRV9SRVFVRVNUICAqUmVxdWVzdA0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMg ICAgICAgICAgIFN0YXR1czsNCg0KKyAgVVNCX0VUSEVSTkVUX0RSSVZFUiAgKlVzYkV0aERyaXZl cjsNCg0KKyAgVUlOVE4gICAgICAgICAgICAgICAgRGF0YUxlbmd0aCA9IDA7DQoNCisNCg0KKyAg VXNiRXRoRHJpdmVyID0gVVNCX0VUSEVSTkVUX0RFVl9GUk9NX1RISVMgKFRoaXMpOw0KDQorICBp ZiAoSXNOZXdUcmFuc2ZlciA9PSBUUlVFKSB7DQoNCisgICAgRGF0YUxlbmd0aCA9IHNpemVvZiAo RUZJX1VTQl9ERVZJQ0VfUkVRVUVTVCkgKyBzaXplb2YgKFVTQl9DT05ORUNUX1NQRUVEX0NIQU5H RSk7DQoNCisgICAgU3RhdHVzICAgICA9IFVzYkV0aERyaXZlci0+VXNiSW8tPlVzYkFzeW5jSW50 ZXJydXB0VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFVzYkV0aERyaXZlci0+VXNiSW8sDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5JbnRlcnJ1cHRFbmRwb2ludCwNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJc05ld1RyYW5zZmVyLA0KDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBvbGxpbmdJbnRlcnZhbCwNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEYXRhTGVuZ3RoLA0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChFRklfQVNZTkNfVVNCX1RSQU5T RkVSX0NBTExCQUNLKUludGVycnVwdENhbGxiYWNrLA0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIFJlcXVlc3QNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICApOw0KDQorICB9IGVsc2Ugew0KDQorICAgIFN0YXR1cyA9IFVzYkV0aERy aXZlci0+VXNiSW8tPlVzYkFzeW5jSW50ZXJydXB0VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5Vc2JJbywNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYkV0aERyaXZlci0+SW50ZXJydXB0RW5kcG9p bnQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJc05ld1RyYW5zZmVy LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsDQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgTlVMTA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAg fQ0KDQorDQoNCisgIHJldHVybiBTdGF0dXM7DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBSZXRy aWV2ZXMgdGhlIFVTQiBFdGhlcm5ldCBNYWMgQWRkcmVzcy4NCg0KKw0KDQorICBAcGFyYW1baW5d IC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sNCg0KKyAgQ0hBUjE2ICAgICAgICAgICAgICAgICAgICAgICBUbXBT dHJbMV07DQoNCisgIFVJTlQ4ICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXg7DQoNCisgIFVJ TlQ4ICAgICAgICAgICAgICAgICAgICAgICAgSGk7DQoNCisgIFVJTlQ4ICAgICAgICAgICAgICAg ICAgICAgICAgTG93Ow0KDQorDQoNCisgIFVzYkV0aERyaXZlciA9IFVTQl9FVEhFUk5FVF9ERVZf RlJPTV9USElTIChUaGlzKTsNCg0KKw0KDQorICBTdGF0dXMgPSBUaGlzLT5Vc2JFdGhGdW5EZXNj cmlwdG9yIChUaGlzLCAmVXNiRXRoRGVzY3JpcHRvcik7DQoNCisgIEFTU0VSVF9FRklfRVJST1Ig KFN0YXR1cyk7DQoNCisNCg0KKyAgU3RhdHVzID0gVXNiRXRoRHJpdmVyLT5Vc2JJby0+VXNiR2V0 U3RyaW5nRGVzY3JpcHRvciAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg VXNiRXRoRHJpdmVyLT5Vc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAweDQwOSwgICAgICAgICAgICAgICAgICAgICAgICAvLyBFbmdsaXNoLVVTIExhbmd1YWdlIElE DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXNiRXRoRGVzY3JpcHRvci5N YWNBZGRyZXNzLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZEYXRhDQoN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgQVNTRVJUX0VGSV9F UlJPUiAoU3RhdHVzKTsNCg0KKw0KDQorICBEYXRhUHRyID0gRGF0YTsNCg0KKyAgZm9yIChJbmRl eCA9IDA7IEluZGV4IDwgUFhFX0hXQUREUl9MRU5fRVRIRVI7IEluZGV4KyspIHsNCg0KKyAgICBD b3B5TWVtIChUbXBTdHIsIERhdGFQ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uVmFsdWUgICAgICAgPSBWYWx1ZTsNCg0KKyAgUmVxdWVzdC5JbmRl eCAgICAgICA9IFVzYkV0aERyaXZlci0+TnVtT2ZJbnRlcmZhY2U7DQoNCisgIFJlcXVlc3QuTGVu Z3RoICAgICAgPSBMZW5ndGg7DQoNCisNCg0KKyAgcmV0dXJuIFVzYkV0aERyaXZlci0+VXNiSW8t PlVzYkNvbnRyb2xUcmFuc2ZlciAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IFVzYkV0aERyaXZlci0+VXNiSW8sDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICZSZXF1ZXN0LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZmlVc2JEYXRh T3V0LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVU0JfRVRIRVJORVRfVFJB TlNGRVJfVElNRU9VVCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGF0dGVy bkZpbHRlciwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGVuZ3RoLA0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmVHJhbnNTdGF0dXMNCg0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFRoaXMg cmVxdWVzdCByZXRyaWV2ZXMgdGhlIHN0YXR1cyBvZiB0aGUgc3BlY2lmaWVkIEV0aGVybmV0IHBv d2VyIG1hbmFnZW1lbnQNCg0KKyAgcGF0dGVybiBmaWx0ZXIgZnJvbSB0aGUgZGV2aWNlLg0KDQor DQoNCisgIEBwYXJhbVtpbl0gIFRoaXMgICAgICAgICAgICAgICAgICAgQSBwb2ludGVyIHRvIHRo ZSBVU0JfRVRIRVJORVRfUFJPVE9DT0wgaW5zdGFuY2UuDQoNCisgIEBwYXJhbVtpbl0gIFZhbHVl ICAgICAgICAgICAgICAgICAg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yAgVXNiRXRoRHJpdmVyID0gVVNCX0VUSEVSTkVU X0RFVl9GUk9NX1RISVMgKFRoaXMpOw0KDQorDQoNCisgIFJlcXVlc3QuUmVxdWVzdFR5cGUgPSBV U0JfRVRIRVJORVRfR0VUX1JFUV9UWVBFOw0KDQorICBSZXF1ZXN0LlJlcXVlc3QgICAgID0gR0VU X0VUSF9QT1dFUl9NQU5BR0VNRU5UX1BBVFRFUk5fRklMVEVSX1JFUTsNCg0KKyAgUmVxdWVzdC5W YWx1ZSAgICAgICA9IFZhbHVlOw0KDQorICBSZXF1ZXN0LkluZGV4ICAgICAgID0gVXNiRXRoRHJp dmVyLT5OdW1PZkludGVyZmFjZTsNCg0KKyAgUmVxdWVzdC5MZW5ndGggICAgICA9IFVTQl9FVEhf UE9XRVJfRklMVEVSX0xFTkdUSDsNCg0KKw0KDQorICByZXR1cm4gVXNiRXRoRHJpdmVyLT5Vc2JJ by0+VXNiQ29udHJvbFRyYW5zZmVyICgNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgVXNiRXRoRHJpdmVyLT5Vc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgJlJlcXVlc3QsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVmaVVzYkRh dGFJbiwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVVNCX0VUSEVSTkVUX1RS QU5TRkVSX1RJTUVPVVQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhdHRl cm5BY3RpdmUsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9FVEhfUE9X RVJfRklMVEVSX0xFTkdUSCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJlRy YW5zU3RhdHVzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7DQoNCit9DQoN CisNCg0KK0JJVF9NQVAgIGdUYWJsZVt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NLRVRfRklM VEVSX0xFTkdUSDsNCg0KKw0KDQorICByZXR1cm4gVXNiRXRoRHJpdmVyLT5Vc2JJby0+VXNiQ29u dHJvbFRyYW5zZmVyICgNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXNiRXRo RHJpdmVyLT5Vc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJlJlcXVl c3QsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVmaVVzYk5vRGF0YSwNCg0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVVNCX0VUSEVSTkVUX1RSQU5TRkVSX1RJ TUVPVVQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsDQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9FVEhfUEFDS0VUX0ZJTFRFUl9MRU5HVEgs DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZUcmFuc1N0YXR1cw0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOw0KDQorfQ0KDQorDQoNCisvKioNCg0KKyAg VGhpcyByZXF1ZXN0IGlzIHVzZWQgdG8gcmV0cmlldmUgYSBzdGF0aXN0aWMgYmFzZWQgb24gdGhl IGZlYXR1cmUgc2VsZWN0b3IuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgVGhpcyAgICAgICAgICAg ICAgICAgIEEgcG9pbnRlciB0byB0aGUgVVNCX0VUSEVSTkVUX1BST1RPQ09MIGluc3RhbmNlLg0K DQorICBAcGFyYW1baW5dICBGZWF0dXJlU2VsZWN0b3IgICAgICAgVmFsdWUgb2YgdGhlIGZlYXR1 cmUgc2VsZWN0b3IuDQoNCisgIEBwYXJhbVtvdXRdIFN0YXRpc3RpYyAgICAgICAgICAgICBBIHBv aW50ZXIgdG8gdGhlIDMyIGJpdCB1bnNpZ25lZCBpbnRlZ2VyLg0KDQorDQoNCisgI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DQoNCisgIHsNCg0KKyAgICBOVUxMLA0KDQorICAgIE5VTEwNCg0KKyAgfQ0KDQorfTsNCg0K Kw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JOY21Db21wb25lbnROYW1lR2V0RHJp dmVyTmFtZSAoDQoNCisgIElOICBFRklfQ09NUE9ORU5UX05BTUVfUFJPVE9DT0wgICpUaGlzLA0K DQorICBJTiAgQ0hBUjggICAgICAgICAgICAgICAgICAgICAgICAqTGFuZ3VhZ2UsDQoNCisgIE9V VCBDSEFSMTYgICAgICAgICAgICAgICAgICAgICAgICoqRHJpdmVyTmFtZQ0KDQorICApOw0KDQor DQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYk5jbUNvbXBvbmVudE5hbWVHZXRDb250 cm9sbGVyTmFtZSAoDQoNCisgIElOIEVGSV9DT01QT05FTlRfTkFNRV9QUk9UT0NPTCAgKlRoaXMs DQoNCisgIElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlciwNCg0KKyAg SU4gRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDaGlsZEhhbmRsZSAgICAgICAgT1BUSU9O QUwsDQoNCisgIElOIENIQVI4ICAgICAgICAgICAgICAgICAgICAgICAgKkxhbmd1YWdlLA0KDQor ICBPVVQgQ0hBUjE2ICAgICAgICAgICAgICAgICAgICAgICoqQ29udHJvbGxlck5hbWUNCg0KKyAg KTsNCg0KKw0KDQorR0xPQkFMX1JFTU9WRV9JRl9VTlJFRkVSRU5DRUQgRUZJX0NPTVBPTkVOVF9O QU1FX1BST1RPQ09MICBnVXNiTmNtQ29tcG9uZW50TmFtZSA9IHsNCg0KKyAgVXNiTmNtQ29tcG9u ZW50TmFtZUdldERyaXZlck5hbWUsDQoNCisgIFVzYk5jbUNvbXBvbmVudE5hbWVHZXRDb250cm9s bGVyTmFtZSwNCg0KKyAgImVuZyINCg0KK307DQoNCisNCg0KK0dMT0JBTF9SRU1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BwYXJhbVtpbl0g IFRoaXMgICAgICAgICAgICAgIEEgcG9pbnRlciB0byB0aGUgRUZJX0NPTVBPTkVOVF9OQU1FMl9Q Uk9UT0NPTCBvcg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFRklfQ09NUE9O RU5UX05BTUVfUFJPVE9DT0wgaW5zdGFuY2UuDQoNCisgIEBwYXJhbVtpbl0gIExhbmd1YWdlICAg ICAgICAgIEEgcG9pbnRlciB0byBhIE51bGwtdGVybWluYXRlZCBBU0NJSSBzdHJpbmcNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXkgaW5kaWNhdGluZyB0aGUgbGFuZ3Vh Z2UuIFRoaXMgaXMgdGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1 YWdlIG9mIHRoZSBkcml2ZXIgbmFtZSB0aGF0IHRoZSBjYWxsZXIgaXMNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdGluZywgYW5kIGl0IG11c3QgbWF0Y2ggb25lIG9m IHRoZQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZXMgc3BlY2lm aWVkIGluIFN1cHBvcnRlZExhbmd1YWdlcy4gVGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIG51bWJlciBvZiBsYW5ndWFnZXMgc3VwcG9ydGVkIGJ5IGEgZHJpdmVyIGlzIHVw DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvIHRoZSBkcml2ZXIgd3JpdGVy LiBMYW5ndWFnZSBpcyBzcGVjaWZpZWQNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgaW4gUkZDIDQ2NDYgb3IgSVNPIDYzOS0yIGxhbmd1YWdlIGNvZGUgZm9ybWF0Lg0KDQorICBA cGFyYW1bb3V0XSBEcml2ZXJOYW1lICAgICAgICBBIHBvaW50Z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Ag IHJldHVybmVkLg0KDQorICBAcGFyYW1baW5dICBDaGlsZEhhbmRsZSAgICAgICBUaGUgaGFuZGxl IG9mIHRoZSBjaGlsZCBjb250cm9sbGVyIHRvIHJldHJpZXZlDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHRoZSBuYW1lIG9mLiAgVGhpcyBpcyBhbiBvcHRpb25hbCBwYXJhbWV0 ZXIgdGhhdA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXkgYmUgTlVMTC4g IEl0IHdpbGwgYmUgTlVMTCBmb3IgZGV2aWNlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGRyaXZlcnMuICBJdCB3aWxsIGFsc28gYmUgTlVMTCBmb3IgYSBidXMgZHJpdmVycw0K DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0IHdpc2ggdG8gcmV0cmlldmUg dGhlIG5hbWUgb2YgdGhlIGJ1cw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBj b250cm9sbGVyLiAgSXQgd2lsbCBub3QgYmUgTlVMTCBmb3IgYSBidXMNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZHJpdmVyIHRoYXQgd2lzaGVzIHRvIHJldHJpZXZlIHRoZSBu YW1lIG9mIGENCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQgY29udHJv bGxlci4NCg0KKyAgQHBhcmFtW2luXSAgTGFuZ3VhZ2UgICAgICAgICAgQSBwb2ludGVyIHRvIGEg TnVsbC10ZXJtaW5hdGVkIEFTQ0lJIHN0cmluZw0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBhcnJheSBpbmRpY2F0aW5nIHRoZSBsYW5ndWFnZS4gIFRoaXMgaXMgdGhlDQoNCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlIG9mIHRoZSBkcml2ZXIgbmFt ZSB0aGF0IHRoZSBjYWxsZXIgaXMNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg cmVxdWVzdGluZywgYW5kIGl0IG11c3QgbWF0Y2ggb25lIG9mIHRoZQ0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZXMgc3BlY2lmaWVkIGluIFN1cHBvcnRlZExhbmd1 YWdlcy4gVGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlciBvZiBs YW5ndWFnZXMgc3VwcG9ydGVkIGJ5IGEgZHJpdmVyIGlzIHVwDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHRvIHRoZSBkcml2ZXIgd3JpdGVyLiBMYW5ndWFnZSBpcyBzcGVjaWZp ZWQgaW4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUkZDIDQ2NDYgb3IgSVNP IDYzOS0yIGxhbmd1YWdlIGNvZGUgZm9ybWF0Lg0KDQorICBAcGFyYW1bb3V0XSBDb250cm9sbGVy TmFtZSAgICBBIHBvaW50ZXIgdG8gdGhlIFVuaWNvZGUgc3RyaW5nIHRvIHJldHVybi4NCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhpcyBVbmljb2RlIHN0cmluZyBpcyB0aGUg bmFtZSBvZiB0aGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udHJvbGxl ciBzcGVjaWZpZWQgYnkgQ29udHJvbGxlckhhbmRsZSBhbmQNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgQ2hpbGRIYW5kbGUgaW4gdGhlIGxhbmd1YWdlIHNwZWNpZmllZCBieQ0K DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYW5ndWFnZSBmcm9tIHRoZSBwb2lu dCBvZiB2aWV3IG9mIHRoZSBkcml2ZXINCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3BlY2lmaWVkIGJ5IFRoaXMuDQoNCisNCg0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAg ICAgICAgVGhlIFVuaWNvZGUgc3RyaW5nIGZvciB0aGUgdXNlciByZWFkYWJsZSBuYW1lIGluDQoN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBsYW5ndWFnZSBzcGVjaWZpZWQg YnkgTGFuZ3VhZ2UgZm9yIHRoZQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBk cml2ZXIgc3BlY2lmaWVkIGJ5IFRoaXMgd2FzIHJldHVybmVkIGluDQoNCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIERyaXZlck5hbWUuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURf UEFSQU1FVEVSIENvbnRyb2xsZXJIYW5kbGUgaXMgbm90IGEgdmFsaWQgRUZJX0hBTkRMRS4NCg0K KyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIgQ2hpbGRIYW5kbGUgaXMgbm90IE5VTEwg YW5kIGl0IGlzIG5vdCBhIHZhbGlkDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IEVGSV9IQU5ETEUuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIExhbmd1YWdl IGlzIE5VTEwuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIENvbnRyb2xsZXJO YW1lIGlzIE5VTEwuDQoNCisgIEByZXR2YWwgRUZJX1VOU1VQUE9SVEVEICAgICAgIFRoZSBkcml2 ZXIgc3BlY2lmaWVkIGJ5IFRoaXMgaXMgbm90IGN1cnJlbnRseQ0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBtYW5hZ2luZyB0aGUgY29udHJvbGxlciBzcGVjaWZpZWQgYnkNCg0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhb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oNCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2UgdG8gc3RhcnQuDQoNCisN Cg0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAgICAgICAgICAgIFRoaXMgZHJpdmVyIHN1cHBv cnRzIHRoaXMgZGV2aWNlLg0KDQorICBAcmV0dmFsIEVGSV9BTFJFQURZX1NUQVJURUQgICAgICAg VGhpcyBkcml2ZXIgaXMgYWxyZWFkeSBydW5uaW5nIG9uIHRoaXMgZGV2aWNlLg0KDQorICBAcmV0 dmFsIG90aGVyICAgICAgICAgICAgICAgICAgICAgVGhpcyBkcml2ZXIgZG9lcyBub3Qgc3VwcG9y dCB0aGlzIGRldmljZS4NCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0K K1VzYk5jbURyaXZlclN1cHBvcnRlZCAoDQoNCisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9U T0NPTCAgKlRoaXMsDQoNCisgIElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJv bGxlckhhbmRsZSwNCg0KKyAgSU4gRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWlu aW5nRGV2aWNlUGF0aA0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgIFN0 YXR1czsNCg0KKyAgRUZJX1VTQl9JT19QUk9UT0NPTCAgKlVzYklvID0gTlVMTDsNCg0KKw0KDQor ICBTdGF0dXMgPSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250 cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3Vp ZCwNCg0KKyAgICAgICAgICAgICAgICAgIChWT0lEICoqKSZVc2JJbywNCg0KKyAgICAgICAgICAg ICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBD b250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xf QllfRFJJVkVSDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChT dGF0dXMpKSB7DQoNCisgICAgcmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1 cyA9IElzU3VwcG9ydGVkRGV2aWNlIChVc2JJbykgPyBFRklfU1VDQ0VTUyA6IEVGSV9VTlNVUFBP UlRFRDsNCg0KKw0KDQorICBnQlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAgICAgQ29udHJv bGxlckhhbmRsZSwNCg0KKyAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisgICAg ICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgQ29udHJvbGxlckhh bmRsZQ0KDQorICAgICAgICAgKTsNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0KDQor LyoqDQoNCisgIENoZWNrIGlmIHRoZSBVU0IgTkNNIGFuZCBVU0IgQ0RDIERhdGEgaW50ZXJmYWNl cyBhcmUgZnJvbSB0aGUgc2FtZSBkZXZpY2UuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgVXNiRXRo UGF0aCAgICAgICAgICAgICAgICAgIEEgcG9pbnRlciB0byB0aGUgRUZJX0RFVklDRV9QQVRIX1BS T1RPQ09MIGluc3RhbmNlLg0KDQorICBAcGFyYW1baW5dICBVc2JDZGNEYXRhUGF0aCAgICAgICAg ICAgICAgQSBwb2ludGVyIHRvIHRoZSBFRklfREVWSUNFX1BBVEhfUFJPVE9DT0wgaW5zdGFuY2Uu DQoNCisNCg0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAgICAgICAgICAgICAgICAgIElzIHRo ZSBzYW1lIGRldmljZS4NCg0KKyAgQHJldHZh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m4gVVNCIENEQyBEYXRhIEhhbmRsZS4NCg0KKw0KDQor ICBAcGFyYW1baW5dICAgICAgVXNiRXRoUGF0aCAgICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIEVG SV9ERVZJQ0VfUEFUSF9QUk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFtW2luLCBvdXRdIFVz YkNkY0RhdGFIYW5kbGUgICAgQSBwb2ludGVyIHRvIHRoZSBFRklfSEFORExFIGZvciBVU0IgQ0RD IERhdGEuDQoNCisNCg0KKyAgQHJldHZhbCBUUlVFICAgICAgICAgICAgICAgIFVTQiBDREMgRGF0 YShVc2JJbykgaW5zdGFsbGVkLg0KDQorICBAcmV0dmFsIEZBTFNFICAgICAgICAgICAgICAgVVNC IENEQyBEYXRhKFVzYklvKSBkaWQgbm90IGluc3RhbGxlZC4NCg0KKw0KDQorKiovDQoNCitCT09M RUFODQoNCitJc1VzYkNkY0RhdGEgKA0KDQorICBJTiAgICAgIEVGSV9ERVZJQ0VfUEFUSF9QUk9U T0NPTCAgKlVzYkV0aFBhdGgsDQoNCisgIElOIE9VVCAgRUZJX0hBTkRMRSAgICAgICAgICAgICAg ICAqVXNiQ2RjRGF0YUhhbmRsZQ0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAg ICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAg SW5kZXg7DQoNCisgIFVJTlROICAgICAgICAgICAgICAgICAgICAgICAgIEhhbmRsZUNvdW50Ow0K DQorICBFRklfSEFORExFICAgICAgICAgICAgICAgICAgICAqSGFuZGxlQnVmZmVyOw0KDQorICBF RklfVVNCX0lPX1BST1RPQ09MICAgICAgICAgICAqVXNiSW87DQoNCisgIEVGSV9VU0JfSU5URVJG QUNFX0RFU0NSSVBUT1IgIEludGVyZmFjZTsNCg0KKyAgRUZJX0RFVklDRV9QQVRIX1BST1RPQ09M ICAgICAgKlVzYkNkY0RhdGFQYXRoOw0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+TG9jYXRlSGFu ZGxlQnVmZmVyICgNCg0KKyAgICAgICAgICAgICAgICAgIEJ5UHJvdG9jb2wsDQoNCisgICAgICAg ICAgICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAg TlVMTCwNCg0KKyAgICAgICAgICAgICAgICAgICZIYW5kbGVDb3VudCwNCg0KKyAgICAgICAgICAg ICAgICAgICZIYW5kbGVCdWZmZXINCg0KKyAgICAgICAgICAgICAgICAgICk7DQoNCisgIGlmIChF RklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICByZXR1cm4gRkFMU0U7DQoNCisgIH0NCg0KKw0K DQorICBmb3IgKEluZGV4ID0gMDsgSW5kZXggPCBIYW5kbGVDb3VudDsgSW5kZXgrKykgew0KDQor ICAgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJvdG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAg ICBIYW5kbGVCdWZmZXJbSW5kZXhdLA0KDQorICAgICAgICAgICAgICAgICAgICAmZ0VmaVVzYklv UHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiSW8NCg0K KyAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMp Ow0KDQorDQoNCisgICAgU3RhdHVzID0gVXNiSW8tPlVzYkdldEludGVyZmFjZURlc2NyaXB0b3Ig KFVzYklvLCAmSW50ZXJmYWNlKTsNCg0KKyAgICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMpOw0K DQorDQoNCisgICAgaWYgKChJbnRlcmZhY2UuSW50ZXJmYWNlQ2xhc3MgPT0gVVNCX0NEQ19EQVRB X0NMQVNTKSAmJg0KDQorICAgICAgICAoSW50ZXJmYWNlLkludGVyZmFjZVN1YkNsYXNzID09IFVT Ql9DRENfREFUQV9TVUJDTEFTUykgJiYNCg0KKyAgICAgICAgKEludGVyZmFjZS5JbnRlcmZhY2VQ cm90b2NvbCA9PSBVU0JfTkNNX05UQl9QUk9UT0NPTCkpDQoNCisgICAgew0KDQorICAgICAgU3Rh dHVzID0gZ0JTLT5IYW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgSGFu ZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAmZ0VmaURldmljZVBh dGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVzYkNk Y0RhdGFQYXRoDQoNCisgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICAgIGlmIChFRklf RVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgICAgY29udGludWU7DQoNCisgICAgICB9DQoNCisN Cg0KKyAgICAgIFN0YXR1cyA9IElzU2FtZURldmljZSAoVXNiRXRoUGF0aCwgVXNiQ2RjRGF0YVBh dGgpOw0KDQorICAgICAgaWYgKCFFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgICAgQ29w eU1lbSAoVXNiQ2RjRGF0YUhhbmRsZSwgJkhhbmRsZUJ1ZmZlcltJbmRleF0sIHNpemVvZiAoRUZJ X0hBTkRMRSkpOw0KDQorICAgICAgICBnQlMtPkZyZWVQb29sIChIYW5kbGVCdWZmZXIpOw0KDQor ICAgICAgICByZXR1cm4gVFJVRTsNCg0KKyAgICAgIH0NCg0KKyAgICB9DQoNCisgIH0NCg0KKw0K DQorICBnQlMtPkZyZWVQb29sIChIYW5kbGVCdWZmZXIpOw0KDQorICByZXR1cm4gRkFMU0U7DQoN Cit9DQoNCisNCg0KKy8qKg0KDQorICBDYWxsIEJhY2sgRnVuY3Rpb24uDQoNCisNCg0KKyAgQHBh cmFtW2luXSAgRXZlbnQgICAgICAgRXZlbnQgd2hvc2Ugbm90aWZpY2F0aW9uIGZ1bmN0aW9uIGlz IGJlaW5nIGludm9rZWQuDQoNCisgIEBwYXJhbVtpbl0gIENvbnRleHQgICAgIFRoZSBwb2ludGVy IHRvIHRoZSBub3RpZmljYXRpb24gZnVuY3Rpb24ncyBjb250ZXh0LA0KDQorICAgICAgICAgICAg ICAgICAgICAgICAgICB3aGljaCBpcyBpbXBsZW1lbnRhdGlvbi1kZXBlbmRlbnQuDQoNCisNCg0K KyoqLw0KDQorVk9JRA0KDQorRUZJQVBJDQoNCitDYWxsYmFja0Z1bmN0aW9uICgNCg0KKyAgSU4g RUZJX0VWRU5UICBFdmVudCwNCg0KKyAgSU4gVk9JRCAgICAgICAqQ29udGV4dA0KDQorICApDQoN Cit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVUlO VE4gICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXg7DQoNCisgIFVJTlROICAgICAgICAgICAg ICAgICAgICAgICAgIEhhbmRsZUNvdW50Ow0KDQorICBFRklfSEFORExFICAgICAgICAgICAgICAg ICAgICAqSGFuZGxlQnVmZmVyOw0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAgICAgICAgICAq VXNiSW87DQoNCisgIEVGSV9VU0JfSU5URVJGQUNFX0RFU0NSSVBUT1IgIEludGVyZmFjZTsNCg0K Kw0KDQorICBTdGF0dXMgPSBnQlMtPkxvY2F0ZUhhbmRsZUJ1ZmZlciAoDQoNCisgICAgICAgICAg ICAgICAgICBCeVByb3RvY29sLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3Rv Y29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgICAgIE5VTEwsDQoNCisgICAgICAgICAgICAgICAg ICAmSGFuZGxlQ291bnQsDQoNCisgICAgICAgICAgICAgICAgICAmSGFuZGxlQnVmZmVyDQoNCisg ICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisg IC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SV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgSU4gRUZJ X0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQorICApDQoN Cit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVk9J RCAgICAgICAgICAgICAgICAgICAgICAgICAgKlJlZzsNCg0KKyAgRUZJX0VWRU5UICAgICAgICAg ICAgICAgICAgICAgRXZlbnQ7DQoNCisgIFVTQl9FVEhFUk5FVF9EUklWRVIgICAgICAgICAgICpV c2JFdGhEcml2ZXI7DQoNCisgIEVGSV9ERVZJQ0VfUEFUSF9QUk9UT0NPTCAgICAgICpVc2JFdGhQ YXRoOw0KDQorICBFRklfSEFORExFICAgICAgICAgICAgICAgICAgICBVc2JDZGNEYXRhSGFuZGxl Ow0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAgICAgICAgICAqVXNiSW87DQoNCisgIEVGSV9V U0JfSU5URVJGQUNFX0RFU0NSSVBUT1IgIEludGVyZmFjZTsNCg0KKw0KDQorICBTdGF0dXMgPSBn QlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxl LA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAg ICAgICAgICAgICAgIChWT0lEICoqKSZVc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgIFRoaXMt PkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFu ZGxlLA0KDQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfQllfRFJJVkVSDQoN CisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoN CisgICAgcmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+T3Bl blByb3RvY29sICgNCg0KKyAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisg ICAgICAgICAgICAgICAgICAmZ0VmaURldmljZVBhdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAg ICAgICAgICAgICAoVk9JRCAqKikmVXNiRXRoUGF0aCwNCg0KKyAgICAgICAgICAgICAgICAgIFRo aXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVy SGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfR0VUX1BST1RP Q09MDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMp KSB7DQoNCisgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZSwNCg0KKyAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAg ICAgICAgVGhpcy0+RHJpdmVyQmluZGluZ0hhbmRsZSwNCg0KKyAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZQ0KDQorICAgICAgICAgICApOw0KDQorICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0N Cg0KKw0KDQorICBTdGF0dXMgPSBJc1VzYkNkY0RhdGEgKFVzYkV0aFBhdGgsICZVc2JDZGNEYXRh SGFuZGxlKSA/IEVGSV9TVUNDRVNTIDogRUZJX1VOU1VQUE9SVEVEOw0KDQorICBpZiAoRUZJX0VS Uk9SIChTdGF0dXMpKSB7DQoNCisgICAgZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAg ICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3Vp ZCwNC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ICAgICAgICAgJkNvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICAmZ1VzYkV0 aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgICAgIEVGSV9OQVRJVkVfSU5URVJGQUNF LA0KDQorICAgICAgICAgICAgICAgICAgJihVc2JFdGhEcml2ZXItPlVzYkV0aCkNCg0KKyAgICAg ICAgICAgICAgICAgICk7DQoNCisgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICBn QlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQor ICAgICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICBUaGlzLT5E cml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICBDb250cm9sbGVySGFuZGxlDQoNCisg ICAgICAgICAgICk7DQoNCisgICAgZ0JTLT5GcmVlUG9vbCAoVXNiRXRoRHJpdmVyKTsNCg0KKyAg ICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30N Cg0KKw0KDQorLyoqDQoNCisgIFVTQiBOQ00gRHJpdmVyIEJpbmRpbmcgU3RvcC4NCg0KKw0KDQor ICBAcGFyYW1baW5dICBUaGlzICAgICAgICAgICAgICAgICAgUHJvdG9jb2wgaW5zdGFuY2UgcG9p bnRlci4NCg0KKyAgQHBhcmFtW2luXSAgQ29udHJvbGxlckhhbmRsZSAgICAgIEhhbmRsZSBvZiBk ZXZpY2UgdG8gc3RvcCBkcml2ZXIgb24NCg0KKyAgQHBhcmFtW2luXSAgTnVtYmVyT2ZDaGlsZHJl biAgICAgIE51bWJlciBvZiBIYW5kbGVzIGluIENoaWxkSGFuZGxlQnVmZmVyLiBJZiBudW1iZXIg b2YNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuIGlzIHpl cm8gc3RvcCB0aGUgZW50aXJlIGJ1cyBkcml2ZXIuDQoNCisgIEBwYXJhbVtpbl0gIENoaWxkSGFu ZGxlQnVmZmVyICAgICBMaXN0IG9mIENoaWxkIEhhbmRsZXMgdG8gU3RvcC4NCg0KKw0KDQorICBA cmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgICAgICAgVGhpcyBkcml2ZXIgaXMgcmVtb3ZlZCBD b250cm9sbGVySGFuZGxlDQoNCisgIEByZXR2YWwgb3RoZXIgICAgICAgICAgICAgICAgICAgICBU aGlzIGRyaXZlciB3YXMgbm90IHJlbW92ZWQgZnJvbSB0aGlzIGRldmljZQ0KDQorDQoNCisqKi8N Cg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorVXNiTmNtRHJpdmVyU3RvcCAoDQoNCisgIElO ICBFRklfRFJJVkVSX0JJTkRJTkdfUFJPVE9DT0wgICpUaGlzLA0KDQorICBJTiAgRUZJX0hBTkRM RSAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICBJTiAgVUlOVE4gICAg ICAgICAgICAgICAgICAgICAgICBOdW1iZXJPZkNoaWxkcmVuLA0KDQorICBJTiAgRUZJX0hBTkRM RSAgICAgICAgICAgICAgICAgICAqQ2hpbGRIYW5kbGVCdWZmZXINCg0KKyAgKQ0KDQorew0KDQor ICBFRklfU1RBVFVTICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVVNCX0VUSEVSTkVUX1BST1RP Q09MICAqVXNiRXRoUHJvdG9jb2w7DQoNCisgIFVTQl9FVEhFUk5FVF9EUklWRVIgICAgKlVzYkV0 aERyaXZlcjsNCg0KKw0KDQorICBTdGF0dXMgPSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAg ICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdV c2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiRXRo UHJvdG9jb2wsDQoNCisgICAgICAgICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxl LA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAg ICAgICAgIEVGSV9PUEVOX1BST1RPQ09MX0dFVF9QUk9UT0NPTA0KDQorICAgICAgICAgICAgICAg ICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBTdGF0 dXM7DQoNCisgIH0NCg0KKw0KDQorICBVc2JFdGhEcml2ZXIgPSBVU0JfRVRIRVJORVRfREVWX0ZS T01fVEhJUyAoVXNiRXRoUHJvdG9jb2wpOw0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+VW5pbnN0 YWxsUHJvdG9jb2xJbnRlcmZhY2UgKA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhh bmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnVXNiRXRoUHJvdG9jb2xHdWlkLA0KDQorICAg ICAgICAgICAgICAgICAgVXNiRXRoUHJvdG9jb2wNCg0KKyAgICAgICAgICAgICAgICAgICk7DQoN CisgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICByZXR1cm4gU3RhdHVzOw0KDQor ICB9DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5DbG9zZVByb3RvY29sICgNCg0KKyAgICAgICAg ICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICAmZ0VmaVVz YklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgVGhpcy0+RHJpdmVyQmluZGlu Z0hhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgICAg ICAgICAgICAgICAgICk7DQoNCisgIGdCUy0+R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AgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAg SU4gIFVJTlROICAgICAgICAgICAgICAgICAgICAgICAgTnVtYmVyT2ZDaGlsZHJlbiwNCg0KKyAg SU4gIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgKkNoaWxkSGFuZGxlQnVmZmVyDQoNCisg ICk7DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK0xvYWRBbGxEZXNjcmlwdG9yICgNCg0KKyAgSU4g IEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgICpVc2JJbywNCg0KKyAgT1VUIEVGSV9VU0JfQ09O RklHX0RFU0NSSVBUT1IgICoqQ29uZmlnRGVzYw0KDQorICApOw0KDQorDQoNCitCT09MRUFODQoN CitOZXh0RGVzY3JpcHRvciAoDQoNCisgIElOIEVGSV9VU0JfQ09ORklHX0RFU0NSSVBUT1IgICpE ZXNjLA0KDQorICBJTiBPVVQgVUlOVE4gICAgICAgICAgICAgICAgICAqT2Zmc2V0DQoNCisgICk7 DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK0dldEZ1bmN0aW9uYWxEZXNjcmlwdG9yICgNCg0KKyAg SU4gIEVGSV9VU0JfQ09ORklHX0RFU0NSSVBUT1IgICpDb25maWcsDQoNCisgIElOICBVSU5UOCAg ICAgICAgICAgICAgICAgICAgICBGdW5EZXNjcmlwdG9yVHlwZSwNCg0KKyAgT1VUIFZPSUQgICAg ICAgICAgICAgICAgICAgICAgICpEYXRhQnVmZmVyDQoNCisgICk7DQoNCisNCg0KK1ZPSUQNCg0K K0dldEVuZHBvaW50ICgNCg0KKyAgSU4gICAgICBFRklfVVNCX0lPX1BST1RPQ09MICAqVXNiSW8s DQoNCisgIElOIE9VVCAgVVNCX0VUSEVSTkVUX0RSSVZFUiAgKlVzYkV0aERyaXZlcg0KDQorICAp Ow0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYkV0aFJlY2VpdmUgKA0KDQor ICBJTiAgICAgUFhFX0NEQiAgICAgICAgICAgICAgICAqQ2RiLA0KDQorICBJTiAgICAgVVNCX0VU SEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4gT1VUIFZPSUQgICAgICAgICAgICAgICAg ICAgKlBhY2tldCwNCg0KKyAgSU4gT1VUIFVJTlROICAgICAgICAgICAgICAgICAgKlBhY2tldExl bmd0aA0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYkV0aFRy YW5zbWl0ICgNCg0KKyAgSU4gICAgICBQWEVfQ0RCICAgICAgICAgICAgICAgICpDZGIsDQoNCisg IElOICAgICAgVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4gICAgICBWT0lE ICAgICAgICAgICAgICAgICAgICpQYWNrZXQsDQoNCisgIElOIE9VVCAgVUlOVE4gICAgICAgICAg ICAgICAgICAqUGFja2V0TGVuZ3RoDQoNCisgICk7DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK0VG SUFQSQ0KDQorVXNiRXRoSW50ZXJydXB0ICgNCg0KKyAgSU4gVVNCX0VUSEVSTkVUX1BST1RPQ09M ICAgKlRoaXMsDQoNCisgIElOIEJPT0xFQU4gICAgICAgICAgICAgICAgIElzTmV3VHJhbnNmZXIs DQoNCisgIElOIFVJTlROICAgICAgICAgICAgICAgICAgIFBvbGxpbmdJbnRlcnZhbCwNCg0KKyAg SU4gRUZJX1VTQl9ERVZJQ0VfUkVRVUVTVCAgKlJlcXVlc3QNCg0KKyAgKTsNCg0KKw0KDQorRUZJ X1NUQVRVUw0KDQorRUZJQVBJDQoNCitJbnRlcnJ1cHRDYWxsYmFjayAoDQoNCisgIElOICBWT0lE ICAgICpEYXRhLA0KDQorICBJTiAgVUlOVE4gICBEYXRhTGVuZ3RoLA0KDQorICBJTiAgVk9JRCAg ICAqQ29udGV4dCwNCg0KKyAgSU4gIFVJTlQzMiAgU3RhdHVzDQoNCisgICk7DQoNCis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itFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1NldFVzYkV0aE1j YXN0RmlsdGVyICgNCg0KKyAgSU4gVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAg SU4gVUlOVDE2ICAgICAgICAgICAgICAgICBWYWx1ZSwNCg0KKyAgSU4gVk9JRCAgICAgICAgICAg ICAgICAgICAqTWNhc3RBZGRyDQoNCisgICk7DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQ SQ0KDQorU2V0VXNiRXRoUG93ZXJGaWx0ZXIgKA0KDQorICBJTiBVU0JfRVRIRVJORVRfUFJPVE9D T0wgICpUaGlzLA0KDQorICBJTiBVSU5UMTYgICAgICAgICAgICAgICAgIFZhbHVlLA0KDQorICBJ TiBVSU5UMTYgICAgICAgICAgICAgICAgIExlbmd0aCwNCg0KKyAgSU4gVk9JRCAgICAgICAgICAg ICAgICAgICAqUGF0dGVybkZpbHRlcg0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitF RklBUEkNCg0KK0dldFVzYkV0aFBvd2VyRmlsdGVyICgNCg0KKyAgSU4gIFVTQl9FVEhFUk5FVF9Q Uk9UT0NPTCAgKlRoaXMsDQoNCisgIElOICBVSU5UMTYgICAgICAgICAgICAgICAgIFZhbHVlLA0K DQorICBPVVQgQk9PTEVBTiAgICAgICAgICAgICAgICAqUGF0dGVybkFjdGl2ZQ0KDQorICApOw0K DQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1NldFVzYkV0aFBhY2tldEZpbHRlciAo DQoNCisgIElOIFVTQl9FVEhFUk5FVF9QUk9UT0NPTCAgKlRoaXMsDQoNCisgIElOIFVJTlQxNiAg ICAgICAgICAgICAgICAgVmFsdWUNCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorRUZJ QVBJDQoNCitHZXRVc2JFdGhTdGF0aXN0aWMgKA0KDQorICBJTiAgVVNCX0VUSEVSTkVUX1BST1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KDQorICAgICAgICAgICAgICBEYXRhQnVmZmVyLA0KDQor ICAgICAgICAgICAgICAoVVNCX0hFQURFUl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0K KyAgICAgICAgICAgICAgc2l6ZW9mIChVU0JfSEVBREVSX0ZVTl9ERVNDUklQVE9SKQ0KDQorICAg ICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUNDRVNTOw0KDQorICAg ICAgICAgIGNhc2UgVU5JT05fRlVOX0RFU0NSSVBUT1I6DQoNCisgICAgICAgICAgICBDb3B5TWVt ICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAgICAgICAgICAgKFVTQl9V TklPTl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAgICAgICAgICAgICAgKChVU0Jf VU5JT05fRlVOX0RFU0NSSVBUT1IgKilJbnRlcmZhY2UpLT5GdW5jdGlvbkxlbmd0aA0KDQorICAg ICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUNDRVNTOw0KDQorICAg ICAgICAgIGNhc2UgRVRIRVJORVRfRlVOX0RFU0NSSVBUT1I6DQoNCisgICAgICAgICAgICBDb3B5 TWVtICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAgICAgICAgICAgKFVT Ql9FVEhFUk5FVF9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAgICAgICAgICAgICAg c2l6ZW9mIChVU0JfRVRIRVJORVRfRlVOX0RFU0NSSVBUT1IpDQoNCisgICAgICAgICAgICAgICk7 DQoNCisgICAgICAgICAgICByZXR1cm4gRUZJX1NVQ0NFU1M7DQoNCisgICAgICAgICAgZGVmYXVs dDoNCg0KKyAgICAgICAgICAgIFN0YXR1cyA9IEVGSV9VTlNVUFBPUlRFRDsNCg0KKyAgICAgICAg ICAgIGJyZWFrOw0KDQorICA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ZWQgaW4gc3RhdHVzLg0KDQorICBAcmV0dmFs IEVGSV9JTlZBTElEX1BBUkFNRVRFICBPbmUgb3IgbW9yZSBwYXJhbWV0ZXJzIGFyZSBpbnZhbGlk Lg0KDQorICBAcmV0dmFsIEVGSV9PVVRfT0ZfUkVTT1VSQ0VTICBUaGUgcmVxdWVzdCBjb3VsZCBu b3QgYmUgc3VibWl0dGVkIGR1ZSB0byBhIGxhY2sgb2YgcmVzb3VyY2VzLg0KDQorICBAcmV0dmFs IEVGSV9USU1FT1VUICAgICAgICAgICBUaGUgY29udHJvbCB0cmFuc2ZlciBmYWlscyBkdWUgdG8g dGltZW91dC4NCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYkV0 aFJlY2VpdmUgKA0KDQorICBJTiAgICAgUFhFX0NEQiAgICAgICAgICAgICAgICAqQ2RiLA0KDQor ICBJTiAgICAgVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4gT1VUIFZPSUQg ICAgICAgICAgICAgICAgICAgKlBhY2tldCwNCg0KKyAgSU4gT1VUIFVJTlROICAgICAgICAgICAg ICAgICAgKlBhY2tldExlbmd0aA0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAg ICAgICAgICAgICAgU3RhdHVzOw0KDQorICBVU0JfRVRIRVJORVRfRFJJVkVSICAgICAgICAgICpV c2JFdGhEcml2ZXI7DQoNCisgIEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgICAgKlVzYklvOw0K DQorICBVSU5UMzIgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zU3RhdHVzOw0KDQorICBVSU5U OCAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4Ow0KDQorICBVSU5UTiAgICAgICAgICAgICAg ICAgICAgICAgIEJ1bGtEYXRhTGVuZ2h0Ow0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAg ICAgIFRvdGFsTGVuZ3RoID0g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PlRvdGFs RGF0YWdyYW0gPSAwOw0KDQorDQoNCisgICAgU3RhdHVzID0gVXNiSW8tPlVzYkJ1bGtUcmFuc2Zl ciAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgVXNiSW8sDQoNCisgICAgICAgICAgICAgICAg ICAgICAgVXNiRXRoRHJpdmVyLT5CdWxrSW5FbmRwb2ludCwNCg0KKyAgICAgICAgICAgICAgICAg ICAgICBVc2JFdGhEcml2ZXItPkJ1bGtCdWZmZXIsDQoNCisgICAgICAgICAgICAgICAgICAgICAg JkJ1bGtEYXRhTGVuZ2h0LA0KDQorICAgICAgICAgICAgICAgICAgICAgIFVTQl9FVEhFUk5FVF9C VUxLX1RJTUVPVVQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgJlRyYW5zU3RhdHVzDQoNCisg ICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7 DQoNCisgICAgICByZXR1cm4gU3RhdHVzOw0KDQorICAgIH0NCg0KKw0KDQorICAgIE50aCAgICAg ICAgICAgICAgICAgICAgICAgICA9IChVU0JfTkNNX1RSQU5TRkVSX0hFQURFUl8xNiAqKVVzYkV0 aERyaXZlci0+QnVsa0J1ZmZlcjsNCg0KKyAgICBOZHAgICAgICAgICAgICAgICAgICAgICAgICAg PSAoVVNCX05DTV9EQVRBR1JBTV9QT0lOVEVSXzE2ICopKChVSU5UOCAqKVVzYkV0aERyaXZlci0+ QnVsa0J1ZmZlciArIE50aC0+TmRwSW5kZXgpOw0KDQorICAgIERhdGFncmFtICAgICAgICAgICAg ICAgICAgICA9IChVU0JfTkNNX0RBVEFfR1JBTSAqKSgoVUlOVDggKilOZHAgKyBzaXplb2YgKFVT Ql9OQ01fREFUQUdSQU1fUE9JTlRFUl8xNikpOw0KDQorICAgIFVzYkV0aERyaXZlci0+VG90YWxE YXRhZ3JhbSA9IChVSU5UOCkoKE5kcC0+TGVuZ3RoIC0gOCkgLyA0IC0gMS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fUFJPVE9DT0wgICAgICAgICAgKlVzYklvOw0KDQorICBV SU5UMzIgICAgICAgICAgICAgICAgICAgICAgIFRyYW5zU3RhdHVzOw0KDQorICBVU0JfTkNNX1RS QU5TRkVSX0hFQURFUl8xNiAgICpOdGg7DQoNCisgIFVTQl9OQ01fREFUQUdSQU1fUE9JTlRFUl8x NiAgKk5kcDsNCg0KKyAgVVNCX05DTV9EQVRBX0dSQU0gICAgICAgICAgICAqRGF0YWdyYW07DQoN CisgIFVJTlQ4ICAgICAgICAgICAgICAgICAgICAgICAgKlRvdGFsUGFja2V0Ow0KDQorICBVSU5U TiAgICAgICAgICAgICAgICAgICAgICAgIFRvdGFsTGVuZ3RoOw0KDQorDQoNCisgIFVzYkV0aERy aXZlciA9IFVTQl9FVEhFUk5FVF9ERVZfRlJPTV9USElTIChUaGlzKTsNCg0KKw0KDQorICBTdGF0 dXMgPSBnQlMtPkhhbmRsZVByb3RvY29sICgNCg0KKyAgICAgICAgICAgICAgICAgIFVzYkV0aERy aXZlci0+VXNiQ2RjRGF0YUhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpVXNiSW9Q cm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiSW8NCg0KKyAg ICAgICAgICAgICAgICAgICk7DQoNCisgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAg ICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAgaWYgKFVzYkV0aERyaXZlci0+QnVs a091dEVuZHBvaW50ID09IDApIHsNCg0KKyAgICBHZXRFbmRwb2ludCAoVXNiSW8sIFVzYkV0aERy aXZlcik7DQoNCisgIH0NCg0KKw0KDQorICBUb3RhbExlbmd0aCA9IChVSU5UTikoVVNCX05DTV9O VEhfTEVOR1RIICsgVVNCX05DTV9ORFBfTEVOR1RIICsgKCpQYWNrZXRMZW5ndGgpKTsNCg0KKw0K DQorICBTdGF0dXMgPSBnQlM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BR1JBTV9QT0lOVEVS XzE2KSk7DQoNCisgIERhdGFncmFtLT5EYXRhZ3JhbUluZGV4ICA9IE50aC0+SGVhZGVyTGVuZ3Ro ICsgTmRwLT5MZW5ndGg7DQoNCisgIERhdGFncmFtLT5EYXRhZ3JhbUxlbmd0aCA9IChVSU5UMTYp KlBhY2tldExlbmd0aDsNCg0KKw0KDQorICBDb3B5TWVtIChUb3RhbFBhY2tldCArIERhdGFncmFt LT5EYXRhZ3JhbUluZGV4LCBQYWNrZXQsICpQYWNrZXRMZW5ndGgpOw0KDQorDQoNCisgICpQYWNr ZXRMZW5ndGggPSBUb3RhbExlbmd0aDsNCg0KKw0KDQorICBTdGF0dXMgPSBVc2JJby0+VXNiQnVs a1RyYW5zZmVyICgNCg0KKyAgICAgICAgICAgICAgICAgICAgVXNiSW8sDQoNCisgICAgICAgICAg ICAgICAgICAgIFVzYkV0aERyaXZlci0+QnVsa091dEVuZHBvaW50LA0KDQorICAgICAgICAgICAg ICAgICAgICBUb3RhbFBhY2tldCwNCg0KKyAgICAgICAgICAgICAgICAgICAgUGFja2V0TGVuZ3Ro LA0KDQorICAgICAgICAgICAgICAgICAgICBVU0JfRVRIRVJORVRfQlVMS19USU1FT1VULA0KDQor ICAgICAgICAgICAgICAgICAgICAmVHJhbnNTdGF0dXMNCg0KKyAgICAgICAgICAgICAgICAgICAg KTsNCg0KKyAgZ0JTLT5GcmVlUG9vbCAoVG90YWxQYWNrZXQpOw0KDQorICByZXR1cm4gU3RhdHVz Ow0KDQorfQ0KDQorDQoNCisvKioNCg0KKyAgQXN5bmMgVVNCIHRyYW5zZmVyIGNhbGxiYWNrIHJv dXRpbmUuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgRGF0YSAgICAgICAgICAgIERhdGEgcmVjZWl2 ZWQgb3Igc2VudCB2aWEgdGhlIFVTQiBBc3luY2hyb25vdXMgVHJhbnNmZXIsIGlmIHRoZQ0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdH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orICBVU0JfRVRIRVJORVRfRFJJ VkVSICAqVXNiRXRoRHJpdmVyOw0KDQorICBVSU5UTiAgICAgICAgICAgICAgICBEYXRhTGVuZ3Ro ID0gMDsNCg0KKw0KDQorICBVc2JFdGhEcml2ZXIgPSBVU0JfRVRIRVJORVRfREVWX0ZST01fVEhJ UyAoVGhpcyk7DQoNCisgIGlmIChJc05ld1RyYW5zZmVyID09IFRSVUUpIHsNCg0KKyAgICBEYXRh TGVuZ3RoID0gc2l6ZW9mIChFRklfVVNCX0RFVklDRV9SRVFVRVNUKSArIHNpemVvZiAoVVNCX0NP Tk5FQ1RfU1BFRURfQ0hBTkdFKTsNCg0KKyAgICBTdGF0dXMgICAgID0gVXNiRXRoRHJpdmVyLT5V c2JJby0+VXNiQXN5bmNJbnRlcnJ1cHRUcmFuc2ZlciAoDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5Vc2JJbywNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVc2JFdGhEcml2ZXItPkludGVycnVwdEVuZHBv aW50LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElzTmV3VHJh bnNmZXIsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUG9sbGlu Z0ludGVydmFsLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERh dGFMZW5ndGgsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEVG SV9BU1lOQ19VU0JfVFJBTlNGRVJfQ0FMTEJBQ0spSW50ZXJydXB0Q2FsbGJhY2ssDQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVxdWVzdA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7DQoNCisgIH0gZWxzZSB7DQoNCisgICAg U3RhdHVzID0gVXNiRXRoRHJpdmVyLT5Vc2JJby0+VXNiQXN5bmNJbnRlcnJ1cHRUcmFuc2ZlciAo DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVc2JFdGhEcml2ZXItPlVz YklvLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVy LT5JbnRlcnJ1cHRFbmRwb2ludCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIElzTmV3VHJhbnNmZXIsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAwLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwNCg0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBOVUxMDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICApOw0KDQorICB9DQoNCisNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0K DQorLyoqDQoNCisgIFJldHJpZXZlcyB0aGUgVVNCIEV0aGVybmV0IE1hYyBBZGRyZXNzLg0KDQor DQoNCisgIEBwYXJhbVtpbl0gIFRoaXMgICAgICAgICAgQSBwb2ludGVyIHRvIHRoZSBVU0JfRVRI RVJORVRfUFJPVE9DT0wgaW5zdGFuY2UuDQoNCisgIEBwYXJhbVtvdXRdIE1hY0FkZHJlc3MgICAg QSBwb2ludGVyIHRvIHRoZSBjYWxsZXIgYWxsb2NhdGVkIFVTQiBFdGhlcm5ldCBNYWMgQWRkcmVz cy4NCg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgICBUaGUgVVNCIEhlYWRl ciBGdW5jdGlvbmFsIGRlc2NyaXB0b3Igd2FzIHJldHJpZXZlZCBzdWNjZXNzZnVsbHkuDQoNCisg IEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIFVzYkhlYWRlckZ1bkRlc2NyaXB0b3IgaXMg TlVMTC4NCg0KKyAgQHJldHZhbCBFRklfTk9UX0ZPVU5EICAgICAgICAgVGhlIFVTQiBIZWFkZXIg RnVuY3Rpb25hbCBkZXNjcmlwdG9yIHdhcyBub3QgZm91bmQuDQoNCisNCg0KKyoqLw0KDQorRUZJ X1NUQVRVUw0KDQorRUZJQVBJDQoNCitHZXRVc2JFdGhNYWNBZGRyZXNzICgNCg0KKyAgSU4gIFVT Ql9FVEhFUk5FVF9QUk9UT0NPTCAgKlRoaXMsDQoNCisgIE9VVCBFRklfTUFDX0FERFJFU1MgICAg ICAgICpNYWNBZGRyZXNzDQoNCisgICkNCg0KK3sNCg0KKyAgRUZJX1NUQVRVUyAgICAgICAgICAg ICAgICAgICBTdGF0dXM7DQoNCisgIFVTQl9FVEhFUk5FVF9EUklWRVIgICAgICAgICAgKlVzYkV0 aERyaXZlcjsNCg0KKyAgVVNCX0VUSEVSTkVUX0ZVTl9ERVNDUklQVE9SICBVc2JFdGhEZXNjcmlw dG9yOw0KDQorICBDSEFSMTYgICAgICAgICAgICAgICAgICAgICAgICpEYXRhOw0KDQorICBDSEFS MTYgICAgICAgICAgICAgICAgICAgICAgICpEYXRhUHRyOw0KDQorICBDSEFSMTYgICAgICAgICAg ICAgICAgICAgICAgIFRtcFN0clsxXTsNCg0KKyAgVUlOVDggICAgICAgICAgICAgICAgICAgICAg ICBJbmRleDsNCg0KKyAgVUlOVDggICAgICAgICAgICAgICAgICAgICAgICBIaTsNCg0KKyAgVUlO VDggICAgICAgICAgICAgICAgICAgICAgICBMb3c7DQoNCisNCg0KKyAgVXNiRXRoRHJpdmVyID0g VVNCX0VUSEVSTkVUX0RFVl9GUk9NX1RISVMgKFRoaXMpOw0KDQorDQoNCisgIFN0YXR1cyA9IFRo aXMtPlVzYkV0aEZ1bkRlc2NyaXB0b3IgKFRoaXMsICZVc2JFdGhEZXNjcmlwdG9yKTsNCg0KKyAg QVNTRVJUX0VGSV9FUlJPUiAoU3RhdHVzKTsNCg0KKw0KDQorICBTdGF0dXMgPSBVc2JFdGhEcml2 ZXItPlVzYklvLT5Vc2JHZXRTdHJpbmdEZXNjcmlwdG9yICgNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBVc2JFdGhEcml2ZXItPlVzYklvLA0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIDB4NDA5LCAgICAgICAgICAgICAgICAgICAgICAgIC8vIEVuZ2xp c2gtVVMgTGFuZ3VhZ2UgSUQNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBV c2JFdGhEZXNjcmlwdG9yLk1hY0FkZHJlc3MsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgJkRhdGENCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOw0K DQorICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMpOw0KDQorDQoNCisgIERhdGFQdHIgPSBEYXRh Ow0KDQorICBmb3IgKEluZGV4ID0gMDsgSW5kZXggPCBQWEVfSFdBRERSX0xFTl9FVEhFUjsgSW5k ZXgrKykgew0KDQorICAgIENvcHlNZW0gKFRtcFN0ciwgRGF0YVB0ciwgc2l6ZW9mIChDSEFSMTYp KTsNCg0KKyAgICBEYXRhUHRyKys7DQoNCisgICAgSGkgPSAoVUlOVDgpU3RySGV4VG9VaW50biAo VG1wU3RyKTsNCg0KKyAgICBDb3B5TWVtIChUbXBTdHIsIERhdGFQdHIsIHNpemVvZiAoQ0hBUjE2 KSk7DQoNCisgICAgRGF0YVB0cisrOw0KDQorICAgIExvdyAgICAgICAgICAgICAgICAgICAgID0g KFVJTlQ4KVN0ckhleFRvVWludG4gKFRtcFN0cik7DQoNCisgICAgTWFjQWRkcmVzcy0+QWRkcltJ bmRleF0gPSAoSGkgPDwgNCkgfCBMb3c7DQoNCisgIH0NCg0KKw0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NCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVXNiRXRoRHJpdmVyLT5Vc2JJbywNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJlJlcXVlc3QsDQoNCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIEVmaVVzYkRhdGFPdXQsDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIFVTQl9FVEhFUk5FVF9UUkFOU0ZFUl9USU1FT1VULA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBNY2FzdEFkZHIsDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIFJlcXVlc3QuTGVuZ3RoLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAmVHJhbnNTdGF0dXMNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg KTsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFRoaXMgcmVxdWVzdCBzZXRzIHVwIHRoZSBzcGVj aWZpZWQgRXRoZXJuZXQgcG93ZXIgbWFuYWdlbWVudCBwYXR0ZXJuIGZpbHRlciBhcw0KDQorICBk ZXNjcmliZWQgaW4gdGhlIGRhdGEgc3RydWN0dXJlLg0KDQorDQoNCisgIEBwYXJhbVtpbl0gIFRo aXMgICAgICAgICAgICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIFVTQl9FVEhFUk5FVF9QUk9UT0NP TCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFtW2luXSAgVmFsdWUgICAgICAgICAgICAgICAgIE51bWJl ciBvZiBmaWx0ZXJzLg0KDQorICBAcGFyYW1baW5dICBMZW5ndGggICAgICAgICAgICAgICAgU2l6 ZSBvZiB0aGUgcG93ZXIgbWFuYWdlbWVudCBwYXR0ZXJuIGZpbHRlciBkYXRhLg0KDQorICBAcGFy YW1baW5dICBQYXR0ZXJuRmlsdGVyICAgICAgICAgQSBwb2ludGVyIHRvIHRoZSBwb3dl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01fVEhJUyAoVGhpcyk7DQoNCisNCg0KKyAgUmVxdWVzdC5SZXF1ZXN0 VHlwZSA9IFVTQl9FVEhSVE5FVF9TRVRfUkVRX1RZUEU7DQoNCisgIFJlcXVlc3QuUmVxdWVzdCAg ICAgPSBTRVRfRVRIX1BPV0VSX01BTkFHRU1FTlRfUEFUVEVSTl9GSUxURVJfUkVROw0KDQorICBS ZXF1ZXN0LlZhbHVlICAgICAgID0gVmFsdWU7DQoNCisgIFJlcXVlc3QuSW5kZXggICAgICAgPSBV c2JFdGhEcml2ZXItPk51bU9mSW50ZXJmYWNlOw0KDQorICBSZXF1ZXN0Lkxlbmd0aCAgICAgID0g TGVuZ3RoOw0KDQorDQoNCisgIHJldHVybiBVc2JFdGhEcml2ZXItPlVzYklvLT5Vc2JDb250cm9s VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVc2JFdGhEcml2 ZXItPlVzYklvLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUmVxdWVzdCwN Cg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWZpVXNiRGF0YU91dCwNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVVNCX0VUSEVSTkVUX1RSQU5TRkVSX1RJTUVP VVQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhdHRlcm5GaWx0ZXIsDQoN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExlbmd0aCwNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgJlRyYW5zU3RhdHVzDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICk7DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBUaGlzIHJlcXVlc3QgcmV0 cmlldmVzIHRoZSBzdGF0dXMgb2YgdGhlIHNwZWNpZmllZCBFdGhlcm5ldCBwb3dlciBtYW5hZ2Vt ZW50DQoNCisgIHBhd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orICApDQoNCit7DQoNCisg IEVGSV9VU0JfREVWSUNFX1JFUVVFU1QgIFJlcXVlc3Q7DQoNCisgIFVJTlQzMiAgICAgICAgICAg ICAgICAgIFRyYW5zU3RhdHVzOw0KDQorICBVU0JfRVRIRVJORVRfRFJJVkVSICAgICAqVXNiRXRo RHJpdmVyOw0KDQorDQoNCisgIFVzYkV0aERyaXZlciA9IFVTQl9FVEhFUk5FVF9ERVZfRlJPTV9U SElTIChUaGlzKTsNCg0KKw0KDQorICBSZXF1ZXN0LlJlcXVlc3RUeXBlID0gVVNCX0VUSEVSTkVU X0dFVF9SRVFfVFlQRTsNCg0KKyAgUmVxdWVzdC5SZXF1ZXN0ICAgICA9IEdFVF9FVEhfUE9XRVJf TUFOQUdFTUVOVF9QQVRURVJOX0ZJTFRFUl9SRVE7DQoNCisgIFJlcXVlc3QuVmFsdWUgICAgICAg PSBWYWx1ZTsNCg0KKyAgUmVxdWVzdC5JbmRleCAgICAgICA9IFVzYkV0aERyaXZlci0+TnVtT2ZJ bnRlcmZhY2U7DQoNCisgIFJlcXVlc3QuTGVuZ3RoICAgICAgPSBVU0JfRVRIX1BPV0VSX0ZJTFRF Ul9MRU5HVEg7DQoNCisNCg0KKyAgcmV0dXJuIFVzYkV0aERyaXZlci0+VXNiSW8tPlVzYkNvbnRy b2xUcmFuc2ZlciAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYkV0aERy aXZlci0+VXNiSW8sDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZSZXF1ZXN0 LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZmlVc2JEYXRhSW4sDQoNCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9FVEhFUk5FVF9UUkFOU0ZFUl9USU1F T1VULA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXR0ZXJuQWN0aXZlLA0K DQorICAgICAgICAgICAgICAgICAgICAgICA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DQoNCisgIFJlcXVlc3QuVmFsdWUgICAgICAgPSBDb21tYW5kRmlsdGVyOw0K DQorICBSZXF1ZXN0LkluZGV4ICAgICAgID0gVXNiRXRoRHJpdmVyLT5OdW1PZkludGVyZmFjZTsN Cg0KKyAgUmVxdWVzdC5MZW5ndGggICAgICA9IFVTQl9FVEhfUEFDS0VUX0ZJTFRFUl9MRU5HVEg7 DQoNCisNCg0KKyAgcmV0dXJuIFVzYkV0aERyaXZlci0+VXNiSW8tPlVzYkNvbnRyb2xUcmFuc2Zl ciAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYkV0aERyaXZlci0+VXNi SW8sDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZSZXF1ZXN0LA0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZmlVc2JOb0RhdGEsDQoNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIFVTQl9FVEhFUk5FVF9UUkFOU0ZFUl9USU1FT1VULA0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBVU0JfRVRIX1BBQ0tFVF9GSUxURVJfTEVOR1RILA0KDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAmVHJhbnNTdGF0dXMNCg0KKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKTsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFRoaXMgcmVxdWVz dCBpcyB1c2VkIHRvIHJldHJpZXZlIGEgc3RhdGlzdGljIGJhc2VkIG9uIHRoZSBmZWF0dXJlIHNl bGVjdG9yLg0KDQorDQoNCisgIEBwYXJhbVtpbl0gIFRoaXMgICAgICAgICAgICAgICAgICBBIHBv aW50ZXIgdG8gdGhlIFVTQl9FVEhFUk5FVF9QUk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFt W2luXSAgRmVhdHV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AgICAgICAgICAgICAgICAmUmVxdWVzdCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgRWZpVXNiRGF0YUluLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBVU0JfRVRIRVJORVRfVFJBTlNGRVJfVElNRU9VVCwNCg0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgU3RhdGlzdGljLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBVU0JfRVRIX1NUQVRJU1RJQywNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg JlRyYW5zU3RhdHVzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7DQoNCit9 DQoNCmRpZmYgLS1naXQgYS9Vc2JOZXR3b3JrUGtnL1VzYk5ldHdvcmtQa2cuZGVjIGIvVXNiTmV0 d29ya1BrZy9Vc2JOZXR3b3JrUGtnLmRlYw0KbmV3IGZpbGUgbW9kZSAxMDA2NDQNCmluZGV4IDAw MDAwMDAwMDAuLjRmZmFmZDk5ZWQNCi0tLSAvZGV2L251bGwNCisrKyBiL1VzYk5ldHdvcmtQa2cv VXNiTmV0d29ya1BrZy5kZWMNCkBAIC0wLDAgKzEsMzIgQEANCisjIyBAZmlsZQ0KKyMgIFRoaXMg cGFja2FnZSBkZWZpbmVzIFVzYiBuZXR3b3JrIHNwZWNpZmljIGludGVyZmFjZXMgYW5kIGxpYnJh cnkgY2xhc3Nlcw0KKyMgIGFzIHdlbGwgYXMgY29uZmlndXJhdGlvbiBmb3Igc3RhbmRhcmQgZWRr MiBwYWNrYWdlcy4NCisjDQorIyAgQ29weXJpZ2h0IChjKSAxOTg1IC0gMjAyMiwgQU1JLiBBbGwg cmlnaHRzIHJlc2VydmVkLjxCUj4NCisjICBTdWJqZWN0IHRvIEFNSSBsaWNlbnNpbmcgYWdyZWVt ZW50Lg0KKyMjDQorDQorW0RlZmluZXNdDQorICBERUNfU1BFQ0lGSUNBV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CisNCg0KK0VGSV9TVEFUVVMNCg0KK0VGSUFQSQ0KDQorVXNiUm5kaXNDb21wb25lbnROYW1l R2V0RHJpdmVyTmFtZSAoDQoNCisgIElOICBFRklfQ09NUE9ORU5UX05BTUVfUFJPVE9DT0wgICpU aGlzLA0KDQorICBJTiAgQ0hBUjggICAgICAgICAgICAgICAgICAgICAgICAqTGFuZ3VhZ2UsDQoN CisgIE9VVCBDSEFSMTYgICAgICAgICAgICAgICAgICAgICAgICoqRHJpdmVyTmFtZQ0KDQorICAp Ow0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYlJuZGlzQ29tcG9uZW50TmFt ZUdldENvbnRyb2xsZXJOYW1lICgNCg0KKyAgSU4gRUZJX0NPTVBPTkVOVF9OQU1FX1BST1RPQ09M ICAqVGhpcywNCg0KKyAgSU4gRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDb250cm9sbGVy LA0KDQorICBJTiBFRklfSEFORExFICAgICAgICAgICAgICAgICAgIENoaWxkSGFuZGxlICAgICAg ICBPUFRJT05BTCwNCg0KKyAgSU4gQ0hBUjggICAgICAgICAgICAgICAgICAgICAgICAqTGFuZ3Vh Z2UsDQoNCisgIE9VVCBDSEFSMTYgICAgICAgICAgICAgICAgICAgICAgKipDb250cm9sbGVyTmFt ZQ0KDQorICApOw0KDQorDQoNCitHTE9CQUxfUkVNT1ZFX0lGX1VOUkVGRVJFTkNFRCBFRklfQ09N UE9ORU5UX05BTUVfUFJPVE9DT0wgIGdVc2JSbmRpc0NvbXBvbmVudE5hbWUgPSB7DQoNCisgIFVz YlJuZGlzQ29tcG9uZW50TmFtZUdldERyaXZlck5hbWUsDQoNCisgIFVzYlJuZGlzQ29tcG9uZW50 TmFtZUdldENvbnRyb2xsZXJOYW1lLA0KDQorICAiZW5nIg0KDQorfTsNCg0KKw0KDQorR0xPQkFM X1JFTU9WRV9JRl9VTlJFRkVSRU5DRUQgRUZJX0NPTVBPTkVOVF9OQU1FM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wb2ludGVyIHRvIHRoZSBF RklfQ09NUE9ORU5UX05BTUUyX1BST1RPQ09MIG9yDQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIEVGSV9DT01QT05FTlRfTkFNRV9QUk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBh cmFtW2luXSAgTGFuZ3VhZ2UgICAgICAgICAgQSBwb2ludGVyIHRvIGEgTnVsbC10ZXJtaW5hdGVk IEFTQ0lJIHN0cmluZw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheSBp bmRpY2F0aW5nIHRoZSBsYW5ndWFnZS4gVGhpcyBpcyB0aGUNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgbGFuZ3VhZ2Ugb2YgdGhlIGRyaXZlciBuYW1lIHRoYXQgdGhlIGNhbGxl ciBpcw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0aW5nLCBhbmQg aXQgbXVzdCBtYXRjaCBvbmUgb2YgdGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGxhbmd1YWdlcyBzcGVjaWZpZWQgaW4gU3VwcG9ydGVkTGFuZ3VhZ2VzLiBUaGUNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyIG9mIGxhbmd1YWdlcyBzdXBwb3J0 ZWQgYnkgYSBkcml2ZXIgaXMgdXANCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg dG8gdGhlIGRyaXZlciB3cml0ZXIuIExhbmd1YWdlIGlzIHNwZWNpZmllZA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBpbiBSRkMgNDY0NiBvciBJU08gNjM5LTIgbGFuZ3VhZ2Ug Y29kZSBmb3JtYXQuDQoNCisgIEBwYXJhbVtvdXRdIERyaXZlck5hbWUgICAgICAgIEEgcG9pbnRl ciB0byB0aGUgVW5pY29kZSBzdHJpbmcgdG8gcmV0dXJuLg0KDQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBUaGlzIFVuaWNvZGUgc3RyaW5nIGlzIHRoZSBuYW1lIG9mIHRoZQ0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcml2ZXIgc3BlY2lmaWVkIGJ5IFRoaXMg aW4gdGhlIGxhbmd1YWdlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNp ZmllZCBieSBMYW5ndWFnZS4NCg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAg ICBUaGUgVW5pY29kZSBzdHJpbmcgZm9yIHRoZSBEcml2ZXIgc3BlY2lmaWVkIGJ5DQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRoaXMgYW5kIHRoZSBsYW5ndWFnZSBzcGVjaWZp ZWQgYnkgTGFuZ3VhZ2Ugd2FzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJl dHVybmVkIGluIERyaXZlck5hbWUuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVS IExhbmd1YWdlIGlzIE5VTEwuDQoNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSIERy aXZlck5hbWUgaXMgTlVMTC4NCg0KKyAgQHJldHZhbCBFRklfVU5TVVBQT1JURUQgICAgICAgVGhl IGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyBkb2VzIG5vdCBzdXBwb3J0DQoNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHRoZSBsYW5ndWFnZSBzcGVjaWZpZWQgYnkgTGFuZ3VhZ2Uu DQoNCisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JSbmRpc0NvbXBv bmVudE5hbWVHZXREcml2ZXJOYW1lICgNCg0KKyAgSU4gIEVGSV9DT01QT05FTlRfTkFNRV9QUk9U T0NPTCAgK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ZSBpcyByZXR1cm5lZCBpbiBDb250cm9sbGVyTmFtZSwN Cg0KKyAgYW5kIEVGSV9TVUNDRVNTIGlzIHJldHVybmVkLiAgSWYgdGhlIGRyaXZlciBzcGVjaWZp ZWQgYnkgVGhpcyBpcyBub3QgY3VycmVudGx5DQoNCisgIG1hbmFnaW5nIHRoZSBjb250cm9sbGVy IHNwZWNpZmllZCBieSBDb250cm9sbGVySGFuZGxlIGFuZCBDaGlsZEhhbmRsZSwNCg0KKyAgdGhl biBFRklfVU5TVVBQT1JURUQgaXMgcmV0dXJuZWQuICBJZiB0aGUgZHJpdmVyIHNwZWNpZmllZCBi eSBUaGlzIGRvZXMgbm90DQoNCisgIHN1cHBvcnQgdGhlIGxhbmd1YWdlIHNwZWNpZmllZCBieSBM YW5ndWFnZSwgdGhlbiBFRklfVU5TVVBQT1JURUQgaXMgcmV0dXJuZWQuDQoNCisNCg0KKyAgQHBh cmFtW2luXSAgVGhpcyAgICAgICAgICAgICAgQSBwb2ludGVyIHRvIHRoZSBFRklfQ09NUE9ORU5U X05BTUUyX1BST1RPQ09MIG9yDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVG SV9DT01QT05FTlRfTkFNRV9QUk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFtW2luXSAgQ29u dHJvbGxlciAgICAgICAgVGhlIGhhbmRsZSBvZiBhIGNvbnRyb2xsZXIgdGhhdCB0aGUgZHJpdmVy DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpZmllZCBieSBUaGlzIGlz IG1hbmFnaW5nLiAgVGhpcyBoYW5kbGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3BlY2lmaWVzIHRoZSBjb250cm9sbGVyIHdob3NlIG5hbWUgaXMgdG8gYmUNCg0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuZWQuDQoNCisgIEBwYXJhbVtpbl0gIENo aWxkSGFuZGxlICAgICAgIFRoZSBoYW5kbGUgb2YgdGhlIGNoaWxkIGNvbnRyb2xsZXIgdG8gcmV0 cmlldmUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIG5hbWUgb2YuICBU aGlzIGlzIGFuIG9wdGlvbmFsIHBhcmFtZXRlciB0aGF0DQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIG1heSBiZSBOVUxMLiAgSXQgd2lsbCBiZSBOVUxMIGZvciBkZXZpY2UNCg0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJpdmVycy4gIEl0IHdpbGwgYWxzbyBi ZSBOVUxMIGZvciBhIGJ1cyBkcml2ZXJzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHRoYXQgd2lzaCB0byByZXRyaWV2ZSB0aGUgbmFtZSBvZiB0aGUgYnVzDQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRyb2xsZXIuICBJdCB3aWxsIG5vdCBiZSBOVUxM IGZvciBhIGJ1cw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcml2ZXIgdGhh dCB3aXNoZXMgdG8gcmV0cmlldmUgdGhlIG5hbWUgb2YgYQ0KDQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBjaGlsZCBjb250cm9sbGVyLg0KDQorICBAcGFyYW1baW5dICBMYW5ndWFn ZSAgICAgICAgICBBIHBvaW50ZXIgdG8gYSBOdWxsLXRlcm1pbmF0ZWQgQVNDSUkgc3RyaW5nDQoN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5IGluZGljYXRpbmcgdGhlIGxh bmd1YWdlLiAgVGhpcyBpcyB0aGUNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg bGFuZ3VhZ2Ugb2YgdGhlIGRyaXZlciBuYW1lIHRoYXQgdGhlIGNhbGxlciBpcw0KDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0aW5nLCBhbmQgaXQgbXVzdCBtYXRjaCBv bmUgb2YgdGhlDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlcyBz cGVjaWZpZWQgaW4gU3VwcG9ydGVkTGFuZ3VhZ2VzLiBUaGUNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgbnVtYmVyIG9mIGxhbmd1YWdlcyBzdXBwb3J0ZWQgYnkgYSBkcml2ZXIg aXMgdXANCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG8gdGhlIGRyaXZlciB3 cml0ZXIuIExhbmd1YWdlIGlzIHNwZWNpZmllZCBpbg0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBSRkMgNDY0NiBvciBJU08gNjM5LTIgbGFuZ3VhZ2UgY29kZSBmb3JtYXQuDQoN CisgIEBwYXJhbVtvdXRdIENvbnRyb2xsZXJOYW1lICAgIEEgcG9pbnRlciB0byB0aGUgVW5pY29k ZSBzdHJpbmcgdG8gcmV0dXJuLg0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBU aGlzIFVuaWNvZGUgc3RyaW5nIGlzIHRoZSBuYW1lIG9mIHRoZQ0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBjb250cm9sbGVyIHNwZWNpZmllZCBieSBDb250cm9sbGVySGFuZGxl IGFuZA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGlsZEhhbmRsZSBpbiB0 aGUgbGFuZ3VhZ2Ugc3BlY2lmaWVkIGJ5DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIExhbmd1YWdlIGZyb20gdGhlIHBvaW50IG9mIHZpZXcgb2YgdGhlIGRyaXZlcg0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZWQgYnkgVGhpcy4NCg0KKw0KDQor ICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgICBUaGUgVW5pY29kZSBzdHJpbmcgZm9yIHRo ZSB1c2VyIHJlYWRhYmxlIG5hbWUgaW4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgdGhlIGxhbmd1YWdlIHNwZWNpZmllZCBieSBMYW5ndWFnZSBmb3IgdGhlDQoNCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyB3YXMgcmV0 dXJuZWQgaW4NCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRHJpdmVyTmFtZS4N Cg0KKyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIgQ29udHJvbGxlckhhbmRsZSBpcyBu b3QgYSB2YWxpZCBFRklfSEFORExFLg0KDQorICBAcmV0dmFsIEVGSV9JTlZBTElEX1BBUkFNRVRF UiBDaGlsZEhhbmRsZSBpcyBub3QgTlVMTCBhbmQgaXQgaXMgbm90IGEgdmFsaWQNCg0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgRUZJX0hBTkRMRS4NCg0KKyAgQHJldHZhbCBFRklf SU5WQUxJRF9QQVJBTUVURVIgTGFuZ3VhZ2UgaXMgTlVMTC4NCg0KKyAgQHJldHZhbCBFRklfSU5W QUxJRF9QQVJBTUVURVIgQ29udHJvbGxlck5hbWUgaXMgTlVMTC4NCg0KKyAgQHJldHZhbCBFRklf VU5TVVBQT1JURUQgICAgICAgVGhlIGRyaXZlciBzcGVjaWZpZWQgYnkgVGhpcyBpcyBub3QgY3Vy cmVudGx5DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnaW5nIHRoZSBj b250cm9sbGVyIHNwZWNpZmllZCBieQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBDb250cm9sbGVySGFuZGxlIGFuZCBDaGlsZEhhbmRsZS4NCg0KKyAgQHJld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cgdGhpcyBDREMgRGF0YSBpcyBmb3VuZC4NCg0KKyAgQHJldHZhbCBF RklfTk9UX0ZPVU5EICAgICAgICAgICBUaGUgVVNCX1JORElTX0RFVklDRSBtYXRjaGluZyB0aGlz IENEQyBEYXRhIGlzIG5vdCBmb3VuZC4NCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitV cGRhdGVSbmRpc0RldmljZSAoDQoNCisgIElOICBFRklfREVWSUNFX1BBVEhfUFJPVE9DT0wgICpV c2JDZGNEYXRhUGF0aCwNCg0KKyAgT1VUIFVTQl9STkRJU19ERVZJQ0UgICAgICAgICAgKipVc2JS bmRpc0RldmljZQ0KDQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAg U3RhdHVzOw0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEluZGV4Ow0KDQorICBVSU5U TiAgICAgICAgICAgICAgICAgICAgIEhhbmRsZUNvdW50Ow0KDQorICBFRklfSEFORExFICAgICAg ICAgICAgICAgICpIYW5kbGVCdWZmZXI7DQoNCisgIFVTQl9FVEhFUk5FVF9QUk9UT0NPTCAgICAg KlVzYkV0aERldmljZTsNCg0KKyAgRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAqVXNiUm5kaXNE YXRhUGF0aDsNCg0KKyAgRUZJX1VTQl9JT19QUk9UT0NPTCAgICAgICAqVXNiSW87DQoNCisgIEJP T0xFQU4gICAgICAgICAgICAgICAgICAgSXNSbmRpc0ludGVyZmFjZUZsYWcgPSBGQUxTRTsNCg0K Kw0KDQorICBTdGF0dXMgPSBnQlMtPkxvY2F0ZUhhbmRsZUJ1ZmZlciAoDQoNCisgICAgICAgICAg ICAgICAgICBCeVByb3RvY29sLA0KDQorICAgICAgICAgICAgICAgICAgJmdVc2JFdGhQcm90b2Nv bEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAg JkhhbmRsZUNvdW50LA0KDQorICAgICAgICAgICAgICAgICAgJkhhbmRsZUJ1ZmZlcg0KDQorICAg ICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAg IHJldHVybiBTdGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICBmb3IgKEluZGV4ID0gMDsgSW5kZXgg PCBIYW5kbGVDb3VudDsgSW5kZXgrKykgew0KDQorICAgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJv dG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAgICBIYW5kbGVCdWZmZXJbSW5kZXhdLA0KDQor ICAgICAgICAgICAgICAgICAgICAmZ1VzYkV0aFByb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAg ICAgICAgICAgKFZPSUQgKiopJlVzYkV0aERldmljZQ0KDQorICAgICAgICAgICAgICAgICAgICAp Ow0KDQorICAgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCg0KKyAgICAgIGNvbnRpbnVlOw0K DQorICAgIH0NCg0KKw0KDQorICAgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJvdG9jb2wgKA0KDQor ICAgICAgICAgICAgICAgICAgICBIYW5kbGVCdWZmZXJbSW5kZXhdLA0KDQorICAgICAgICAgICAg ICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgICAo Vk9JRCAqKikmVXNiSW8NCg0KKyAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICBpZiAoRUZJ X0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAgICBjb250aW51ZTsNCg0KKyAgICB9DQoNCisNCg0K KyAgICBJc1JuZGlzSW50ZXJmYWNlRmxhZyA9IElzUm5kaXNJbnRlcmZhY2UgKFVzYklvKTsNCg0K KyAgICBpZiAoSXNSbmRpc0ludGVyZmFjZUZsYWcgPT0gRkFMU0UpIHsNCg0KKyAgICAgIGNvbnRp bnVlOw0KDQorICAg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KDQorICB9DQoNCisNCg0KKyAgU3RhdHVzID0gZ0JTLT5Mb2NhdGVI YW5kbGVCdWZmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgQnlQcm90b2NvbCwNCg0KKyAgICAg ICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAg ICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgJkhhbmRsZUNvdW50LA0KDQorICAgICAgICAg ICAgICAgICAgJkhhbmRsZUJ1ZmZlcg0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYg KEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybjsNCg0KKyAgfQ0KDQorDQoNCisg IGZvciAoSW5kZXggPSAwOyBJbmRleCA8IEhhbmRsZUNvdW50OyBJbmRleCsrKSB7DQoNCisgICAg U3RhdHVzID0gZ0JTLT5IYW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICAgIEhh bmRsZUJ1ZmZlcltJbmRleF0sDQoNCisgICAgICAgICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90 b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAgIChWT0lEICoqKSZVc2JJbw0KDQorICAg ICAgICAgICAgICAgICAgICApOw0KDQorICAgIEFTU0VSVF9FRklfRVJST1IgKFN0YXR1cyk7DQoN CisNCg0KKyAgICBpZiAoSXNVc2JDZGNEYXRhIChVc2JJbykpIHsNCg0KKyAgICAgIERFQlVHICgo RUZJX0RfVkVSQk9TRSwgIlJuZGlzIEZpbmRNYXRjaGluZ0NkY0RhdGEgQ0RDRGF0YSBpbnRlcmZh Y2UgZm91bmRcbiIpKTsNCg0KKw0KDQorICAgICAgU3RhdHVzID0gZ0JTLT5IYW5kbGVQcm90b2Nv bCAoDQoNCisgICAgICAgICAgICAgICAgICAgICAgSGFuZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAg ICAgICAgICAgICAgIC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AgU3Rh dHVzOw0KDQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIEluZGV4Ow0KDQorICBVSU5UTiAg ICAgICAgICAgICAgICAgICAgIEhhbmRsZUNvdW50Ow0KDQorICBFRklfSEFORExFICAgICAgICAg ICAgICAgICpIYW5kbGVCdWZmZXI7DQoNCisgIEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgKlVz YklvOw0KDQorICBFRklfREVWSUNFX1BBVEhfUFJPVE9DT0wgICpVc2JSbmRpc0RhdGFQYXRoOw0K DQorICBFRklfREVWSUNFX1BBVEhfUFJPVE9DT0wgICpVc2JDZGNEYXRhUGF0aDsNCg0KKw0KDQor ICAvLyBGaW5kIHRoZSBwYXJlbnQgUk5ESVMgYW5kIHVwZGF0ZSB0aGUgVXNiSW8gZm9yIHRoZSBD REMgZGV2aWNlDQoNCisgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJvdG9jb2wgKA0KDQorICAgICAg ICAgICAgICAgICAgQ2RjSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlEZXZpY2VQ YXRoUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVzYkNkY0Rh dGFQYXRoDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorDQoNCisgIGlmIChFRklfRVJST1Ig KFN0YXR1cykpIHsNCg0KKyAgICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAgU3Rh dHVzID0gZ0JTLT5Mb2NhdGVIYW5kbGVCdWZmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgQnlQ cm90b2NvbCwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoN CisgICAgICAgICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgJkhhbmRsZUNv dW50LA0KDQorICAgICAgICAgICAgICAgICAgJkhhbmRsZUJ1ZmZlcg0KDQorICAgICAgICAgICAg ICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBT dGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICBmb3IgKEluZGV4ID0gMDsgSW5kZXggPCBIYW5kbGVD b3VudDsgSW5kZXgrKykgew0KDQorICAgIFN0YXR1cyA9IGdCUy0+SGFuZGxlUHJvdG9jb2wgKA0K DQorICAgICAgICAgICAgICAgICAgICBIYW5kbGVCdWZmZXJbSW5kZXhdLA0KDQorICAgICAgICAg ICAgICAgICAgICAmZ0VmaVVzYklvUHJvdG9jb2xHdWlkLA0KDQorICAgICAgICAgICAgICAgICAg ICAoVk9JRCAqKikmVXNiSW8NCg0KKyAgICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgICBBU1NF UlRfRUZJX0VSUk9SIChTdGF0dXMpOw0KDQorDQoNCisgICAgaWYgKElzVXNiUm5kaXMgKFVzYklv KSkgew0KDQorICAgICAgU3RhdHVzID0gZ0JTLT5IYW5kbGVQcm90b2NvbCAoDQoNCisgICAgICAg ICAgICAgICAgICAgICAgSGFuZGxlQnVmZmVyW0luZGV4XSwNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAmZ0VmaURldmljZVBhdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAg ICAgKFZPSUQgKiopJlVzYlJuZGlzRGF0YVBhdGgNCg0KKyAgICAgICAgICAgICAgICAgICAgICAp Ow0KDQorICAgICAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgICAgICBERUJVRyAo KEVGSV9EX0VSUk9SLCAiVXNiIFJuZGlzIERldmljZVBhdGggbm90IGZvdW5kXG4iKSk7DQoNCisg ICAgICAgIGJyZWFrOw0KDQorICAgICAgfQ0KDQorDQoNCisgICAgICBTdGF0dXMgPSBJc1NhbWVE ZXZpY2UgKFVzYlJuZGlzRGF0YVBhdGgsIFVzYkNkY0RhdGFQYXRoKTsNCg0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GhpcyBkZXZpY2UuDQoNCisgIEByZXR2YWwgb3RoZXIgICAgICAgICAgICAg ICAgICAgICAgIFRoaXMgZHJpdmVyIGRvZXMgbm90IHN1cHBvcnQgdGhpcyBkZXZpY2UuDQoNCisN Cg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitVc2JSbmRpc0RyaXZlclN1cHBv cnRlZCAoDQoNCisgIElOIEVGSV9EUklWRVJfQklORElOR19QUk9UT0NPTCAgKlRoaXMsDQoNCisg IElOIEVGSV9IQU5ETEUgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAg SU4gRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVtYWluaW5nRGV2aWNlUGF0aA0KDQor ICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgIFN0YXR1czsNCg0KKyAgRUZJX1VT Ql9JT19QUk9UT0NPTCAgKlVzYklvID0gTlVMTDsNCg0KKw0KDQorICBTdGF0dXMgPSBnQlMtPk9w ZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQor ICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAg ICAgICAgIChWT0lEICoqKSZVc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgIFRoaXMtPkRyaXZl ckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0K DQorICAgICAgICAgICAgICAgICAgRUZJX09QRU5fUFJPVE9DT0xfQllfRFJJVkVSDQoNCisgICAg ICAgICAgICAgICAgICApOw0KDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAg cmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1cyA9IElzU3VwcG9ydGVkRGV2 aWNlIChVc2JJbykgPyBFRklfU1VDQ0VTUyA6IEVGSV9VTlNVUFBPUlRFRDsNCg0KKw0KDQorICBn QlMtPkNsb3NlUHJvdG9jb2wgKA0KDQorICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAg ICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICBUaGlzLT5Ecml2ZXJC aW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgQ29udHJvbGxlckhhbmRsZQ0KDQorICAgICAgICAg KTsNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFVTQiBSTkRJ UyBEcml2ZXIgQmluZGluZyBTdGFydC4NCg0KKw0KDQorICBAcGFyYW1baW5dICBUaGlzICAgICAg ICAgICAgICAgICAgICBQcm90b2NvbCBpbnN0YW5jZSBwb2ludGVyLg0KDQorICBAcGFyYW1baW5d ICBDb250cm9sbGVySGFuZGxlICAgICAgICBIYW5kbGUgb2YgZGV2aWNlIHRvIGJpbmQgZHJpdmVy IHRvLg0KDQorICBAcGFyYW1baW5dICBSZW1haW5pbmdEZXZpY2VQYXRoICAgICBPcHRpb25hbCBw YXJhbWV0ZXIgdXNlIHRvIHBpY2sgYSBzcGVjaWZpYyBjaGlsZA0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2UgdG8gc3RhcnQuDQoNCisNCg0KKyAgQHJldHZh bCBFRklfU1VDQ0VTUyAgICAgICAgICAgICAgICAgVGhpcyBkcml2ZXIgaXMgYWRkZWQgdG8gQ29u dHJvbGxlckhhbmRsZQ0KDQorICBAcmV0dmFsIEVGSV9ERVZJQ0VfRVJST1IgICAgICAgICAgICBU aGlzIGRyaXZlciBjb3VsZCBub3QgYmUgc3RhcnRlZCBkdWUgdG8gYSBkZXZpY2UgZXJyb3INCg0K KyAgQHJldHZhbCBFRklfT1VUX09GX1JFU09VUkNFUyAgICAgICAgVGhlIGRyaXZlciBjb3VsZCBu b3QgaW5zdGFsbCBzdWNjZXNzZnVsbHkgZHVlIHRvIGEgbGFjayBvZiByZXNvdXJjZXMuDQoNCisg IEByZXR2YWwgb3RoZXIgICAgICAgICAgICAgICAgICAgICAgIFRoaXMgZHJpdmVyIGRvZXMgbm90 IHN1cHBvcnQgdGhpcyBkZXZpY2UNCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitFRklB UEkNCg0KK1VzYlJuZGlzRHJpdmVyU3RhcnQgKA0KDQorICBJTiBFRklfRFJJVkVSX0JJTkRJTkdf UFJPVE9DT0wgICpUaGlzLA0KDQorICBJTiBFRklfSEFORExFICAgICAgICAgICAgICAgICAgIENv bnRyb2xsZXJIYW5kbGUsDQoNCisgIElOIEVGSV9ERVZJQ0VfUEFUSF9QUk9UT0NPTCAgICAgKlJl bWFpbmluZ0RldmljZVBhdGgNCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVTICAgICAgICAg ICAgICAgICAgICBTdGF0dXM7DQoNCisgIFVTQl9STkRJU19ERVZJQ0UgICAgICAgICAgICAgICpV c2JSbmRpc0RldmljZTsNCg0KKyAgRUZJX0RFVklDRV9QQVRIX1BST1RPQ09MICAgICAgKlVzYkV0 aFBhdGg7DQoNCisgIEVGSV9VU0JfSU9fUFJPVE9DT0wgICAgICAgICAgICpVc2JJbzsNCg0KKyAg RUZJX1VTQl9JTlRFUkZBQ0VfREVTQ1JJUFRPUiAgSW50ZXJmYWNlOw0KDQorICBFRklfSEFORExF ICAgICAgICAgICAgICAgICAgICBSbmRpc0hhbmRsZSA9IENvbnRyb2xsZXJIYW5kbGU7DQoNCisN Cg0KKyAgU3RhdHVzID0gZ0JTLT5PcGVuUHJvdG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAg Q29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2Nv bEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiSW8sDQoNCisgICAgICAg ICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAg ICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIEVGSV9PUEVOX1BST1RP Q09MX0JZX0RSSVZFUg0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJP UiAoU3RhdHVzKSkgew0KDQorICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICBT dGF0dXMgPSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9s bGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdFZmlEZXZpY2VQYXRoUHJvdG9jb2xH dWlkLA0KDQorICAgICAgICAgICAgICAgICAgKFZPSUQgKiopJlVzYkV0aFBhdGgsDQoNCisgICAg ICAgICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAg ICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIEVGSV9PUEVOX1BS T1RPQ09MX0JZX0RSSVZFUg0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9F UlJPUiAoU3RhdHVzKSkgew0KDQorICAgIGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAg ICAgIENvbnRyb2xsZXJIYW5kbGUsDQoNCisgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1 aWQsDQoNCisgICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAg ICAgIENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgICAgICAgICAgKTsNCg0KKyAgICByZXR1cm4gU3Rh dHVzOw0KDQorICB9DQoNCisNCg0KKyAgZ0JTLT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ZSAgICAgSGFuZGxlIG9mIGRldmljZSB0byBiaW5kIGRyaXZlciB0by4NCg0KKw0K DQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgIFRoaXMgZHJpdmVyIGlzIGFkZGVkIHRv IENvbnRyb2xsZXJIYW5kbGUNCg0KKyAgQHJldHZhbCBFRklfREVWSUNFX0VSUk9SICAgICBUaGlz IGRyaXZlciBjb3VsZCBub3QgYmUgc3RhcnRlZCBkdWUgdG8gYSBkZXZpY2UgZXJyb3INCg0KKyAg QHJldHZhbCBvdGhlciAgICAgICAgICAgICAgICBUaGlzIGRyaXZlciBkb2VzIG5vdCBzdXBwb3J0 IHRoaXMgZGV2aWNlDQoNCisNCg0KKyoqLw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitD aGVja2FuZFN0b3BSbmRpc0RldmljZSAoDQoNCisgIElOICBFRklfRFJJVkVSX0JJTkRJTkdfUFJP VE9DT0wgICpUaGlzLA0KDQorICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDb250 cm9sbGVySGFuZGxlDQoNCisgICkNCg0KK3sNCg0KKyAgRUZJX1NUQVRVUyAgICAgICAgICAgU3Rh dHVzOw0KDQorICBFRklfVVNCX0lPX1BST1RPQ09MICAqVXNiSW87DQoNCisNCg0KKyAgU3RhdHVz ID0gZ0JTLT5PcGVuUHJvdG9jb2wgKA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhh bmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisg ICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiSW8sDQoNCisgICAgICAgICAgICAgICAgICBU aGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgIEVGSV9PUEVOX1BST1RPQ09MX0dFVF9QUk9U T0NPTA0KDQorICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVz KSkgew0KDQorICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICBpZiAoSXNVc2JS bmRpcyAoVXNiSW8pKSB7DQoNCisgICAgU3RhdHVzID0gZ0JTLT5DbG9zZVByb3RvY29sICgNCg0K KyAgICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAgICAg ICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAgICAgICAgICAgICAgICAgVGhp cy0+RHJpdmVyQmluZGluZ0hhbmRsZSwNCg0KKyAgICAgICAgICAgICAgICAgICAgQ29udHJvbGxl ckhhbmRsZQ0KDQorICAgICAgICAgICAgICAgICAgICApOw0KDQorICAgIERFQlVHICgoRUZJX0Rf RVJST1IsICJSbmRpcyBDb250cm9sbGVySGFuZGxlIFN0b3AgJXJcbiIsIFN0YXR1cykpOw0KDQor ICAgIHJldHVybiBTdGF0dXM7DQoNCisgIH0NCg0KKw0KDQorICByZXR1cm4gRUZJX1VOU1VQUE9S VEVEOw0KDQorfQ0KDQorDQoNCisvKioNCg0KKyAgVVNCIFJuZGlzIERyaXZlciBCaW5kaW5nIFN0 b3AuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgVGhpcyAgICAgICAgICAgICAgICAgIFByb3RvY29s IGluc3RhbmNlIHBvaW50ZXIuDQoNCisgIEBwYXJhbVtpbl0gIENvbnRyb2xsZXJIYW5kbGUgICAg ICBIYW5kbGUgb2YgZGV2aWNlIHRvIHN0b3AgZHJpdmVyIG9uDQoNCisgIEBwYXJhbVtpbl0gIE51 bWJlck9mQ2hpbGRyZW4gICAgICBOdW1iZXIgb2YgSGFuZGxlcyBpbiBDaGlsZEhhbmRsZUJ1ZmZl ci4gSWYgbnVtYmVyIG9mDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBj aGlsZHJlbiBpcyB6ZXJvIHN0b3AgdGhlIGVudGlyZSBidXMgZHJpdmVyLg0KDQorICBAcGFyYW1b aW5dICBDaGlsZEhhbmRsZUJ1ZmZlciAgICAgTGlzdCBvZiBDaGlsZCBIYW5kbGVzIHRvIFN0b3Au DQoNCisNCg0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAgICAgICAgICAgIFRoaXMgZHJpdmVy IGlzIHJlbW92ZWQgQ29udHJvbGxlckhhbmRsZQ0KDQorICBAcmV0dmFsIG90aGVyICAgICAgICAg ICAgICAgICAgICAgVGhpcyBkcml2ZXIgd2FzIG5vdCByZW1vdmVkIGZyb20gdGhpcyBkZXZpY2UN Cg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK1VzYlJuZGlzRHJpdmVy U3RvcCAoDQoNCisgIElOICBFRklfRFJJVkVSX0JJTkRJTkdfUFJPVE9DT0wgICpUaGlzLA0KDQor ICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQor ICBJTiAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICBOdW1iZXJPZkNoaWxkcmVuLA0KDQor ICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICAqQ2hpbGRIYW5kbGVCdWZmZXINCg0K KyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVTICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVVNC X0VUSEVSTkVUX1BST1RPQ09MICAqVXNiRXRoUHJvdG9jb2w7DQoNCisgIFVTQl9STkRJU19ERVZJ Q0UgICAgICAgKlVzYlJuZGlzRGV2aWNlOw0KDQorDQoNCisgIERFQlVHICgoRUZJX0RfRVJST1Is ICJVc2JSbmRpc0RyaXZlclN0b3AgQ29udHJvbGxlckhhbmRsZSAlbHhcbiIsIENvbnRyb2xsZXJI YW5kbGUpKTsNCg0KKw0KDQorICBTdGF0dXMgPSBnQlMtPk9wZW5Qcm90b2NvbCAoDQoNCisgICAg ICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdV c2JFdGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICAoVk9JRCAqKikmVXNiRXRo UHJvdG9jb2wsDQoNCisgICAgICAgICAgICAgICAgICBUaGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxl LA0KDQorICAgICAgICAgICAgICAgICAgQ29udHJvbGxlckhhbmRsZSwNCg0KKyAgICAgICAgICAg ICAgICAgIEVGSV9PUEVOX1BST1RPQ09MX0dFVF9QUk9UT0NPTA0KDQorICAgICAgICAgICAgICAg ICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQorICAgIFN0YXR1cyA9IENo ZWNrYW5kU3RvcFJuZGlzRGV2aWNlIChUaGlzLCBDb250cm9sbGVySGFuZGxlKTsNCg0KKw0KDQor ICAgIERFQlVHICgoRUZJX0RfRVJST1IsICJDaGVja2FuZFN0b3BSbmRpc0RldmljZSAlclxuIiwg U3RhdHVzKSk7DQoNCisNCg0KKyAgICByZXR1cm4gU3RhdHVzOw0KDQorICB9DQoNCisNCg0KKyAg VXNiUm5kaXNEZXZpY2UgPSBVU0JfUk5ESVNfREVWSUNFX0ZST01fVEhJUyAoVXNiRXRoUHJvdG9j b2wpOw0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAg ICAgICAgICAgICBVc2JSbmRpc0RldmljZS0+VXNiQ2RjRGF0YUhhbmRsZSwNCg0KKyAgICAgICAg ICAgICAgICAgICZnRWZpVXNiSW9Qcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICBU aGlzLT5Ecml2ZXJCaW5kaW5nSGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgVXNiUm5kaXNE ZXZpY2UtPlVzYkNkY0RhdGFIYW5kbGUNCg0KKyAgICAgICAgICAgICAgICAgICk7DQoNCisNCg0K KyAgU3RhdHVzID0gZ0JTLT5Vbmluc3RhbGxQcm90b2NvbEludGVyZmFjZSAoDQoNCisgICAgICAg ICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0KDQorICAgICAgICAgICAgICAgICAgJmdVc2JF dGhQcm90b2NvbEd1aWQsDQoNCisgICAgICAgICAgICAgICAgICBVc2JFdGhQcm90b2NvbA0KDQor ICAgICAgICAgICAgICAgICAgKTsNCg0KKyAgaWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KDQor ICAgIERFQlVHICgoRUZJX0RfRVJST1IsICJFRklfRVJST1IgJXJcbiIsIFN0YXR1cykpOw0KDQor DQoNCisgICAgcmV0dXJuIFN0YXR1czsNCg0KKyAgfQ0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+ Q2xvc2VQcm90b2NvbCAoDQoNCisgICAgICAgICAgICAgICAgICBDb250cm9sbGVySGFuZGxlLA0K DQorICAgICAgICAgICAgICAgICAgJmdFZmlVc2JJb1Byb3RvY29sR3VpZCwNCg0KKyAgICAgICAg ICAgICAgICAgIFRoaXMtPkRyaXZlckJpbmRpbmdIYW5kbGUsDQoNCisgICAgICAgICAgICAgICAg ICBDb250cm9sbGVySGFuZGxlDQoNCisgICAgICAgICAgICAgICAgICApOw0KDQorDQoNCisgIGdC Uy0+RnJlZVBvb2wgKFVzYlJuZGlzRGV2aWNlLT5Db25maWcpOw0KDQorICBnQlMtPkZyZWVQb29s IChVc2JSbmRpc0RldmljZSk7DQoNCisNCg0KKyAgREVCVUcgKChFRklfRF9FUlJPUiwgIlVzYlJu ZGlzRHJpdmVyU3RvcCAlclxuIiwgU3RhdHVzKSk7DQoNCisgIHJldHVybiBTdGF0dXM7DQoNCit9 DQoNCisNCg0KKy8qKg0KDQorICBFbnRyeXBvaW50IG9mIFJORElTIERyaXZlci4NCg0KKw0KDQor ICBUaGlzIGZ1bm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b2ludDsNCg0KKyAgVUlOVDggICAgICAgICAgICAgICAgICAgICAgICBJbnRlcnJ1cEVu ZHBvaW50Ow0KDQorICBFRklfTUFDX0FERFJFU1MgICAgICAgICAgICAgIE1hY0FkZHJlc3M7DQoN CisgIFVJTlQzMiAgICAgICAgICAgICAgICAgICAgICAgUmVxdWVzdElkOw0KDQorICBVSU5UMzIg ICAgICAgICAgICAgICAgICAgICAgIE1lZGl1bTsNCg0KKyAgVUlOVDMyICAgICAgICAgICAgICAg ICAgICAgICBNYXhQYWNrZXRzUGVyVHJhbnNmZXI7DQoNCisgIFVJTlQzMiAgICAgICAgICAgICAg ICAgICAgICAgTWF4VHJhbnNmZXJTaXplOw0KDQorICBVSU5UMzIgICAgICAgICAgICAgICAgICAg ICAgIFBhY2tldEFsaWdubWVudEZhY3RvcjsNCg0KKyAgTElTVF9FTlRSWSAgICAgICAgICAgICAg ICAgICBSZWNlaXZlUGFja2V0TGlzdDsNCg0KK30gVVNCX1JORElTX0RFVklDRTsNCg0KKw0KDQor I2RlZmluZSBVU0JfUk5ESVNfRFJJVkVSX1ZFUlNJT04gICAgICAgMQ0KDQorI2RlZmluZSBVU0Jf VFhfRVRIRVJORVRfQlVMS19USU1FT1VUICAgMzAwMA0KDQorI2RlZmluZSBVU0JfUlhfRVRIRVJO RVRfQlVMS19USU1FT1VUICAgMw0KDQorI2RlZmluZSBVU0JfRVRIRVJORVRfVFJBTlNGRVJfVElN RU9VVCAgMjAwDQoNCisNCg0KKyNkZWZpbmUgTEFOX0JVTEtJTl9DTURfQ09OVFJPTCAgMQ0KDQor I2RlZmluZSBNQVhJTVVNX1NUT1BCVUxLSU5fQ05UICAzMDAgICAgICAgICAgICAvLyBJbmRpY2F0 aW5nIG1heGltdW0gY291bnRzIGZvciB3YWl0aW5nIGJ1bGsgaW4gY29tbWFuZA0KDQorI2RlZmlu ZSBNSU5JTVVNX1NUT1BCVUxLSU5fQ05UICAzICAgICAgICAgICAgICAvLyBJbmRpY2F0aW5nI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RFVklDRV9QQVRIX1BST1RPQ09MICAgICAqUmVt YWluaW5nRGV2aWNlUGF0aA0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkN Cg0KK1VzYlJuZGlzRHJpdmVyU3RvcCAoDQoNCisgIElOICBFRklfRFJJVkVSX0JJTkRJTkdfUFJP VE9DT0wgICpUaGlzLA0KDQorICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICBDb250 cm9sbGVySGFuZGxlLA0KDQorICBJTiAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICBOdW1i ZXJPZkNoaWxkcmVuLA0KDQorICBJTiAgRUZJX0hBTkRMRSAgICAgICAgICAgICAgICAgICAqQ2hp bGRIYW5kbGVCdWZmZXINCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorTG9hZEFsbERl c2NyaXB0b3IgKA0KDQorICBJTiAgRUZJX1VTQl9JT19QUk9UT0NPTCAgICAgICAgKlVzYklvLA0K DQorICBPVVQgRUZJX1VTQl9DT05GSUdfREVTQ1JJUFRPUiAgKipDb25maWdEZXNjDQoNCisgICk7 DQoNCisNCg0KK0JPT0xFQU4NCg0KK05leHREZXNjcmlwdG9yICgNCg0KKyAgSU4gRUZJX1VTQl9D T05GSUdfREVTQ1JJUFRPUiAgKkRlc2MsDQoNCisgIElOIE9VVCBVSU5UTiAgICAgICAgICAgICAg ICAgICpPZmZzZXQNCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorR2V0RnVuY3Rpb25h bERlc2NyaXB0b3IgKA0KDQorICBJTiAgRUZJX1VTQl9DT05GSUdfREVTQ1JJUFRPUiAgKkNvbmZp ZywNCg0KKyAgSU4gIFVJTlQ4ICAgICAgICAgICAgICAgICAgICAgIEZ1bkRlc2NyaXB0b3JUeXBl LA0KDQorICBPVVQgVk9JRCAgICAgICAgICAgICAgICAgICAgICAgKkRhdGFCdWZmZXINCg0KKyAg KTsNCg0KKw0KDQor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ICAgICAgICBWYWx1ZSwNCg0KKyAgSU4gVUlOVDE2ICAgICAgICAgICAg ICAgICBMZW5ndGgsDQoNCisgIElOIFZPSUQgICAgICAgICAgICAgICAgICAgKlBhdHRlcm5GaWx0 ZXINCg0KKyAgKTsNCg0KKw0KDQorRUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitHZXRVc2JSbmRp c1Bvd2VyRmlsdGVyICgNCg0KKyAgSU4gVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0K KyAgSU4gVUlOVDE2ICAgICAgICAgICAgICAgICBWYWx1ZSwNCg0KKyAgSU4gQk9PTEVBTiAgICAg ICAgICAgICAgICAqUGF0dGVybkFjdGl2ZQ0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoN CitFRklBUEkNCg0KK1NldFVzYlJuZGlzUGFja2V0RmlsdGVyICgNCg0KKyAgSU4gVVNCX0VUSEVS TkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4gVUlOVDE2ICAgICAgICAgICAgICAgICBWYWx1 ZQ0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitFRklBUEkNCg0KK0dldFJuZGlzU3Rh dGlzdGljICgNCg0KKyAgSU4gVVNCX0VUSEVSTkVUX1BST1RPQ09MICAqVGhpcywNCg0KKyAgSU4g VUlOVDE2ICAgICAgICAgICAgICAgICBWYWx1ZSwNCg0KKyAgSU4gVk9JRCAgICAgICAgICAgICAg ICAgICAqU3RhdGlzdGljDQoNCisgICk7DQoNCisNCg0KK0VGSV9TVEFUVVMNCg0KK1NlbmRSbmRp c1NldE1zZyAoDQoNCisgIElOICBVU0JfUk5ESVNfREVWSUNFICAqVXNiUm5kaXNEZXZpY2UsDQoN CisgIFVJTlQ4ICAgICAgICAgICAgICAgICBPaWQsDQoNCisgIFVJTlQzMiAgICAgICAgICAgICAg ICBMZW5ndGgsDQoNCisgIFVJTlQ4ICAgICAgICAgICAgICAgICAqQnVmDQoNCisgICk7DQoNCisN Cg0KK0VGSV9TVEFUVVMNCg0KK1JuZGlzQ29udHJvbE1zZyAoDQoNCisgIElOICBVU0JfUk5ESVNf REVWSUNFICAgICAgICAqVXNiUm5kaXNEZXZpY2UsDQoNCisgIElOICBSRU1PVEVfTkRJU19NU0df SEVBREVSICAqUm5kaXNNc2csDQoNCisgIE9VVCBSRU1PVEVfTkRJU19NU0dfSEVBREVSICAqUm5k aXNNc2dSZXNwb25zZQ0KDQorICApOw0KDQorDQoNCitFRklfU1RBVFVTDQoNCitSbmRpc1RyYW5z bWl0RGF0YU1zZyAoDQoNCisgIElOICBVU0JfUk5ESVNfREVWSUNFICAgICAgICAqVXNiUm5kaXNE ZXZpY2UsDQoNCisgIElOICBSRU1PVEVfTkRJU19NU0dfSEVBREVSICAqUm5kaXNNc2csDQoNCisg IFVJTlROICAgICAgICAgICAgICAgICAgICAgICAqVHJhbnNmZXJMZW5ndGgNCg0KKyAgKTsNCg0K Kw0KDQorRUZJX1NUQVRVUw0KDQorUm5kaXNSZWNlaXZlRGF0YU1zZyAoDQoNCisgIElOICBVU0Jf Uk5ESVNfREVWSUNFICAgICAgICAqVXNiUm5kaXNEZXZpY2UsDQoNCisgIElOICBSRU1PVEVfTkRJ U19NU0dfSEVBREVSICAqUm5kaXNNc2csDQoNCisgIFVJTlROICAgICAgICAgICAgICAgICAgICAg ICAqVHJhbnNmZXJMZW5ndGgNCg0KKyAgKTsNCg0KKw0KDQorVk9JRA0KDQorUHJpbnRSbmRpc01z ZyAoDQoNCisgIElOICBSRU1PVEVfTkRJU19NU0dfSEVBREVSICAqUm5kaXNNc2cNCg0KKyAgKTsN Cg0KKw0KDQorI2RlZmluZSBSTkRJU19NQUpPUl9WRVJTSU9OICAgICAgMHgwMDAwMDAwMQ0KDQor I2RlZmluZSBSTkRJU19NSU5PUl9WRVJTSU9OICAgICAgMHgwMDAwMDAwMA0KDQorI2RlZmluZSBS TkRJU19NQVhfVFJBTlNGRVJfU0laRSAgMHg0MDAwDQoNCisNCg0KKyNkZWZpbmUgUk5ESVNfUEFD S0VUX01TRyAgICAgICAgICAgMHgwMDAwMDAwMQ0KDQorI2RlZmluZSBSTkRJU19JTklUSUFMSVpF X01TRyAgICAgICAweDAwMDAwMDAyDQoNCisjZGVmaW5lIFJORElTX0lOSVRJQUxJWkVfQ01QTFQg ICAgIDB4ODAwMDAwMDINCg0KKyNkZWZpbmUgUk5ESVNfSExUX01TRyAgICAgICAgICAgICAgMHgw MDAwMDAwMw0KDQorI2RlZmluZSBSTkRJU19RVUVSWV9NU0cgICAgICAgICAgICAweDAwMDAwMDA0 DQoNCisjZGVmaW5lIFJORElTX1FVRVJZX0NNUExUICAgICAgICAgIDB4ODAwMDAwMDQNCg0KKyNk ZWZpbmUgUk5ESVNfU0VUX01TRyAgICAgICAgICAgICAgMHgwMDAwMDAwNQ0KDQorI2RlZmluZSBS TkRJU19TRVRfQ01QTFQgICAgICAgICAgICAweDgwMDAwMDA1DQoNCisjZGVmaW5lIFJORElTX1JF U0VUX01TRyAgICAgICAgICAgIDB4MDAwMDAwMDYNCg0KKyNkZWZpbmUgUk5ESVNfUkVTRVRfQ01Q TFQgICAgICAgICAgMHg4MDAwMDAwNg0KDQorI2RlZmluZSBSTkRJU19JTkRJQ0FURV9TVEFUVVNf TVNHICAweDAwMDAwMDA3DQoNCisjZGVmaW5lIFJORElTX0tFRVBBTElWRV9NU0cgICAgICAgIDB4 MDAwMDAwMDgNCg0KKyNkZWZpbmUgUk5ESVNfS0VFUEFMSVZFX0NNUExUICAgICAgMHg4MDAwMDAw OA0KDQorDQoNCisjZGVmaW5lIFJORElTX1NUQVRVU19TVUNDRVNTICAgICAgICAgICAweDAwMDAw MDAwDQoNCisjZGVmaW5lIFJORElTX1NUQVRVU19GQUlMVVJFICAgICAgICAgICAweEMwMDAwMDAx DQoNCisjZGVmaW5lIFJORElTX1NUQVRVU19JTlZBTElEX0RBVEEgICAgICAweEMwMDEwMDE1DQoN CisjZGVmaW5lIFJORElTX1NUQVRVU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V9VU0JfQ09ORklHX0RFU0NSSVBUT1IgICoqQ29uZmlnRGVzYw0KDQorICAp DQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAgVUlO VDMyICAgICAgICAgICAgICAgICAgICAgVHJhbnNTdGF0dXM7DQoNCisgIEVGSV9VU0JfQ09ORklH X0RFU0NSSVBUT1IgIFRtcDsNCg0KKw0KDQorICBTdGF0dXMgPSBVc2JJby0+VXNiR2V0Q29uZmln RGVzY3JpcHRvciAoVXNiSW8sICZUbXApOw0KDQorICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMp Ow0KDQorDQoNCisgIFN0YXR1cyA9IGdCUy0+QWxsb2NhdGVQb29sICgNCg0KKyAgICAgICAgICAg ICAgICAgIEVmaUJvb3RTZXJ2aWNlc0RhdGEsDQoNCisgICAgICAgICAgICAgICAgICBUbXAuVG90 YWxMZW5ndGgsDQoNCisgICAgICAgICAgICAgICAgICAoVk9JRCAqKilDb25maWdEZXNjDQoNCisg ICAgICAgICAgICAgICAgICApOw0KDQorICBBU1NFUlRfRUZJX0VSUk9SIChTdGF0dXMpOw0KDQor DQoNCisgIFN0YXR1cyA9IFVzYkdldERlc2NyaXB0b3IgKA0KDQorICAgICAgICAgICAgIFVzYklv LA0KDQorICAgICAgICAgICAgIFVTQl9ERVNDX1RZUEVfQ09ORklHIDw8IDggfCAoVG1wLkNvbmZp Z3VyYXRpb25WYWx1ZSAtIDEpLCAgICAgICAgICAgICAgICAgLy8gemVybyBiYXNlZA0KDQorICAg ICAgICAgICAgIDAsDQoNCisgICAgICAgICAgICAgVG1wLlRvdGFsTGVuZ3RoLA0KDQorICAgICAg ICAgICAgICpDb25maWdEZXNjLA0KDQorICAgICAgICAgICAgICZUcmFuc1N0YXR1cw0KDQorICAg ICAgICAgICAgICk7DQoNCisgIHJldHVybiBTdGF0dXM7DQoNCit9DQoNCisNCg0KKy8qKg0KDQor ICBSZXR1cm5zIHBvaW50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orICBPVVQgVk9JRCAgICAgICAg ICAgICAgICAgICAgICAgKkRhdGFCdWZmZXINCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVT ICAgICAgICAgICAgICAgICAgICBTdGF0dXMgPSBFRklfTk9UX0ZPVU5EOw0KDQorICBVSU5UTiAg ICAgICAgICAgICAgICAgICAgICAgICBPZmZzZXQ7DQoNCisgIEVGSV9VU0JfSU5URVJGQUNFX0RF U0NSSVBUT1IgICpJbnRlcmZhY2U7DQoNCisNCg0KKyAgZm9yIChPZmZzZXQgPSAwOyBOZXh0RGVz Y3JpcHRvciAoQ29uZmlnLCAmT2Zmc2V0KTspIHsNCg0KKyAgICBJbnRlcmZhY2UgPSAoRUZJX1VT Ql9JTlRFUkZBQ0VfREVTQ1JJUFRPUiAqKSgoVUlOVDggKilDb25maWcgKyBPZmZzZXQpOw0KDQor ICAgIGlmIChJbnRlcmZhY2UtPkRlc2NyaXB0b3JUeXBlID09IENTX0lOVEVSRkFDRSkgew0KDQor ICAgICAgaWYgKCgoVVNCX0hFQURFUl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSktPkRlc2Ny aXB0b3JTdWJ0eXBlID09IEZ1bkRlc2NyaXB0b3JUeXBlKSB7DQoNCisgICAgICAgIHN3aXRjaCAo RnVuRGVzY3JpcHRvclR5cGUpIHsNCg0KKyAgICAgICAgICBjYXNlIEhFQURFUl9GVU5fREVTQ1JJ UFRPUjoNCg0KKyAgICAgICAgICAgIENvcHlNZW0gKA0KDQorICAgICAgICAgICAgICBEYXRhQnVm ZmVyLA0KDQorICAgICAgICAgICAgICAoVVNCX0hFQURFUl9GVU5fREVTQ1JJUFRPUiAqKUludGVy ZmFjZSwNCg0KKyAgICAgICAgICAgICAgc2l6ZW9mIChVU0JfSEVBREVSX0ZVTl9ERVNDUklQVE9S KQ0KDQorICAgICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUNDRVNT Ow0KDQorICAgICAgICAgIGNhc2UgVU5JT05fRlVOX0RFU0NSSVBUT1I6DQoNCisgICAgICAgICAg ICBDb3B5TWVtICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAgICAgICAg ICAgKFVTQl9VTklPTl9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAgICAgICAgICAg ICAgKChVU0JfVU5JT05fRlVOX0RFU0NSSVBUT1IgKilJbnRlcmZhY2UpLT5GdW5jdGlvbkxlbmd0 aA0KDQorICAgICAgICAgICAgICApOw0KDQorICAgICAgICAgICAgcmV0dXJuIEVGSV9TVUNDRVNT Ow0KDQorICAgICAgICAgIGNhc2UgRVRIRVJORVRfRlVOX0RFU0NSSVBUT1I6DQoNCisgICAgICAg ICAgICBDb3B5TWVtICgNCg0KKyAgICAgICAgICAgICAgRGF0YUJ1ZmZlciwNCg0KKyAgICAgICAg ICAgICAgKFVTQl9FVEhFUk5FVF9GVU5fREVTQ1JJUFRPUiAqKUludGVyZmFjZSwNCg0KKyAgICAg ICAgICAgICAgc2l6ZW9mIChVU0JfRVRIRVJORVRfRlVOX0RFU0NSSVBUT1IpDQoNCisgICAgICAg ICAgICAgICk7DQoNCisgICAgICAgICAgICByZXR1cm4gRUZJX1NVQ0NFU1M7DQoNCisgICAgICAg ICAgZGVmYXVsdDoNCg0KKyAgICAgICAgICAgIFN0YXR1cyA9IEVGSV9VTlNVUFBPUlRFRDsNCg0K KyAgICAgICAgICAgIGJyZWFrOw0KDQorICAgICAgICB9DQoNCisgICAgICB9DQoNCisgICAgfQ0K DQorICB9DQoNCisNCg0KKyAgcmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisg IEdldCBVU0IgRXRoZXJuZXQgSU8gZW5kcG9pbnQgYW5kIFVTQiBDREMgZGF0YSBJTyBlbmRwb2lu dC4NCg0KKw0KDQorICBAcGFyYW1baW5dICAgICAgVXNiSW8gICAgICAgICAgIEEgcG9pbnRlciB0 byB0a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pSZXF1c3QNCg0KKyAgKQ0KDQorew0KDQorICBFRklfU1RBVFVTICAgICAg ICBTdGF0dXM7DQoNCisgIFVTQl9STkRJU19ERVZJQ0UgICpVc2JSbmRpc0RldmljZTsNCg0KKyAg VUlOVE4gICAgICAgICAgICAgRGF0YUxlbmd0aCA9IDA7DQoNCisNCg0KKyAgVXNiUm5kaXNEZXZp Y2UgPSBVU0JfUk5ESVNfREVWSUNFX0ZST01fVEhJUyAoVGhpcyk7DQoNCisNCg0KKyAgaWYgKElz TmV3VHJhbnNmZXIgPT0gVFJVRSkgew0KDQorICAgIERhdGFMZW5ndGggPSBzaXplb2YgKEVGSV9V U0JfREVWSUNFX1JFUVVFU1QpICsgc2l6ZW9mIChVU0JfQ09OTkVDVF9TUEVFRF9DSEFOR0UpOw0K DQorICAgIFN0YXR1cyAgICAgPSBVc2JSbmRpc0RldmljZS0+VXNiSW8tPlVzYkFzeW5jSW50ZXJy dXB0VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgVXNiUm5kaXNEZXZpY2UtPlVzYklvLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgVXNiUm5kaXNEZXZpY2UtPkludGVycnVwRW5kcG9pbnQsDQoNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJc05ld1RyYW5zZmVyLA0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUG9sbGluZ0ludGVydmFs LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGF0YUxlbmd0 aCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEludGVycnVw dENhbGxiYWNrLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg UmVxdXN0DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOw0K DQorDQoNCisgICAgaWYgKFN0YXR1cyA9PSBFRklfSU5WQUxJRF9QQVJBTUVURVIpIHsNCg0KKyAg ICAgIC8vIEJlY2F1c2Ugb2YgU3RhY2tlZCBBc3luY0ludGVycnVwdCByZXF1ZXN0IGFyZSBub3Qg c3VwcG9ydGVkDQoNCisgICAgICBTdGF0dXMgPSBVc2JSbmRpc0RldmljZS0+VXNiSW8tPlVzYkFz eW5jSW50ZXJydXB0VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIFVzYlJuZGlzRGV2aWNlLT5Vc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBVc2JSbmRpc0RldmljZS0+SW50ZXJydXBFbmRwb2ludCwNCg0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgMCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIE5VTEwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOw0K DQorICAgIH0NCg0KKyAgfSBlbHNlIHsNCg0KKyAgICBTdGF0dXMgPSBVc2JSbmRpc0RldmljZS0+ VXNiSW8tPlVzYkFzeW5jSW50ZXJydXB0VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBVc2JSbmRpc0RldmljZS0+VXNiSW8sDQoNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYlJuZGlzRGV2aWNlLT5JbnRlcnJ1cEVuZHBv aW50LA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJc05ld1RyYW5z ZmVyLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLA0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLA0KDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBOVUxMLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBOVUxMDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICk7DQoNCisgIH0NCg0KKw0KDQorICByZXR1cm4gU3RhdHVzOw0KDQorfQ0KDQorDQoNCisv KioNCg0KKyAgUmV0cmlldmVzIHRoZSBVU0IgRXRoZXJuZXQgTWFjIEFkZHJlc3MuDQoNCisNCg0K KyAgQHBhcmFtW2luXSAgVGhpcyAgICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIFVTQl9FVEhFUk5F VF9QUk9UT0NPTCBpbnN0YW5jZS4NCg0KKyAgQHBhcmFtW291dF0gTWFjQWRkcmVzcyAgICBBIHBv aW50ZXIgdG8gdGhlIGNhbGxlciBhbGxvY2F0ZWQgVVNCIEV0aGVybmV0IE1hYyBBZGRyZXNzLg0K DQorDQoNCisgIEByZXR2YWwgRUZJX1NVQ0NFU1MgICAgICAgICAgIFRoZSBVU0IgSGVhZGVyIEZ1 bmN0aW9uYWwgZGVzY3JpcHRvciB3YXMgcmV0cmlldmVkIHN1Y2Nlc3NmdWxseS4NCg0KKyAgQHJl dHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIgVXNiSGVhZGVyRnVuRGVzY3JpcHRvciBpcyBOVUxM Lg0KDQorICBAcmV0dmFsIEVGSV9OT1RfRk9VTkQgICAgICAgICBUaGUgVVNCIEhlYWRlciBGdW5j dGlvbmFsIGRlc2NyaXB0b3Igd2FzIG5vdCBmb3VuZC4NCg0KKw0KDQorKiovDQoNCitFRklfU1RB VFVTDQoNCitFRklBUE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AgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgMHg0MDksICAgICAgICAgICAgICAgICAgICAgICAv LyBFbmdsaXNoLVVTIExhbmd1YWdlIElEDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBVc2JFdGhEZXNjcmlwdG9yLk1hY0FkZHJlc3MsDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAmRGF0YQ0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKTsNCg0KKyAgQVNTRVJUX0VGSV9FUlJPUiAoU3RhdHVzKTsNCg0KKw0KDQorICBE YXRhUHRyID0gRGF0YTsNCg0KKyAgZm9yIChJbmRleCA9IDA7IEluZGV4IDwgUFhFX0hXQUREUl9M RU5fRVRIRVI7IEluZGV4KyspIHsNCg0KKyAgICBDb3B5TWVtIChUbXBTdHIsIERhdGFQdHIsIHNp emVvZiAoQ0hBUjE2KSk7DQoNCisgICAgRGF0YVB0cisrOw0KDQorICAgIEhpID0gKFVJTlQ4KVN0 ckhleFRvVWludG4gKFRtcFN0cik7DQoNCisgICAgQ29weU1lbSAoVG1wU3RyLCBEYXRhUHRyLCBz aXplb2YgKENIQVIxNikpOw0KDQorICAgIERhdGFQdHIrKzsNCg0KKyAgICBMb3cgICAgICAgICAg ICAgICAgICAgICA9IChVSU5UOClTdHJIZXhUb1VpbnRuIChUbXBTdHIpOw0KDQorICAgIE1hY0Fk ZHJlc3MtPkFkZHJbSW5kZXhdID0gKEhpIDw8IDQpIHwgTG93Ow0KDQorICB9DQoNCisNCg0KKyAg cmV0dXJuIFN0YXR1czsNCg0KK30NCg0KKw0KDQorLyoqDQoNCisgIFJldHJpZXZlcyB0aGUgVVNC IEV0aGVybmV0IEJ1bGsgdHJhbnNmZXIgZGF0YSBzaXplLg0KDQorDQoNCisgIEBwYXJhbVtpbl0g IFRoaXMgICAgICAgICAgQSBwb2ludGVyIHRvIHRoZSBVU0JfRVRIRVJORVRfUF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VyTWNGaWx0ZXJzIDw8IDEpID09IDApIHsNCg0KKyAgICByZXR1cm4gRUZJX1VOU1VQUE9SVEVE Ow0KDQorICB9DQoNCisNCg0KKyAgUmVxdWVzdC5SZXF1ZXN0VHlwZSA9IFVTQl9FVEhSVE5FVF9T RVRfUkVRX1RZUEU7DQoNCisgIFJlcXVlc3QuUmVxdWVzdCAgICAgPSBTRVRfRVRIX01VTFRJQ0FT VF9GSUxURVJTX1JFUTsNCg0KKyAgUmVxdWVzdC5WYWx1ZSAgICAgICA9IFZhbHVlOw0KDQorICBS ZXF1ZXN0LkluZGV4ICAgICAgID0gVXNiUm5kaXNEZXZpY2UtPk51bU9mSW50ZXJmYWNlOw0KDQor ICBSZXF1ZXN0Lkxlbmd0aCAgICAgID0gVmFsdWUgKiA2Ow0KDQorDQoNCisgIHJldHVybiBVc2JS bmRpc0RldmljZS0+VXNiSW8tPlVzYkNvbnRyb2xUcmFuc2ZlciAoDQoNCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgVXNiUm5kaXNEZXZpY2UtPlVzYklvLA0KDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICZSZXF1ZXN0LA0KDQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIEVmaVVzYkRhdGFPdXQsDQoNCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgVVNCX0VUSEVSTkVUX1RSQU5TRkVSX1RJTUVPVVQsDQoNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgTWNhc3RBZGRyLA0KDQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFJlcXVlc3QuTGVuZ3RoLA0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICZUcmFuc1N0YXR1cw0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICk7DQoNCit9DQoNCisNCg0KKy8qKg0KDQorICBUaGlzIHJlcXVlc3Qgc2V0cyB1cC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8sDQoNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgJlJlcXVlc3QsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgRWZpVXNiRGF0YU91dCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBVU0JfRVRIRVJORVRfVFJBTlNGRVJfVElNRU9VVCwNCg0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBQYXR0ZXJuRmlsdGVyLA0KDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIExlbmd0aCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAmVHJhbnNTdGF0dXMNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOw0K DQorfQ0KDQorDQoNCisvKioNCg0KKyAgVGhpcyByZXF1ZXN0IHJldHJpZXZlcyB0aGUgc3RhdHVz IG9mIHRoZSBzcGVjaWZpZWQgRXRoZXJuZXQgcG93ZXIgbWFuYWdlbWVudA0KDQorICBwYXR0ZXJu IGZpbHRlciBmcm9tIHRoZSBkZXZpY2UuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgVGhpcyAgICAg ICAgICAgICAgICAgICBBIHBvaW50ZXIgdG8gdGhlIFVTQl9FVEhFUk5FVF9QUk9UT0NPTCBpbnN0 YW5jZS4NCg0KKyAgQHBhcmFtW2luXSAgVmFsdWUgICAgICAgICAgICAgICAgICBUaGUgZmlsdGVy IG51bWJlci4NCg0KKyAgQHBhcmFtW291dF0gUGF0dGVybkFjdGl2ZSAgICAgICAgICBBIHBvaW50 ZXIgdG8gdGhlIHBhdHRlcm4gYWN0aXZlIGJvb2xlYW4uDQoNCisNCg0KKyAgQHJldHZhbCBFRklf U1VDQ0VTUyAgICAgICAgICAgIFRoZSByZXF1ZXN0IGV4ZWN1dGVkIHN1Y2Nlc3NmdWxseS4NCg0K KyAgQHJldHZhbCBFRklfVElNRU9VVCAgICAgICAgICA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gPSBWYWx1 ZTsNCg0KKyAgUmVxdWVzdC5JbmRleCAgICAgICA9IFVzYlJuZGlzRGV2aWNlLT5OdW1PZkludGVy ZmFjZTsNCg0KKyAgUmVxdWVzdC5MZW5ndGggICAgICA9IFVTQl9FVEhfUE9XRVJfRklMVEVSX0xF TkdUSDsNCg0KKw0KDQorICByZXR1cm4gVXNiUm5kaXNEZXZpY2UtPlVzYklvLT5Vc2JDb250cm9s VHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYlJuZGlz RGV2aWNlLT5Vc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmUmVx dWVzdCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZmlVc2JEYXRhSW4s DQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVVNCX0VUSEVSTkVUX1RSQU5T RkVSX1RJTUVPVVQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGF0dGVy bkFjdGl2ZSwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVU0JfRVRIX1BP V0VSX0ZJTFRFUl9MRU5HVEgsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg JlRyYW5zU3RhdHVzDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0K K30NCg0KKw0KDQorLyoqDQoNCisNCg0KKyAgQ29udmVydHMgUFhFIGZpbHRlciBzZXR0aW5ncyB0 byBSTkRJUyB2YWx1ZXMNCg0KKw0KDQorICBAcGFyYW1baW5dICBWYWx1ZSAgICAgIFBYRSBmaWx0 ZXIgZGF0YS4NCg0KKyAgQHBhcmFtW291dF0gQ2RjRmlsdGVyICBBIHBvaW50ZXIgdG8gdGhlIEV0 aGVybmV0IFBhY2tldCBGaWx0ZXIgQml0bWFwIHZhbHVlIGNvbnZlcnRlZCBieSBQ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IEluZGV4KyspIHsNCg0KKyAgICBpZiAoVGFibGVbSW5kZXhdLlNyYyAm IFZhbHVlKSB7DQoNCisgICAgICAqQ2RjRmlsdGVyIHw9IFRhYmxlW0luZGV4XS5Ec3Q7DQoNCisg ICAgfQ0KDQorICB9DQoNCit9DQoNCisNCg0KKy8qKg0KDQorDQoNCisgIFVwZGF0ZXMgRmlsdGVy IHNldHRpbmdzIG9uIHRoZSBkZXZpY2UuDQoNCisNCg0KKyAgQHBhcmFtW2luXSAgQ2RiICBBIHBv aW50ZXIgdG8gdGhlIGNvbW1hbmQgZGVzY3JpcHRvciBibG9jay4NCg0KKyAgQHBhcmFtW2luXSAg TmljICBBIHBvaW50ZXIgdG8gdGhlIE5ldHdvcmsgaW50ZXJmYWNlIGNvbnRyb2xsZXIgZGF0YS4N Cg0KKw0KDQorICBAcmV0dmFsIEVGSV9TVEFUVVMNCg0KKw0KDQorKiovDQoNCitFRklfU1RBVFVT DQoNCitFRklBUEkNCg0KK1JuZGlzVW5kaVJlY2VpdmVGaWx0ZXIgKA0KDQorICBJTiAgUFhFX0NE QiAgICpDZGIsDQoNCisgIElOICBOSUNfREFUQSAgKk5pYw0KDQorICApDQoNCit7DQoNCisgIEVG SV9TVEFUVVMgICAgICAgICAgICAgICAgICAgU3RhdHVzOw0KDQorICBVSU5UOCAgICAgICAgICAg ICAgICAgICAgICAgICpNY2FzdExpc3Q7DQoNCisgIFVJTlQ4ICAgICAgICAgICAgICAgICAgICAg ICAgQ291bnQgPSAwOw0KDQorICBVSU5UOCAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4MTsN Cg0KKyAgVUlOVDggICAgICAgICAgICAgICAgICAgICAgICBJbmRleDI7DQoNCisgIFVJTlQ2NCAg ICAgICAgICAgICAgICAgICAgICAgQ3BiQWRkciAgID0gQ2RiLT5DUEJhZGRyOw0KDQorICBVSU5U MzIgICAgICAgICAgICAgICAgICAgICAgIENwYlNpemUgICA9IENkYi0+Q1BCc2l6ZTsNCg0KKyA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F9GT1VORCAg ICAgICAgIE5vIGJ1ZmZlciB3YXMgZm91bmQgaW4gdGhlIGxpc3QuDQoNCisNCg0KKyoqLw0KDQor RUZJX1NUQVRVUw0KDQorRUZJQVBJDQoNCitSbmRpc1VuZGlSZWNlaXZlICgNCg0KKyAgSU4gICAg IFBYRV9DREIgICAgICAgICAgICAgICAgKkNkYiwNCg0KKyAgSU4gICAgIFVTQl9FVEhFUk5FVF9Q Uk9UT0NPTCAgKlRoaXMsDQoNCisgIElOIE9VVCBWT0lEICAgICAgICAgICAgICAgICAgICpCdWxr SW5EYXRhLA0KDQorICBJTiBPVVQgVUlOVE4gICAgICAgICAgICAgICAgICAqRGF0YUxlbmd0aA0K DQorICApDQoNCit7DQoNCisgIEVGSV9TVEFUVVMgICAgICAgICAgICAgIFN0YXR1czsNCg0KKyAg VVNCX1JORElTX0RFVklDRSAgICAgICAgKlVzYlJuZGlzRGV2aWNlID0gVVNCX1JORElTX0RFVklD RV9GUk9NX1RISVMgKFRoaXMpOw0KDQorICBSRU1PVEVfTkRJU19QQUNLRVRfTVNHICAqUm5kaXNQ YWNrZXRNc2c7DQoNCisgIFVJTlROICAgICAgICAgICAgICAgICAgIFRyYW5zZmVyTGVuZ3RoOw0K DQorICBWT0lEICAgICAgICAgICAgICAgICAgICAqQnVmZmVyOw0KDQorICBQQUNLRVRfTElTVCAg ICAgICAgICAgICAqSGVhZFBhY2tldCA9IE5VTEw7DQoNCisgIFBBQ0tFVF9MSVNUICAgICAgICAg ICAgICpQYWNrZXRMaXN0Ow0KDQorICBVSU5UMzIgICAgICAgICAgICAgICAgICBSZWNlaXZlZEJ5 dGVzID0gMDsNCg0KKw0KDQorICAvLyBDaGVjayBpZiB0aGVyZSBpcyBhbnkgb3V0c3RhbmRpbmcg cGFja2V0IHRvIHJlY2VpdmUNCg0KKyAgLy8gVGhlIGJ1ZmZlciBhbGxvY2F0ZWQgaGFzIGEgbGlu a2VkIExpc3QgZm9sbG93ZWQgYnkgdGhlIHBhY2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VxLlJlcXVlc3RUeXBlID0gVVNCX1JFUV9UWVBFX0NMQVNTIHwgVVNCX1RBUkdFVF9JTlRFUkZB Q0U7DQoNCisgIERldlJlcS5SZXF1ZXN0ICAgICA9IFNFTkRfRU5DQVBTVUxBVEVEX0NPTU1BTkQ7 DQoNCisgIERldlJlcS5WYWx1ZSAgICAgICA9IDA7DQoNCisgIERldlJlcS5JbmRleCAgICAgICA9 IDA7DQoNCisgIERldlJlcS5MZW5ndGggICAgICA9IChVSU5UMTYpUm5kaXNNc2ctPk1lc3NhZ2VM ZW5ndGg7DQoNCisNCg0KKyAgUHJpbnRSbmRpc01zZyAoUm5kaXNNc2cpOw0KDQorDQoNCisgIFN0 YXR1cyA9IFVzYklvLT5Vc2JDb250cm9sVHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAg ICBVc2JJbywNCg0KKyAgICAgICAgICAgICAgICAgICAgJkRldlJlcSwNCg0KKyAgICAgICAgICAg ICAgICAgICAgRWZpVXNiRGF0YU91dCwNCg0KKyAgICAgICAgICAgICAgICAgICAgVVNCX0VUSEVS TkVUX1RSQU5TRkVSX1RJTUVPVVQsDQoNCisgICAgICAgICAgICAgICAgICAgIFJuZGlzTXNnLA0K DQorICAgICAgICAgICAgICAgICAgICBSbmRpc01zZy0+TWVzc2FnZUxlbmd0aCwNCg0KKyAgICAg ICAgICAgICAgICAgICAgJlVzYlN0YXR1cw0KDQorICAgICAgICAgICAgICAgICAgICApOw0KDQor DQoNCisgIERFQlVHICgoREVCVUdfSU5GTywgIlJuZGlzQ29udHJvbE1zZzogVXNiU3RhdHVzIDog JXggU3RhdHVzIDogJXIgUm5kaXNNc2dSZXNwb25zZSA6ICVseFxuIiwgVXNiU3RhdHVzLCBTdGF0 dXMsIFJuZGlzTXNnUmVzcG9uc2UpKTsNCg0KKw0KDQorICAvLyBFcnJvciBvciBubyByZXNwb25z ZSBleHBlY3RlZA0KDQorICBpZiAoKEVGSV9FUlJPUiAoU3RhdHVzKSkgfHwg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ldmljZS0+QnVsa0luRW5kcG9pbnQgPT0gMCkgew0KDQorICAgIEdldEVuZHBvaW50IChVc2JS bmRpc0RldmljZS0+VXNiSW9DZGNEYXRhLCBVc2JSbmRpc0RldmljZSk7DQoNCisgIH0NCg0KKw0K DQorICBQcmludFJuZGlzTXNnIChSbmRpc01zZyk7DQoNCisNCg0KKyAgU3RhdHVzID0gVXNiUm5k aXNEZXZpY2UtPlVzYklvQ2RjRGF0YS0+VXNiQnVsa1RyYW5zZmVyICgNCg0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVc2JSbmRpc0RldmljZS0+VXNiSW9DZGNE YXRhLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYlJu ZGlzRGV2aWNlLT5CdWxrT3V0RW5kcG9pbnQsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgUm5kaXNNc2csDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgVHJhbnNmZXJMZW5ndGgsDQoNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgVVNCX1RYX0VUSEVSTkVUX0JVTEtfVElNRU9VVCwNCg0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmVXNiU3RhdHVzDQoN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKw0KDQor ICBpZiAoU3RhdHVzID09IEVGSV9TVUNDRVNTKSB7DQoNCisgICAgU3RvcEJ1bGtJbkNudCA9IE1B WElNVU1fU1RPUEJVTEtJTl9DTlQ7ICAgICAvLyBBZnRlciBzZW5kaW5nIGNtZCAsd2Ugd2lsbCBw b2xsaW5nIHJlY2VpdmUgcGFja2FnZSBmb3IgTUFYSU1VTV9TVE9QQlVMS0lOX0NOVCB0aW1lcw0K DQorICB9DQoNCisNCg0KKy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SbmRpc0RldmljZS0+VXNiSW9DZGNEYXRh LCBVc2JSbmRpc0RldmljZSk7DQoNCisgIH0NCg0KKw0KDQorICAvLyBVc2UgU3RvcEJ1bGtJbkNu dCB0byBzdG9wIEJ1bGtJbiBjb21tYW5kDQoNCisgIGlmIChTdG9wQnVsa0luQ250IHx8IExBTl9C VUxLSU5fQ01EX0NPTlRST0wpIHsNCg0KKyAgICBTdGF0dXMgPSBVc2JSbmRpc0RldmljZS0+VXNi SW9DZGNEYXRhLT5Vc2JCdWxrVHJhbnNmZXIgKA0KDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgVXNiUm5kaXNEZXZpY2UtPlVzYklvQ2RjRGF0YSwNCg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVzYlJuZGlzRGV2aWNl LT5CdWxrSW5FbmRwb2ludCwNCg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIFJuZGlzTXNnLA0KDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgVHJhbnNmZXJMZW5ndGgsDQoNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBVU0JfUlhfRVRIRVJORVRfQlVMS19USU1FT1VULA0KDQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJlVzYlN0YXR1cw0KDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCg0KKw0KDQor ICAgIGlmICghRUZJX0VSUk9SIChTdGF0dXMpKSB7DQoNCisgICAgICBTdG9wQnVsa0luQ250ID0g TUlOSU1VTV9TVE9QQlVMS0lOX0NOVDsNCg0KKyAgICB9IGVsc2Ugew0KDQorICAgICAgU3RvcEJ1 bGtJbkNudC0tOw0KDQorICAgIH0NCg0KKyAgfSBlbHNlIHsNCg0KKyAgICBTdGF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k8sICJSTkRJU19JTklUSUFMSVpFX01TRzpcbiIpKTsNCg0KKyAgICAg IExlbmd0aCA9IHNpemVvZiAoUkVNT1RFX05ESVNfSU5JVElBTElaRV9NU0cpOw0KDQorICAgICAg YnJlYWs7DQoNCisgICAgY2FzZSBSTkRJU19JTklUSUFMSVpFX0NNUExUOg0KDQorICAgICAgREVC VUcgKChERUJVR19JTkZPLCAiUk5ESVNfSU5JVElBTElaRV9DTVBMVDpcbiIpKTsNCg0KKyAgICAg IExlbmd0aCA9IHNpemVvZiAoUkVNT1RFX05ESVNfSU5JVElBTElaRV9DTVBMVCk7DQoNCisgICAg ICBicmVhazsNCg0KKyAgICBjYXNlIFJORElTX0hMVF9NU0c6DQoNCisgICAgICBERUJVRyAoKERF QlVHX0lORk8sICJSTkRJU19ITFRfTVNHOlxuIikpOw0KDQorICAgICAgTGVuZ3RoID0gc2l6ZW9m IChSRU1PVEVfTkRJU19IQUxUX01TRyk7DQoNCisgICAgICBicmVhazsNCg0KKyAgICBjYXNlIFJO RElTX1FVRVJZX01TRzoNCg0KKyAgICAgIERFQlVHICgoREVCVUdfSU5GTywgIlJORElTX1FVRVJZ X01TRzpcbiIpKTsNCg0KKyAgICAgIExlbmd0aCA9IHNpemVvZiAoUkVNT1RFX05ESVNfUVVFUllf TVNHKTsNCg0KKyAgICAgIGJyZWFrOw0KDQorICAgIGNhc2UgUk5ESVNfUVVFUllfQ01QTFQ6DQoN CisgICAgICBERUJVRyAoKERFQlVHX0lORk8sICJSTkRJU19RVUVSWV9DTVBMVDpcbiIpKTsNCg0K KyAgICAgIExlbmd0aCA9IHNpemVvZiAoUkVNT1RFX05ESVNfUVVFUllfQ01QTFQpOw0KDQorICAg ICAgYnJlYWs7DQoNCisgICAgY2FzZSBSTkRJU19TRVRfTVNHOg0KDQorICAgICAgREVCVUcgKChE RUJVR19JTkZPLCAiUk5ESVNfU0VUX01TRzpcbiIpKTsNCg0KKyAgICAgIExlbmd0aCA9IHNpemVv ZiAoUkVNT1RFX05ESVNfU0VUX01TRyk7DQoNCisgICAgICBicmVhazsNCg0KKyAgICBjYXNlIFJO RElTX1NFVF9DTVBMVDoNCg0KKyAgICAgIERFQlVHICgoREVCVUdfSU5GTywgIlJORElTX1NFVF9D TVBMVDpcbiIpKTsNCg0KKyAgICAgIExlbmd0aCA9IHNpemVvZiAoUkVNT1RFX05ESVNfU0VUX0NN UExUKTsNCg0KKyAgICAgIGJyZWFrOw0KDQorICAgIGNhc2UgUk5ESVNfUkVTRVRfTVNHOg0KDQor ICAgICAgREVCVUcgKChERUJVR19JTkZPLCAiUk5ESVNfUkVTRVRfTVNHOlxuIikpOw0KDQorICAg ICAgTGVuZ3RoID0gc2l6ZW9mIChSRU1PVEVfTkRJU19SRVNFVF9NU0cpOw0KDQorICAgICAgYnJl YWs7DQoNCisgICAgY2FzZSBSTkRJU19SRVNFVF9DTVBMVDoNCg0KKyAgICAgIERFQlVHICgoREVC VUdfSU5GTywgIlJORElTX1JFU0VUX0NNUExUOlxuIikpOw0KDQorICAgICAgTGVuZ3RoID0gc2l6 ZW9mIChSRU1PVEVfTkRJU19SRVNFVF9DTVBMVCk7DQoNCisgICAgICBicmVhazsNCg0KKyAgICBj YXNlIFJORElTX0lORElDQVRFX1NUQVRVU19NU0c6DQoNCisgICAgICBERUJVRyAoKERFQlVHX0lO Rk8sICJSTkRJU19JTkRJQ0FURV9TVEFUVVNfTVNHOlxuIikpOw0KDQorICAgICAgTGVuZ3RoID0g c2l6ZW9mIChSRU1PVEVfTkRJU19JTkRJQ0FURV9TVEFUVVNfTVNHKTsNCg0KKyAgICAgIGJyZWFr Ow0KDQorICAgIGNhc2UgUk5ESVNfS0VFUEFMSVZFX01TRzoNCg0KKyAgICAgIERFQlVHICgoREVC VUdfSU5GTywgIlJORElTX0tFRVBBTElWRV9NU0c6XG4iKSk7DQoNCisgICAgICBMZW5ndGggPSBz aXplb2YgKFJFTU9URV9ORElTX0tFRVBBTElWRV9NU0cpOw0KDQorICAgICAgYnJlY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uIGRlbGV0ZSBvciBkZXN0cm95IGFsbCBjb3BpZXMgb2YgdGhlIHRyYW5zbWlzc2lvbi4N Cg== --_000_DM5PR10MB1660C39610362F92EE374C2EB0769DM5PR10MB1660namp_ Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable

Hi Pedro,

I will modify license an= d add more CC next.

Thanks,

Richard

 =

From: Pedro Falcato <pedro.falcato@gmail.com>
Sent: 2022=A6~8=A4= =EB19=A4=E9 11:56 PM
To: edk2-devel-groups-io <devel@edk2.groups.io>; RichardHo [=A6=F3=A9=FA=A9=BE] <RichardHo@a= mi.com>
Cc: TonyLo [
=C3=B9=AA=F7=AAQ 

 

**CAUTION: The e-mail below is from an external source. Please exerc= ise caution before opening attachments, clicking links, or following guidance.**

Also, I forgot, but you should CC the EDK2 stewards = (they're the ones that are going to add the Reviewed-by:).

 

On Fri, Aug 19, 2022 at 4:54 PM Pedro Falcato <pedro.falcato@gmail.com> wr= ote:

Hi Richard,

 

What license is this code under? "Subject to AM= I licensing agreement." does not sound like a valid OSS license.<= /o:p>

 

Thanks,

Pedro

 

On Fri, Aug 19, 2022 at 10:32 AM RichardHo [=A6=F3=A9=FA=A9=BE] via groups.io <richardho=3Dami.com@groups.io> wrote:

UsbNetworkPkg provide= s network functions for USB ACM, USB NCM,
and USB RNDIS network device.

Signed-off-by: Richard Ho <richardho@ami.com>
Reviewed-by: Tony Lo <tonylo@ami.com>
---
 UsbNetworkPkg/Config/UsbNetworkPkg.inc.dsc    |   = ; 9 +
 .../Config/UsbNetworkPkgComponentsDxe.inc.dsc |   20 +
 .../Config/UsbNetworkPkgComponentsDxe.inc.fdf |   21 +
 .../Config/UsbNetworkPkgDefines.inc.dsc       |&n= bsp;  23 +
 .../Include/Protocol/UsbEthernetProtocol.h    |  872 += ++++++++
 UsbNetworkPkg/NetworkCommon/ComponentName.c   |  264 += ++
 UsbNetworkPkg/NetworkCommon/DriverBinding.c   |  583 += +++++
 UsbNetworkPkg/NetworkCommon/DriverBinding.h   |  263 += ++
 UsbNetworkPkg/NetworkCommon/NetworkCommon.inf |   43 +
 UsbNetworkPkg/NetworkCommon/PxeFunction.c     | 1734 += ++++++++++++++++
 UsbNetworkPkg/ReadMe.md            &nbs= p;          |   65 +
 UsbNetworkPkg/ReleaseNotes.md           = ;      |   11 +
 UsbNetworkPkg/UsbCdcEcm/ComponentName.c       |&n= bsp; 170 ++
 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.c         =  |  504 +++++
 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.h         =  |  211 ++
 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf        &nbs= p;|   41 +
 UsbNetworkPkg/UsbCdcEcm/UsbEcmFunction.c      |  = 861 ++++++++
 UsbNetworkPkg/UsbCdcNcm/ComponentName.c       |&n= bsp; 170 ++
 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.c         =  |  508 +++++
 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.h         =  |  245 +++
 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf        &nbs= p;|   41 +
 UsbNetworkPkg/UsbCdcNcm/UsbNcmFunction.c      |  = 946 +++++++++
 UsbNetworkPkg/UsbNetworkPkg.dec          &nb= sp;    |   32 +
 UsbNetworkPkg/UsbRndis/ComponentName.c        |&n= bsp; 172 ++
 UsbNetworkPkg/UsbRndis/UsbRndis.c          &= nbsp;  |  848 ++++++++
 UsbNetworkPkg/UsbRndis/UsbRndis.h          &= nbsp;  |  569 ++++++
 UsbNetworkPkg/UsbRndis/UsbRndis.inf         =  |   41 +
 UsbNetworkPkg/UsbRndis/UsbRndisFunction.c     | 1587 += ++++++++++++++
 28 files changed, 10854 insertions(+)
 create mode 100644 UsbNetworkPkg/Config/UsbNetworkPkg.inc.dsc
 create mode 100644 UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.in= c.dsc
 create mode 100644 UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.in= c.fdf
 create mode 100644 UsbNetworkPkg/Config/UsbNetworkPkgDefines.inc.dsc<= br>  create mode 100644 UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol= .h
 create mode 100644 UsbNetworkPkg/NetworkCommon/ComponentName.c
 create mode 100644 UsbNetworkPkg/NetworkCommon/DriverBinding.c
 create mode 100644 UsbNetworkPkg/NetworkCommon/DriverBinding.h
 create mode 100644 UsbNetworkPkg/NetworkCommon/NetworkCommon.inf
 create mode 100644 UsbNetworkPkg/NetworkCommon/PxeFunction.c
 create mode 100644 UsbNetworkPkg/ReadMe.md
 create mode 100644 UsbNetworkPkg/ReleaseNotes.md
 create mode 100644 UsbNetworkPkg/UsbCdcEcm/ComponentName.c
 create mode 100644 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.c
 create mode 100644 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.h
 create mode 100644 UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf
 create mode 100644 UsbNetworkPkg/UsbCdcEcm/UsbEcmFunction.c
 create mode 100644 UsbNetworkPkg/UsbCdcNcm/ComponentName.c
 create mode 100644 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.c
 create mode 100644 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.h
 create mode 100644 UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf
 create mode 100644 UsbNetworkPkg/UsbCdcNcm/UsbNcmFunction.c
 create mode 100644 UsbNetworkPkg/UsbNetworkPkg.dec
 create mode 100644 UsbNetworkPkg/UsbRndis/ComponentName.c
 create mode 100644 UsbNetworkPkg/UsbRndis/UsbRndis.c
 create mode 100644 UsbNetworkPkg/UsbRndis/UsbRndis.h
 create mode 100644 UsbNetworkPkg/UsbRndis/UsbRndis.inf
 create mode 100644 UsbNetworkPkg/UsbRndis/UsbRndisFunction.c

diff --git a/UsbNetworkPkg/Config/UsbNetworkPkg.inc.dsc b/UsbNetworkPkg/Con= fig/UsbNetworkPkg.inc.dsc
new file mode 100644
index 0000000000..504680bc4b
--- /dev/null
+++ b/UsbNetworkPkg/Config/UsbNetworkPkg.inc.dsc
@@ -0,0 +1,9 @@
+## @file
+# Global DSC definitions to be included into project DSC file.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Components.X64]
+!include UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc
diff --git a/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc b/UsbN= etworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc
new file mode 100644
index 0000000000..ae2727b68c
--- /dev/null
+++ b/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.dsc
@@ -0,0 +1,20 @@
+## @file
+# List of Core Components.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+  UsbNetworkPkg/NetworkCommon/NetworkCommon.inf
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcEcmSupport
+  UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf
+!endif
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcNcmSupport
+  UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf
+!endif
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbRndisSupport
+  UsbNetworkPkg/UsbRndis/UsbRndis.inf
+!endif
diff --git a/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.fdf b/UsbN= etworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.fdf
new file mode 100644
index 0000000000..6a611e359c
--- /dev/null
+++ b/UsbNetworkPkg/Config/UsbNetworkPkgComponentsDxe.inc.fdf
@@ -0,0 +1,21 @@
+## @file
+# List of Core Components.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+  INF UsbNetworkPkg/NetworkCommon/NetworkCommon.inf
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcEcmSupport
+  INF UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf
+!endif
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbCdcNcmSupport
+  INF UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf
+!endif
+
+!if gUsbNetworkPkgTokenSpaceGuid.UsbRndisSupport
+  INF UsbNetworkPkg/UsbRndis/UsbRndis.inf
+!endif
+
\ No newline at end of file
diff --git a/UsbNetworkPkg/Config/UsbNetworkPkgDefines.inc.dsc b/UsbNetwork= Pkg/Config/UsbNetworkPkgDefines.inc.dsc
new file mode 100644
index 0000000000..ef663bf253
--- /dev/null
+++ b/UsbNetworkPkg/Config/UsbNetworkPkgDefines.inc.dsc
@@ -0,0 +1,23 @@
+## @file
+# Global switches enable/disable project features.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Defines]
+!if "IA32" in $(ARCH) && "X64" in $(ARCH)
+  DEFINE PEI=3DIA32
+  DEFINE DXE=3DX64
+!else
+  DEFINE PEI=3DCOMMON
+  DEFINE DXE=3DCOMMON
+!endif
+
+[Packages]
+  UsbNetworkPkg/UsbNetworkPkg.dec
+
+[PcdsFeatureFlag]
+  gUsbNetworkPkgTokenSpaceGuid.UsbCdcEcmSupport|FALSE
+  gUsbNetworkPkgTokenSpaceGuid.UsbCdcNcmSupport|FALSE
+  gUsbNetworkPkgTokenSpaceGuid.UsbRndisSupport|TRUE
diff --git a/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h b/UsbNetw= orkPkg/Include/Protocol/UsbEthernetProtocol.h
new file mode 100644
index 0000000000..d60e83f723
--- /dev/null
+++ b/UsbNetworkPkg/Include/Protocol/UsbEthernetProtocol.h
@@ -0,0 +1,872 @@
+/** @file

+  Header file contains code for USB Ethernet Protocol

+  definitions

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#ifndef _USB_ETHERNET_PROTOCOL_H

+#define _USB_ETHERNET_PROTOCOL_H

+

+#define USB_ETHERNET_PROTOCOL_GUID \

+    {0x8d8969cc, 0xfeb0, 0x4303, {0xb2, 0x1a, 0x1f, 0x11, 0x6f, = 0x38, 0x56, 0x43}}

+

+typedef struct _USB_ETHERNET_PROTOCOL USB_ETHERNET_PROTOCOL;

+

+#define USB_CDC_CLASS          0x02

+#define USB_CDC_ACM_SUBCLASS   0x02

+#define USB_CDC_ECM_SUBCLASS   0x06

+#define USB_CDC_NCM_SUBCLASS   0x0D

+#define USB_CDC_DATA_CLASS     0x0A

+#define USB_CDC_DATA_SUBCLASS  0x00

+#define USB_NO_CLASS_PROTOCOL  0x00

+#define USB_NCM_NTB_PROTOCOL   0x01

+#define USB_VENDOR_PROTOCOL    0xFF

+

+// Type Values for the DescriptorType Field

+#define CS_INTERFACE  0x24

+#define CS_ENDPOINT   0x25

+

+// Descriptor SubType in Functional Descriptors

+#define HEADER_FUN_DESCRIPTOR    0x00

+#define UNION_FUN_DESCRIPTOR     0x06

+#define ETHERNET_FUN_DESCRIPTOR  0x0F

+

+#define MAX_LAN_INTERFACE  0x10

+

+// Table 20: Class-Specific Notification Codes

+#define USB_CDC_NETWORK_CONNECTION  0x00

+

+// 6.3.1 NetworkConnection

+#define NETWORK_CONNECTED   0x01

+#define NETWORK_DISCONNECT  0x00

+

+// USB Header functional Descriptor

+typedef struct {

+  UINT8     FunctionLength;

+  UINT8     DescriptorType;

+  UINT8     DescriptorSubtype;

+  UINT16    BcdCdc;

+} USB_HEADER_FUN_DESCRIPTOR;

+

+// USB Union Functional Descriptor

+typedef struct {

+  UINT8    FunctionLength;

+  UINT8    DescriptorType;

+  UINT8    DescriptorSubtype;

+  UINT8    MasterInterface;

+  UINT8    SlaveInterface;

+} USB_UNION_FUN_DESCRIPTOR;

+

+// USB Ethernet Functional Descriptor

+typedef struct {

+  UINT8     FunctionLength;

+  UINT8     DescriptorType;

+  UINT8     DescriptorSubtype;

+  UINT8     MacAddress;

+  UINT32    EthernetStatistics;

+  UINT16    MaxSegmentSize;

+  UINT16    NumberMcFilters;

+  UINT8     NumberPowerFilters;

+} USB_ETHERNET_FUN_DESCRIPTOR;

+

+typedef struct {

+  UINT32    UsBitRate;

+  UINT32    DsBitRate;

+} USB_CONNECT_SPEED_CHANGE;

+

+// Request Type Codes for USB Ethernet

+#define USB_ETHERNET_GET_REQ_TYPE  0xA1

+#define USB_ETHRTNET_SET_REQ_TYPE  0x21

+

+// Class-Specific Request Codes for Ethernet subclass

+// USB ECM 1.2 specification, Section 6.2

+#define SET_ETH_MULTICAST_FILTERS_REQ          &n= bsp;     0x40

+#define SET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ  0x41

+#define GET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ  0x42

+#define SET_ETH_PACKET_FILTER_REQ           =         0x43

+#define GET_ETH_STATISTIC_REQ            &nb= sp;           0x44

+

+// USB ECM command request length

+#define USB_ETH_POWER_FILTER_LENGTH   2 // Section 6.2.3

+#define USB_ETH_PACKET_FILTER_LENGTH  0 // Section 6.2.4

+#define USB_ETH_STATISTIC             4= // Section 6.2.5

+

+// USB Ethernet Packet Filter Bitmap

+// USB ECM 1.2 specification, Section 6.2.4

+#define USB_ETH_PACKET_TYPE_PROMISCUOUS    BIT0

+#define USB_ETH_PACKET_TYPE_ALL_MULTICAST  BIT1

+#define USB_ETH_PACKET_TYPE_DIRECTED       BIT2

+#define USB_ETH_PACKET_TYPE_BROADCAST      BIT3

+#define USB_ETH_PACKET_TYPE_MULTICAST      BIT4

+

+// USB Ethernet Statistics Feature Selector Codes

+// USB ECM 1.2 specification, Section 6.2.5

+#define USB_ETH_XMIT_OK              &n= bsp;  0x01

+#define USB_ETH_RCV_OK              &nb= sp;   0x02

+#define USB_ETH_XMIT_ERROR             = 0x03

+#define USB_ETH_RCV_ERROR              =  0x04

+#define USB_ETH_RCV_NO_BUFFER           0x05=

+#define USB_ETH_DIRECTED_BYTES_XMIT     0x06

+#define USB_ETH_DIRECTED_FRAMES_XMIT    0x07

+#define USB_ETH_MULTICAST_BYTES_XMIT    0x08

+#define USB_ETH_MULTICAST_FRAMES_XMIT   0x09

+#define USB_ETH_BROADCAST_BYTES_XMIT    0x0A

+#define USB_ETH_BROADCAST_FRAMES_XMIT   0x0B

+#define USB_ETH_DIRECTED_BYTES_RCV      0x0C

+#define USB_ETH_DIRECTED_FRAMES_RCV     0x0D

+#define USB_ETH_MULTICAST_BYTES_RCV     0x0E

+#define USB_ETH_MULTICAST_FRAMES_RCV    0x0F

+#define USB_ETH_BROADCAST_BYTES_RCV     0x10

+#define USB_ETH_BROADCAST_FRAMES_RCV    0x11

+#define USB_ETH_RCV_CRC_ERROR           0x12=

+#define USB_ETH_TRANSMIT_QUEUE_LENGTH   0x13

+#define USB_ETH_RCV_ERROR_ALIGNMENT     0x14

+#define USB_ETH_XMIT_ONE_COLLISION      0x15

+#define USB_ETH_XMIT_MORE_COLLISIONS    0x16

+#define USB_ETH_XMIT_DEFERRED           0x17=

+#define USB_ETH_XMIT_MAX_COLLISIONS     0x18

+#define USB_ETH_RCV_OVERRUN             = ;0x19

+#define USB_ETH_XMIT_UNDERRUN           0x1A=

+#define USB_ETH_XMIT_HEARTBEAT_FAILURE  0x1B

+#define USB_ETH_XMIT_TIMES_CRS_LOST     0x1C

+#define USB_ETH_XMIT_LATE_COLLISIONS    0x1D

+

+// NIC Information

+typedef struct {

+  UINT32                 = ;   Signature;

+  USB_ETHERNET_PROTOCOL     *UsbEth;

+  UINT16                 = ;   InterrupOpFlag;

+  UINT64                 = ;   MappedAddr;

+  PXE_MAC_ADDR              McastL= ist[MAX_MCAST_ADDRESS_CNT];

+  UINT8                 =    McastCount;

+  UINT64                 = ;   MediaHeader[MAX_XMIT_BUFFERS];

+  UINT8                 =    TxBufferCount;

+  UINT16                 = ;   State;

+  BOOLEAN                &nbs= p;  CanTransmit;

+  BOOLEAN                &nbs= p;  CanReceive;

+  UINT16                 = ;   ReceiveStatus;

+  UINT8                 =    RxFilter;

+  UINT32                 = ;   RxFrame;

+  UINT32                 = ;   TxFrame;

+  UINT16                 = ;   NetworkConnect;

+  UINT8                 =    CableDetect;

+  UINT16                 = ;   MaxSegmentSize;

+  EFI_MAC_ADDRESS           MacAddr;
+  PXE_CPB_START_31          PxeStart;

+  PXE_CPB_INITIALIZE        PxeInit;

+  UINT8                 =    PermNodeAddress[PXE_MAC_LENGTH];

+  UINT8                 =    CurrentNodeAddress[PXE_MAC_LENGTH];

+  UINT8                 =    BroadcastNodeAddress[PXE_MAC_LENGTH];

+  EFI_USB_DEVICE_REQUEST    Request;

+} NIC_DATA;

+

+#define NIC_DATA_SIGNATURE  SIGNATURE_32('n', 'i', 'c', 'd')

+#define NIC_DATA_FROM_USB_ETHERNET_PROTOCOL(a)  CR (a, NIC_DATA, UsbE= th, NIC_DATA_SIGNATURE)

+

+/**

+  This command is used to determine the operational state of the UNDI= .

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_GET_STATE)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to change the UNDI operational state from stop= ped to started.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_START)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to change the UNDI operational state from star= ted to stopped.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_STOP)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to retrieve initialization information that is=

+  needed by drivers and applications to initialized UNDI.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_GET_INIT_INFO)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to retrieve configuration information about
+  the NIC being controlled by the UNDI.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_GET_CONFIG_INFO)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command resets the network adapter and initializes UNDI using<= br>
+  the parameters supplied in the CPB.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_INITIALIZE)(

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+/**

+  This command resets the network adapter and reinitializes the UNDI<= br>
+  with the same parameters provided in the Initialize command.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_RESET)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  The Shutdown command resets the network adapter and leaves it in a<= br>
+  safe state for another driver to initialize.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_SHUTDOWN)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  The Interrupt Enables command can be used to read and/or change

+  the current external interrupt enable settings.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_INTERRUPT_ENABLE)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to read and change receive filters and,

+  if supported, read and change the multicast MAC address filter list= .

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_RECEIVE_FILTER)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to get current station and broadcast MAC addre= sses

+  and, if supported, to change the current station MAC address.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_STATION_ADDRESS)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to read and clear the NIC traffic statistics.<= br>
+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_STATISTICS)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  Translate a multicast IPv4 or IPv6 address to a multicast MAC addre= ss.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_MCAST_IPTOMAC)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to read and write (if supported by NIC H/W)
+  nonvolatile storage on the NIC.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_NV_DATA)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command returns the current interrupt status and/or the

+  transmitted buffer addresses and the current media status.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_GET_STATUS)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command is used to fill the media header(s) in transmit packet= (s).

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_FILL_HEADER)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  The Transmit command is used to place a packet into the transmit qu= eue.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_TRANSMIT)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  When the network adapter has received a frame, this command is used=

+  to copy the frame into driver/application storage.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_UNDI_RECEIVE)(

+  IN  PXE_CDB     *Cdb,

+  IN  NIC_DATA    *Nic

+  );

+

+/**

+  This command resets the network adapter and initializes UNDI using<= br>
+  the parameters supplied in the CPB.

+

+  @param[in]      Cdb  A pointer to the command d= escriptor block.

+  @param[in, out] Nic  A pointer to the Network interface contro= ller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_INITIALIZE)(

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  );

+

+/**

+  This command is used to read and clear the NIC traffic statistics.<= br>
+

+  @param[in]  Nic     A pointer to the Network in= terface controller data.

+  @param[in]  DbAddr  Data Block Address.

+  @param[in]  DbSize  Data Block Size.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_STATISTICS)(

+  IN  NIC_DATA    *Nic,

+  IN  UINT64      DbAddr,

+  IN  UINT16      DbSize

+  );

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk in.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in, out] Packet        A pointer to the = buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_RECEIVE)(

+  IN     PXE_CDB          &nb= sp;    *Cdb,

+  IN     USB_ETHERNET_PROTOCOL *This,

+  IN OUT VOID                =   *Packet,

+  IN OUT UINTN               =  *PacketLength

+  );

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk out.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in, out] Packet        A pointer to the = buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_TRANSMIT)(

+  IN     PXE_CDB          &nb= sp;    *Cdb,

+  IN     USB_ETHERNET_PROTOCOL *This,

+  IN OUT VOID                =   *Packet,

+  IN OUT UINTN               =  *PacketLength

+  );

+

+/**

+  This function is used to manage a USB device with an interrupt tran= sfer pipe.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  IsNewTransfer     If TRUE, a new tr= ansfer will be submitted to USB controller. If

+                    &nbs= p;           FALSE, the interrupt transfer is dele= ted from the device's interrupt

+                    &nbs= p;           transfer queue.

+  @param[in]  PollingInterval   Indicates the periodic= rate, in milliseconds, that the transfer is to be

+                    &nbs= p;           executed.This parameter is required w= hen IsNewTransfer is TRUE. The

+                    &nbs= p;           value must be between 1 to 255, other= wise EFI_INVALID_PARAMETER is returned.

+                    &nbs= p;           The units are in milliseconds.

+  @param[in]  Request           A = pointer to the EFI_USB_DEVICE_REQUEST data.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_INTERRUPT)(

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Request

+  );

+

+/**

+  Retrieves the USB Ethernet Mac Address.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] MacAddress    A pointer to the caller allocat= ed USB Ethernet Mac Address.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_GET_ETH_MAC_ADDRESS)(

+  IN  USB_ETHERNET_PROTOCOL *This,

+  OUT EFI_MAC_ADDRESS       *MacAddress

+  );

+

+/**

+  Retrieves the USB Ethernet Bulk transfer data size.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] BulkSize      A pointer to the Bulk tran= sfer data size.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETH_MAX_BULK_SIZE)(

+  IN  USB_ETHERNET_PROTOCOL *This,

+  OUT UINTN                &n= bsp;*BulkSize

+  );

+

+/**

+  Retrieves the USB Header functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbHeaderFunDescriptor A pointer to the caller allocate= d USB Header Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_HEADER_FUNCTIONAL_DESCRIPTOR)(

+  IN USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR *UsbHeaderFunDescriptor

+  );

+

+/**

+  Retrieves the USB Union functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbUnionFunDescriptor  A pointer to the caller all= ocated USB Union Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Union Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbUnionFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Unio= n Functional descriptor was not found.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_UNION_FUNCTIONAL_DESCRIPTOR)(

+  IN USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR *UsbUnionFunDescriptor

+  );

+

+/**

+  Retrieves the USB Ethernet functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbEthFunDescriptor    A pointer to the calle= r allocated USB Ethernet Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Ethernet Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbEthFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Ethe= rnet Functional descriptor was not found.

+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_FUNCTIONAL_DESCRIPTOR)(

+  IN USB_ETHERNET_PROTOCOL        *This,

+  OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor

+  );

+

+/**

+  This request sets the Ethernet device multicast filters as specifie= d in the

+  sequential list of 48 bit Ethernet multicast addresses.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     Number of filters.

+  @param[in]  McastAddr           =   A pointer to the value of the multicast addresses.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_SET_ETH_MULTICAST_FILTERS)(

+  IN USB_ETHERNET_PROTOCOL *This,

+  IN UINT16                Va= lue,

+  IN VOID                &nbs= p; *McastAddr

+  );

+

+/**

+  This request sets up the specified Ethernet power management patter= n filter as

+  described in the data structure.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     Number of filters.

+  @param[in]  Length            &n= bsp;    Size of the power management pattern filter data.

+  @param[in]  PatternFilter          A = pointer to the power management pattern filter structure.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER)(

+  IN USB_ETHERNET_PROTOCOL *This,

+  IN UINT16                Va= lue,

+  IN UINT16                Le= ngth,

+  IN VOID                &nbs= p; *PatternFilter

+  );

+

+/**

+  This request retrieves the status of the specified Ethernet power m= anagement

+  pattern filter from the device.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     The filter number.

+  @param[out] PatternActive          A point= er to the pattern active boolean.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER)(

+  IN   USB_ETHERNET_PROTOCOL *This,

+  IN   UINT16            &nbs= p;   Value,

+  OUT  BOOLEAN              &= nbsp;*PatternActive

+  );

+

+/**

+  This request is used to configure device Ethernet packet filter set= tings.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;Packet Filter Bitmap.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_SET_ETH_PACKET_FILTER)(

+  IN USB_ETHERNET_PROTOCOL *This,

+  IN UINT16                Va= lue

+  );

+

+/**

+  This request is used to retrieve a statistic based on the feature s= elector.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  FeatureSelector       Value of= the feature selector.

+  @param[out] Statistic            &nbs= p;A pointer to the 32 bit unsigned integer.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+**/

+typedef

+EFI_STATUS

+(EFIAPI *USB_ETHERNET_GET_ETH_STATISTIC)(

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  );

+

+typedef struct {

+  USB_ETHERNET_UNDI_GET_STATE           = ;UsbEthUndiGetState;

+  USB_ETHERNET_UNDI_START            &n= bsp;  UsbEthUndiStart;

+  USB_ETHERNET_UNDI_STOP            &nb= sp;   UsbEthUndiStop;

+  USB_ETHERNET_UNDI_GET_INIT_INFO       UsbEthUnd= iGetInitInfo;

+  USB_ETHERNET_UNDI_GET_CONFIG_INFO     UsbEthUndiGetC= onfigInfo;

+  USB_ETHERNET_UNDI_INITIALIZE          UsbE= thUndiInitialize;

+  USB_ETHERNET_UNDI_RESET            &n= bsp;  UsbEthUndiReset;

+  USB_ETHERNET_UNDI_SHUTDOWN           = UsbEthUndiShutdown;

+  USB_ETHERNET_UNDI_INTERRUPT_ENABLE    UsbEthUndiInterrupt= Enable;

+  USB_ETHERNET_UNDI_RECEIVE_FILTER      UsbEthUndiRece= iveFilter;

+  USB_ETHERNET_UNDI_STATION_ADDRESS     UsbEthUndiStat= ionAddress;

+  USB_ETHERNET_UNDI_STATISTICS          UsbE= thUndiStatistics;

+  USB_ETHERNET_UNDI_MCAST_IPTOMAC       UsbEthUnd= iMcastIp2Mac;

+  USB_ETHERNET_UNDI_NV_DATA            =  UsbEthUndiNvData;

+  USB_ETHERNET_UNDI_GET_STATUS          UsbE= thUndiGetStatus;

+  USB_ETHERNET_UNDI_FILL_HEADER         UsbE= thUndiFillHeader;

+  USB_ETHERNET_UNDI_TRANSMIT           = UsbEthUndiTransmit;

+  USB_ETHERNET_UNDI_RECEIVE            =  UsbEthUndiReceive;

+} USB_ETHERNET_UNDI;

+

+// The USB_ETHERNET_PROTOCOL provides some basic USB Ethernet device relev= ant

+// descriptor and specific requests.

+struct _USB_ETHERNET_PROTOCOL {

+  USB_ETHERNET_UNDI              &= nbsp;                    = UsbEthUndi;

+  // for calling the UNDI child functions

+  USB_ETHERNET_INITIALIZE            &n= bsp;                UsbEthInitializ= e;

+  USB_ETHERNET_STATISTICS            &n= bsp;                UsbEthStatistic= s;

+  USB_ETHERNET_RECEIVE             = ;                   UsbEthRece= ive;

+  USB_ETHERNET_TRANSMIT            &nbs= p;                  UsbEthTran= smit;

+  USB_ETHERNET_INTERRUPT            &nb= sp;                 UsbEthInterrupt= ;

+  USB_GET_ETH_MAC_ADDRESS            &n= bsp;                UsbEthMacAddres= s;

+  USB_ETH_MAX_BULK_SIZE            &nbs= p;                  UsbEthMaxB= ulkSize;

+  USB_HEADER_FUNCTIONAL_DESCRIPTOR          =           UsbHeaderFunDescriptor;

+  USB_UNION_FUNCTIONAL_DESCRIPTOR          &= nbsp;          UsbUnionFunDescriptor;

+  USB_ETHERNET_FUNCTIONAL_DESCRIPTOR         = ;         UsbEthFunDescriptor;

+  USB_ETHERNET_SET_ETH_MULTICAST_FILTERS        &= nbsp;     SetUsbEthMcastFilter;

+  USB_ETHERNET_SET_ETH_POWER_MANAGE_PATTERN_FILTER    SetUs= bEthPowerPatternFilter;

+  USB_ETHERNET_GET_ETH_POWER_MANAGE_PATTERN_FILTER    GetUs= bEthPoewrPatternFilter;

+  USB_ETHERNET_SET_ETH_PACKET_FILTER         = ;         SetUsbEthPacketFilter;

+  USB_ETHERNET_GET_ETH_STATISTIC          &n= bsp;           GetUsbEthStatistic;

+};

+

+#endif

diff --git a/UsbNetworkPkg/NetworkCommon/ComponentName.c b/UsbNetworkPkg/Ne= tworkCommon/ComponentName.c
new file mode 100644
index 0000000000..2697bf5083
--- /dev/null
+++ b/UsbNetworkPkg/NetworkCommon/ComponentName.c
@@ -0,0 +1,264 @@
+/** @file

+  This file contains code for USB network common driver

+  component name definitions

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "DriverBinding.h"

+

+extern EFI_DRIVER_BINDING_PROTOCOL  gNetworkCommonDriverBinding;

+extern EFI_GUID                &nb= sp;    gUsbEthProtocolGuid;

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  gNetworkCommo= nDriverNameTable[] =3D {

+  {

+    "eng;en",

+    L"Network Common Driver"

+  },

+  {

+    NULL,

+    NULL

+  }

+};

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  *gNetworkComm= onControllerNameTable =3D NULL;

+

+EFI_STATUS

+EFIAPI

+NetworkCommonComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  );

+

+EFI_STATUS

+EFIAPI

+NetworkCommonComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  );

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gNetworkCo= mmonComponentName =3D {

+  NetworkCommonComponentNameGetDriverName,

+  NetworkCommonComponentNameGetControllerName,

+  "eng"

+};

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  gNetworkC= ommonComponentName2 =3D {

+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)NetworkCommonComponentNameGetD= riverName,

+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)NetworkCommonComponentName= GetControllerName,

+  "en"

+};

+

+/**

+  Retrieves a Unicode string that is the user readable name of the dr= iver.

+

+  This function retrieves the user readable name of a driver in the f= orm of a

+  Unicode string. If the driver specified by This has a user readable= name in

+  the language specified by Language, then a pointer to the driver na= me is

+  returned in DriverName, and EFI_SUCCESS is returned. If the driver = specified

+  by This does not support the language specified by Language,

+  then EFI_UNSUPPORTED is returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language. This i= s the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified

+                    &nbs= p;           in RFC 4646 or ISO 639-2 language cod= e format.

+  @param[out] DriverName        A pointer to the = Unicode string to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           driver specified by This in the langu= age

+                    &nbs= p;           specified by Language.

+

+  @retval EFI_SUCCESS           The Uni= code string for the Driver specified by

+                    &nbs= p;           This and the language specified by La= nguage was

+                    &nbs= p;           returned in DriverName.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER DriverName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  )

+{

+  return LookupUnicodeString2 (

+           Language,

+           This->SupportedLanguages,

+           gNetworkCommonDriverNameTable,
+           DriverName,

+           (BOOLEAN)(This =3D=3D &gNetwo= rkCommonComponentName)

+           );

+}

+

+/**

+  Retrieves a Unicode string that is the user readable name of the co= ntroller

+  that is being managed by a driver.

+

+  This function retrieves the user readable name of the controller sp= ecified by

+  ControllerHandle and ChildHandle in the form of a Unicode string. I= f the

+  driver specified by This has a user readable name in the language s= pecified by

+  Language, then a pointer to the controller name is returned in Cont= rollerName,

+  and EFI_SUCCESS is returned.  If the driver specified by This = is not currently

+  managing the controller specified by ControllerHandle and ChildHand= le,

+  then EFI_UNSUPPORTED is returned.  If the driver specified by = This does not

+  support the language specified by Language, then EFI_UNSUPPORTED is= returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Controller        The handle o= f a controller that the driver

+                    &nbs= p;           specified by This is managing.  = This handle

+                    &nbs= p;           specifies the controller whose name i= s to be

+                    &nbs= p;           returned.

+  @param[in]  ChildHandle       The handle o= f the child controller to retrieve

+                    &nbs= p;           the name of.  This is an optiona= l parameter that

+                    &nbs= p;           may be NULL.  It will be NULL fo= r device

+                    &nbs= p;           drivers.  It will also be NULL f= or a bus drivers

+                    &nbs= p;           that wish to retrieve the name of the= bus

+                    &nbs= p;           controller.  It will not be NULL= for a bus

+                    &nbs= p;           driver that wishes to retrieve the na= me of a

+                    &nbs= p;           child controller.

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language.  = This is the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified in

+                    &nbs= p;           RFC 4646 or ISO 639-2 language code f= ormat.

+  @param[out] ControllerName    A pointer to the Unicode st= ring to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           controller specified by ControllerHan= dle and

+                    &nbs= p;           ChildHandle in the language specified= by

+                    &nbs= p;           Language from the point of view of th= e driver

+                    &nbs= p;           specified by This.

+

+  @retval EFI_SUCCESS           The Uni= code string for the user readable name in

+                    &nbs= p;           the language specified by Language fo= r the

+                    &nbs= p;           driver specified by This was returned= in

+                    &nbs= p;           DriverName.

+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_H= ANDLE.

+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not= a valid

+                    &nbs= p;           EFI_HANDLE.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This is not currently

+                    &nbs= p;           managing the controller specified by<= br>
+                    &nbs= p;           ControllerHandle and ChildHandle.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonComponentNameGetControllerName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      Controller,

+  IN  EFI_HANDLE             =      ChildHandle        OPTIONAL,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **ControllerName

+  )

+{

+  EFI_STATUS                &= nbsp;Status;

+  CHAR16                 = ;    *HandleName;

+  EFI_USB_IO_PROTOCOL        *UsbIo =3D NULL;

+  EFI_USB_DEVICE_DESCRIPTOR  DevDesc;

+

+  if (!Language || !ControllerName) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (ChildHandle =3D=3D NULL) {

+    return EFI_UNSUPPORTED;

+  }

+

+  //

+  // Make sure this driver is currently managing ControllerHandle

+  //

+  Status =3D EfiTestManagedDevice (

+             Controller,

+             gNetworkCommonDriverBindin= g.DriverBindingHandle,

+             &gUsbEthProtocolGuid
+             );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  //

+  // Make sure this driver produced ChildHandle

+  //

+  Status =3D EfiTestChildHandle (

+             Controller,

+             ChildHandle,

+             &gUsbEthProtocolGuid
+             );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->HandleProtocol (Controller, &gEfiUsbIoProtoc= olGuid, (VOID **)&UsbIo);

+

+  if (!EFI_ERROR (Status)) {

+    Status =3D UsbIo->UsbGetDeviceDescriptor (UsbIo, &Dev= Desc);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    Status =3D UsbIo->UsbGetStringDescriptor (UsbIo, 0x409, D= evDesc.StrManufacturer, &HandleName);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    *ControllerName =3D HandleName;

+

+    if (gNetworkCommonControllerNameTable !=3D NULL) {

+      FreeUnicodeStringTable (gNetworkCommonControllerNameT= able);

+      gNetworkCommonControllerNameTable =3D NULL;

+    }

+

+    Status =3D AddUnicodeString2 (

+               "eng",
+               gNetworkCommonCompo= nentName.SupportedLanguages,

+               &gNetworkCommon= ControllerNameTable,

+               HandleName,

+               TRUE

+               );

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    Status =3D AddUnicodeString2 (

+               "en",

+               gNetworkCommonCompo= nentName2.SupportedLanguages,

+               &gNetworkCommon= ControllerNameTable,

+               HandleName,

+               FALSE

+               );

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    return LookupUnicodeString2 (

+             Language,

+             This->SupportedLanguage= s,

+             gNetworkCommonControllerNa= meTable,

+             ControllerName,

+             (BOOLEAN)(This =3D=3D &= ;gNetworkCommonComponentName)

+             );

+  }

+

+  return EFI_UNSUPPORTED;

+}

diff --git a/UsbNetworkPkg/NetworkCommon/DriverBinding.c b/UsbNetworkPkg/Ne= tworkCommon/DriverBinding.c
new file mode 100644
index 0000000000..18b2daa7a8
--- /dev/null
+++ b/UsbNetworkPkg/NetworkCommon/DriverBinding.c
@@ -0,0 +1,583 @@
+/** @file

+  This file contains code for USB network binding driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "DriverBinding.h"

+

+PXE_SW_UNDI  *gPxe =3D NULL;

+NIC_DEVICE   *gLanDeviceList[MAX_LAN_INTERFACE];

+

+EFI_GUID  gUsbEthProtocolGuid =3D USB_ETHERNET_PROTOCOL_GUID;

+

+EFI_DRIVER_BINDING_PROTOCOL  gNetworkCommonDriverBinding =3D {

+  NetworkCommonSupported,

+  NetworkCommonDriverStart,

+  NetworkCommonDriverStop,

+  NETWORK_COMMON_DRIVER_VERSION,

+  NULL,

+  NULL

+};

+

+/**

+  Create MAC Device Path

+

+  @param[in, out] Dev             = A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+  @param[in]      BaseDev        &= nbsp;A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+  @param[in]      Nic         = ;    A pointer to the Network interface controller data.

+

+  @retval EFI_OUT_OF_RESOURCES    The device path could not= be created successfully due to a lack of resources.

+  @retval EFI_SUCCESS             = MAC device path created successfully.

+

+**/

+EFI_STATUS

+CreateMacDevicePath (

+  IN OUT  EFI_DEVICE_PATH_PROTOCOL  **Dev,

+  IN      EFI_DEVICE_PATH_PROTOCOL  *BaseDev,

+  IN      NIC_DATA          &= nbsp;       *Nic

+  )

+{

+  EFI_STATUS                S= tatus;

+  MAC_ADDR_DEVICE_PATH      MacAddrNode;

+  EFI_DEVICE_PATH_PROTOCOL  *EndNode;

+  UINT8                 =    *DevicePath;

+  UINT16                 = ;   TotalLength;

+  UINT16                 = ;   BaseLength;

+

+  ZeroMem (&MacAddrNode, sizeof (MAC_ADDR_DEVICE_PATH));

+  CopyMem (&MacAddrNode.MacAddress, &Nic->MacAddr, sizeof = (EFI_MAC_ADDRESS));

+

+  MacAddrNode.Header.Type      =3D MESSAGING_DEVICE_PA= TH;

+  MacAddrNode.Header.SubType   =3D MSG_MAC_ADDR_DP;

+  MacAddrNode.Header.Length[0] =3D (UINT8)sizeof (MacAddrNode);

+  MacAddrNode.Header.Length[1] =3D 0;

+

+  EndNode =3D BaseDev;

+

+  while (!IsDevicePathEnd (EndNode)) {

+    EndNode =3D NextDevicePathNode (EndNode);

+  }

+

+  BaseLength  =3D (UINT16)((UINTN)(EndNode) - (UINTN)(BaseDev));=

+  TotalLength =3D (UINT16)(BaseLength + sizeof (MacAddrNode) + sizeof= (EFI_DEVICE_PATH_PROTOCOL));

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, TotalLength, = (VOID **)&DevicePath);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  *Dev =3D (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;

+  CopyMem (DevicePath, (CHAR8 *)BaseDev, BaseLength);

+  DevicePath +=3D BaseLength;

+  CopyMem (DevicePath, (CHAR8 *)&MacAddrNode, sizeof (MacAddrNode= ));

+  DevicePath +=3D sizeof (MacAddrNode);

+  CopyMem (DevicePath, (CHAR8 *)EndNode, sizeof (EFI_DEVICE_PATH_PROT= OCOL));

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Network Common Driver Binding Support.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to test.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver supports this device.

+  @retval EFI_ALREADY_STARTED         This d= river is already running on this device.

+  @retval other               = ;        This driver does not support this device.

+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS             Status;
+  USB_ETHERNET_PROTOCOL  *UsbEth;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEth,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  gBS->CloseProtocol (

+         ControllerHandle,

+         &gUsbEthProtocolGuid,

+         This->DriverBindingHandle,

+         ControllerHandle

+         );

+  return Status;

+}

+

+/**

+  Network Common Driver Binding Start.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to bind driver to.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver is added to ControllerHandle

+  @retval EFI_DEVICE_ERROR            T= his driver could not be started due to a device error

+  @retval EFI_OUT_OF_RESOURCES        The driver = could not install successfully due to a lack of resources.

+  @retval other               = ;        This driver does not support this device

+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS                S= tatus;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbEthPath;

+  USB_ETHERNET_PROTOCOL     *UsbEth;

+  EFI_MAC_ADDRESS           MacAddress;=

+  UINTN                 =    BulkDataSize;

+  NIC_DEVICE                *= NicDevice;

+  UINT8                 =    *TmpPxePointer =3D NULL;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEth,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbEthPath,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return Status;

+  }

+

+  ZeroMem (&MacAddress, sizeof (EFI_MAC_ADDRESS));

+

+  Status =3D UsbEth->UsbEthMacAddress (UsbEth, &MacAddress);
+  ASSERT_EFI_ERROR (Status);

+  Status =3D UsbEth->UsbEthMaxBulkSize (UsbEth, &BulkDataSize)= ;

+

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiDevicePathProtocolGuid,<= br>
+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return Status;

+  }

+

+  NicDevice =3D AllocateZeroPool (sizeof (NIC_DEVICE));

+  if (!NicDevice) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiDevicePathProtocolGuid,<= br>
+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return EFI_OUT_OF_RESOURCES;

+  }

+

+  // for alignment adjustment

+  if (gPxe =3D=3D NULL) {

+    TmpPxePointer =3D AllocateZeroPool (sizeof (PXE_SW_UNDI) + 1= 6);

+    if (!TmpPxePointer) {

+      if (NicDevice !=3D NULL) {

+        gBS->FreePool (NicDevice);

+      }

+

+      gBS->CloseProtocol (

+             ControllerHandle,

+             &gEfiDevicePathProtoco= lGuid,

+             This->DriverBindingHand= le,

+             ControllerHandle

+             );

+      gBS->CloseProtocol (

+             ControllerHandle,

+             &gUsbEthProtocolGuid,<= br>
+             This->DriverBindingHand= le,

+             ControllerHandle

+             );

+

+      return EFI_OUT_OF_RESOURCES;

+    } else {

+      // check for paragraph alignment here

+      if (((UINTN)TmpPxePointer & 0x0F) !=3D 0) {

+        gPxe =3D (PXE_SW_UNDI *)(TmpPxePointer + 8);
+      } else {

+        gPxe =3D (PXE_SW_UNDI *)TmpPxePointer;

+      }

+

+      if (!gPxe) {

+        if (NicDevice !=3D NULL) {

+          gBS->FreePool (NicDevice);

+        }

+

+        gBS->CloseProtocol (

+               ControllerHandle,
+               &gEfiDevicePath= ProtocolGuid,

+               This->DriverBind= ingHandle,

+               ControllerHandle
+               );

+        gBS->CloseProtocol (

+               ControllerHandle,
+               &gUsbEthProtoco= lGuid,

+               This->DriverBind= ingHandle,

+               ControllerHandle
+               );

+        return EFI_OUT_OF_RESOURCES;

+      }

+

+      PxeStructInit (gPxe);

+    }

+  }

+

+  NicDevice->NiiProtocol.Id    =3D (UINT64)(UINTN)(gPxe)= ;

+  NicDevice->NiiProtocol.IfNum =3D gPxe->IFcnt | gPxe->IFcnt= Ext << 8;

+

+  UpdateNicNum (&NicDevice->NicInfo, gPxe);

+

+  NicDevice->NicInfo.Signature =3D NIC_DATA_SIGNATURE;

+

+  NicDevice->NicInfo.UsbEth         =3D U= sbEth;

+  NicDevice->NicInfo.MaxSegmentSize =3D (UINT16)BulkDataSize;

+  NicDevice->NicInfo.CableDetect    =3D 0;

+

+  CopyMem ((CHAR8 *)&(NicDevice->NicInfo.MacAddr), (CHAR8 *)&a= mp;MacAddress, sizeof (MacAddress));

+

+  NicDevice->NicInfo.TxBufferCount =3D 0;

+

+  if (NicDevice->NiiProtocol.IfNum < MAX_LAN_INTERFACE) {

+    gLanDeviceList[NicDevice->NiiProtocol.IfNum] =3D NicDevic= e;

+  } else {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiDevicePathProtocolGuid,<= br>
+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+

+    if (TmpPxePointer !=3D NULL) {

+      gBS->FreePool (TmpPxePointer);

+    }

+

+    if (NicDevice !=3D NULL) {

+      gBS->FreePool (NicDevice);

+    }

+

+    return EFI_DEVICE_ERROR;

+  }

+

+  Status =3D CreateMacDevicePath (

+             &NicDevice->DevPath= ,

+             UsbEthPath,

+             &NicDevice->NicInfo=

+             );

+

+  if (EFI_ERROR (Status)) {

+    UpdateNicNum (NULL, gPxe);

+    if (TmpPxePointer !=3D NULL) {

+      gBS->FreePool (TmpPxePointer);

+    }

+  }

+

+  NicDevice->Signature            &n= bsp;    =3D UNDI_DEV_SIGNATURE;

+  NicDevice->NiiProtocol.Revision      =3D EFI_NETW= ORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION;

+  NicDevice->NiiProtocol.Type          = =3D EfiNetworkInterfaceUndi;

+  NicDevice->NiiProtocol.MajorVer      =3D PXE_ROMI= D_MAJORVER;

+  NicDevice->NiiProtocol.MinorVer      =3D PXE_ROMI= D_MINORVER;

+  NicDevice->NiiProtocol.ImageSize     =3D 0;

+  NicDevice->NiiProtocol.ImageAddr     =3D 0;

+  NicDevice->NiiProtocol.Ipv6Supported =3D TRUE;

+

+  NicDevice->NiiProtocol.StringId[0] =3D 'U';

+  NicDevice->NiiProtocol.StringId[1] =3D 'N';

+  NicDevice->NiiProtocol.StringId[2] =3D 'D';

+  NicDevice->NiiProtocol.StringId[3] =3D 'I';

+  NicDevice->DeviceHandle           = =3D NULL;

+

+  ZeroMem (&NicDevice->NicInfo.Request, sizeof (EFI_USB_DEVICE= _REQUEST));

+

+  Status =3D UsbEth->UsbEthInterrupt (UsbEth, TRUE, NETWORK_COMMON= _POLLING_INTERVAL, &NicDevice->NicInfo.Request);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D gBS->InstallMultipleProtocolInterfaces (

+                  &NicDev= ice->DeviceHandle,

+                  &gEfiNe= tworkInterfaceIdentifierProtocolGuid_31,

+                  &NicDev= ice->NiiProtocol,

+                  &gEfiDe= vicePathProtocolGuid,

+                  NicDevice-&= gt;DevPath,

+                  NULL

+                  );

+

+  if (EFI_ERROR (Status)) {

+    if (NicDevice->NiiProtocol.IfNum < MAX_LAN_INTERFACE) = {

+      gLanDeviceList[NicDevice->NiiProtocol.IfNum] =3D N= ULL;

+    }

+

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiDevicePathProtocolGuid,<= br>
+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+

+    if (TmpPxePointer !=3D NULL) {

+      gBS->FreePool (TmpPxePointer);

+    }

+

+    if (NicDevice->DevPath !=3D NULL) {

+      gBS->FreePool (NicDevice->DevPath);

+    }

+

+    if (NicDevice !=3D NULL) {

+      gBS->FreePool (NicDevice);

+    }

+

+    return EFI_DEVICE_ERROR;

+  }

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEth,

+                  This->Dr= iverBindingHandle,

+                  NicDevice-&= gt;DeviceHandle,

+                  EFI_OPEN_PR= OTOCOL_BY_CHILD_CONTROLLER

+                  );

+

+  return Status;

+}

+

+/**

+  Network Common Driver Binding Stop.

+

+  @param[in]  This            &nbs= p;     Protocol instance pointer.

+  @param[in]  ControllerHandle      Handle of dev= ice to stop driver on

+  @param[in]  NumberOfChildren      Number of Han= dles in ChildHandleBuffer. If number of

+                    &nbs= p;               children is zero stop t= he entire bus driver.

+  @param[in]  ChildHandleBuffer     List of Child= Handles to Stop.

+

+  @retval EFI_SUCCESS             =  This driver is removed ControllerHandle

+  @retval other               = ;      This driver was not removed from this device

+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  )

+{

+  EFI_STATUS                &= nbsp;                Status;

+  BOOLEAN                &nbs= p;                   AllChildr= enStopped;

+  UINTN                 =                     Inde= x;

+  USB_ETHERNET_PROTOCOL            &nbs= p;         *UsbEth;

+  NIC_DEVICE                &= nbsp;                *NicDevice;
+  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL  *NiiProtocol;

+

+  if (NumberOfChildren =3D=3D 0) {

+    Status =3D gBS->OpenProtocol (

+                    Cont= rollerHandle,

+                    &= ;gEfiNetworkInterfaceIdentifierProtocolGuid_31,

+                    (VOI= D **)&NiiProtocol,

+                    This= ->DriverBindingHandle,

+                    Cont= rollerHandle,

+                    EFI_= OPEN_PROTOCOL_GET_PROTOCOL

+                    );
+

+    if (EFI_ERROR (Status)) {

+      gBS->CloseProtocol (

+             ControllerHandle,

+             &gEfiDevicePathProtoco= lGuid,

+             This->DriverBindingHand= le,

+             ControllerHandle

+             );

+      gBS->CloseProtocol (

+             ControllerHandle,

+             &gUsbEthProtocolGuid,<= br>
+             This->DriverBindingHand= le,

+             ControllerHandle

+             );

+      return EFI_SUCCESS;

+    }

+

+    NicDevice =3D UNDI_DEV_FROM_THIS (NiiProtocol);

+    Status    =3D gBS->UninstallMultipleProtocolInt= erfaces (

+                    &nbs= p;  ControllerHandle,

+                    &nbs= p;  &gEfiNetworkInterfaceIdentifierProtocolGuid_31,

+                    &nbs= p;  &NicDevice->NiiProtocol,

+                    &nbs= p;  &gEfiDevicePathProtocolGuid,

+                    &nbs= p;  NicDevice->DevPath,

+                    &nbs= p;  NULL

+                    &nbs= p;  );

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    gBS->FreePool (NicDevice->DevPath);

+    gBS->FreePool (NicDevice);

+

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiDevicePathProtocolGuid,<= br>
+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return EFI_SUCCESS;

+  }

+

+  AllChildrenStopped =3D TRUE;

+

+  for (Index =3D 0; Index < NumberOfChildren; Index++) {

+    Status =3D gBS->OpenProtocol (

+                    Chil= dHandleBuffer[Index],

+                    &= ;gEfiNetworkInterfaceIdentifierProtocolGuid_31,

+                    (VOI= D **)&NiiProtocol,

+                    This= ->DriverBindingHandle,

+                    Cont= rollerHandle,

+                    EFI_= OPEN_PROTOCOL_GET_PROTOCOL

+                    );
+    if (EFI_ERROR (Status)) {

+      AllChildrenStopped =3D FALSE;

+      continue;

+    }

+

+    NicDevice =3D UNDI_DEV_FROM_THIS (NiiProtocol);

+

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gUsbEthProtocolGuid,

+           This->DriverBindingHandle,

+           ChildHandleBuffer[Index]

+           );

+

+    Status =3D gBS->UninstallMultipleProtocolInterfaces (

+                    Chil= dHandleBuffer[Index],

+                    &= ;gEfiNetworkInterfaceIdentifierProtocolGuid_31,

+                    &= ;NicDevice->NiiProtocol,

+                    &= ;gEfiDevicePathProtocolGuid,

+                    NicD= evice->DevPath,

+                    NULL=

+                    );
+    if (EFI_ERROR (Status)) {

+      Status =3D gBS->OpenProtocol (

+                    &nbs= p; ControllerHandle,

+                    &nbs= p; &gUsbEthProtocolGuid,

+                    &nbs= p; (VOID **)&UsbEth,

+                    &nbs= p; This->DriverBindingHandle,

+                    &nbs= p; ChildHandleBuffer[Index],

+                    &nbs= p; EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

+                    &nbs= p; );

+    } else {

+      gBS->FreePool (NicDevice->DevPath);

+      gBS->FreePool (NicDevice);

+    }

+  }

+

+  if (!AllChildrenStopped) {

+    return EFI_DEVICE_ERROR;

+  }

+

+  return Status;

+}

+

+/**

+  Entrypoint of Network Common Driver.

+

+  This function is the entrypoint of Network Common Driver. It instal= ls Driver Binding

+  Protocols together with Component Name Protocols.

+

+  @param[in]  ImageHandle       The firmware= allocated handle for the EFI image.

+  @param[in]  SystemTable       A pointer to= the EFI System Table.

+

+  @retval EFI_SUCCESS           The ent= ry point is executed successfully.

+

+**/

+EFI_STATUS

+EFIAPI

+NetworkCommonEntry (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  EFI_STATUS  Status;

+

+  gNetworkCommonDriverBinding.DriverBindingHandle =3D ImageHandle;
+  gNetworkCommonDriverBinding.ImageHandle        =  =3D ImageHandle;

+

+  Status =3D gBS->InstallMultipleProtocolInterfaces (

+                  &gNetwo= rkCommonDriverBinding.DriverBindingHandle,

+                  &gEfiDr= iverBindingProtocolGuid,

+                  &gNetwo= rkCommonDriverBinding,

+                  &gEfiCo= mponentName2ProtocolGuid,

+                  &gNetwo= rkCommonComponentName2,

+                  NULL

+                  );

+  return Status;

+}

diff --git a/UsbNetworkPkg/NetworkCommon/DriverBinding.h b/UsbNetworkPkg/Ne= tworkCommon/DriverBinding.h
new file mode 100644
index 0000000000..223e034f2f
--- /dev/null
+++ b/UsbNetworkPkg/NetworkCommon/DriverBinding.h
@@ -0,0 +1,263 @@
+/** @file

+  Header file for for USB network common driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#ifndef _DRIVER_BINDING_H_

+#define _DRIVER_BINDING_H_

+

+#include <Library/UefiDriverEntryPoint.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiLib.h>

+#include <Library/DevicePathLib.h>

+#include <Library/DebugLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/UefiUsbLib.h>

+#include <Protocol/UsbIo.h>

+#include <Protocol/NetworkInterfaceIdentifier.h>

+#include <Protocol/UsbEthernetProtocol.h>

+

+#define NETWORK_COMMON_DRIVER_VERSION    1

+#define NETWORK_COMMON_POLLING_INTERVAL  0x10

+#define RX_BUFFER_COUNT              &n= bsp;   32

+#define TX_BUFFER_COUNT              &n= bsp;   32

+#define MEMORY_REQUIRE              &nb= sp;    0

+

+#define UNDI_DEV_SIGNATURE  SIGNATURE_32('u','n','d','i')

+#define UNDI_DEV_FROM_THIS(a)  CR(a, NIC_DEVICE, NiiProtocol, UNDI_DE= V_SIGNATURE)

+#define UNDI_DEV_FROM_NIC(a)   CR(a, NIC_DEVICE, NicInfo, UNDI_D= EV_SIGNATURE)

+

+#pragma pack(1)

+typedef struct {

+  UINT8     DestAddr[PXE_HWADDR_LEN_ETHER];

+  UINT8     SrcAddr[PXE_HWADDR_LEN_ETHER];

+  UINT16    Protocol;

+} EthernetHeader;

+#pragma pack()

+

+typedef struct {

+  UINTN                 =                     &nbs= p; Signature;

+  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL    NiiProtocol;=

+  EFI_HANDLE                &= nbsp;                  DeviceH= andle;

+  EFI_DEVICE_PATH_PROTOCOL            &= nbsp;        *BaseDevPath;

+  EFI_DEVICE_PATH_PROTOCOL            &= nbsp;        *DevPath;

+  NIC_DATA                &nb= sp;                    Ni= cInfo;

+} NIC_DEVICE;

+

+typedef VOID (*API_FUNC)(

+  PXE_CDB *,

+  NIC_DATA *

+  );

+

+extern PXE_SW_UNDI                =    *gPxe;

+extern NIC_DEVICE                &= nbsp;   *gLanDeviceList[MAX_LAN_INTERFACE];

+extern EFI_COMPONENT_NAME2_PROTOCOL  gNetworkCommonComponentName2;
+

+EFI_STATUS

+EFIAPI

+NetworkCommonSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+NetworkCommonDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+NetworkCommonDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  );

+

+VOID

+PxeStructInit (

+  OUT PXE_SW_UNDI  *PxeSw

+  );

+

+VOID

+UpdateNicNum (

+  IN      NIC_DATA     *Nic,

+  IN OUT  PXE_SW_UNDI  *PxeSw

+  );

+

+VOID

+UndiApiEntry (

+  IN  UINT64  Cdb

+  );

+

+UINTN

+MapIt (

+  IN NIC_DATA  *Nic,

+  IN UINT64    MemAddr,

+  IN UINT32    Size,

+  IN UINT32    Direction,

+  OUT UINT64   MappedAddr

+  );

+

+VOID

+UnMapIt (

+  IN NIC_DATA  *Nic,

+  IN UINT64    MemAddr,

+  IN UINT32    Size,

+  IN UINT32    Direction,

+  IN UINT64    MappedAddr

+  );

+

+VOID

+UndiGetState (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiStart (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiStop (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiGetInitInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiGetConfigInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiInitialize (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  );

+

+VOID

+UndiReset (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiShutdown (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  );

+

+VOID

+UndiInterruptEnable (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiReceiveFilter (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiStationAddress (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiStatistics (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiMcastIp2Mac (

+  IN OUT  PXE_CDB   *Cdb,

+  IN      NIC_DATA  *Nic

+  );

+

+VOID

+UndiNvData (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiGetStatus (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiFillHeader (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiTransmit (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+VOID

+UndiReceive (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+UINT16

+Initialize (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  );

+

+UINT16

+Transmit (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic,

+  IN      UINT64    CpbAddr,

+  IN      UINT16    OpFlags

+  );

+

+UINT16

+Receive (

+  IN PXE_CDB       *Cdb,

+  IN OUT NIC_DATA  *Nic,

+  IN UINT64        CpbAddr,

+  IN OUT UINT64    DbAddr

+  );

+

+UINT16

+Setfilter (

+  IN  NIC_DATA  *Nic,

+  IN  UINT16    SetFilter,

+  IN  UINT64    CpbAddr,

+  IN  UINT32    CpbSize

+  );

+

+UINT16

+Statistics (

+  IN NIC_DATA  *Nic,

+  IN UINT64    DbAddr,

+  IN UINT16    DbSize

+  );

+

+#endif

diff --git a/UsbNetworkPkg/NetworkCommon/NetworkCommon.inf b/UsbNetworkPkg/= NetworkCommon/NetworkCommon.inf
new file mode 100644
index 0000000000..483df660f7
--- /dev/null
+++ b/UsbNetworkPkg/NetworkCommon/NetworkCommon.inf
@@ -0,0 +1,43 @@
+## @file
+#   This is Usb Network Common driver for DXE phase.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Defines]
+  INF_VERSION                =     =3D 0x00010005
+  BASE_NAME                &n= bsp;     =3D NetworkCommon
+  FILE_GUID                &n= bsp;     =3D ca6eb4f4-f1d6-4375-97d6-18856871e1bf
+  MODULE_TYPE                =     =3D DXE_DRIVER
+  VERSION_STRING              &nbs= p;  =3D 1.0
+  ENTRY_POINT                =     =3D NetworkCommonEntry
+
+[Sources]
+  DriverBinding.c
+  DriverBinding.h
+  ComponentName.c
+  PxeFunction.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UsbNetworkPkg/UsbNetworkPkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+  UefiLib
+  DebugLib
+  UefiUsbLib
+  MemoryAllocationLib
+  BaseMemoryLib
+
+[Protocols]
+  gEfiNetworkInterfaceIdentifierProtocolGuid_31
+  gEfiUsbIoProtocolGuid
+  gEfiDevicePathProtocolGuid
+  gEfiDriverBindingProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/UsbNetworkPkg/NetworkCommon/PxeFunction.c b/UsbNetworkPkg/Netw= orkCommon/PxeFunction.c
new file mode 100644
index 0000000000..d34b61a69f
--- /dev/null
+++ b/UsbNetworkPkg/NetworkCommon/PxeFunction.c
@@ -0,0 +1,1734 @@
+/** @file

+  This file contains code for UNDI command based on UEFI specificatio= n.

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "DriverBinding.h"

+

+// API table, defined in UEFI specification

+API_FUNC  gUndiApiTable[] =3D {

+  UndiGetState,

+  UndiStart,

+  UndiStop,

+  UndiGetInitInfo,

+  UndiGetConfigInfo,

+  UndiInitialize,

+  UndiReset,

+  UndiShutdown,

+  UndiInterruptEnable,

+  UndiReceiveFilter,

+  UndiStationAddress,

+  UndiStatistics,

+  UndiMcastIp2Mac,

+  UndiNvData,

+  UndiGetStatus,

+  UndiFillHeader,

+  UndiTransmit,

+  UndiReceive

+};

+

+/**

+  This command is used to determine the operational state of the UNDI= .

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiGetState (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_GET_STATE) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED) ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  Cdb->StatFlags =3D Cdb->StatFlags | Nic->State;

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiGetState !=3D NULL) {
+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiGetState = (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to change the UNDI operational state from stop= ped to started.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiStart (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_CPB_START_31  *Cpb;

+  EFI_STATUS        Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_START) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_START_31)) ||
+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED) ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_STOPPED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_ALREADY_STARTED;

+    return;

+  }

+

+  Cpb =3D (PXE_CPB_START_31 *)(UINTN)Cdb->CPBaddr;

+

+  Nic->PxeStart.Delay     =3D Cpb->Delay;

+  Nic->PxeStart.Virt2Phys =3D Cpb->Virt2Phys;

+  Nic->PxeStart.Block     =3D Cpb->Block;

+  Nic->PxeStart.Map_Mem   =3D 0;

+  Nic->PxeStart.UnMap_Mem =3D 0;

+  Nic->PxeStart.Sync_Mem  =3D Cpb->Sync_Mem;

+  Nic->PxeStart.Unique_ID =3D Cpb->Unique_ID;

+  Nic->State              =3D P= XE_STATFLAGS_GET_STATE_STARTED;

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiStart !=3D NULL) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiStart (Cd= b, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to change the UNDI operational state from star= ted to stopped.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiStop (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_STOP) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED) ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_STOPPED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_STARTED;

+    return;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_SHUTDOWN;

+    return;

+  }

+

+  Nic->PxeStart.Delay     =3D 0;

+  Nic->PxeStart.Virt2Phys =3D 0;

+  Nic->PxeStart.Block     =3D 0;

+  Nic->PxeStart.Map_Mem   =3D 0;

+  Nic->PxeStart.UnMap_Mem =3D 0;

+  Nic->PxeStart.Sync_Mem  =3D 0;

+  Nic->State              =3D P= XE_STATFLAGS_GET_STATE_STOPPED;

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiStop !=3D NULL) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiStop (Cdb= , Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to retrieve initialization information that is=

+  needed by drivers and applications to initialized UNDI.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiGetInitInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_DB_GET_INIT_INFO  *Db;

+  EFI_STATUS            Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_GET_INIT_INFO) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D sizeof (PXE_DB_GET_INIT_INFO)) |= |

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_STOPPED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_STARTED;

+    return;

+  }

+

+  Db =3D (PXE_DB_GET_INIT_INFO *)(UINTN)Cdb->DBaddr;

+

+  Db->MemoryRequired         =3D MEMORY_R= EQUIRE;

+  Db->FrameDataLen           =3D PXE= _MAX_TXRX_UNIT_ETHER;

+  Db->LinkSpeeds[0]          =3D 10;

+  Db->LinkSpeeds[1]          =3D 100;

+  Db->LinkSpeeds[2]          =3D 1000;
+  Db->LinkSpeeds[3]          =3D 0;

+  Db->MediaHeaderLen         =3D PXE_MAC_= HEADER_LEN_ETHER;

+  Db->HWaddrLen              = =3D PXE_HWADDR_LEN_ETHER;

+  Db->MCastFilterCnt         =3D MAX_MCAS= T_ADDRESS_CNT;

+  Db->TxBufCnt              &nb= sp;=3D Nic->PxeInit.TxBufCnt;

+  Db->TxBufSize              = =3D Nic->PxeInit.TxBufSize;

+  Db->RxBufCnt              &nb= sp;=3D Nic->PxeInit.RxBufCnt;

+  Db->RxBufSize              = =3D Nic->PxeInit.RxBufSize;

+  Db->IFtype               = ;  =3D PXE_IFTYPE_ETHERNET;

+  Db->SupportedDuplexModes   =3D PXE_DUPLEX_DEFAULT;

+  Db->SupportedLoopBackModes =3D LOOPBACK_NORMAL;

+

+  Cdb->StatFlags |=3D (PXE_STATFLAGS_CABLE_DETECT_SUPPORTED |

+                    &nbs= p;PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED);

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiGetInitInfo !=3D NULL) = {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiGetInitIn= fo (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to retrieve configuration information about
+  the NIC being controlled by the UNDI.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiGetConfigInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_DB_GET_CONFIG_INFO  *Db;

+  EFI_STATUS              Status;<= br>
+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_GET_CONFIG_INFO) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D sizeof (PXE_DB_GET_CONFIG_INFO))= ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_STOPPED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_STARTED;

+    return;

+  }

+

+  Db =3D (PXE_DB_GET_CONFIG_INFO *)(UINTN)Cdb->DBaddr;

+

+  Db->pci.BusType =3D PXE_BUSTYPE_USB;

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiGetConfigInfo !=3D NULL= ) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiGetConfig= Info (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command resets the network adapter and initializes UNDI using<= br>
+  the parameters supplied in the CPB.

+

+  @param[in]      Cdb  A pointer to the command d= escriptor block.

+  @param[in, out] Nic  A pointer to the Network interface contro= ller data.

+

+**/

+VOID

+UndiInitialize (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  )

+{

+  PXE_CPB_INITIALIZE  *Cpb;

+  PXE_DB_INITIALIZE   *Db;

+  EFI_STATUS          Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_INITIALIZE) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_INITIALIZE)))
+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_STOPPED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_STARTED;

+    return;

+  }

+

+  if ((Cdb->OpFlags !=3D PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) &= ;&

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_INITIALIZE_DO_NOT_D= ETECT_CABLE))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  }

+

+  if (Nic->State =3D=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_ALREADY_INITIALIZED;=

+    return;

+  }

+

+  Cpb =3D (PXE_CPB_INITIALIZE *)(UINTN)Cdb->CPBaddr;

+  Db  =3D (PXE_DB_INITIALIZE *)(UINTN)Cdb->DBaddr;

+

+  Nic->PxeInit.LinkSpeed    =3D Cpb->LinkSpeed;

+  Nic->PxeInit.DuplexMode   =3D Cpb->DuplexMode;

+  Nic->PxeInit.LoopBackMode =3D Cpb->LoopBackMode;

+  Nic->PxeInit.MemoryAddr   =3D Cpb->MemoryAddr;

+  Nic->PxeInit.MemoryLength =3D Cpb->MemoryLength;

+  Nic->PxeInit.TxBufCnt     =3D TX_BUFFER_COUNT;
+  Nic->PxeInit.TxBufSize    =3D Nic->MaxSegmentSize;<= br>
+  Nic->PxeInit.RxBufCnt     =3D RX_BUFFER_COUNT;
+  Nic->PxeInit.RxBufSize    =3D Nic->MaxSegmentSize;<= br>
+

+  Cdb->StatCode =3D Initialize (Cdb, Nic);

+

+  Db->MemoryUsed =3D MEMORY_REQUIRE;

+  Db->TxBufCnt   =3D Nic->PxeInit.TxBufCnt;

+  Db->TxBufSize  =3D Nic->PxeInit.TxBufSize;

+  Db->RxBufCnt   =3D Nic->PxeInit.RxBufCnt;

+  Db->RxBufSize  =3D Nic->PxeInit.RxBufSize;

+

+  Nic->RxFilter    =3D PXE_OPFLAGS_RECEIVE_FILTER_BROADC= AST;

+  Nic->CanReceive  =3D FALSE;

+  Nic->CanTransmit =3D FALSE;

+

+  if (Cdb->OpFlags =3D=3D PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) {
+    if ((Nic->Request.Request =3D=3D USB_CDC_NETWORK_CONNECTI= ON) && (Nic->Request.Value =3D=3D NETWORK_DISCONNECT)) {

+      Nic->CableDetect =3D 0;

+    } else if ((Nic->Request.Request =3D=3D USB_CDC_NETWORK_C= ONNECTION) && (Nic->Request.Value =3D=3D NETWORK_CONNECTED)) {
+      Nic->CableDetect =3D 1;

+    }

+

+    if (Nic->CableDetect =3D=3D 0) {

+      Cdb->StatFlags |=3D PXE_STATFLAGS_INITIALIZED_NO_M= EDIA;

+    }

+  }

+

+  if (Cdb->StatCode !=3D PXE_STATCODE_SUCCESS) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+  } else {

+    Nic->State =3D PXE_STATFLAGS_GET_STATE_INITIALIZED;

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiInitialize !=3D NULL) {=

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiInitializ= e (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  Initialize Network interface controller data.

+

+  @param[in]      Cdb     A pointer to = the command descriptor block.

+  @param[in, out] Nic     A pointer to the Network int= erface controller data.

+

+  @retval Status  A value of Pxe statcode.

+

+**/

+UINT16

+Initialize (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  )

+{

+  UINTN       Status;

+  UINT32      Index;

+  EFI_STATUS  EfiStatus;

+

+  Status =3D MapIt (

+             Nic,

+             Nic->PxeInit.MemoryAddr= ,

+             Nic->PxeInit.MemoryLeng= th,

+             TO_AND_FROM_DEVICE,

+             (UINT64)(UINTN)&Nic-&g= t;MappedAddr

+             );

+

+  if (Status !=3D 0) {

+    return (UINT16)Status;

+  }

+

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    Nic->PermNodeAddress[Index] =3D Nic->MacAddr.Addr[Inde= x];

+  }

+

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    Nic->CurrentNodeAddress[Index] =3D Nic->PermNodeAddres= s[Index];

+  }

+

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    Nic->BroadcastNodeAddress[Index] =3D 0xFF;

+  }

+

+  for (Index =3D PXE_HWADDR_LEN_ETHER; Index < PXE_MAC_LENGTH; Ind= ex++) {

+    Nic->CurrentNodeAddress[Index]   =3D 0;

+    Nic->PermNodeAddress[Index]      =3D 0;
+    Nic->BroadcastNodeAddress[Index] =3D 0;

+  }

+

+  if (Nic->UsbEth->UsbEthInitialize !=3D NULL) {

+    EfiStatus =3D Nic->UsbEth->UsbEthInitialize (Cdb, Nic)= ;

+    if (EFI_ERROR (EfiStatus)) {

+      return PXE_STATFLAGS_COMMAND_FAILED;

+    }

+  }

+

+  return (UINT16)Status;

+}

+

+/**

+  This command resets the network adapter and reinitializes the UNDI<= br>
+  with the same parameters provided in the Initialize command.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiReset (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_RESET) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  if ((Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED) &&

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_RESET_DISABLE_INTER= RUPTS) &&

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_RESET_DISABLE_FILTE= RS))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_RESET_DISABLE_FILTERS) =3D= =3D 0) {

+    Nic->RxFilter =3D PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;
+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS) != =3D 0) {

+    Nic->InterrupOpFlag =3D 0;

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiReset !=3D NULL) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiReset (Cd= b, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  The Shutdown command resets the network adapter and leaves it in a<= br>
+  safe state for another driver to initialize.

+

+  @param[in]      Cdb  A pointer to the command d= escriptor block.

+  @param[in, out] Nic  A pointer to the Network interface contro= ller data.

+

+**/

+VOID

+UndiShutdown (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_SHUTDOWN) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED) ||

+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED) ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  Nic->CanReceive  =3D FALSE;

+  Nic->CanTransmit =3D FALSE;

+

+  Nic->State =3D PXE_STATFLAGS_GET_STATE_STARTED;

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiShutdown !=3D NULL) {
+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiShutdown = (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZ= ED;

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  The Interrupt Enables command can be used to read and/or change

+  the current external interrupt enable settings.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiInterruptEnable (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  Cdb->StatCode =3D PXE_STATCODE_UNSUPPORTED;

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiInterruptEnable !=3D NU= LL) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiInterrupt= Enable (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    } else {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;=

+      Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+    }

+  }

+}

+

+/**

+  This command is used to read and change receive filters and,

+  if supported, read and change the multicast MAC address filter list= .

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiReceiveFilter (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  UINT16                 = ; NewFilter;

+  PXE_DB_RECEIVE_FILTERS  *Db;

+  EFI_STATUS              Status;<= br>
+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_RECEIVE_FILTERS) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  NewFilter =3D (UINT16)(Cdb->OpFlags & 0x1F);

+

+  switch (Cdb->OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_OPMASK) {<= br>
+    case PXE_OPFLAGS_RECEIVE_FILTER_READ:

+      if (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) {

+        Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FA= ILED;

+        Cdb->StatCode  =3D PXE_STATCODE_INVALI= D_CDB;

+      }

+

+      if ((NewFilter & PXE_OPFLAGS_RECEIVE_FILTER_RESET= _MCAST_LIST) =3D=3D 0) {

+        if ((Cdb->DBsize !=3D 0)) {

+          Db =3D (PXE_DB_RECEIVE_FILTERS *)(UINTN= )Cdb->DBaddr;

+          CopyMem (Db, &Nic->McastList, Ni= c->McastCount);

+        }

+      }

+

+      break;

+

+    case PXE_OPFLAGS_RECEIVE_FILTER_ENABLE:

+      if (NewFilter =3D=3D 0) {

+        Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FA= ILED;

+      }

+

+      if (Cdb->CPBsize !=3D 0) {

+        if (((NewFilter & PXE_OPFLAGS_RECEIVE_FILT= ER_FILTERED_MULTICAST) =3D=3D 0) ||

+            ((NewFilter & PXE_OPFLAGS_RE= CEIVE_FILTER_RESET_MCAST_LIST) !=3D 0) ||

+            ((NewFilter & PXE_OPFLAGS_RE= CEIVE_FILTER_ALL_MULTICAST) !=3D 0) ||

+            ((Cdb->CPBsize % sizeof (PXE_= MAC_ADDR)) !=3D 0))

+        {

+          Cdb->StatFlags =3D PXE_STATFLAGS_COM= MAND_FAILED;

+        }

+      }

+

+      if ((Cdb->OpFlags & PXE_OPFLAGS_RECEIVE_FILTER= _FILTERED_MULTICAST) !=3D 0) {

+        if (((Cdb->OpFlags & PXE_OPFLAGS_RECEIV= E_FILTER_RESET_MCAST_LIST) !=3D 0) ||

+            ((Cdb->OpFlags & PXE_OPFL= AGS_RECEIVE_FILTER_ALL_MULTICAST) !=3D 0))

+        {

+          Cdb->StatFlags =3D PXE_STATFLAGS_COM= MAND_FAILED;

+        }

+

+        if ((Cdb->CPBsize =3D=3D 0)) {

+          Cdb->StatFlags =3D PXE_STATFLAGS_COM= MAND_FAILED;

+        }

+      }

+

+      Cdb->StatCode =3D Setfilter (Nic, NewFilter, Cdb-&= gt;CPBaddr, Cdb->CPBsize);

+      break;

+

+    case PXE_OPFLAGS_RECEIVE_FILTER_DISABLE:

+      if (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) {

+        Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FA= ILED;

+        Cdb->StatCode  =3D PXE_STATCODE_INVALI= D_CDB;

+      }

+

+      Nic->CanReceive =3D TRUE;

+      break;

+

+    default:

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+      Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;<= br>
+  }

+

+  if (Nic->CanReceive) {

+    Cdb->StatFlags =3D (PXE_STATFLAGS)(Cdb->StatFlags | Ni= c->RxFilter);

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiReceiveFilter !=3D NULL= ) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiReceiveFi= lter (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  Set PXE receive filter.

+

+  @param[in]  Nic         A pointer to = the Network interface controller data.

+  @param[in]  SetFilter   PXE receive filter

+  @param[in]  CpbAddr     Command Parameter Block= Address

+  @param[in]  CpbSize     Command Parameter Block= Size

+

+**/

+UINT16

+Setfilter (

+  IN  NIC_DATA  *Nic,

+  IN  UINT16    SetFilter,

+  IN  UINT64    CpbAddr,

+  IN  UINT32    CpbSize

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  UINT8                 =       *McastList;

+  UINT8                 =       Count =3D 0;

+  UINT8                 =       Index1;

+  UINT8                 =       Index2;

+  PXE_CPB_RECEIVE_FILTERS      *Cpb =3D (PXE_CPB_RECEI= VE_FILTERS *)(UINTN)CpbAddr;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+

+  // The Cpb could be NULL.(ref:PXE_CPBADDR_NOT_USED)

+  Nic->RxFilter =3D (UINT8)SetFilter;

+

+  if (((SetFilter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST= ) !=3D 0) || (Cpb !=3D NULL)) {

+    if (Cpb !=3D NULL) {

+      Nic->McastCount =3D (UINT8)(CpbSize / PXE_MAC_LENG= TH);

+      CopyMem (&Nic->McastList, Cpb, Nic->McastCo= unt);

+    }

+

+    if (Nic->CanReceive) {

+      Nic->CanReceive =3D FALSE;

+    }

+

+    Nic->UsbEth->UsbEthFunDescriptor (Nic->UsbEth, &= ;UsbEthFunDescriptor);

+    if ((UsbEthFunDescriptor.NumberMcFilters << 1) =3D=3D = 0) {

+      Nic->RxFilter |=3D PXE_OPFLAGS_RECEIVE_FILTER_ALL_= MULTICAST;

+      Nic->UsbEth->SetUsbEthPacketFilter (Nic->Usb= Eth, Nic->RxFilter);

+    } else {

+      Status =3D gBS->AllocatePool (EfiBootServicesData,= Nic->McastCount * 6, (VOID **)&McastList);

+      if (EFI_ERROR (Status)) {

+        return PXE_STATCODE_INVALID_PARAMETER;

+      }

+

+      if (Cpb !=3D NULL) {

+        for (Index1 =3D 0; Index1 < Nic->McastCo= unt; Index1++) {

+          for (Index2 =3D 0; Index2 < 6; Index= 2++) {

+            McastList[Count++] =3D Cpb->M= CastList[Index1][Index2];

+          }

+        }

+      }

+

+      Nic->RxFilter |=3D PXE_OPFLAGS_RECEIVE_FILTER_FILT= ERED_MULTICAST;

+      if (Cpb !=3D NULL) {

+        Nic->UsbEth->SetUsbEthMcastFilter (Nic-&= gt;UsbEth, Nic->McastCount, McastList);

+      }

+

+      Nic->UsbEth->SetUsbEthPacketFilter (Nic->Usb= Eth, Nic->RxFilter);

+      gBS->FreePool (McastList);

+    }

+  }

+

+  return PXE_STATCODE_SUCCESS;

+}

+

+/**

+  This command is used to get current station and broadcast MAC addre= sses

+  and, if supported, to change the current station MAC address.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiStationAddress (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_CPB_STATION_ADDRESS  *Cpb;

+  PXE_DB_STATION_ADDRESS   *Db;

+  UINT16                 = ;  Index;

+  EFI_STATUS               St= atus;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_STATION_ADDRESS) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->DBsize !=3D sizeof (PXE_DB_STATION_ADDRESS))= )

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  if (Cdb->OpFlags =3D=3D PXE_OPFLAGS_STATION_ADDRESS_RESET) {

+    if (CompareMem (&Nic->CurrentNodeAddress[0], &Nic= ->PermNodeAddress[0], PXE_MAC_LENGTH) !=3D 0) {

+      for (Index =3D 0; Index < PXE_MAC_LENGTH; Index++)= {

+        Nic->CurrentNodeAddress[Index] =3D Nic->= PermNodeAddress[Index];

+      }

+    }

+  }

+

+  if (Cdb->CPBaddr !=3D 0) {

+    Cpb =3D (PXE_CPB_STATION_ADDRESS *)(UINTN)Cdb->CPBaddr;
+    for (Index =3D 0; Index < PXE_MAC_LENGTH; Index++) {

+      Nic->CurrentNodeAddress[Index] =3D Cpb->Station= Addr[Index];

+    }

+  }

+

+  if (Cdb->DBaddr !=3D 0) {

+    Db =3D (PXE_DB_STATION_ADDRESS *)(UINTN)Cdb->DBaddr;

+    for (Index =3D 0; Index < PXE_MAC_LENGTH; Index++) {

+      Db->StationAddr[Index]   =3D Nic->Cur= rentNodeAddress[Index];

+      Db->BroadcastAddr[Index] =3D Nic->BroadcastNode= Address[Index];

+      Db->PermanentAddr[Index] =3D Nic->PermNodeAddre= ss[Index];

+    }

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiStationAddress !=3D NUL= L) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiStationAd= dress (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to read and clear the NIC traffic statistics.<= br>
+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiStatistics (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_STATISTICS) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  if ((Cdb->OpFlags !=3D PXE_OPFLAGS_STATISTICS_RESET) &&<= br>
+      (Cdb->OpFlags !=3D PXE_OPFLAGS_STATISTICS_READ))
+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  }

+

+  Cdb->StatCode =3D Statistics (Nic, Cdb->DBaddr, Cdb->DBsiz= e);

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiStatistics !=3D NULL) {=

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiStatistic= s (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  Return data for DB data.

+

+  @param[in]  Nic      A pointer to the Network i= nterface controller data.

+  @param[in]  DbAddr   Data Block Address.

+  @param[in]  DbSize   Data Block Size.

+

+**/

+UINT16

+Statistics (

+  IN NIC_DATA  *Nic,

+  IN UINT64    DbAddr,

+  IN UINT16    DbSize

+  )

+{

+  PXE_DB_STATISTICS  *DbStatistic;

+  EFI_STATUS         Status;

+

+  DbStatistic =3D (PXE_DB_STATISTICS *)(UINTN)DbAddr;

+

+  if (DbSize =3D=3D 0) {

+    return PXE_STATCODE_SUCCESS;

+  }

+

+  DbStatistic->Supported  =3D 0x802;

+  DbStatistic->Data[0x01] =3D Nic->RxFrame;

+  DbStatistic->Data[0x0B] =3D Nic->TxFrame;

+

+  if (Nic->UsbEth->UsbEthStatistics !=3D NULL) {

+    Status =3D Nic->UsbEth->UsbEthStatistics (Nic, DbAddr,= DbSize);

+    if (EFI_ERROR (Status)) {

+      return PXE_STATFLAGS_COMMAND_FAILED;

+    }

+  }

+

+  return PXE_STATCODE_SUCCESS;

+}

+

+/**

+  Translate a multicast IPv4 or IPv6 address to a multicast MAC addre= ss.

+

+  @param[in, out] Cdb  A pointer to the command descriptor block= .

+  @param[in]      Nic  A pointer to the Network i= nterface controller data.

+

+**/

+VOID

+UndiMcastIp2Mac (

+  IN OUT  PXE_CDB   *Cdb,

+  IN      NIC_DATA  *Nic

+  )

+{

+  PXE_CPB_MCAST_IP_TO_MAC  *Cpb;

+  PXE_DB_MCAST_IP_TO_MAC   *Db;

+  UINT8                 =   *Tmp;

+  EFI_STATUS               St= atus;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_MCAST_IP_TO_MAC) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_MCAST_IP_TO_MAC= )) ||

+      (Cdb->DBsize !=3D sizeof (PXE_DB_MCAST_IP_TO_MAC))= )

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  Cpb =3D (PXE_CPB_MCAST_IP_TO_MAC *)(UINTN)Cdb->CPBaddr;

+  Db  =3D (PXE_DB_MCAST_IP_TO_MAC *)(UINTN)Cdb->DBaddr;

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_MCAST_IPV6_TO_MAC) !=3D 0) {=

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_UNSUPPORTED;

+    return;

+  }

+

+  Tmp =3D (UINT8 *)(&Cpb->IP.IPv4);

+

+  if ((Tmp[0] & 0xF0) !=3D 0xE0) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CPB;

+  }

+

+  Db->MAC[0] =3D 0x01;

+  Db->MAC[1] =3D 0x00;

+  Db->MAC[2] =3D 0x5E;

+  Db->MAC[3] =3D Tmp[1] & 0x7F;

+  Db->MAC[4] =3D Tmp[2];

+  Db->MAC[5] =3D Tmp[3];

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiMcastIp2Mac !=3D NULL) = {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiMcastIp2M= ac (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to read and write (if supported by NIC H/W)
+  nonvolatile storage on the NIC.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiNvData (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  Cdb->StatCode =3D PXE_STATCODE_UNSUPPORTED;

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiNvData !=3D NULL) {

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiNvData (C= db, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    } else {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;=

+      Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+    }

+  }

+}

+

+/**

+  This command returns the current interrupt status and/or the

+  transmitted buffer addresses and the current media status.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiGetStatus (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_DB_GET_STATUS  *Db;

+  PXE_DB_GET_STATUS  TmpGetStatus;

+  UINT16             NumEntries;
+  UINTN              Index;

+  EFI_STATUS         Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_GET_STATUS) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D PXE_CPBSIZE_NOT_USED) ||

+      (Cdb->CPBaddr !=3D PXE_CPBADDR_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  TmpGetStatus.RxFrameLen =3D 0;

+  TmpGetStatus.reserved   =3D 0;

+  Db                  &n= bsp;   =3D (PXE_DB_GET_STATUS *)(UINTN)Cdb->DBaddr;

+

+  if ((Cdb->DBsize > 0) && (Cdb->DBsize < sizeof = (UINT32) * 2)) {

+    CopyMem (Db, &TmpGetStatus, Cdb->DBsize);

+  } else {

+    CopyMem (Db, &TmpGetStatus, sizeof (UINT32) * 2);

+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS) != =3D 0) {

+    if (Cdb->DBsize =3D=3D 0) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+      Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;<= br>
+      return;

+    }

+

+    NumEntries  =3D Cdb->DBsize - sizeof (UINT64);

+    Cdb->DBsize =3D sizeof (UINT32) * 2;

+

+    for (Index =3D 0; NumEntries >=3D sizeof (UINT64); Index+= +, NumEntries -=3D sizeof (UINT64)) {

+      if (Nic->TxBufferCount > 0) {

+        Nic->TxBufferCount--;

+        Db->TxBuffer[Index] =3D Nic->MediaHeader= [Nic->TxBufferCount];

+      }

+    }

+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_GET_INTERRUPT_STATUS) !=3D 0= ) {

+    if (Nic->ReceiveStatus !=3D 0) {

+      Cdb->StatFlags |=3D PXE_STATFLAGS_GET_STATUS_RECEI= VE;

+    }

+  }

+

+  if ((Nic->Request.Request =3D=3D USB_CDC_NETWORK_CONNECTION) &am= p;& (Nic->Request.Value =3D=3D NETWORK_DISCONNECT)) {

+    Nic->CableDetect =3D 0;

+  } else if ((Nic->Request.Request =3D=3D USB_CDC_NETWORK_CONNECTI= ON) && (Nic->Request.Value =3D=3D NETWORK_CONNECTED)) {

+    Nic->CableDetect =3D 1;

+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_GET_MEDIA_STATUS) !=3D 0) {<= br>
+    if (Nic->CableDetect =3D=3D 0) {

+      Cdb->StatFlags |=3D PXE_STATFLAGS_GET_STATUS_NO_ME= DIA;

+    }

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiGetStatus !=3D NULL) {<= br>
+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiGetStatus= (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  This command is used to fill the media header(s) in transmit packet= (s).

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiFillHeader (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  PXE_CPB_FILL_HEADER             = *CpbFillHeader;

+  PXE_CPB_FILL_HEADER_FRAGMENTED  *CpbFill;

+  EthernetHeader              &nbs= p;   *MacHeader;

+  UINTN                 =          Index;

+  EFI_STATUS                &= nbsp;     Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_FILL_HEADER) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_FILL_HEADER_FRA= GMENTED)) ||

+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    return;

+  }

+

+  if (Cdb->CPBsize =3D=3D PXE_CPBSIZE_NOT_USED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  }

+

+  if ((Cdb->OpFlags & PXE_OPFLAGS_FILL_HEADER_FRAGMENTED) !=3D= 0) {

+    CpbFill =3D (PXE_CPB_FILL_HEADER_FRAGMENTED *)(UINTN)Cdb->= ;CPBaddr;

+

+    if ((CpbFill->FragCnt =3D=3D 0) || (CpbFill->FragDesc[= 0].FragLen < PXE_MAC_HEADER_LEN_ETHER)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+      Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;<= br>
+      return;

+    }

+

+    MacHeader           =3D (Ether= netHeader *)(UINTN)CpbFill->FragDesc[0].FragAddr;

+    MacHeader->Protocol =3D CpbFill->Protocol;

+

+    for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) = {

+      MacHeader->DestAddr[Index] =3D CpbFill->DestAdd= r[Index];

+      MacHeader->SrcAddr[Index]  =3D CpbFill->Sr= cAddr[Index];

+    }

+  } else {

+    CpbFillHeader =3D (PXE_CPB_FILL_HEADER *)(UINTN)Cdb->CPBa= ddr;

+

+    MacHeader           =3D (Ether= netHeader *)(UINTN)CpbFillHeader->MediaHeader;

+    MacHeader->Protocol =3D CpbFillHeader->Protocol;

+

+    for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) = {

+      MacHeader->DestAddr[Index] =3D CpbFillHeader->D= estAddr[Index];

+      MacHeader->SrcAddr[Index]  =3D CpbFillHeader-= >SrcAddr[Index];

+    }

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiFillHeader !=3D NULL) {=

+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiFillHeade= r (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+  }

+}

+

+/**

+  The Transmit command is used to place a packet into the transmit qu= eue.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiTransmit (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_TRANSMIT) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_TRANSMIT)) ||
+      (Cdb->DBsize !=3D PXE_DBSIZE_NOT_USED) ||

+      (Cdb->DBaddr !=3D PXE_DBADDR_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    return;

+  }

+

+  if (Cdb->CPBsize =3D=3D PXE_CPBSIZE_NOT_USED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiTransmit !=3D NULL) {
+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiTransmit = (Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+

+    return;

+  }

+

+  Cdb->StatCode =3D Transmit (Cdb, Nic, Cdb->CPBaddr, Cdb->O= pFlags);

+

+  if (Cdb->StatCode !=3D PXE_STATCODE_SUCCESS) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+  }

+}

+

+/**

+  Use USB Ethernet Protocol Bulk out command to transmit data.

+

+  @param[in]      Cdb      A pointer to= the command descriptor block.

+  @param[in, out] Nic      A pointer to the Network in= terface controller data.

+  @param[in]      CpbAddr  Command Parameter Bloc= k Address.

+  @param[in]      OpFlags  Operation Flags.

+

+**/

+UINT16

+Transmit (

+  IN      PXE_CDB   *Cdb,

+  IN OUT  NIC_DATA  *Nic,

+  IN      UINT64    CpbAddr,

+  IN      UINT16    OpFlags

+  )

+{

+  EFI_STATUS        Status;

+  PXE_CPB_TRANSMIT  *Cpb;

+  UINT64            BulkOutData =3D 0;<= br>
+  UINTN             DataLength;
+  UINTN             Map;

+  UINT32            Counter =3D 0;

+  UINT16            StatCode;

+

+  Cpb =3D (PXE_CPB_TRANSMIT *)(UINTN)CpbAddr;

+

+  if (Nic->CanTransmit) {

+    return PXE_STATCODE_BUSY;

+  }

+

+  Nic->CanTransmit =3D TRUE;

+

+  if ((OpFlags & PXE_OPFLAGS_TRANSMIT_FRAGMENTED) !=3D 0) {

+    return PXE_STATCODE_INVALID_PARAMETER;

+  }

+

+  Map =3D MapIt (

+          Nic,

+          Cpb->FrameAddr,

+          Cpb->DataLen + (UINT32)Cpb->Media= headerLen,

+          TO_DEVICE,

+          (UINT64)(UINTN)&BulkOutData

+          );

+

+  if (Map !=3D 0) {

+    Nic->CanTransmit =3D FALSE;

+    return PXE_STATCODE_INVALID_PARAMETER;

+  }

+

+  if (Nic->TxBufferCount < MAX_XMIT_BUFFERS) {

+    Nic->MediaHeader[Nic->TxBufferCount] =3D Cpb->Frame= Addr;

+    Nic->TxBufferCount++;

+  }

+

+  DataLength =3D (UINTN)(Cpb->DataLen + (UINT32)Cpb->Mediaheade= rLen);

+

+  while (1) {

+    if (Counter >=3D 3) {

+      StatCode =3D PXE_STATCODE_BUSY;

+      break;

+    }

+

+    Status =3D Nic->UsbEth->UsbEthTransmit (Cdb, Nic->U= sbEth, (VOID *)(UINTN)BulkOutData, &DataLength);

+    if (EFI_ERROR (Status)) {

+      StatCode =3D  PXE_STATFLAGS_COMMAND_FAILED;

+    }

+

+    if (Status =3D=3D EFI_INVALID_PARAMETER) {

+      StatCode =3D PXE_STATCODE_INVALID_PARAMETER;

+      break;

+    }

+

+    if (Status =3D=3D EFI_DEVICE_ERROR) {

+      StatCode =3D PXE_STATCODE_DEVICE_FAILURE;

+      break;

+    }

+

+    if (!EFI_ERROR (Status)) {

+      Nic->TxFrame++;

+      StatCode =3D PXE_STATCODE_SUCCESS;

+      break;

+    }

+

+    Counter++;

+  }

+

+  UnMapIt (

+    Nic,

+    Cpb->FrameAddr,

+    Cpb->DataLen + (UINT32)Cpb->MediaheaderLen,

+    TO_DEVICE,

+    BulkOutData

+    );

+

+  Nic->CanTransmit =3D FALSE;

+

+  return StatCode;

+}

+

+/**

+  When the network adapter has received a frame, this command is used=

+  to copy the frame into driver/application storage.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+**/

+VOID

+UndiReceive (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  if ((Cdb->OpCode !=3D PXE_OPCODE_RECEIVE) ||

+      (Cdb->StatCode !=3D PXE_STATCODE_INITIALIZE) ||
+      (Cdb->StatFlags !=3D PXE_STATFLAGS_INITIALIZE) ||<= br>
+      (Cdb->IFnum >=3D (gPxe->IFcnt | gPxe->IFc= ntExt << 8)) ||

+      (Cdb->CPBsize !=3D sizeof (PXE_CPB_RECEIVE)) ||
+      (Cdb->DBsize !=3D sizeof (PXE_DB_RECEIVE)) ||

+      (Cdb->OpFlags !=3D PXE_OPFLAGS_NOT_USED))

+  {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_INVALID_CDB;

+    return;

+  } else {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_COMPLETE;

+    Cdb->StatCode  =3D PXE_STATCODE_SUCCESS;

+  }

+

+  if (Nic->State !=3D PXE_STATFLAGS_GET_STATE_INITIALIZED) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    return;

+  }

+

+  if (!Nic->CanReceive) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+    Cdb->StatCode  =3D PXE_STATCODE_NOT_INITIALIZED;

+    return;

+  }

+

+  if (Nic->UsbEth->UsbEthUndi.UsbEthUndiReceive !=3D NULL) {
+    Status =3D Nic->UsbEth->UsbEthUndi.UsbEthUndiReceive (= Cdb, Nic);

+    if (EFI_ERROR (Status)) {

+      Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;
+    }

+

+    return;

+  }

+

+  Cdb->StatCode =3D Receive (Cdb, Nic, Cdb->CPBaddr, Cdb->DB= addr);

+

+  if (Cdb->StatCode !=3D PXE_STATCODE_SUCCESS) {

+    Cdb->StatFlags =3D PXE_STATFLAGS_COMMAND_FAILED;

+  }

+}

+

+/**

+  Use USB Ethernet Protocol Bulk in command to receive data.

+

+  @param[in]      Cdb      A pointer to= the command descriptor block.

+  @param[in, out] Nic      A pointer to the Network in= terface controller data.

+  @param[in]      CpbAddr  Command Parameter Bloc= k Address.

+  @param[in, out] DbAddr   Data Block Address.

+

+**/

+UINT16

+Receive (

+  IN PXE_CDB       *Cdb,

+  IN OUT NIC_DATA  *Nic,

+  IN UINT64        CpbAddr,

+  IN OUT UINT64    DbAddr

+  )

+{

+  EFI_STATUS       Status;

+  UINTN            Index;

+  UINT16           StatCode  =3D P= XE_STATCODE_NO_DATA;

+  PXE_FRAME_TYPE   FrameType =3D PXE_FRAME_TYPE_NONE;

+  PXE_CPB_RECEIVE  *Cpb;

+  PXE_DB_RECEIVE   *Db;

+  UINT8            *BulkInData;

+  UINTN            DataLength =3D (UINT= N)Nic->MaxSegmentSize;

+  EthernetHeader   *Header;

+

+  Cpb =3D (PXE_CPB_RECEIVE *)(UINTN)CpbAddr;

+  Db  =3D (PXE_DB_RECEIVE *)(UINTN)DbAddr;

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, DataLength, (= VOID **)&BulkInData);

+  if (EFI_ERROR (Status)) {

+    return PXE_STATCODE_INVALID_PARAMETER;

+  }

+

+  while (1) {

+    Status =3D Nic->UsbEth->UsbEthReceive (Cdb, Nic->Us= bEth, (VOID *)BulkInData, &DataLength);

+    if (EFI_ERROR (Status)) {

+      break;

+    }

+

+    Nic->RxFrame++;

+

+    if (DataLength !=3D 0) {

+      if (DataLength > Cpb->BufferLen) {

+        DataLength =3D (UINTN)Cpb->BufferLen;

+      }

+

+      CopyMem ((UINT8 *)(UINTN)Cpb->BufferAddr, (UINT8 *= )BulkInData, DataLength);

+

+      Header =3D (EthernetHeader *)BulkInData;

+

+      Db->FrameLen       =3D (UINT32= )DataLength;

+      Db->MediaHeaderLen =3D PXE_MAC_HEADER_LEN_ETHER;
+

+      for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; In= dex++) {

+        if (Header->DestAddr[Index] !=3D Nic->Cu= rrentNodeAddress[Index]) {

+          break;

+        }

+      }

+

+      if (Index >=3D PXE_HWADDR_LEN_ETHER) {

+        FrameType =3D PXE_FRAME_TYPE_UNICAST;

+      } else {

+        for (Index =3D 0; Index < PXE_HWADDR_LEN_ET= HER; Index++) {

+          if (Header->DestAddr[Index] !=3D Nic= ->BroadcastNodeAddress[Index]) {

+            break;

+          }

+        }

+

+        if (Index >=3D PXE_HWADDR_LEN_ETHER) {

+          FrameType =3D PXE_FRAME_TYPE_BROADCAST;=

+        } else {

+          if ((Header->DestAddr[0] & 1) = =3D=3D 1) {

+            FrameType =3D PXE_FRAME_TYPE_FIL= TERED_MULTICAST;

+          } else {

+            FrameType =3D PXE_FRAME_TYPE_PRO= MISCUOUS;

+          }

+        }

+      }

+

+      Db->Type     =3D FrameType;

+      Db->Protocol =3D Header->Protocol;

+

+      for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; In= dex++) {

+        Db->SrcAddr[Index]  =3D Header->Src= Addr[Index];

+        Db->DestAddr[Index] =3D Header->DestAddr= [Index];

+      }

+

+      StatCode =3D PXE_STATCODE_SUCCESS;

+      break;

+    }

+  }

+

+  if (FrameType =3D=3D PXE_FRAME_TYPE_NONE) {

+    Nic->ReceiveStatus =3D 0;

+  } else {

+    Nic->ReceiveStatus =3D 1;

+  }

+

+  gBS->FreePool (BulkInData);

+

+  return StatCode;

+}

+

+/**

+  Fill out PXE SW UNDI structure.

+

+  @param[out]  PxeSw      A pointer to the PXE SW= UNDI structure.

+

+**/

+VOID

+PxeStructInit (

+  OUT PXE_SW_UNDI  *PxeSw

+  )

+{

+  PxeSw->Signature =3D PXE_ROMID_SIGNATURE;

+  PxeSw->Len       =3D (UINT8)sizeof (PXE_SW_U= NDI);

+  PxeSw->Fudge     =3D 0;

+  PxeSw->IFcnt     =3D 0;

+  PxeSw->IFcntExt  =3D 0;

+  PxeSw->Rev       =3D PXE_ROMID_REV;

+  PxeSw->MajorVer  =3D PXE_ROMID_MAJORVER;

+  PxeSw->MinorVer  =3D PXE_ROMID_MINORVER;

+  PxeSw->reserved1 =3D 0;

+

+  PxeSw->Implementation =3D PXE_ROMID_IMP_SW_VIRT_ADDR |

+                    &nbs= p;     PXE_ROMID_IMP_FRAG_SUPPORTED |

+                    &nbs= p;     PXE_ROMID_IMP_CMD_LINK_SUPPORTED |

+                    &nbs= p;     PXE_ROMID_IMP_STATION_ADDR_SETTABLE |

+                    &nbs= p;     PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED |

+                    &nbs= p;     PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED |

+                    &nbs= p;     PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED |

+                    &nbs= p;     PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED;

+

+  PxeSw->EntryPoint   =3D (UINT64)(UINTN)UndiApiEntry;
+  PxeSw->reserved2[0] =3D 0;

+  PxeSw->reserved2[1] =3D 0;

+  PxeSw->reserved2[2] =3D 0;

+  PxeSw->BusCnt       =3D 1;

+  PxeSw->BusType[0]   =3D PXE_BUSTYPE_USB;

+  PxeSw->Fudge        =3D PxeSw->Fudge - Ca= lculateSum8 ((VOID *)PxeSw, PxeSw->Len);

+}

+

+/**

+  Update NIC number.

+

+  @param[in]      Nic       A poin= ter to the Network interface controller data.

+  @param[in, out] PxeSw     A pointer to the PXE SW UN= DI structure.

+

+**/

+VOID

+UpdateNicNum (

+  IN      NIC_DATA     *Nic,

+  IN OUT  PXE_SW_UNDI  *PxeSw

+  )

+{

+  UINT16  NicNum;

+

+  NicNum =3D (PxeSw->IFcnt | PxeSw->IFcntExt << 8);

+

+  if (Nic =3D=3D NULL) {

+    if (NicNum > 0) {

+      NicNum--;

+    }

+

+    PxeSw->IFcnt    =3D (UINT8)(NicNum & 0xFF);=           // Get lower byte

+    PxeSw->IFcntExt =3D (UINT8)((NicNum & 0xFF00) >>= ; 8); // Get upper byte

+    PxeSw->Fudge    =3D (UINT8)(PxeSw->Fudge - C= alculateSum8 ((VOID *)PxeSw, PxeSw->Len));

+    return;

+  }

+

+  NicNum++;

+

+  PxeSw->IFcnt    =3D (UINT8)(NicNum & 0xFF);  =         // Get lower byte

+  PxeSw->IFcntExt =3D (UINT8)((NicNum & 0xFF00) >> 8); /= / Get upper byte

+  PxeSw->Fudge    =3D (UINT8)(PxeSw->Fudge - Calculat= eSum8 ((VOID *)PxeSw, PxeSw->Len));

+}

+

+/**

+  UNDI API table entry.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+

+**/

+VOID

+UndiApiEntry (

+  IN  UINT64  Cdb

+  )

+{

+  PXE_CDB   *CdbPtr;

+  NIC_DATA  *Nic;

+

+  if (Cdb =3D=3D 0) {

+    return;

+  }

+

+  CdbPtr =3D (PXE_CDB *)(UINTN)Cdb;

+  Nic    =3D &(gLanDeviceList[CdbPtr->IFnum]->Nic= Info);

+  gUndiApiTable[CdbPtr->OpCode](CdbPtr, Nic);

+}

+

+/**

+  Map virtual memory address for DMA. This field can be set to

+  zero if there is no mapping service.

+

+  @param[in]  Nic           A poin= ter to the Network interface controller data.

+  @param[in]  MemAddr       Virtual address = to be mapped.

+  @param[in]  Size          Size of mem= ory to be mapped.

+  @param[in]  Direction     Direction of data flo= w for this memory's usage:

+                    &nbs= p;       cpu->device, device->cpu or both ways.

+  @param[out] MappedAddr    Pointer to return the mapped de= vice address.

+

+**/

+UINTN

+MapIt (

+  IN NIC_DATA  *Nic,

+  IN UINT64    MemAddr,

+  IN UINT32    Size,

+  IN UINT32    Direction,

+  OUT UINT64   MappedAddr

+  )

+{

+  UINT64  *PhyAddr;

+

+  PhyAddr =3D (UINT64 *)(UINTN)MappedAddr;

+

+  if (Nic->PxeStart.Map_Mem =3D=3D 0) {

+    *PhyAddr =3D MemAddr;

+  } else {

+    ((void (*)(UINT64, UINT64, UINT32, UINT32, UINT64))(UINTN) N= ic->PxeStart.Map_Mem)(

+  Nic->PxeStart.Unique_ID,

+  MemAddr,

+  Size,

+  Direction,

+  MappedAddr

+  );

+  }

+

+  return PXE_STATCODE_SUCCESS;

+}

+

+/**

+  Un-map previously mapped virtual memory address. This field can be = set

+  to zero only if the Map_Mem() service is also set to zero.

+

+  @param[in]  Nic           A poin= ter to the Network interface controller data.

+  @param[in]  MemAddr       Virtual address = to be mapped.

+  @param[in]  Size          Size of mem= ory to be mapped.

+  @param[in]  Direction     Direction of data flo= w for this memory's usage:

+                    &nbs= p;       cpu->device, device->cpu or both ways.

+  @param[in]  MappedAddr    Pointer to return the mapp= ed device address.

+

+**/

+VOID

+UnMapIt (

+  IN NIC_DATA  *Nic,

+  IN UINT64    MemAddr,

+  IN UINT32    Size,

+  IN UINT32    Direction,

+  IN UINT64    MappedAddr

+  )

+{

+  if (Nic->PxeStart.UnMap_Mem !=3D 0) {

+    ((void (*)(UINT64, UINT64, UINT32, UINT32, UINT64))(UINTN) N= ic->PxeStart.UnMap_Mem)(

+  Nic->PxeStart.Unique_ID,

+  MemAddr,

+  Size,

+  Direction,

+  MappedAddr

+  );

+  }

+

+  return;

+}

diff --git a/UsbNetworkPkg/ReadMe.md b/UsbNetworkPkg/ReadMe.md
new file mode 100644
index 0000000000..6dc0514ba7
--- /dev/null
+++ b/UsbNetworkPkg/ReadMe.md
@@ -0,0 +1,65 @@
+# UsbNetworkPkg
+
+This document is intend to provide package information, include the interf= ace details.
+
+# INDEX
+  * [Introduction](#introduction)
+  * [Components](#components)
+    * [[NetworkCommon]](#networkcommon)
+    * [[UsbCdcEcm]](#usbcdcecm)
+    * [[UsbCdcNcm]](#usbcdcncm)
+    * [[UsbRndis]](#usbrndis)
+
+#  Introduction
+UsbNetworkPkg provides network functions for USB LAN devices.
+
+# Components
+Below module is included in this package:<br>
+- NetworkCommon
+- UsbCdcEcm
+- UsbCdcNcm
+- UsbRndis
+
+## [NetworkCommon]
+Provides a LAN driver based on UEFI specification(UNDI). It supports USB c= ommunication class subclass devices and USB Rndis devices, depending on the= UsbEthernetProtocol.
+
+## Required Components
+- NetworkPkg
+
+## [UsbCdcEcm]
+This driver provides a communication interface for USB Ethernet devices th= at follows the ECM protocol. The driver installs UsbEthernetProtocol with E= CM functions which are consumed by the NetworkCommon driver.
+
+The driver is compatible with the following USB class codes:
+|Class Code|SubClass Code|Protocol Code|
+|:--------:|:-----------:|:-----------:|
+|0x02|0x06|0x00|
+
+## Required Components
+- NetworkCommon
+- MdeModulePkg(USB bus driver)
+
+## [UsbCdcNcm]
+This driver provides a communication interface for USB Ethernet devices th= at follows the NCM protocol. The driver installs UsbEthernetProtocol with N= CM functions which are consumed by the NetworkCommon driver.
+
+The driver is compatible with the following USB class codes:
+|Class Code|SubClass Code|Protocol Code|
+|:--------:|:-----------:|:-----------:|
+|0x02|0x0D|0x00|
+
+## Required Components
+- NetworkCommon
+- MdeModulePkg(USB bus driver)
+
+## [UsbRndis]
+This driver provides a communication interface for USB Ethernet devices th= at follows the RNDIS protocol. The driver installs UsbEthernetProtocol with= RNDIS functions which are consumed by the NetworkCommon driver.
+
+The driver is compatible with the following USB class codes:
+|Class Code|SubClass Code|Protocol Code|
+|:--------:|:-----------:|:-----------:|
+|0x02|0x02|0xFF|
+|0xEF|0x04|0x01|
+
+## Required Components
+- NetworkCommon
+- MdeModulePkg(USB bus driver)
+
diff --git a/UsbNetworkPkg/ReleaseNotes.md b/UsbNetworkPkg/ReleaseNotes.md<= br> new file mode 100644
index 0000000000..03912e7788
--- /dev/null
+++ b/UsbNetworkPkg/ReleaseNotes.md
@@ -0,0 +1,11 @@
+# UsbNetworkPkg Release Notes<!-- omit in toc -->

+

+# Release History<!-- omit in toc -->

+- [1.00](#100)

+

+## 1.00

+

+**Release Date:** Mar 10, 2022

+

+**New Features**

+- UsbNetworkPkg first release.

diff --git a/UsbNetworkPkg/UsbCdcEcm/ComponentName.c b/UsbNetworkPkg/UsbCdc= Ecm/ComponentName.c
new file mode 100644
index 0000000000..39123994b2
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcEcm/ComponentName.c
@@ -0,0 +1,170 @@
+/** @file

+  This file contains code for USB Ecm Driver Component Name definitio= ns

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+#include "UsbCdcEcm.h"

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  gUsbEcmDriver= NameTable[] =3D {

+  {

+    "eng;en",

+    L"USB ECM Driver"

+  },

+  {

+    NULL,

+    NULL

+  }

+};

+

+EFI_STATUS

+EFIAPI

+UsbEcmComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEcmComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  );

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gUsbEcmCom= ponentName =3D {

+  UsbEcmComponentNameGetDriverName,

+  UsbEcmComponentNameGetControllerName,

+  "eng"

+};

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  gUsbEcmCo= mponentName2 =3D {

+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbEcmComponentNameGetDriverNa= me,

+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbEcmComponentNameGetCont= rollerName,

+  "en"

+};

+

+/**

+  Retrieves a Unicode string that is the user readable name of the dr= iver.

+

+  This function retrieves the user readable name of a driver in the f= orm of a

+  Unicode string. If the driver specified by This has a user readable= name in

+  the language specified by Language, then a pointer to the driver na= me is

+  returned in DriverName, and EFI_SUCCESS is returned. If the driver = specified

+  by This does not support the language specified by Language,

+  then EFI_UNSUPPORTED is returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language. This i= s the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified

+                    &nbs= p;           in RFC 4646 or ISO 639-2 language cod= e format.

+  @param[out] DriverName        A pointer to the = Unicode string to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           driver specified by This in the langu= age

+                    &nbs= p;           specified by Language.

+

+  @retval EFI_SUCCESS           The Uni= code string for the Driver specified by

+                    &nbs= p;           This and the language specified by La= nguage was

+                    &nbs= p;           returned in DriverName.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER DriverName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  )

+{

+  return LookupUnicodeString2 (

+           Language,

+           This->SupportedLanguages,

+           gUsbEcmDriverNameTable,

+           DriverName,

+           (BOOLEAN)(This =3D=3D &gUsbEc= mComponentName)

+           );

+}

+

+/**

+  Retrieves a Unicode string that is the user readable name of the co= ntroller

+  that is being managed by a driver.

+

+  This function retrieves the user readable name of the controller sp= ecified by

+  ControllerHandle and ChildHandle in the form of a Unicode string. I= f the

+  driver specified by This has a user readable name in the language s= pecified by

+  Language, then a pointer to the controller name is returned in Cont= rollerName,

+  and EFI_SUCCESS is returned.  If the driver specified by This = is not currently

+  managing the controller specified by ControllerHandle and ChildHand= le,

+  then EFI_UNSUPPORTED is returned.  If the driver specified by = This does not

+  support the language specified by Language, then EFI_UNSUPPORTED is= returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Controller        The handle o= f a controller that the driver

+                    &nbs= p;           specified by This is managing.  = This handle

+                    &nbs= p;           specifies the controller whose name i= s to be

+                    &nbs= p;           returned.

+  @param[in]  ChildHandle       The handle o= f the child controller to retrieve

+                    &nbs= p;           the name of.  This is an optiona= l parameter that

+                    &nbs= p;           may be NULL.  It will be NULL fo= r device

+                    &nbs= p;           drivers.  It will also be NULL f= or a bus drivers

+                    &nbs= p;           that wish to retrieve the name of the= bus

+                    &nbs= p;           controller.  It will not be NULL= for a bus

+                    &nbs= p;           driver that wishes to retrieve the na= me of a

+                    &nbs= p;           child controller.

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language.  = This is the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified in

+                    &nbs= p;           RFC 4646 or ISO 639-2 language code f= ormat.

+  @param[out] ControllerName    A pointer to the Unicode st= ring to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           controller specified by ControllerHan= dle and

+                    &nbs= p;           ChildHandle in the language specified= by

+                    &nbs= p;           Language from the point of view of th= e driver

+                    &nbs= p;           specified by This.

+

+  @retval EFI_SUCCESS           The Uni= code string for the user readable name in

+                    &nbs= p;           the language specified by Language fo= r the

+                    &nbs= p;           driver specified by This was returned= in

+                    &nbs= p;           DriverName.

+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_H= ANDLE.

+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not= a valid

+                    &nbs= p;           EFI_HANDLE.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This is not currently

+                    &nbs= p;           managing the controller specified by<= br>
+                    &nbs= p;           ControllerHandle and ChildHandle.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  )

+{

+  return EFI_UNSUPPORTED;

+}

diff --git a/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.c b/UsbNetworkPkg/UsbCdcEcm/= UsbCdcEcm.c
new file mode 100644
index 0000000000..34f115f48d
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.c
@@ -0,0 +1,504 @@
+/** @file

+  This file contains code for USB Ethernet Control Model

+  Driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+#include "UsbCdcEcm.h"

+

+EFI_GUID  gUsbEthProtocolGuid =3D USB_ETHERNET_PROTOCOL_GUID;

+

+EFI_DRIVER_BINDING_PROTOCOL  gUsbEcmDriverBinding =3D {

+  UsbEcmDriverSupported,

+  UsbEcmDriverStart,

+  UsbEcmDriverStop,

+  USB_ECM_DRIVER_VERSION,

+  NULL,

+  NULL

+};

+

+/**

+  Check if this interface is USB ECM SubType

+

+  @param[in]  UsbIo     A pointer to the EFI_USB_= IO_PROTOCOL instance.

+

+  @retval TRUE          USB ECM SubType.

+  @retval FALSE         Not USB ECM SubType.=

+

+**/

+BOOLEAN

+IsSupportedDevice (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  if ((InterfaceDescriptor.InterfaceClass =3D=3D USB_CDC_CLASS) &= &

+      (InterfaceDescriptor.InterfaceSubClass =3D=3D USB_CDC= _ECM_SUBCLASS) &&

+      (InterfaceDescriptor.InterfaceProtocol =3D=3D USB_NO_= CLASS_PROTOCOL))

+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  USB ECM Driver Binding Support.

+

+  @param[in]  This            &nbs= p;     Protocol instance pointer.

+  @param[in]  ControllerHandle      Handle of dev= ice to test.

+  @param[in]  RemainingDevicePath   Optional parameter= use to pick a specific child

+                    &nbs= p;               device to start.

+

+  @retval EFI_SUCCESS             =  This driver supports this device.

+  @retval EFI_ALREADY_STARTED       This driver i= s already running on this device.

+  @retval other               = ;      This driver does not support this device.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS           Status;

+  EFI_USB_IO_PROTOCOL  *UsbIo =3D NULL;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D IsSupportedDevice (UsbIo) ? EFI_SUCCESS : EFI_UNSUPPORTE= D;

+

+  gBS->CloseProtocol (

+         ControllerHandle,

+         &gEfiUsbIoProtocolGuid,

+         This->DriverBindingHandle,

+         ControllerHandle

+         );

+  return Status;

+}

+

+/**

+  Check if the USB ECM and USB CDC Data interfaces are from the same = device.

+

+  @param[in]  UsbEthPath           = ;       A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.<= br>
+  @param[in]  UsbCdcDataPath          &= nbsp;   A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+

+  @retval EFI_SUCCESS             =        Is the same device.

+  @retval EFI_NOT_FOUND            &nbs= p;      Is not the same device.

+

+**/

+EFI_STATUS

+IsSameDevice (

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbEthPath,

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath

+  )

+{

+  while (1) {

+    if ((UsbEthPath->Type =3D=3D ACPI_DEVICE_PATH) &&= (UsbEthPath->SubType =3D=3D ACPI_DP)) {

+      if (CompareMem ((ACPI_HID_DEVICE_PATH *)UsbCdcDataPat= h, (ACPI_HID_DEVICE_PATH *)UsbEthPath, sizeof (ACPI_HID_DEVICE_PATH))) {
+        return EFI_NOT_FOUND;

+      }

+    }

+

+    if ((UsbEthPath->Type =3D=3D HARDWARE_DEVICE_PATH) &&= amp; (UsbEthPath->SubType =3D=3D HW_PCI_DP)) {

+      if (CompareMem ((PCI_DEVICE_PATH *)UsbCdcDataPath, (P= CI_DEVICE_PATH *)UsbEthPath, sizeof (PCI_DEVICE_PATH))) {

+        return EFI_NOT_FOUND;

+      }

+    }

+

+    if ((UsbEthPath->Type =3D=3D MESSAGING_DEVICE_PATH) &= & (UsbEthPath->SubType =3D=3D MSG_USB_DP)) {

+      if (IsDevicePathEnd (NextDevicePathNode (UsbEthPath))= ) {

+        if (((USB_DEVICE_PATH *)UsbEthPath)->Parent= PortNumber =3D=3D

+            ((USB_DEVICE_PATH *)UsbCdcDataPa= th)->ParentPortNumber)

+        {

+          return EFI_SUCCESS;

+        } else {

+          return EFI_NOT_FOUND;

+        }

+      } else {

+        if (CompareMem ((USB_DEVICE_PATH *)UsbCdcDataP= ath, (USB_DEVICE_PATH *)UsbEthPath, sizeof (USB_DEVICE_PATH))) {

+          return EFI_NOT_FOUND;

+        }

+      }

+    }

+

+    UsbEthPath     =3D NextDevicePathNode (UsbEth= Path);

+    UsbCdcDataPath =3D NextDevicePathNode (UsbCdcDataPath);

+  }

+}

+

+/**

+  Check if the USB CDC Data(UsbIo) installed and return USB CDC Data = Handle.

+

+  @param[in]      UsbEthPath       = ;   A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+  @param[in, out] UsbCdcDataHandle    A pointer to the EFI_= HANDLE for USB CDC Data.

+

+  @retval TRUE               = USB CDC Data(UsbIo) installed.

+  @retval FALSE               = ;USB CDC Data(UsbIo) did not installed.

+

+**/

+BOOLEAN

+IsUsbCdcData (

+  IN      EFI_DEVICE_PATH_PROTOCOL  *UsbEthPath,<= br>
+  IN OUT  EFI_HANDLE            &n= bsp;   *UsbCdcDataHandle

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINTN                 =        Index;

+  UINTN                 =        HandleCount;

+  EFI_HANDLE                &= nbsp;   *HandleBuffer;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_DEVICE_PATH_PROTOCOL      *UsbCdcDataPath;

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+

+    if ((Interface.InterfaceClass =3D=3D USB_CDC_DATA_CLASS) &am= p;&

+        (Interface.InterfaceSubClass =3D=3D USB_CDC_DA= TA_SUBCLASS) &&

+        (Interface.InterfaceProtocol =3D=3D USB_NO_CLA= SS_PROTOCOL))

+    {

+      Status =3D gBS->HandleProtocol (

+                    &nbs= p; HandleBuffer[Index],

+                    &nbs= p; &gEfiDevicePathProtocolGuid,

+                    &nbs= p; (VOID **)&UsbCdcDataPath

+                    &nbs= p; );

+      if (EFI_ERROR (Status)) {

+        continue;

+      }

+

+      Status =3D IsSameDevice (UsbEthPath, UsbCdcDataPath);=

+      if (!EFI_ERROR (Status)) {

+        CopyMem (UsbCdcDataHandle, &HandleBuffer[I= ndex], sizeof (EFI_HANDLE));

+        gBS->FreePool (HandleBuffer);

+        return TRUE;

+      }

+    }

+  }

+

+  gBS->FreePool (HandleBuffer);

+  return FALSE;

+}

+

+/**

+  Call Back Function.

+

+  @param[in]  Event       Event whose notifi= cation function is being invoked.

+  @param[in]  Context     The pointer to the noti= fication function's context,

+                    &nbs= p;     which is implementation-dependent.

+

+**/

+VOID

+EFIAPI

+CallbackFunction (

+  IN EFI_EVENT  Event,

+  IN VOID       *Context

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINTN                 =        Index;

+  UINTN                 =        HandleCount;

+  EFI_HANDLE                &= nbsp;   *HandleBuffer;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+

+    if ((Interface.InterfaceClass =3D=3D USB_CDC_CLASS) &&am= p;

+        (Interface.InterfaceSubClass =3D=3D USB_CDC_EC= M_SUBCLASS) &&

+        (Interface.InterfaceProtocol =3D=3D USB_NO_CLA= SS_PROTOCOL))

+    {

+      gBS->ConnectController (HandleBuffer[Index], NULL,= NULL, TRUE);

+    }

+  }

+

+  gBS->FreePool (HandleBuffer);

+  gBS->CloseEvent (Event);

+}

+

+/**

+  USB ECM Driver Binding Start.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to bind driver to.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver is added to ControllerHandle

+  @retval EFI_DEVICE_ERROR            T= his driver could not be started due to a device error

+  @retval EFI_OUT_OF_RESOURCES        The driver = could not install successfully due to a lack of resources.

+  @retval other               = ;        This driver does not support this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  VOID                  =         *Reg;

+  EFI_EVENT                &n= bsp;    Event;

+  USB_ETHERNET_DRIVER           *UsbEth= Driver;

+  EFI_DEVICE_PATH_PROTOCOL      *UsbEthPath;

+  EFI_HANDLE                &= nbsp;   UsbCdcDataHandle;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbEthPath,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return Status;

+  }

+

+  Status =3D IsUsbCdcData (UsbEthPath, &UsbCdcDataHandle) ? EFI_S= UCCESS : EFI_UNSUPPORTED;

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+

+    Status =3D gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLB= ACK, CallbackFunction, NULL, &Event);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    Status =3D gBS->RegisterProtocolNotify (&gEfiUsbIoPro= tocolGuid, Event, &Reg);

+    return Status;

+  }

+

+  UsbEthDriver =3D AllocateZeroPool (sizeof (USB_ETHERNET_DRIVER));
+  if (!UsbEthDriver) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return EFI_OUT_OF_RESOURCES;

+  }

+

+  Status =3D LoadAllDescriptor (UsbIo, &UsbEthDriver->Config);=

+  ASSERT_EFI_ERROR (Status);

+

+  GetEndpoint (UsbIo, UsbEthDriver);

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  UsbEthDriver->Signature           =               =3D USB_ETHERNET_SIGNATUR= E;

+  UsbEthDriver->NumOfInterface          &= nbsp;          =3D Interface.InterfaceNumber;

+  UsbEthDriver->UsbCdcDataHandle         =          =3D UsbCdcDataHandle;

+  UsbEthDriver->UsbIo            &nb= sp;                 =3D UsbIo;

+  UsbEthDriver->UsbEth.UsbEthReceive        &n= bsp;      =3D UsbEthReceive;

+  UsbEthDriver->UsbEth.UsbEthTransmit        &= nbsp;     =3D UsbEthTransmit;

+  UsbEthDriver->UsbEth.UsbEthInterrupt        =      =3D UsbEthInterrupt;

+  UsbEthDriver->UsbEth.UsbEthMacAddress       =     =3D GetUsbEthMacAddress;

+  UsbEthDriver->UsbEth.UsbEthMaxBulkSize       = ;    =3D UsbEthBulkSize;

+  UsbEthDriver->UsbEth.UsbHeaderFunDescriptor      = =3D GetUsbHeaderFunDescriptor;

+  UsbEthDriver->UsbEth.UsbUnionFunDescriptor      &= nbsp;=3D GetUsbUnionFunDescriptor;

+  UsbEthDriver->UsbEth.UsbEthFunDescriptor      &nb= sp;  =3D GetUsbEthFunDescriptor;

+  UsbEthDriver->UsbEth.SetUsbEthMcastFilter      &n= bsp; =3D SetUsbEthMcastFilter;

+  UsbEthDriver->UsbEth.SetUsbEthPowerPatternFilter =3D SetUsbEthPo= werFilter;

+  UsbEthDriver->UsbEth.GetUsbEthPoewrPatternFilter =3D GetUsbEthPo= werFilter;

+  UsbEthDriver->UsbEth.SetUsbEthPacketFilter      &= nbsp;=3D SetUsbEthPacketFilter;

+  UsbEthDriver->UsbEth.GetUsbEthStatistic      &nbs= p;   =3D GetUsbEthStatistic;

+

+  Status =3D gBS->InstallProtocolInterface (

+                  &Contro= llerHandle,

+                  &gUsbEt= hProtocolGuid,

+                  EFI_NATIVE_= INTERFACE,

+                  &(UsbEt= hDriver->UsbEth)

+                  );

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->FreePool (UsbEthDriver);

+    return Status;

+  }

+

+  return Status;

+}

+

+/**

+  USB ECM Driver Binding Stop.

+

+  @param[in]  This            &nbs= p;   Protocol instance pointer.

+  @param[in]  ControllerHandle    Handle of device to = stop driver on

+  @param[in]  NumberOfChildren    Number of Handles in= ChildHandleBuffer. If number of

+                    &nbs= p;             children is zero stop the enti= re bus driver.

+  @param[in]  ChildHandleBuffer   List of Child Handle= s to Stop.

+

+  @retval EFI_SUCCESS             = This driver is removed ControllerHandle

+  @retval other               = ;    This driver was not removed from this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  )

+{

+  EFI_STATUS             Status;
+  USB_ETHERNET_PROTOCOL  *UsbEthProtocol;

+  USB_ETHERNET_DRIVER    *UsbEthDriver;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEthProtocol,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (UsbEthProtocol);

+

+  Status =3D gBS->UninstallProtocolInterface (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  UsbEthProto= col

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->CloseProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle

+                  );

+  gBS->FreePool (UsbEthDriver->Config);

+  gBS->FreePool (UsbEthDriver);

+  return Status;

+}

+

+/**

+  Entrypoint of ECM Driver.

+

+  This function is the entrypoint of ECM Driver. It installs Driver B= inding

+  Protocols together with Component Name Protocols.

+

+  @param[in]  ImageHandle       The firmware= allocated handle for the EFI image.

+  @param[in]  SystemTable       A pointer to= the EFI System Table.

+

+  @retval EFI_SUCCESS           The ent= ry point is executed successfully.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEcmEntry (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  gUsbEcmDriverBinding.DriverBindingHandle =3D ImageHandle;

+  gUsbEcmDriverBinding.ImageHandle         = =3D ImageHandle;

+

+  return gBS->InstallMultipleProtocolInterfaces (

+                &gUsbEcmDriver= Binding.DriverBindingHandle,

+                &gEfiDriverBin= dingProtocolGuid,

+                &gUsbEcmDriver= Binding,

+                &gEfiComponent= Name2ProtocolGuid,

+                &gUsbEcmCompon= entName2,

+                NULL

+                );

+}

diff --git a/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.h b/UsbNetworkPkg/UsbCdcEcm/= UsbCdcEcm.h
new file mode 100644
index 0000000000..52a818466e
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.h
@@ -0,0 +1,211 @@
+/** @file

+  Header file contains code for USB Ethernet Control Model

+  driver definitions

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#ifndef _USB_CDC_ECM_H_

+#define _USB_CDC_ECM_H_

+

+#include <Library/UefiDriverEntryPoint.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiLib.h>

+#include <Library/DevicePathLib.h>

+#include <Library/DebugLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/UefiUsbLib.h>

+#include <Protocol/UsbIo.h>

+#include <Protocol/UsbEthernetProtocol.h>

+

+typedef struct {

+  UINTN                 =       Signature;

+  USB_ETHERNET_PROTOCOL        UsbEth;

+  EFI_HANDLE                &= nbsp;  UsbCdcDataHandle;

+  EFI_USB_IO_PROTOCOL          *UsbIo;

+  EFI_USB_CONFIG_DESCRIPTOR    *Config;

+  UINT8                 =       NumOfInterface;

+  UINT8                 =       BulkInEndpoint;

+  UINT8                 =       BulkOutEndpoint;

+  UINT8                 =       InterruptEndpoint;

+  EFI_MAC_ADDRESS              Mac= Address;

+} USB_ETHERNET_DRIVER;

+

+#define USB_ECM_DRIVER_VERSION         1

+#define USB_ETHERNET_BULK_TIMEOUT      1

+#define USB_ETHERNET_TRANSFER_TIMEOUT  200

+

+#define USB_ETHERNET_SIGNATURE  SIGNATURE_32('u', 'e', 't', 'h')

+#define USB_ETHERNET_DEV_FROM_THIS(a)  CR (a, USB_ETHERNET_DRIVER, Us= bEth, USB_ETHERNET_SIGNATURE)

+

+typedef struct {

+  UINT16    Src;

+  UINT16    Dst;

+} BIT_MAP;

+

+extern EFI_COMPONENT_NAME2_PROTOCOL  gUsbEcmComponentName2;

+

+EFI_STATUS

+EFIAPI

+UsbEcmDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEcmDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEcmDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  );

+

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  );

+

+BOOLEAN

+NextDescriptor (

+  IN EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT UINTN               =   *Offset

+  );

+

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  );

+

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_ETHERNET_DRIVER  *UsbEthDriver

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *Packet,

+  IN OUT UINTN               =   *PacketLength

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *Packet,

+  IN OUT  UINTN              =     *PacketLength

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Request

+  );

+

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthPowerFilter (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  Value,

+  OUT BOOLEAN                = *PatternActive

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthStatistic (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  );

+

+#endif

diff --git a/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf b/UsbNetworkPkg/UsbCdcEc= m/UsbCdcEcm.inf
new file mode 100644
index 0000000000..ed031864c6
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcEcm/UsbCdcEcm.inf
@@ -0,0 +1,41 @@
+## @file
+#   This is Usb Cdc Ecm driver for DXE phase.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Defines]
+  INF_VERSION                =     =3D 0x00010005
+  BASE_NAME                &n= bsp;     =3D UsbCdcEcm
+  FILE_GUID                &n= bsp;     =3D 07a84945-685d-48ec-a6a1-1b397579fa76
+  MODULE_TYPE                =     =3D DXE_DRIVER
+  VERSION_STRING              &nbs= p;  =3D 1.0
+  ENTRY_POINT                =     =3D UsbEcmEntry
+
+[Sources]
+  UsbCdcEcm.c
+  UsbCdcEcm.h
+  UsbEcmFunction.c
+  ComponentName.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UsbNetworkPkg/UsbNetworkPkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+  UefiLib
+  DebugLib
+  UefiUsbLib
+  MemoryAllocationLib
+  BaseMemoryLib
+
+[Protocols]
+  gEfiUsbIoProtocolGuid
+  gEfiDevicePathProtocolGuid
+  gEfiDriverBindingProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/UsbNetworkPkg/UsbCdcEcm/UsbEcmFunction.c b/UsbNetworkPkg/UsbCd= cEcm/UsbEcmFunction.c
new file mode 100644
index 0000000000..175addddc6
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcEcm/UsbEcmFunction.c
@@ -0,0 +1,861 @@
+/** @file

+  This file contains code for USB Ethernet descriptor

+  and specific requests implement.

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbCdcEcm.h"

+

+/**

+  Load All of device descriptor.

+

+  @param[in]  UsbIo            &nb= sp;    A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[out] ConfigDesc            A p= ointer to the configuration descriptor.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be complet= ed because the

+                    &nbs= p;           buffer specified by DescriptorLength = and Descriptor

+                    &nbs= p;           is not large enough to hold the resul= t of the request.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error. The transfer

+                    &nbs= p;           status is returned in Status.

+

+**/

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  )

+{

+  EFI_STATUS                &= nbsp;Status;

+  UINT32                 = ;    TransStatus;

+  EFI_USB_CONFIG_DESCRIPTOR  Tmp;

+

+  Status =3D UsbIo->UsbGetConfigDescriptor (UsbIo, &Tmp);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, Tmp.TotalLeng= th, (VOID **)ConfigDesc);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbGetDescriptor (

+             UsbIo,

+             USB_DESC_TYPE_CONFIG <&= lt; 8 | (Tmp.ConfigurationValue - 1),          &nb= sp;        // zero based

+             0,

+             Tmp.TotalLength,

+             *ConfigDesc,

+             &TransStatus

+             );

+  return Status;

+}

+

+/**

+  Returns pointer to the next descriptor for the pack of USB descript= ors

+  located in continues memory segment

+

+  @param[in]      Desc   A pointer to the CO= NFIG_DESCRIPTOR instance.

+  @param[in, out] Offset A pointer to the sum of descriptor length.
+

+  @retval TRUE   The request executed successfully.

+  @retval FALSE  No next descriptor.

+

+**/

+BOOLEAN

+NextDescriptor (

+  IN EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT UINTN               =   *Offset

+  )

+{

+  if ((Desc =3D=3D NULL) || (*Offset >=3D Desc->TotalLength)) {=

+    return FALSE;

+  }

+

+  if (((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))->Lengt= h =3D=3D 0) {

+    return FALSE;

+  }

+

+  *Offset +=3D ((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))-= >Length;

+  if ( *Offset >=3D Desc->TotalLength ) {

+    return FALSE;

+  }

+

+  return TRUE;

+}

+

+/**

+  Read Function descriptor

+

+  @param[in]  Config            &n= bsp;A pointer to all of configuration.

+  @param[in]  FunDescriptorType  USB CDC class descriptor S= ubType.

+  @param[out] DataBuffer         A pointer t= o the Data of corresponding to device capability.

+

+  @retval EFI_SUCCESS        The device capabilit= y descriptor was retrieved

+                    &nbs= p;        successfully.

+  @retval EFI_UNSUPPORTED    No supported.

+  @retval EFI_NOT_FOUND      The device capability des= criptor was not found.

+

+**/

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  )

+{

+  EFI_STATUS                &= nbsp;   Status =3D EFI_NOT_FOUND;

+  UINTN                 =        Offset;

+  EFI_USB_INTERFACE_DESCRIPTOR  *Interface;

+

+  for (Offset =3D 0; NextDescriptor (Config, &Offset);) {

+    Interface =3D (EFI_USB_INTERFACE_DESCRIPTOR *)((UINT8 *)Conf= ig + Offset);

+    if (Interface->DescriptorType =3D=3D CS_INTERFACE) {

+      if (((USB_HEADER_FUN_DESCRIPTOR *)Interface)->Desc= riptorSubtype =3D=3D FunDescriptorType) {

+        switch (FunDescriptorType) {

+          case HEADER_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_HEADER_FUN_DESCRIPTO= R *)Interface,

+              sizeof (USB_HEADER_FUN_DE= SCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          case UNION_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_UNION_FUN_DESCRIPTOR= *)Interface,

+              ((USB_UNION_FUN_DESCRIPTO= R *)Interface)->FunctionLength

+              );

+            return EFI_SUCCESS;

+          case ETHERNET_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_ETHERNET_FUN_DESCRIP= TOR *)Interface,

+              sizeof (USB_ETHERNET_FUN_= DESCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          default:

+            Status =3D EFI_UNSUPPORTED;

+            break;

+        }

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Get USB Ethernet IO endpoint and USB CDC data IO endpoint.

+

+  @param[in]      UsbIo        &nb= sp;A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[in, out] UsbEthDriver  A pointer to the USB_ETHERNET_DR= IVER instance.

+

+**/

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_ETHERNET_DRIVER  *UsbEthDriver

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINT8                 =        Index;

+  UINT32                 = ;       Result;

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_USB_ENDPOINT_DESCRIPTOR   Endpoint;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  if (Interface.NumEndpoints =3D=3D 0) {

+    Status =3D UsbSetInterface (UsbIo, Interface.InterfaceNumber= , 1, &Result);

+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+  }

+

+  for (Index =3D 0; Index < Interface.NumEndpoints; Index++) {

+    Status =3D UsbIo->UsbGetEndpointDescriptor (UsbIo, Index,= &Endpoint);

+    ASSERT_EFI_ERROR (Status);

+

+    switch ((Endpoint.Attributes & (BIT0 | BIT1))) {

+      case USB_ENDPOINT_BULK:

+        if (Endpoint.EndpointAddress & BIT7) {

+          UsbEthDriver->BulkInEndpoint =3D End= point.EndpointAddress;

+        } else {

+          UsbEthDriver->BulkOutEndpoint =3D En= dpoint.EndpointAddress;

+        }

+

+        break;

+      case USB_ENDPOINT_INTERRUPT:

+        UsbEthDriver->InterruptEndpoint =3D Endpoin= t.EndpointAddress;

+        break;

+    }

+  }

+}

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk in.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in, out] Packet        A pointer to the = buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *Packet,

+  IN OUT UINTN               =   *PacketLength

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+  EFI_USB_IO_PROTOCOL  *UsbIo;

+  UINT32               TransS= tatus;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D gBS->HandleProtocol (

+                  UsbEthDrive= r->UsbCdcDataHandle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (UsbEthDriver->BulkInEndpoint =3D=3D 0) {

+    GetEndpoint (UsbIo, UsbEthDriver);

+  }

+

+  Status =3D UsbIo->UsbBulkTransfer (

+                    UsbI= o,

+                    UsbE= thDriver->BulkInEndpoint,

+                    Pack= et,

+                    Pack= etLength,

+                    USB_= ETHERNET_BULK_TIMEOUT,

+                    &= ;TransStatus

+                    );
+  return Status;

+}

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk out.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]      Packet        A = pointer to the buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *Packet,

+  IN OUT  UINTN              =     *PacketLength

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+  EFI_USB_IO_PROTOCOL  *UsbIo;

+  UINT32               TransS= tatus;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D gBS->HandleProtocol (

+                  UsbEthDrive= r->UsbCdcDataHandle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (UsbEthDriver->BulkOutEndpoint =3D=3D 0) {

+    GetEndpoint (UsbIo, UsbEthDriver);

+  }

+

+  Status =3D UsbIo->UsbBulkTransfer (

+                    UsbI= o,

+                    UsbE= thDriver->BulkOutEndpoint,

+                    Pack= et,

+                    Pack= etLength,

+                    USB_= ETHERNET_BULK_TIMEOUT,

+                    &= ;TransStatus

+                    );
+  return Status;

+}

+

+/**

+  Async USB transfer callback routine.

+

+  @param[in]  Data            Data= received or sent via the USB Asynchronous Transfer, if the

+                    &nbs= p;         transfer completed successfully.

+  @param[in]  DataLength      The length of Data = received or sent via the Asynchronous

+                    &nbs= p;         Transfer, if transfer successfully completes= .

+  @param[in]  Context         Data pass= ed from UsbAsyncInterruptTransfer() request.

+  @param[in]  Status          Indicates= the result of the asynchronous transfer.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  )

+{

+  if (((EFI_USB_DEVICE_REQUEST *)Data)->Request =3D=3D USB_CDC_NET= WORK_CONNECTION) {

+    CopyMem (

+      (EFI_USB_DEVICE_REQUEST *)Context,

+      (EFI_USB_DEVICE_REQUEST *)Data,

+      sizeof (EFI_USB_DEVICE_REQUEST)

+      );

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is used to manage a USB device with an interrupt tran= sfer pipe.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  IsNewTransfer     If TRUE, a new tr= ansfer will be submitted to USB controller. If

+                    &nbs= p;           FALSE, the interrupt transfer is dele= ted from the device's interrupt

+                    &nbs= p;           transfer queue.

+  @param[in]  PollingInterval   Indicates the periodic= rate, in milliseconds, that the transfer is to be

+                    &nbs= p;           executed.This parameter is required w= hen IsNewTransfer is TRUE. The

+                    &nbs= p;           value must be between 1 to 255, other= wise EFI_INVALID_PARAMETER is returned.

+                    &nbs= p;           The units are in milliseconds.

+  @param[in]  Request           A = pointer to the EFI_USB_DEVICE_REQUEST data.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Request

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+  UINTN                DataLe= ngth =3D 0;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+  if (IsNewTransfer =3D=3D TRUE) {

+    DataLength =3D sizeof (EFI_USB_DEVICE_REQUEST) + sizeof (USB= _CONNECT_SPEED_CHANGE);

+    Status     =3D UsbEthDriver->UsbIo->Usb= AsyncInterruptTransfer (

+                    &nbs= p;                   UsbEthDri= ver->UsbIo,

+                    &nbs= p;                   UsbEthDri= ver->InterruptEndpoint,

+                    &nbs= p;                   IsNewTran= sfer,

+                    &nbs= p;                   PollingIn= terval,

+                    &nbs= p;                   DataLengt= h,

+                    &nbs= p;                   (EFI_ASYN= C_USB_TRANSFER_CALLBACK)InterruptCallback,

+                    &nbs= p;                   Request
+                    &nbs= p;                   );

+  } else {

+    Status =3D UsbEthDriver->UsbIo->UsbAsyncInterruptTrans= fer (

+                    &nbs= p;               UsbEthDriver->UsbIo,=

+                    &nbs= p;               UsbEthDriver->Interr= uptEndpoint,

+                    &nbs= p;               IsNewTransfer,

+                    &nbs= p;               0,

+                    &nbs= p;               0,

+                    &nbs= p;               NULL,

+                    &nbs= p;               NULL

+                    &nbs= p;               );

+  }

+

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet Mac Address.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] MacAddress    A pointer to the caller allocat= ed USB Ethernet Mac Address.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthDescriptor;

+  CHAR16                 = ;      *Data;

+  CHAR16                 = ;      *DataPtr;

+  CHAR16                 = ;      TmpStr[1];

+  UINT8                 =       Index;

+  UINT8                 =       Hi;

+  UINT8                 =       Low;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthDescripto= r);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbEthDriver->UsbIo->UsbGetStringDescriptor (

+                    &nbs= p;             UsbEthDriver->UsbIo,

+                    &nbs= p;             0x409,      &nb= sp;                 // English-US L= anguage ID

+                    &nbs= p;             UsbEthDescriptor.MacAddress,
+                    &nbs= p;             &Data

+                    &nbs= p;             );

+  ASSERT_EFI_ERROR (Status);

+

+  DataPtr =3D Data;

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Hi =3D (UINT8)StrHexToUintn (TmpStr);

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Low                &= nbsp;    =3D (UINT8)StrHexToUintn (TmpStr);

+    MacAddress->Addr[Index] =3D (Hi << 4) | Low;

+  }

+

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet Bulk transfer data size.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] BulkSize      A pointer to the Bulk tran= sfer data size.

+

+  @retval EFI_SUCCESS       The bulk transfer dat= a size was retrieved successfully.

+  @retval other             Failed= to retrieve the bulk transfer data size.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  *BulkSize =3D (UINTN)UsbEthFunDescriptor.MaxSegmentSize;

+  return Status;

+}

+

+/**

+  Retrieves the USB Header functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbHeaderFunDescriptor A pointer to the caller allocate= d USB Header Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbHeaderFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, HEADER= _FUN_DESCRIPTOR, UsbHeaderFunDescriptor);

+  return Status;

+}

+

+/**

+  Retrieves the USB Union functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbUnionFunDescriptor  A pointer to the caller all= ocated USB Union Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Union Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbUnionFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Unio= n Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbUnionFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, UNION_= FUN_DESCRIPTOR, UsbUnionFunDescriptor);

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbEthFunDescriptor    A pointer to the calle= r allocated USB Ethernet Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Ethernet Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbEthFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Ethe= rnet Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbEthFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, ETHERN= ET_FUN_DESCRIPTOR, UsbEthFunDescriptor);

+  return Status;

+}

+

+/**

+  This request sets the Ethernet device multicast filters as specifie= d in the

+  sequential list of 48 bit Ethernet multicast addresses.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     Number of filters.

+  @param[in]  McastAddr           =   A pointer to the value of the multicast addresses.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  EFI_USB_DEVICE_REQUEST       Request;

+  UINT32                 = ;      TransStatus;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if ((UsbEthFunDescriptor.NumberMcFilters << 1) =3D=3D 0) {
+    return EFI_UNSUPPORTED;

+  }

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_MULTICAST_FILTERS_RE= Q;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D Value * 6;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataOut,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           McastAddr,

+                    &nbs= p;           Request.Length,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request sets up the specified Ethernet power management patter= n filter as

+  described in the data structure.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;    Number of filters.

+  @param[in]  Length            &n= bsp;   Size of the power management pattern filter data.

+  @param[in]  PatternFilter         A p= ointer to the power management pattern filter structure.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D Length;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataOut,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           PatternFilter,

+                    &nbs= p;           Length,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request retrieves the status of the specified Ethernet power m= anagement

+  pattern filter from the device.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     The filter number.

+  @param[out] PatternActive          A point= er to the pattern active boolean.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthPowerFilter (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  Value,

+  OUT BOOLEAN                = *PatternActive

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHERNET_GET_REQ_TYPE;

+  Request.Request     =3D GET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_POWER_FILTER_LENGTH;=

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataIn,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           PatternActive,

+                    &nbs= p;           USB_ETH_POWER_FILTER_LENGTH,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+BIT_MAP  gTable[] =3D {

+  { PXE_OPFLAGS_RECEIVE_FILTER_UNICAST,        &n= bsp;   USB_ETH_PACKET_TYPE_DIRECTED      },

+  { PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST,        =   USB_ETH_PACKET_TYPE_BROADCAST     },

+  { PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST, USB_ETH_PACKET_TYP= E_MULTICAST     },

+  { PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS,       = ; USB_ETH_PACKET_TYPE_PROMISCUOUS   },

+  { PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST,      USB= _ETH_PACKET_TYPE_ALL_MULTICAST },

+};

+

+/**

+  Convert value between PXE receive filter and USB ETH packet filter.=

+

+  @param[in]  Value      PXE filter data.

+  @param[out] CdcFilter  A pointer to the Ethernet Packet Filter= Bitmap value converted by PXE_OPFLAGS.

+

+**/

+VOID

+ConvertFilter (

+  IN  UINT16  Value,

+  OUT UINT16  *CdcFilter

+  )

+{

+  UINT32  Index;

+  UINT32  Count;

+

+  Count =3D sizeof (gTable)/sizeof (gTable[0]);

+

+  for (Index =3D 0; (gTable[Index].Src !=3D 0) && (Index <= Count); Index++) {

+    if (gTable[Index].Src & Value) {

+      *CdcFilter |=3D gTable[Index].Dst;

+    }

+  }

+}

+

+/**

+  This request is used to configure device Ethernet packet filter set= tings.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;Packet Filter Bitmap.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+  UINT16                 = ; CommandFilter =3D 0;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  ConvertFilter (Value, &CommandFilter);

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_PACKET_FILTER_REQ;
+  Request.Value       =3D CommandFilter;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_PACKET_FILTER_LENGTH= ;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbNoData,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           NULL,

+                    &nbs= p;           USB_ETH_PACKET_FILTER_LENGTH,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request is used to retrieve a statistic based on the feature s= elector.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  FeatureSelector       Value of= the feature selector.

+  @param[out] Statistic            &nbs= p;A pointer to the 32 bit unsigned integer.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthStatistic (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  EFI_USB_DEVICE_REQUEST       Request;

+  UINT32                 = ;      TransStatus;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (UsbEthFunDescriptor.EthernetStatistics =3D=3D 0) {

+    return EFI_UNSUPPORTED;

+  }

+

+  Request.RequestType =3D USB_ETHERNET_GET_REQ_TYPE;

+  Request.Request     =3D GET_ETH_STATISTIC_REQ;

+  Request.Value       =3D FeatureSelector;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_STATISTIC;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataIn,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           Statistic,

+                    &nbs= p;           USB_ETH_STATISTIC,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

diff --git a/UsbNetworkPkg/UsbCdcNcm/ComponentName.c b/UsbNetworkPkg/UsbCdc= Ncm/ComponentName.c
new file mode 100644
index 0000000000..36792b89c5
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcNcm/ComponentName.c
@@ -0,0 +1,170 @@
+/** @file

+  This file contains code for USB Ncm Driver Component Name definitio= ns

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+#include "UsbCdcNcm.h"

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  gUsbNcmDriver= NameTable[] =3D {

+  {

+    "eng;en",

+    L"USB NCM Driver"

+  },

+  {

+    NULL,

+    NULL

+  }

+};

+

+EFI_STATUS

+EFIAPI

+UsbNcmComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  );

+

+EFI_STATUS

+EFIAPI

+UsbNcmComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  );

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gUsbNcmCom= ponentName =3D {

+  UsbNcmComponentNameGetDriverName,

+  UsbNcmComponentNameGetControllerName,

+  "eng"

+};

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  gUsbNcmCo= mponentName2 =3D {

+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbNcmComponentNameGetDriverNa= me,

+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbNcmComponentNameGetCont= rollerName,

+  "en"

+};

+

+/**

+  Retrieves a Unicode string that is the user readable name of the dr= iver.

+

+  This function retrieves the user readable name of a driver in the f= orm of a

+  Unicode string. If the driver specified by This has a user readable= name in

+  the language specified by Language, then a pointer to the driver na= me is

+  returned in DriverName, and EFI_SUCCESS is returned. If the driver = specified

+  by This does not support the language specified by Language,

+  then EFI_UNSUPPORTED is returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language. This i= s the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified

+                    &nbs= p;           in RFC 4646 or ISO 639-2 language cod= e format.

+  @param[out] DriverName        A pointer to the = Unicode string to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           driver specified by This in the langu= age

+                    &nbs= p;           specified by Language.

+

+  @retval EFI_SUCCESS           The Uni= code string for the Driver specified by

+                    &nbs= p;           This and the language specified by La= nguage was

+                    &nbs= p;           returned in DriverName.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER DriverName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  )

+{

+  return LookupUnicodeString2 (

+           Language,

+           This->SupportedLanguages,

+           gUsbNcmDriverNameTable,

+           DriverName,

+           (BOOLEAN)(This =3D=3D &gUsbNc= mComponentName)

+           );

+}

+

+/**

+  Retrieves a Unicode string that is the user readable name of the co= ntroller

+  that is being managed by a driver.

+

+  This function retrieves the user readable name of the controller sp= ecified by

+  ControllerHandle and ChildHandle in the form of a Unicode string. I= f the

+  driver specified by This has a user readable name in the language s= pecified by

+  Language, then a pointer to the controller name is returned in Cont= rollerName,

+  and EFI_SUCCESS is returned.  If the driver specified by This = is not currently

+  managing the controller specified by ControllerHandle and ChildHand= le,

+  then EFI_UNSUPPORTED is returned.  If the driver specified by = This does not

+  support the language specified by Language, then EFI_UNSUPPORTED is= returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Controller        The handle o= f a controller that the driver

+                    &nbs= p;           specified by This is managing.  = This handle

+                    &nbs= p;           specifies the controller whose name i= s to be

+                    &nbs= p;           returned.

+  @param[in]  ChildHandle       The handle o= f the child controller to retrieve

+                    &nbs= p;           the name of.  This is an optiona= l parameter that

+                    &nbs= p;           may be NULL.  It will be NULL fo= r device

+                    &nbs= p;           drivers.  It will also be NULL f= or a bus drivers

+                    &nbs= p;           that wish to retrieve the name of the= bus

+                    &nbs= p;           controller.  It will not be NULL= for a bus

+                    &nbs= p;           driver that wishes to retrieve the na= me of a

+                    &nbs= p;           child controller.

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language.  = This is the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified in

+                    &nbs= p;           RFC 4646 or ISO 639-2 language code f= ormat.

+  @param[out] ControllerName    A pointer to the Unicode st= ring to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           controller specified by ControllerHan= dle and

+                    &nbs= p;           ChildHandle in the language specified= by

+                    &nbs= p;           Language from the point of view of th= e driver

+                    &nbs= p;           specified by This.

+

+  @retval EFI_SUCCESS           The Uni= code string for the user readable name in

+                    &nbs= p;           the language specified by Language fo= r the

+                    &nbs= p;           driver specified by This was returned= in

+                    &nbs= p;           DriverName.

+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_H= ANDLE.

+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not= a valid

+                    &nbs= p;           EFI_HANDLE.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This is not currently

+                    &nbs= p;           managing the controller specified by<= br>
+                    &nbs= p;           ControllerHandle and ChildHandle.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  )

+{

+  return EFI_UNSUPPORTED;

+}

diff --git a/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.c b/UsbNetworkPkg/UsbCdcNcm/= UsbCdcNcm.c
new file mode 100644
index 0000000000..fc7cbd8132
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.c
@@ -0,0 +1,508 @@
+/** @file

+  This file contains code for USB Network Control Model

+  binding driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbCdcNcm.h"

+

+EFI_GUID  gUsbEthProtocolGuid =3D USB_ETHERNET_PROTOCOL_GUID;

+

+EFI_DRIVER_BINDING_PROTOCOL  gUsbNcmDriverBinding =3D {

+  UsbNcmDriverSupported,

+  UsbNcmDriverStart,

+  UsbNcmDriverStop,

+  USB_NCM_DRIVER_VERSION,

+  NULL,

+  NULL

+};

+

+/**

+  Check if this interface is USB NCM SubType

+

+  @param[in]  UsbIo   A pointer to the EFI_USB_IO_PROT= OCOL instance.

+

+  @retval TRUE        USB NCM SubType.

+  @retval FALSE       Not USB NCM SubType.

+

+**/

+BOOLEAN

+IsSupportedDevice (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  if ((InterfaceDescriptor.InterfaceClass =3D=3D USB_CDC_CLASS) &= &

+      (InterfaceDescriptor.InterfaceSubClass =3D=3D USB_CDC= _NCM_SUBCLASS) &&

+      (InterfaceDescriptor.InterfaceProtocol =3D=3D USB_NO_= CLASS_PROTOCOL))

+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  USB NCM Driver Binding Support.

+

+  @param[in]  This            &nbs= p;     Protocol instance pointer.

+  @param[in]  ControllerHandle      Handle of dev= ice to test.

+  @param[in]  RemainingDevicePath   Optional parameter= use to pick a specific child

+                    &nbs= p;               device to start.

+

+  @retval EFI_SUCCESS             =  This driver supports this device.

+  @retval EFI_ALREADY_STARTED       This driver i= s already running on this device.

+  @retval other               = ;      This driver does not support this device.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS           Status;

+  EFI_USB_IO_PROTOCOL  *UsbIo =3D NULL;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D IsSupportedDevice (UsbIo) ? EFI_SUCCESS : EFI_UNSUPPORTE= D;

+

+  gBS->CloseProtocol (

+         ControllerHandle,

+         &gEfiUsbIoProtocolGuid,

+         This->DriverBindingHandle,

+         ControllerHandle

+         );

+  return Status;

+}

+

+/**

+  Check if the USB NCM and USB CDC Data interfaces are from the same = device.

+

+  @param[in]  UsbEthPath           = ;       A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.<= br>
+  @param[in]  UsbCdcDataPath          &= nbsp;   A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+

+  @retval EFI_SUCCESS             =        Is the same device.

+  @retval EFI_NOT_FOUND            &nbs= p;      Is not the same device.

+

+**/

+EFI_STATUS

+IsSameDevice (

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbEthPath,

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath

+  )

+{

+  while (1) {

+    if ((UsbEthPath->Type =3D=3D ACPI_DEVICE_PATH) &&= (UsbEthPath->SubType =3D=3D ACPI_DP)) {

+      if (CompareMem ((ACPI_HID_DEVICE_PATH *)UsbCdcDataPat= h, (ACPI_HID_DEVICE_PATH *)UsbEthPath, sizeof (ACPI_HID_DEVICE_PATH))) {
+        return EFI_NOT_FOUND;

+      }

+    }

+

+    if ((UsbEthPath->Type =3D=3D HARDWARE_DEVICE_PATH) &&= amp; (UsbEthPath->SubType =3D=3D HW_PCI_DP)) {

+      if (CompareMem ((PCI_DEVICE_PATH *)UsbCdcDataPath, (P= CI_DEVICE_PATH *)UsbEthPath, sizeof (PCI_DEVICE_PATH))) {

+        return EFI_NOT_FOUND;

+      }

+    }

+

+    if ((UsbEthPath->Type =3D=3D MESSAGING_DEVICE_PATH) &= & (UsbEthPath->SubType =3D=3D MSG_USB_DP)) {

+      if (IsDevicePathEnd (NextDevicePathNode (UsbEthPath))= ) {

+        if (((USB_DEVICE_PATH *)UsbEthPath)->Parent= PortNumber =3D=3D

+            ((USB_DEVICE_PATH *)UsbCdcDataPa= th)->ParentPortNumber)

+        {

+          return EFI_SUCCESS;

+        } else {

+          return EFI_NOT_FOUND;

+        }

+      } else {

+        if (CompareMem ((USB_DEVICE_PATH *)UsbCdcDataP= ath, (USB_DEVICE_PATH *)UsbEthPath, sizeof (USB_DEVICE_PATH))) {

+          return EFI_NOT_FOUND;

+        }

+      }

+    }

+

+    UsbEthPath     =3D NextDevicePathNode (UsbEth= Path);

+    UsbCdcDataPath =3D NextDevicePathNode (UsbCdcDataPath);

+  }

+}

+

+/**

+  Check if the USB CDC Data(UsbIo) installed and return USB CDC Data = Handle.

+

+  @param[in]      UsbEthPath       = ;   A pointer to the EFI_DEVICE_PATH_PROTOCOL instance.

+  @param[in, out] UsbCdcDataHandle    A pointer to the EFI_= HANDLE for USB CDC Data.

+

+  @retval TRUE               = USB CDC Data(UsbIo) installed.

+  @retval FALSE               = ;USB CDC Data(UsbIo) did not installed.

+

+**/

+BOOLEAN

+IsUsbCdcData (

+  IN      EFI_DEVICE_PATH_PROTOCOL  *UsbEthPath,<= br>
+  IN OUT  EFI_HANDLE            &n= bsp;   *UsbCdcDataHandle

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINTN                 =        Index;

+  UINTN                 =        HandleCount;

+  EFI_HANDLE                &= nbsp;   *HandleBuffer;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_DEVICE_PATH_PROTOCOL      *UsbCdcDataPath;

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+

+    if ((Interface.InterfaceClass =3D=3D USB_CDC_DATA_CLASS) &am= p;&

+        (Interface.InterfaceSubClass =3D=3D USB_CDC_DA= TA_SUBCLASS) &&

+        (Interface.InterfaceProtocol =3D=3D USB_NCM_NT= B_PROTOCOL))

+    {

+      Status =3D gBS->HandleProtocol (

+                    &nbs= p; HandleBuffer[Index],

+                    &nbs= p; &gEfiDevicePathProtocolGuid,

+                    &nbs= p; (VOID **)&UsbCdcDataPath

+                    &nbs= p; );

+      if (EFI_ERROR (Status)) {

+        continue;

+      }

+

+      Status =3D IsSameDevice (UsbEthPath, UsbCdcDataPath);=

+      if (!EFI_ERROR (Status)) {

+        CopyMem (UsbCdcDataHandle, &HandleBuffer[I= ndex], sizeof (EFI_HANDLE));

+        gBS->FreePool (HandleBuffer);

+        return TRUE;

+      }

+    }

+  }

+

+  gBS->FreePool (HandleBuffer);

+  return FALSE;

+}

+

+/**

+  Call Back Function.

+

+  @param[in]  Event       Event whose notifi= cation function is being invoked.

+  @param[in]  Context     The pointer to the noti= fication function's context,

+                    &nbs= p;     which is implementation-dependent.

+

+**/

+VOID

+EFIAPI

+CallbackFunction (

+  IN EFI_EVENT  Event,

+  IN VOID       *Context

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINTN                 =        Index;

+  UINTN                 =        HandleCount;

+  EFI_HANDLE                &= nbsp;   *HandleBuffer;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+

+    if ((Interface.InterfaceClass =3D=3D USB_CDC_CLASS) &&am= p;

+        (Interface.InterfaceSubClass =3D=3D USB_CDC_NC= M_SUBCLASS) &&

+        (Interface.InterfaceProtocol =3D=3D USB_NO_CLA= SS_PROTOCOL))

+    {

+      gBS->ConnectController (HandleBuffer[Index], NULL,= NULL, TRUE);

+    }

+  }

+

+  gBS->FreePool (HandleBuffer);

+  gBS->CloseEvent (Event);

+}

+

+/**

+  USB NCM Driver Binding Start.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to bind driver to.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver is added to ControllerHandle

+  @retval EFI_DEVICE_ERROR            T= his driver could not be started due to a device error

+  @retval EFI_OUT_OF_RESOURCES        The driver = could not install successfully due to a lack of resources.

+  @retval other               = ;        This driver does not support this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  VOID                  =         *Reg;

+  EFI_EVENT                &n= bsp;    Event;

+  USB_ETHERNET_DRIVER           *UsbEth= Driver;

+  EFI_DEVICE_PATH_PROTOCOL      *UsbEthPath;

+  EFI_HANDLE                &= nbsp;   UsbCdcDataHandle;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbEthPath,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return Status;

+  }

+

+  Status =3D IsUsbCdcData (UsbEthPath, &UsbCdcDataHandle) ? EFI_S= UCCESS : EFI_UNSUPPORTED;

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+

+    Status =3D gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLB= ACK, CallbackFunction, NULL, &Event);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    Status =3D gBS->RegisterProtocolNotify (&gEfiUsbIoPro= tocolGuid, Event, &Reg);

+    return Status;

+  }

+

+  UsbEthDriver =3D AllocateZeroPool (sizeof (USB_ETHERNET_DRIVER));
+  if (!UsbEthDriver) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return EFI_OUT_OF_RESOURCES;

+  }

+

+  Status =3D LoadAllDescriptor (UsbIo, &UsbEthDriver->Config);=

+  ASSERT_EFI_ERROR (Status);

+

+  GetEndpoint (UsbIo, UsbEthDriver);

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  UsbEthDriver->Signature           =               =3D USB_ETHERNET_SIGNATUR= E;

+  UsbEthDriver->NumOfInterface          &= nbsp;          =3D Interface.InterfaceNumber;

+  UsbEthDriver->UsbCdcDataHandle         =          =3D UsbCdcDataHandle;

+  UsbEthDriver->UsbIo            &nb= sp;                 =3D UsbIo;

+  UsbEthDriver->UsbEth.UsbEthReceive        &n= bsp;      =3D UsbEthReceive;

+  UsbEthDriver->UsbEth.UsbEthTransmit        &= nbsp;     =3D UsbEthTransmit;

+  UsbEthDriver->UsbEth.UsbEthInterrupt        =      =3D UsbEthInterrupt;

+  UsbEthDriver->UsbEth.UsbEthMacAddress       =     =3D GetUsbEthMacAddress;

+  UsbEthDriver->UsbEth.UsbEthMaxBulkSize       = ;    =3D UsbEthBulkSize;

+  UsbEthDriver->UsbEth.UsbHeaderFunDescriptor      = =3D GetUsbHeaderFunDescriptor;

+  UsbEthDriver->UsbEth.UsbUnionFunDescriptor      &= nbsp;=3D GetUsbUnionFunDescriptor;

+  UsbEthDriver->UsbEth.UsbEthFunDescriptor      &nb= sp;  =3D GetUsbEthFunDescriptor;

+  UsbEthDriver->UsbEth.SetUsbEthMcastFilter      &n= bsp; =3D SetUsbEthMcastFilter;

+  UsbEthDriver->UsbEth.SetUsbEthPowerPatternFilter =3D SetUsbEthPo= werFilter;

+  UsbEthDriver->UsbEth.GetUsbEthPoewrPatternFilter =3D GetUsbEthPo= werFilter;

+  UsbEthDriver->UsbEth.SetUsbEthPacketFilter      &= nbsp;=3D SetUsbEthPacketFilter;

+  UsbEthDriver->UsbEth.GetUsbEthStatistic      &nbs= p;   =3D GetUsbEthStatistic;

+

+  UsbEthDriver->BulkBuffer =3D AllocateZeroPool (USB_NCM_MAX_NTB_S= IZE);

+

+  Status =3D gBS->InstallProtocolInterface (

+                  &Contro= llerHandle,

+                  &gUsbEt= hProtocolGuid,

+                  EFI_NATIVE_= INTERFACE,

+                  &(UsbEt= hDriver->UsbEth)

+                  );

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    gBS->FreePool (UsbEthDriver);

+    return Status;

+  }

+

+  return Status;

+}

+

+/**

+  USB NCM Driver Binding Stop.

+

+  @param[in]  This            &nbs= p;     Protocol instance pointer.

+  @param[in]  ControllerHandle      Handle of dev= ice to stop driver on

+  @param[in]  NumberOfChildren      Number of Han= dles in ChildHandleBuffer. If number of

+                    &nbs= p;               children is zero stop t= he entire bus driver.

+  @param[in]  ChildHandleBuffer     List of Child= Handles to Stop.

+

+  @retval EFI_SUCCESS             =  This driver is removed ControllerHandle

+  @retval other               = ;      This driver was not removed from this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  )

+{

+  EFI_STATUS             Status;
+  USB_ETHERNET_PROTOCOL  *UsbEthProtocol;

+  USB_ETHERNET_DRIVER    *UsbEthDriver;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEthProtocol,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (UsbEthProtocol);

+

+  Status =3D gBS->UninstallProtocolInterface (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  UsbEthProto= col

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->CloseProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle

+                  );

+  gBS->FreePool (UsbEthDriver->Config);

+  gBS->FreePool (UsbEthDriver->BulkBuffer);

+  gBS->FreePool (UsbEthDriver);

+  return Status;

+}

+

+/**

+  Entrypoint of NCM Driver.

+

+  This function is the entrypoint of NCM Driver. It installs Driver B= inding

+  Protocols together with Component Name Protocols.

+

+  @param[in]  ImageHandle       The firmware= allocated handle for the EFI image.

+  @param[in]  SystemTable       A pointer to= the EFI System Table.

+

+  @retval EFI_SUCCESS           The ent= ry point is executed successfully.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbNcmEntry (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  gUsbNcmDriverBinding.DriverBindingHandle =3D ImageHandle;

+  gUsbNcmDriverBinding.ImageHandle         = =3D ImageHandle;

+

+  return gBS->InstallMultipleProtocolInterfaces (

+                &gUsbNcmDriver= Binding.DriverBindingHandle,

+                &gEfiDriverBin= dingProtocolGuid,

+                &gUsbNcmDriver= Binding,

+                &gEfiComponent= Name2ProtocolGuid,

+                &gUsbNcmCompon= entName2,

+                NULL

+                );

+}

diff --git a/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.h b/UsbNetworkPkg/UsbCdcNcm/= UsbCdcNcm.h
new file mode 100644
index 0000000000..40b2671a1e
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.h
@@ -0,0 +1,245 @@
+/** @file

+  Header file for USB Network Control Model driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#ifndef _USB_CDC_NCM_H_

+#define _USB_CDC_NCM_H_

+

+#include <Library/UefiDriverEntryPoint.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiLib.h>

+#include <Library/DevicePathLib.h>

+#include <Library/DebugLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/UefiUsbLib.h>

+#include <Protocol/UsbIo.h>

+#include <Protocol/UsbEthernetProtocol.h>

+

+typedef struct {

+  UINTN                 =       Signature;

+  USB_ETHERNET_PROTOCOL        UsbEth;

+  EFI_HANDLE                &= nbsp;  UsbCdcDataHandle;

+  EFI_USB_IO_PROTOCOL          *UsbIo;

+  EFI_USB_CONFIG_DESCRIPTOR    *Config;

+  UINT8                 =       NumOfInterface;

+  UINT8                 =       BulkInEndpoint;

+  UINT8                 =       BulkOutEndpoint;

+  UINT8                 =       InterruptEndpoint;

+  EFI_MAC_ADDRESS              Mac= Address;

+  UINT16                 = ;      BulkOutSequence;

+  UINT8                 =       *BulkBuffer;

+  UINT8                 =       TotalDatagram;

+  UINT8                 =       NowDatagram;

+} USB_ETHERNET_DRIVER;

+

+#define USB_NCM_DRIVER_VERSION         1

+#define USB_ETHERNET_BULK_TIMEOUT      1

+#define USB_ETHERNET_TRANSFER_TIMEOUT  200

+#define USB_NCM_MAX_NTB_SIZE           0xFFF= F

+#define USB_ETH_FRAME_SIZE             = 0x5F2  // frome network stack snp

+

+// Defined in USB NCM 1.0 spec., section 3.2 and 3.3

+#define USB_NCM_NTH_SIGN_16      0x484D434E

+#define USB_NCM_NDP_SIGN_16      0x304D434E

+#define USB_NCM_NDP_SIGN_16_CRC  0x314D434E

+#define USB_NCM_NTH_LENGTH       0x000C

+#define USB_NCM_NDP_LENGTH       0x0010// at least 16<= br>
+

+// USB NCM Transfer header structure - UINT16

+typedef struct {

+  UINT32    Signature;

+  UINT16    HeaderLength;

+  UINT16    Sequence;

+  UINT16    BlockLength;

+  UINT16    NdpIndex;

+} USB_NCM_TRANSFER_HEADER_16;

+

+// USB NCM Datagram pointer structure - UINT16

+typedef struct {

+  UINT32    Signature;

+  UINT16    Length;

+  UINT16    NextNdpIndex;

+} USB_NCM_DATAGRAM_POINTER_16;

+

+// USB NCM Datagram structure

+typedef struct {

+  UINT16    DatagramIndex;

+  UINT16    DatagramLength;

+} USB_NCM_DATA_GRAM;

+

+#define USB_ETHERNET_SIGNATURE  SIGNATURE_32('u', 'e', 't', 'h')

+#define USB_ETHERNET_DEV_FROM_THIS(a)  CR (a, USB_ETHERNET_DRIVER, Us= bEth, USB_ETHERNET_SIGNATURE)

+

+typedef struct {

+  UINT16    Src;

+  UINT16    Dst;

+} BIT_MAP;

+

+extern EFI_COMPONENT_NAME2_PROTOCOL  gUsbNcmComponentName2;

+

+EFI_STATUS

+EFIAPI

+UsbNcmDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbNcmDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbNcmDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  );

+

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  );

+

+BOOLEAN

+NextDescriptor (

+  IN EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT UINTN               =   *Offset

+  );

+

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  );

+

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_ETHERNET_DRIVER  *UsbEthDriver

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *Packet,

+  IN OUT UINTN               =   *PacketLength

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *Packet,

+  IN OUT  UINTN              =     *PacketLength

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Request

+  );

+

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthPowerFilter (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  Value,

+  OUT BOOLEAN                = *PatternActive

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbEthPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthStatistic (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  );

+

+#endif

diff --git a/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf b/UsbNetworkPkg/UsbCdcNc= m/UsbCdcNcm.inf
new file mode 100644
index 0000000000..cfbf9ad720
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcNcm/UsbCdcNcm.inf
@@ -0,0 +1,41 @@
+## @file
+#   This is Usb Cdc Ncm driver for DXE phase.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Defines]
+  INF_VERSION                =     =3D 0x00010005
+  BASE_NAME                &n= bsp;     =3D UsbCdcNcm
+  FILE_GUID                &n= bsp;     =3D 52230d31-6c11-4442-b262-bec6bfe84efa
+  MODULE_TYPE                =     =3D DXE_DRIVER
+  VERSION_STRING              &nbs= p;  =3D 1.0
+  ENTRY_POINT                =     =3D UsbNcmEntry
+
+[Sources]
+  UsbCdcNcm.c
+  UsbCdcNcm.h
+  UsbNcmFunction.c
+  ComponentName.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UsbNetworkPkg/UsbNetworkPkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+  UefiLib
+  DebugLib
+  UefiUsbLib
+  MemoryAllocationLib
+  BaseMemoryLib
+
+[Protocols]
+  gEfiUsbIoProtocolGuid
+  gEfiDevicePathProtocolGuid
+  gEfiDriverBindingProtocolGuid
+
+[Depex]
+  TRUE
\ No newline at end of file
diff --git a/UsbNetworkPkg/UsbCdcNcm/UsbNcmFunction.c b/UsbNetworkPkg/UsbCd= cNcm/UsbNcmFunction.c
new file mode 100644
index 0000000000..98bcf6d6d5
--- /dev/null
+++ b/UsbNetworkPkg/UsbCdcNcm/UsbNcmFunction.c
@@ -0,0 +1,946 @@
+/** @file

+  This file contains code for USB Ethernet descriptor

+  and specific requests implement.

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbCdcNcm.h"

+

+/**

+  Load All of device descriptor.

+

+  @param[in]  UsbIo            &nb= sp;    A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[out] ConfigDesc            A p= ointer to the configuration descriptor.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be complet= ed because the

+                    &nbs= p;           buffer specified by DescriptorLength = and Descriptor

+                    &nbs= p;           is not large enough to hold the resul= t of the request.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error. The transfer

+                    &nbs= p;           status is returned in Status.

+

+**/

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  )

+{

+  EFI_STATUS                &= nbsp;Status;

+  UINT32                 = ;    TransStatus;

+  EFI_USB_CONFIG_DESCRIPTOR  Tmp;

+

+  Status =3D UsbIo->UsbGetConfigDescriptor (UsbIo, &Tmp);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, Tmp.TotalLeng= th, (VOID **)ConfigDesc);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbGetDescriptor (

+             UsbIo,

+             USB_DESC_TYPE_CONFIG <&= lt; 8 | (Tmp.ConfigurationValue - 1),          &nb= sp;        // zero based

+             0,

+             Tmp.TotalLength,

+             *ConfigDesc,

+             &TransStatus

+             );

+  return Status;

+}

+

+/**

+  Returns pointer to the next descriptor for the pack of USB descript= ors

+  located in continues memory segment

+

+  @param[in]      Desc   A pointer to the CO= NFIG_DESCRIPTOR instance.

+  @param[in, out] Offset A pointer to the sum of descriptor length.
+

+  @retval TRUE   The request executed successfully.

+  @retval FALSE  No next descriptor.

+

+**/

+BOOLEAN

+NextDescriptor (

+  IN EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT UINTN               =   *Offset

+  )

+{

+  if ((Desc =3D=3D NULL) || (*Offset >=3D Desc->TotalLength)) {=

+    return FALSE;

+  }

+

+  if (((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))->Lengt= h =3D=3D 0) {

+    return FALSE;

+  }

+

+  *Offset +=3D ((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))-= >Length;

+  if ( *Offset >=3D Desc->TotalLength ) {

+    return FALSE;

+  }

+

+  return TRUE;

+}

+

+/**

+  Read Function descriptor

+

+  @param[in]  Config            &n= bsp;A pointer to all of configuration.

+  @param[in]  FunDescriptorType  USB CDC class descriptor S= ubType.

+  @param[out] DataBuffer         A pointer t= o the Data of corresponding to device capability.

+

+  @retval EFI_SUCCESS        The device capabilit= y descriptor was retrieved

+                    &nbs= p;        successfully.

+  @retval EFI_UNSUPPORTED    No supported.

+  @retval EFI_NOT_FOUND      The device capability des= criptor was not found.

+

+**/

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  )

+{

+  EFI_STATUS                &= nbsp;   Status =3D EFI_NOT_FOUND;

+  UINTN                 =        Offset;

+  EFI_USB_INTERFACE_DESCRIPTOR  *Interface;

+

+  for (Offset =3D 0; NextDescriptor (Config, &Offset);) {

+    Interface =3D (EFI_USB_INTERFACE_DESCRIPTOR *)((UINT8 *)Conf= ig + Offset);

+    if (Interface->DescriptorType =3D=3D CS_INTERFACE) {

+      if (((USB_HEADER_FUN_DESCRIPTOR *)Interface)->Desc= riptorSubtype =3D=3D FunDescriptorType) {

+        switch (FunDescriptorType) {

+          case HEADER_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_HEADER_FUN_DESCRIPTO= R *)Interface,

+              sizeof (USB_HEADER_FUN_DE= SCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          case UNION_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_UNION_FUN_DESCRIPTOR= *)Interface,

+              ((USB_UNION_FUN_DESCRIPTO= R *)Interface)->FunctionLength

+              );

+            return EFI_SUCCESS;

+          case ETHERNET_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_ETHERNET_FUN_DESCRIP= TOR *)Interface,

+              sizeof (USB_ETHERNET_FUN_= DESCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          default:

+            Status =3D EFI_UNSUPPORTED;

+            break;

+        }

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Get USB Ethernet IO endpoint and USB CDC data IO endpoint.

+

+  @param[in]      UsbIo        &nb= sp;A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[in, out] UsbEthDriver  A pointer to the USB_ETHERNET_DR= IVER instance.

+

+**/

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_ETHERNET_DRIVER  *UsbEthDriver

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINT8                 =        Index;

+  UINT32                 = ;       Result;

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_USB_ENDPOINT_DESCRIPTOR   Endpoint;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  if (Interface.NumEndpoints =3D=3D 0) {

+    Status =3D UsbSetInterface (UsbIo, Interface.InterfaceNumber= , 1, &Result);

+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+  }

+

+  for (Index =3D 0; Index < Interface.NumEndpoints; Index++) {

+    Status =3D UsbIo->UsbGetEndpointDescriptor (UsbIo, Index,= &Endpoint);

+    ASSERT_EFI_ERROR (Status);

+

+    switch ((Endpoint.Attributes & (BIT0 | BIT1))) {

+      case USB_ENDPOINT_BULK:

+        if (Endpoint.EndpointAddress & BIT7) {

+          UsbEthDriver->BulkInEndpoint =3D End= point.EndpointAddress;

+        } else {

+          UsbEthDriver->BulkOutEndpoint =3D En= dpoint.EndpointAddress;

+        }

+

+        break;

+      case USB_ENDPOINT_INTERRUPT:

+        UsbEthDriver->InterruptEndpoint =3D Endpoin= t.EndpointAddress;

+        break;

+    }

+  }

+}

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk in.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in, out] Packet        A pointer to the = buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *Packet,

+  IN OUT UINTN               =   *PacketLength

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+  EFI_USB_IO_PROTOCOL          *UsbIo;

+  UINT32                 = ;      TransStatus;

+  UINT8                 =       Index;

+  UINTN                 =       BulkDataLenght;

+  UINTN                 =       TotalLength =3D 0;

+  USB_NCM_TRANSFER_HEADER_16   *Nth;

+  USB_NCM_DATAGRAM_POINTER_16  *Ndp;

+  USB_NCM_DATA_GRAM            *Datagra= m;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbEthDriver->TotalDatagram =3D=3D UsbEthDriver->NowDatag= ram) {

+    Status =3D gBS->HandleProtocol (

+                    UsbE= thDriver->UsbCdcDataHandle,

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    if (UsbEthDriver->BulkInEndpoint =3D=3D 0) {

+      GetEndpoint (UsbIo, UsbEthDriver);

+    }

+

+    BulkDataLenght =3D USB_NCM_MAX_NTB_SIZE;

+    SetMem (UsbEthDriver->BulkBuffer, BulkDataLenght, 0);

+    UsbEthDriver->NowDatagram   =3D 0;

+    UsbEthDriver->TotalDatagram =3D 0;

+

+    Status =3D UsbIo->UsbBulkTransfer (

+                    &nbs= p; UsbIo,

+                    &nbs= p; UsbEthDriver->BulkInEndpoint,

+                    &nbs= p; UsbEthDriver->BulkBuffer,

+                    &nbs= p; &BulkDataLenght,

+                    &nbs= p; USB_ETHERNET_BULK_TIMEOUT,

+                    &nbs= p; &TransStatus

+                    &nbs= p; );

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    Nth                &= nbsp;        =3D (USB_NCM_TRANSFER_HEADER_16 *)UsbEthDr= iver->BulkBuffer;

+    Ndp                &= nbsp;        =3D (USB_NCM_DATAGRAM_POINTER_16 *)((UINT8= *)UsbEthDriver->BulkBuffer + Nth->NdpIndex);

+    Datagram              &nb= sp;     =3D (USB_NCM_DATA_GRAM *)((UINT8 *)Ndp + sizeof (USB_NCM_= DATAGRAM_POINTER_16));

+    UsbEthDriver->TotalDatagram =3D (UINT8)((Ndp->Length -= 8) / 4 - 1);

+

+    for (Index =3D 0; Index < UsbEthDriver->TotalDatagram;= Index++) {

+      TotalLength +=3D Datagram->DatagramLength;

+      Datagram     =3D (USB_NCM_DATA_GRAM *)= ((UINT8 *)Datagram + sizeof (USB_NCM_DATA_GRAM));

+    }

+

+    if (TotalLength < USB_ETH_FRAME_SIZE) {

+      Datagram =3D (USB_NCM_DATA_GRAM *)((UINT8 *)Ndp + siz= eof (USB_NCM_DATAGRAM_POINTER_16));

+

+      TotalLength =3D 0;

+      for (Index =3D 0; Index < UsbEthDriver->TotalDa= tagram; Index++) {

+        CopyMem ((UINT8 *)Packet + TotalLength, (UINT8= *)UsbEthDriver->BulkBuffer + Datagram->DatagramIndex, Datagram->D= atagramLength);

+        TotalLength +=3D Datagram->DatagramLength;<= br>
+        Datagram     =3D (USB_NCM_DATA_= GRAM *)((UINT8 *)Datagram + sizeof (USB_NCM_DATA_GRAM));

+      }

+

+      *PacketLength           = ;  =3D TotalLength;

+      UsbEthDriver->NowDatagram =3D UsbEthDriver->Tot= alDatagram;

+    } else {

+      UsbEthDriver->NowDatagram++;

+

+      Datagram =3D (USB_NCM_DATA_GRAM *)((UINT8 *)Ndp + siz= eof (USB_NCM_DATAGRAM_POINTER_16));

+      CopyMem (Packet, (UINT8 *)UsbEthDriver->BulkBuffer= + Datagram->DatagramIndex, Datagram->DatagramLength);

+      *PacketLength =3D Datagram->DatagramLength;

+    }

+

+    return Status;

+  } else {

+    UsbEthDriver->NowDatagram++;

+

+    Nth      =3D (USB_NCM_TRANSFER_HEADER_16 *)Us= bEthDriver->BulkBuffer;

+    Ndp      =3D (USB_NCM_DATAGRAM_POINTER_16 *)(= (UINT8 *)UsbEthDriver->BulkBuffer + Nth->NdpIndex);

+    Datagram =3D (USB_NCM_DATA_GRAM *)((UINT8 *)Ndp + sizeof (US= B_NCM_DATAGRAM_POINTER_16));

+    Datagram =3D (USB_NCM_DATA_GRAM *)((UINT8 *)Datagram + sizeo= f (USB_NCM_DATA_GRAM) * (UsbEthDriver->NowDatagram - 1));

+

+    CopyMem (Packet, (UINT8 *)UsbEthDriver->BulkBuffer + Data= gram->DatagramIndex, Datagram->DatagramLength);

+    *PacketLength =3D Datagram->DatagramLength;

+

+    return EFI_SUCCESS;

+  }

+}

+

+/**

+  This function is used to manage a USB device with the bulk transfer= pipe. The endpoint is Bulk out.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]      Packet        A = pointer to the buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] PacketLength  A pointer to the PacketLength.
+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The transfer failed. T= he transfer status is returned in status.

+  @retval EFI_INVALID_PARAMETE  One or more parameters are inval= id.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitt= ed due to a lack of resources.

+  @retval EFI_TIMEOUT           The con= trol transfer fails due to timeout.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *Packet,

+  IN OUT  UINTN              =     *PacketLength

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+  EFI_USB_IO_PROTOCOL          *UsbIo;

+  UINT32                 = ;      TransStatus;

+  USB_NCM_TRANSFER_HEADER_16   *Nth;

+  USB_NCM_DATAGRAM_POINTER_16  *Ndp;

+  USB_NCM_DATA_GRAM            *Datagra= m;

+  UINT8                 =       *TotalPacket;

+  UINTN                 =       TotalLength;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D gBS->HandleProtocol (

+                  UsbEthDrive= r->UsbCdcDataHandle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (UsbEthDriver->BulkOutEndpoint =3D=3D 0) {

+    GetEndpoint (UsbIo, UsbEthDriver);

+  }

+

+  TotalLength =3D (UINTN)(USB_NCM_NTH_LENGTH + USB_NCM_NDP_LENGTH + (= *PacketLength));

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, TotalLength, = (VOID **)&TotalPacket);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  SetMem (TotalPacket, TotalLength, 0);

+

+  Nth               =3D (USB_= NCM_TRANSFER_HEADER_16 *)TotalPacket;

+  Nth->Signature    =3D USB_NCM_NTH_SIGN_16;

+  Nth->HeaderLength =3D USB_NCM_NTH_LENGTH;

+  Nth->Sequence     =3D UsbEthDriver->BulkOutSeq= uence++;

+  Nth->BlockLength  =3D (UINT16)TotalLength;

+  Nth->NdpIndex     =3D Nth->HeaderLength;

+

+  Ndp               =3D (USB_= NCM_DATAGRAM_POINTER_16 *)((UINT8 *)TotalPacket + Nth->NdpIndex);

+  Ndp->Signature    =3D USB_NCM_NDP_SIGN_16;

+  Ndp->Length       =3D USB_NCM_NDP_LENGTH;
+  Ndp->NextNdpIndex =3D 0x00;

+

+  Datagram                &nb= sp;=3D (USB_NCM_DATA_GRAM *)((UINT8 *)Ndp + sizeof (USB_NCM_DATAGRAM_POINTE= R_16));

+  Datagram->DatagramIndex  =3D Nth->HeaderLength + Ndp->= ;Length;

+  Datagram->DatagramLength =3D (UINT16)*PacketLength;

+

+  CopyMem (TotalPacket + Datagram->DatagramIndex, Packet, *PacketL= ength);

+

+  *PacketLength =3D TotalLength;

+

+  Status =3D UsbIo->UsbBulkTransfer (

+                    UsbI= o,

+                    UsbE= thDriver->BulkOutEndpoint,

+                    Tota= lPacket,

+                    Pack= etLength,

+                    USB_= ETHERNET_BULK_TIMEOUT,

+                    &= ;TransStatus

+                    );
+  gBS->FreePool (TotalPacket);

+  return Status;

+}

+

+/**

+  Async USB transfer callback routine.

+

+  @param[in]  Data            Data= received or sent via the USB Asynchronous Transfer, if the

+                    &nbs= p;         transfer completed successfully.

+  @param[in]  DataLength      The length of Data = received or sent via the Asynchronous

+                    &nbs= p;         Transfer, if transfer successfully completes= .

+  @param[in]  Context         Data pass= ed from UsbAsyncInterruptTransfer() request.

+  @param[in]  Status          Indicates= the result of the asynchronous transfer.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  )

+{

+  if (((EFI_USB_DEVICE_REQUEST *)Data)->Request =3D=3D USB_CDC_NET= WORK_CONNECTION) {

+    CopyMem (

+      (EFI_USB_DEVICE_REQUEST *)Context,

+      (EFI_USB_DEVICE_REQUEST *)Data,

+      sizeof (EFI_USB_DEVICE_REQUEST)

+      );

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is used to manage a USB device with an interrupt tran= sfer pipe.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  IsNewTransfer     If TRUE, a new tr= ansfer will be submitted to USB controller. If

+                    &nbs= p;           FALSE, the interrupt transfer is dele= ted from the device's interrupt

+                    &nbs= p;           transfer queue.

+  @param[in]  PollingInterval   Indicates the periodic= rate, in milliseconds, that the transfer is to be

+                    &nbs= p;           executed.This parameter is required w= hen IsNewTransfer is TRUE. The

+                    &nbs= p;           value must be between 1 to 255, other= wise EFI_INVALID_PARAMETER is returned.

+                    &nbs= p;           The units are in milliseconds.

+  @param[in]  Request           A = pointer to the EFI_USB_DEVICE_REQUEST data.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Request

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+  UINTN                DataLe= ngth =3D 0;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+  if (IsNewTransfer =3D=3D TRUE) {

+    DataLength =3D sizeof (EFI_USB_DEVICE_REQUEST) + sizeof (USB= _CONNECT_SPEED_CHANGE);

+    Status     =3D UsbEthDriver->UsbIo->Usb= AsyncInterruptTransfer (

+                    &nbs= p;                   UsbEthDri= ver->UsbIo,

+                    &nbs= p;                   UsbEthDri= ver->InterruptEndpoint,

+                    &nbs= p;                   IsNewTran= sfer,

+                    &nbs= p;                   PollingIn= terval,

+                    &nbs= p;                   DataLengt= h,

+                    &nbs= p;                   (EFI_ASYN= C_USB_TRANSFER_CALLBACK)InterruptCallback,

+                    &nbs= p;                   Request
+                    &nbs= p;                   );

+  } else {

+    Status =3D UsbEthDriver->UsbIo->UsbAsyncInterruptTrans= fer (

+                    &nbs= p;               UsbEthDriver->UsbIo,=

+                    &nbs= p;               UsbEthDriver->Interr= uptEndpoint,

+                    &nbs= p;               IsNewTransfer,

+                    &nbs= p;               0,

+                    &nbs= p;               0,

+                    &nbs= p;               NULL,

+                    &nbs= p;               NULL

+                    &nbs= p;               );

+  }

+

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet Mac Address.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] MacAddress    A pointer to the caller allocat= ed USB Ethernet Mac Address.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthDescriptor;

+  CHAR16                 = ;      *Data;

+  CHAR16                 = ;      *DataPtr;

+  CHAR16                 = ;      TmpStr[1];

+  UINT8                 =       Index;

+  UINT8                 =       Hi;

+  UINT8                 =       Low;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthDescripto= r);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbEthDriver->UsbIo->UsbGetStringDescriptor (

+                    &nbs= p;             UsbEthDriver->UsbIo,

+                    &nbs= p;             0x409,      &nb= sp;                 // English-US L= anguage ID

+                    &nbs= p;             UsbEthDescriptor.MacAddress,
+                    &nbs= p;             &Data

+                    &nbs= p;             );

+  ASSERT_EFI_ERROR (Status);

+

+  DataPtr =3D Data;

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Hi =3D (UINT8)StrHexToUintn (TmpStr);

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Low                &= nbsp;    =3D (UINT8)StrHexToUintn (TmpStr);

+    MacAddress->Addr[Index] =3D (Hi << 4) | Low;

+  }

+

+  return Status;

+}

+

+/**

+  Get the USB NCM max NTB size.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] BulkSize      A pointer to the Bulk tran= sfer data size.

+

+  @retval EFI_SUCCESS           Get the= USB NCM max NTB size successfully.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  )

+{

+  *BulkSize =3D USB_NCM_MAX_NTB_SIZE;

+  return EFI_SUCCESS;

+}

+

+/**

+  Retrieves the USB Header functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbHeaderFunDescriptor A pointer to the caller allocate= d USB Header Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbHeaderFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, HEADER= _FUN_DESCRIPTOR, UsbHeaderFunDescriptor);

+  return Status;

+}

+

+/**

+  Retrieves the USB Union functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbUnionFunDescriptor  A pointer to the caller all= ocated USB Union Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Union Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbUnionFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Unio= n Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbUnionFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, UNION_= FUN_DESCRIPTOR, UsbUnionFunDescriptor);

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbEthFunDescriptor    A pointer to the calle= r allocated USB Ethernet Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Ethernet Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbEthFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Ethe= rnet Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  )

+{

+  EFI_STATUS           Status;

+  USB_ETHERNET_DRIVER  *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  if (UsbEthFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (UsbEthDriver->Config, ETHERN= ET_FUN_DESCRIPTOR, UsbEthFunDescriptor);

+  return Status;

+}

+

+/**

+  This request sets the Ethernet device multicast filters as specifie= d in the

+  sequential list of 48 bit Ethernet multicast addresses.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     Number of filters.

+  @param[in]  McastAddr           =   A pointer to the value of the multicast addresses.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  EFI_USB_DEVICE_REQUEST       Request;

+  UINT32                 = ;      TransStatus;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if ((UsbEthFunDescriptor.NumberMcFilters << 1) =3D=3D 0) {
+    return EFI_UNSUPPORTED;

+  }

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_MULTICAST_FILTERS_RE= Q;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D Value * 6;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataOut,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           McastAddr,

+                    &nbs= p;           Request.Length,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request sets up the specified Ethernet power management patter= n filter as

+  described in the data structure.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;    Number of filters.

+  @param[in]  Length            &n= bsp;   Size of the power management pattern filter data.

+  @param[in]  PatternFilter         A p= ointer to the power management pattern filter structure.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D Length;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataOut,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           PatternFilter,

+                    &nbs= p;           Length,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request retrieves the status of the specified Ethernet power m= anagement

+  pattern filter from the device.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     The filter number.

+  @param[out] PatternActive          A point= er to the pattern active boolean.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthPowerFilter (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  Value,

+  OUT BOOLEAN                = *PatternActive

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHERNET_GET_REQ_TYPE;

+  Request.Request     =3D GET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_POWER_FILTER_LENGTH;=

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataIn,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           PatternActive,

+                    &nbs= p;           USB_ETH_POWER_FILTER_LENGTH,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+BIT_MAP  gTable[] =3D {

+  { PXE_OPFLAGS_RECEIVE_FILTER_UNICAST,        &n= bsp;   USB_ETH_PACKET_TYPE_DIRECTED      },

+  { PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST,        =   USB_ETH_PACKET_TYPE_BROADCAST     },

+  { PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST, USB_ETH_PACKET_TYP= E_MULTICAST     },

+  { PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS,       = ; USB_ETH_PACKET_TYPE_PROMISCUOUS   },

+  { PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST,      USB= _ETH_PACKET_TYPE_ALL_MULTICAST },

+};

+

+/**

+  Convert value between PXE receive filter and USB ETH packet filter.=

+

+  @param[in]  Value      PXE filter data.

+  @param[out] CdcFilter  A pointer to the Ethernet Packet Filter= Bitmap value converted by PXE_OPFLAGS.

+

+**/

+VOID

+ConvertFilter (

+  IN  UINT16  Value,

+  OUT UINT16  *CdcFilter

+  )

+{

+  UINT32  Index;

+  UINT32  Count;

+

+  Count =3D sizeof (gTable)/sizeof (gTable[0]);

+

+  for (Index =3D 0; (gTable[Index].Src !=3D 0) && (Index <= Count); Index++) {

+    if (gTable[Index].Src & Value) {

+      *CdcFilter |=3D gTable[Index].Dst;

+    }

+  }

+}

+

+/**

+  This request is used to configure device Ethernet packet filter set= tings.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;Packet Filter Bitmap.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbEthPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_ETHERNET_DRIVER     *UsbEthDriver;

+  UINT16                 = ; CommandFilter =3D 0;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  ConvertFilter (Value, &CommandFilter);

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_PACKET_FILTER_REQ;
+  Request.Value       =3D CommandFilter;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_PACKET_FILTER_LENGTH= ;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbNoData,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           NULL,

+                    &nbs= p;           USB_ETH_PACKET_FILTER_LENGTH,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

+

+/**

+  This request is used to retrieve a statistic based on the feature s= elector.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  FeatureSelector       Value of= the feature selector.

+  @param[out] Statistic            &nbs= p;A pointer to the 32 bit unsigned integer.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthStatistic (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  EFI_USB_DEVICE_REQUEST       Request;

+  UINT32                 = ;      TransStatus;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+  USB_ETHERNET_DRIVER          *UsbEthDriver= ;

+

+  UsbEthDriver =3D USB_ETHERNET_DEV_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (UsbEthFunDescriptor.EthernetStatistics =3D=3D 0) {

+    return EFI_UNSUPPORTED;

+  }

+

+  Request.RequestType =3D USB_ETHERNET_GET_REQ_TYPE;

+  Request.Request     =3D GET_ETH_STATISTIC_REQ;

+  Request.Value       =3D FeatureSelector;

+  Request.Index       =3D UsbEthDriver->NumOfI= nterface;

+  Request.Length      =3D USB_ETH_STATISTIC;

+

+  return UsbEthDriver->UsbIo->UsbControlTransfer (

+                    &nbs= p;           UsbEthDriver->UsbIo,

+                    &nbs= p;           &Request,

+                    &nbs= p;           EfiUsbDataIn,

+                    &nbs= p;           USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p;           Statistic,

+                    &nbs= p;           USB_ETH_STATISTIC,

+                    &nbs= p;           &TransStatus

+                    &nbs= p;           );

+}

diff --git a/UsbNetworkPkg/UsbNetworkPkg.dec b/UsbNetworkPkg/UsbNetworkPkg.= dec
new file mode 100644
index 0000000000..4ffafd99ed
--- /dev/null
+++ b/UsbNetworkPkg/UsbNetworkPkg.dec
@@ -0,0 +1,32 @@
+## @file
+#  This package defines Usb network specific interfaces and library c= lasses
+#  as well as configuration for standard edk2 packages.
+#
+#  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+#  Subject to AMI licensing agreement.
+##
+
+[Defines]
+  DEC_SPECIFICATION              = =3D 0x00010005
+  PACKAGE_NAME               =    =3D UsbNetworkPkg
+  PACKAGE_GUID               =    =3D abfab91e-37ea-4cb4-80a6-563dbb0bcec6
+  PACKAGE_VERSION              &nb= sp; =3D 0.1
+
+[Includes]
+  Include
+
+[Guids]
+  ## Usb Network package token space GUID
+  gUsbNetworkPkgTokenSpaceGuid  =3D { 0xA1231E82, 0x21B8, 0x4204= , { 0x92, 0xBB, 0x37, 0x3A, 0xFB, 0x01, 0xC6, 0xA1 } }
+
+[PcdsFeatureFlag]
+
+  ## Set the PCD 'UsbCdcEcmSupport' to 'TRUE' if 'Usb Cdc Ecm device'= need to be enabled.
+  gUsbNetworkPkgTokenSpaceGuid.UsbCdcEcmSupport|FALSE|BOOLEAN|0x00000= 001
+
+  ## Set the PCD 'UsbCdcNcmSupport' to 'TRUE' if 'Usb Cdc Ncm device'= need to be enabled.
+  gUsbNetworkPkgTokenSpaceGuid.UsbCdcNcmSupport|FALSE|BOOLEAN|0x00000= 002
+
+  ## Set the PCD 'UsbRndisSupport' to 'TRUE' if 'Usb Rndis device' ne= ed to be enabled.
+  gUsbNetworkPkgTokenSpaceGuid.UsbRndisSupport|TRUE|BOOLEAN|0x0000000= 3
+
diff --git a/UsbNetworkPkg/UsbRndis/ComponentName.c b/UsbNetworkPkg/UsbRndi= s/ComponentName.c
new file mode 100644
index 0000000000..6b7891afd9
--- /dev/null
+++ b/UsbNetworkPkg/UsbRndis/ComponentName.c
@@ -0,0 +1,172 @@
+/** @file

+  This file contains code for USB RNDIS Driver Component

+  Name definitions

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbRndis.h"

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  gUsbRndisDriv= erNameTable[] =3D {

+  {

+    "eng;en",

+    L"USB RNDIS Driver"

+  },

+  {

+    NULL,

+    NULL

+  }

+};

+

+EFI_STATUS

+EFIAPI

+UsbRndisComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  );

+

+EFI_STATUS

+EFIAPI

+UsbRndisComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  );

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gUsbRndisC= omponentName =3D {

+  UsbRndisComponentNameGetDriverName,

+  UsbRndisComponentNameGetControllerName,

+  "eng"

+};

+

+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL  gUsbRndis= ComponentName2 =3D {

+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbRndisComponentNameGetDriver= Name,

+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbRndisComponentNameGetCo= ntrollerName,

+  "en"

+};

+

+/**

+  Retrieves a Unicode string that is the user readable name of the dr= iver.

+

+  This function retrieves the user readable name of a driver in the f= orm of a

+  Unicode string. If the driver specified by This has a user readable= name in

+  the language specified by Language, then a pointer to the driver na= me is

+  returned in DriverName, and EFI_SUCCESS is returned. If the driver = specified

+  by This does not support the language specified by Language,

+  then EFI_UNSUPPORTED is returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language. This i= s the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified

+                    &nbs= p;           in RFC 4646 or ISO 639-2 language cod= e format.

+  @param[out] DriverName        A pointer to the = Unicode string to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           driver specified by This in the langu= age

+                    &nbs= p;           specified by Language.

+

+  @retval EFI_SUCCESS           The Uni= code string for the Driver specified by

+                    &nbs= p;           This and the language specified by La= nguage was

+                    &nbs= p;           returned in DriverName.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER DriverName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisComponentNameGetDriverName (

+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN  CHAR8              &nbs= p;         *Language,

+  OUT CHAR16                &= nbsp;      **DriverName

+  )

+{

+  return LookupUnicodeString2 (

+           Language,

+           This->SupportedLanguages,

+           gUsbRndisDriverNameTable,

+           DriverName,

+           (BOOLEAN)(This =3D=3D &gUsbRn= disComponentName)

+           );

+}

+

+/**

+  Retrieves a Unicode string that is the user readable name of the co= ntroller

+  that is being managed by a driver.

+

+  This function retrieves the user readable name of the controller sp= ecified by

+  ControllerHandle and ChildHandle in the form of a Unicode string. I= f the

+  driver specified by This has a user readable name in the language s= pecified by

+  Language, then a pointer to the controller name is returned in Cont= rollerName,

+  and EFI_SUCCESS is returned.  If the driver specified by This = is not currently

+  managing the controller specified by ControllerHandle and ChildHand= le,

+  then EFI_UNSUPPORTED is returned.  If the driver specified by = This does not

+  support the language specified by Language, then EFI_UNSUPPORTED is= returned.

+

+  @param[in]  This            &nbs= p; A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or

+                    &nbs= p;           EFI_COMPONENT_NAME_PROTOCOL instance.=

+  @param[in]  Controller        The handle o= f a controller that the driver

+                    &nbs= p;           specified by This is managing.  = This handle

+                    &nbs= p;           specifies the controller whose name i= s to be

+                    &nbs= p;           returned.

+  @param[in]  ChildHandle       The handle o= f the child controller to retrieve

+                    &nbs= p;           the name of.  This is an optiona= l parameter that

+                    &nbs= p;           may be NULL.  It will be NULL fo= r device

+                    &nbs= p;           drivers.  It will also be NULL f= or a bus drivers

+                    &nbs= p;           that wish to retrieve the name of the= bus

+                    &nbs= p;           controller.  It will not be NULL= for a bus

+                    &nbs= p;           driver that wishes to retrieve the na= me of a

+                    &nbs= p;           child controller.

+  @param[in]  Language          A point= er to a Null-terminated ASCII string

+                    &nbs= p;           array indicating the language.  = This is the

+                    &nbs= p;           language of the driver name that the = caller is

+                    &nbs= p;           requesting, and it must match one of = the

+                    &nbs= p;           languages specified in SupportedLangu= ages. The

+                    &nbs= p;           number of languages supported by a dr= iver is up

+                    &nbs= p;           to the driver writer. Language is spe= cified in

+                    &nbs= p;           RFC 4646 or ISO 639-2 language code f= ormat.

+  @param[out] ControllerName    A pointer to the Unicode st= ring to return.

+                    &nbs= p;           This Unicode string is the name of th= e

+                    &nbs= p;           controller specified by ControllerHan= dle and

+                    &nbs= p;           ChildHandle in the language specified= by

+                    &nbs= p;           Language from the point of view of th= e driver

+                    &nbs= p;           specified by This.

+

+  @retval EFI_SUCCESS           The Uni= code string for the user readable name in

+                    &nbs= p;           the language specified by Language fo= r the

+                    &nbs= p;           driver specified by This was returned= in

+                    &nbs= p;           DriverName.

+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_H= ANDLE.

+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not= a valid

+                    &nbs= p;           EFI_HANDLE.

+  @retval EFI_INVALID_PARAMETER Language is NULL.

+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This is not currently

+                    &nbs= p;           managing the controller specified by<= br>
+                    &nbs= p;           ControllerHandle and ChildHandle.

+  @retval EFI_UNSUPPORTED       The driver specif= ied by This does not support

+                    &nbs= p;           the language specified by Language.
+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisComponentNameGetControllerName (

+  IN EFI_COMPONENT_NAME_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    Controller,

+  IN EFI_HANDLE               = ;    ChildHandle        OPTIONAL,

+  IN CHAR8                &nb= sp;       *Language,

+  OUT CHAR16                &= nbsp;     **ControllerName

+  )

+{

+  return EFI_UNSUPPORTED;

+}

diff --git a/UsbNetworkPkg/UsbRndis/UsbRndis.c b/UsbNetworkPkg/UsbRndis/Usb= Rndis.c
new file mode 100644
index 0000000000..a75355825b
--- /dev/null
+++ b/UsbNetworkPkg/UsbRndis/UsbRndis.c
@@ -0,0 +1,848 @@
+/** @file

+  This file contains code for USB Remote Network Driver

+  Interface Spec. Driver Binding

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbRndis.h"

+

+EFI_GUID                  &nb= sp;          gUsbEthProtocolGuid =3D USB_ETHERNET_= PROTOCOL_GUID;

+extern EFI_COMPONENT_NAME2_PROTOCOL  gUsbRndisComponentName2;

+

+EFI_DRIVER_BINDING_PROTOCOL  gUsbRndisDriverBinding =3D {

+  UsbRndisDriverSupported,

+  UsbRndisDriverStart,

+  UsbRndisDriverStop,

+  USB_RNDIS_DRIVER_VERSION,

+  NULL,

+  NULL

+};

+

+/**

+  Check if this interface is USB Rndis SubType

+

+  @param[in]  UsbIo  A pointer to the EFI_USB_IO_PROTOCOL i= nstance.

+

+  @retval TRUE   USB Rndis SubType.

+  @retval FALSE  Not USB Rndis SubType.

+

+**/

+BOOLEAN

+IsSupportedDevice (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  // Check specific device/RNDIS and CDC-DATA

+  if (((InterfaceDescriptor.InterfaceClass =3D=3D 0x2) &&

+       (InterfaceDescriptor.InterfaceSubClass =3D=3D 0= x2) &&

+       (InterfaceDescriptor.InterfaceProtocol =3D=3D 0= xFF)) || \

+      ((InterfaceDescriptor.InterfaceClass =3D=3D 0xEF) &am= p;&

+       (InterfaceDescriptor.InterfaceSubClass =3D=3D 0= x4) &&

+       (InterfaceDescriptor.InterfaceProtocol =3D=3D 0= x1)) || \

+      ((InterfaceDescriptor.InterfaceClass =3D=3D 0xA) &= ;&

+       (InterfaceDescriptor.InterfaceSubClass =3D=3D 0= x0) &&

+       (InterfaceDescriptor.InterfaceProtocol =3D=3D 0= x00))

+      )

+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  Check if this interface is USB Rndis SubType but not CDC Data inter= face

+

+  @param[in]  UsbIo  A pointer to the EFI_USB_IO_PROTOCOL i= nstance.

+

+  @retval TRUE   USB Rndis SubType.

+  @retval FALSE  Not USB Rndis SubType.

+

+**/

+BOOLEAN

+IsRndisInterface (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  // Check for specific device/RNDIS and CDC-DATA

+  if (((InterfaceDescriptor.InterfaceClass =3D=3D 0x2) &&

+       (InterfaceDescriptor.InterfaceSubClass =3D=3D 0= x2) &&

+       (InterfaceDescriptor.InterfaceProtocol =3D=3D 0= xFF)) || \

+      ((InterfaceDescriptor.InterfaceClass =3D=3D 0xEF) &am= p;&

+       (InterfaceDescriptor.InterfaceSubClass =3D=3D 0= x4) &&

+       (InterfaceDescriptor.InterfaceProtocol =3D=3D 0= x1))

+      )

+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  Check if the USB RNDIS and USB CDC Data interfaces are from the sam= e device.

+

+  @param[in]  UsbRndisDataPath  A pointer to the EFI_DEVICE= _PATH_PROTOCOL instance.

+  @param[in]  UsbCdcDataPath    A pointer to the EFI_D= EVICE_PATH_PROTOCOL instance.

+

+  @retval EFI_SUCCESS           Is the = same device.

+  @retval EFI_UNSUPPORTED       Is not the same d= evice.

+

+**/

+EFI_STATUS

+IsSameDevice (

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbRndisDataPath,

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath

+  )

+{

+  DEBUG ((EFI_D_VERBOSE, "IsSameDevice Entry \n"));

+  while (1) {

+    if (IsDevicePathEnd (NextDevicePathNode (UsbRndisDataPath)))= {

+      if (((USB_DEVICE_PATH *)UsbRndisDataPath)->ParentP= ortNumber =3D=3D

+          ((USB_DEVICE_PATH *)UsbCdcDataPath)->= ;ParentPortNumber)

+      {

+        return EFI_SUCCESS;

+      } else {

+        return EFI_UNSUPPORTED;

+      }

+    } else {

+      if (CompareMem (UsbCdcDataPath, UsbRndisDataPath, siz= eof (EFI_DEVICE_PATH_PROTOCOL)) !=3D 0) {

+        return EFI_UNSUPPORTED;

+      }

+

+      UsbRndisDataPath =3D NextDevicePathNode (UsbRndisData= Path);

+      UsbCdcDataPath   =3D NextDevicePathNode (Us= bCdcDataPath);

+    }

+  }

+

+  DEBUG ((EFI_D_VERBOSE, "IsSameDevice Exit \n"));

+}

+

+/**

+  Check if the USB CDC Data(UsbIo) installed and return USB CDC Data = Handle.

+

+  @param[in]  UsbIo  A pointer to the EFI_USB_IO_PROTOCOL i= nstance.

+

+  @retval TRUE              USB CD= C Data(UsbIo) installed.

+  @retval FALSE             USB CD= C Data(UsbIo) did not installed.

+

+**/

+BOOLEAN

+IsUsbCdcData (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  // Check for CDC-DATA

+  if ((InterfaceDescriptor.InterfaceClass =3D=3D 0xA) &&

+      (InterfaceDescriptor.InterfaceSubClass =3D=3D 0x0) &a= mp;&

+      (InterfaceDescriptor.InterfaceProtocol =3D=3D 0x0))
+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  Check if the USB Rndis(UsbIo) installed

+

+  @param[in]  UsbIo        A pointer to the = EFI_USB_IO_PROTOCOL instance.

+

+  @retval TRUE              USB Rn= dis(UsbIo) installed.

+  @retval FALSE             USB Rn= dis(UsbIo) did not installed.

+

+**/

+BOOLEAN

+IsUsbRndis (

+  IN EFI_USB_IO_PROTOCOL  *UsbIo

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ceDescriptor);

+  if (EFI_ERROR (Status)) {

+    return FALSE;

+  }

+

+  // Check for Rndis

+  if ((InterfaceDescriptor.InterfaceClass =3D=3D 0x2) &&

+      (InterfaceDescriptor.InterfaceSubClass =3D=3D 0x2) &a= mp;&

+      (InterfaceDescriptor.InterfaceProtocol =3D=3D 0xFF))<= br>
+  {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  Control comes here when a CDC device is found.Check if a RNDIS inte= rface is already found for this device or not.

+  For one device two USBIO will be installed each for CDC and RNDIS i= nterface.

+

+  @param[in]  UsbEthPath        A pointer to= the EFI_DEVICE_PATH_PROTOCOL instance.

+  @param[out] UsbRndisDevice    A pointer to the USB_RNDIS_= DEVICE Data.

+

+  @retval EFI_SUCCESS             = The USB_RNDIS_DEVICE matching this CDC Data is found.

+  @retval EFI_NOT_FOUND           The U= SB_RNDIS_DEVICE matching this CDC Data is not found.

+

+**/

+EFI_STATUS

+UpdateRndisDevice (

+  IN  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath,

+  OUT USB_RNDIS_DEVICE          **UsbRndisDe= vice

+  )

+{

+  EFI_STATUS                S= tatus;

+  UINTN                 =    Index;

+  UINTN                 =    HandleCount;

+  EFI_HANDLE                *= HandleBuffer;

+  USB_ETHERNET_PROTOCOL     *UsbEthDevice;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbRndisDataPath;

+  EFI_USB_IO_PROTOCOL       *UsbIo;

+  BOOLEAN                &nbs= p;  IsRndisInterfaceFlag =3D FALSE;

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gUsbEt= hProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gUsbEthProtocolGuid,

+                    (VOI= D **)&UsbEthDevice

+                    );
+    if (EFI_ERROR (Status)) {

+      continue;

+    }

+

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    if (EFI_ERROR (Status)) {

+      continue;

+    }

+

+    IsRndisInterfaceFlag =3D IsRndisInterface (UsbIo);

+    if (IsRndisInterfaceFlag =3D=3D FALSE) {

+      continue;

+    }

+

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiDevicePathProtocolGuid,

+                    (VOI= D **)&UsbRndisDataPath

+                    );
+    Status =3D IsSameDevice (UsbRndisDataPath, UsbCdcDataPath);<= br>
+

+    DEBUG ((EFI_D_VERBOSE, "Rndis IsSameDevice %r\n", = Status));

+

+    if (!EFI_ERROR (Status)) {

+      *UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (UsbEt= hDevice);

+      gBS->FreePool (HandleBuffer);

+      return EFI_SUCCESS;

+    }

+  }   // End of For loop

+

+  gBS->FreePool (HandleBuffer);

+  return EFI_NOT_FOUND;

+}

+

+/**

+

+  For the given Rndis Device, find a matching CDC device already exis= ts or not. If found update the handle

+  and UsbIO protocol.

+

+  @param[in]  UsbRndisDevice        A pointe= r to the USB_RNDIS_DEVICE data.

+

+**/

+VOID

+FindMatchingCdcData (

+  IN USB_RNDIS_DEVICE  *UsbRndisDevice

+  )

+{

+  EFI_STATUS                S= tatus;

+  UINTN                 =    Index;

+  UINTN                 =    HandleCount;

+  EFI_HANDLE                *= HandleBuffer;

+  EFI_USB_IO_PROTOCOL       *UsbIo;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbRndisDataPath;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath;

+

+  // Find the parent RNDIS and update the UsbIo for the CDC device
+  Status =3D gBS->HandleProtocol (

+                  UsbRndisDev= ice->UsbRndisHandle,

+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbRndisDataPath

+                  );

+

+  if (EFI_ERROR (Status)) {

+    return;

+  }

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    if (IsUsbCdcData (UsbIo)) {

+      DEBUG ((EFI_D_VERBOSE, "Rndis FindMatchingCdcDat= a CDCData interface found\n"));

+

+      Status =3D gBS->HandleProtocol (

+                    &nbs= p; HandleBuffer[Index],

+                    &nbs= p; &gEfiDevicePathProtocolGuid,

+                    &nbs= p; (VOID **)&UsbCdcDataPath

+                    &nbs= p; );

+      if (EFI_ERROR (Status)) {

+        DEBUG ((EFI_D_VERBOSE, "Rndis CDCData Dev= icePath not found\n"));

+        gBS->FreePool (HandleBuffer);

+        return;

+      }

+

+      Status =3D IsSameDevice (UsbRndisDataPath, UsbCdcData= Path);

+      DEBUG ((EFI_D_VERBOSE, "Rndis IsSameDevice %r\n&= quot;, Status));

+      if (!EFI_ERROR (Status)) {

+        UsbRndisDevice->UsbCdcDataHandle =3D Handle= Buffer[Index];

+        UsbRndisDevice->UsbIoCdcData    &= nbsp;=3D UsbIo;

+        GetEndpoint (UsbRndisDevice->UsbIoCdcData, = UsbRndisDevice);

+        gBS->FreePool (HandleBuffer);

+        return;

+      }

+    }

+  }   // End of For loop

+

+  gBS->FreePool (HandleBuffer);

+}

+

+/**

+

+  For the given UsbIo CdcData, find a matching RNDIS device already e= xists or not.

+

+  @param[in]  CdcHandle       A pointer to t= he EFI_HANDLE for USB CDC Data.

+  @param[out] CdcUsbIo        A pointer for retri= eve the EFI_USB_IO_PROTOCOL instance.

+  @param[out] RndisHandle     A pointer for retrieve t= he handle of RNDIS device.

+

+  @retval EFI_SUCCESS             = The USB_RNDIS_DEVICE matching this CDC Data is found.

+  @retval EFI_NOT_FOUND           The U= SB_RNDIS_DEVICE matching this CDC Data is not found.

+

+**/

+EFI_STATUS

+EFIAPI

+FindMatchingRndisDev (

+  IN  EFI_HANDLE           CdcHand= le,

+  OUT EFI_USB_IO_PROTOCOL  **CdcUsbIo,

+  OUT EFI_HANDLE           *RndisHandle=

+  )

+{

+  EFI_STATUS                S= tatus;

+  UINTN                 =    Index;

+  UINTN                 =    HandleCount;

+  EFI_HANDLE                *= HandleBuffer;

+  EFI_USB_IO_PROTOCOL       *UsbIo;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbRndisDataPath;

+  EFI_DEVICE_PATH_PROTOCOL  *UsbCdcDataPath;

+

+  // Find the parent RNDIS and update the UsbIo for the CDC device
+  Status =3D gBS->HandleProtocol (

+                  CdcHandle,<= br>
+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbCdcDataPath

+                  );

+

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->LocateHandleBuffer (

+                  ByProtocol,=

+                  &gEfiUs= bIoProtocolGuid,

+                  NULL,

+                  &Handle= Count,

+                  &Handle= Buffer

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  for (Index =3D 0; Index < HandleCount; Index++) {

+    Status =3D gBS->HandleProtocol (

+                    Hand= leBuffer[Index],

+                    &= ;gEfiUsbIoProtocolGuid,

+                    (VOI= D **)&UsbIo

+                    );
+    ASSERT_EFI_ERROR (Status);

+

+    if (IsUsbRndis (UsbIo)) {

+      Status =3D gBS->HandleProtocol (

+                    &nbs= p; HandleBuffer[Index],

+                    &nbs= p; &gEfiDevicePathProtocolGuid,

+                    &nbs= p; (VOID **)&UsbRndisDataPath

+                    &nbs= p; );

+      if (EFI_ERROR (Status)) {

+        DEBUG ((EFI_D_ERROR, "Usb Rndis DevicePat= h not found\n"));

+        break;

+      }

+

+      Status =3D IsSameDevice (UsbRndisDataPath, UsbCdcData= Path);

+

+      if (!EFI_ERROR (Status)) {

+        *RndisHandle =3D HandleBuffer[Index];

+        *CdcUsbIo    =3D UsbIo;

+        gBS->FreePool (HandleBuffer);

+        return Status;

+      }

+    }

+  }   // End of For loop

+

+  gBS->FreePool (HandleBuffer);

+

+  return EFI_NOT_FOUND;

+}

+

+/**

+  USB Rndis Driver Binding Support.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to test.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver supports this device.

+  @retval EFI_ALREADY_STARTED         This d= river is already running on this device.

+  @retval other               = ;        This driver does not support this device.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS           Status;

+  EFI_USB_IO_PROTOCOL  *UsbIo =3D NULL;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D IsSupportedDevice (UsbIo) ? EFI_SUCCESS : EFI_UNSUPPORTE= D;

+

+  gBS->CloseProtocol (

+         ControllerHandle,

+         &gEfiUsbIoProtocolGuid,

+         This->DriverBindingHandle,

+         ControllerHandle

+         );

+  return Status;

+}

+

+/**

+  USB RNDIS Driver Binding Start.

+

+  @param[in]  This            &nbs= p;       Protocol instance pointer.

+  @param[in]  ControllerHandle        Handle= of device to bind driver to.

+  @param[in]  RemainingDevicePath     Optional pa= rameter use to pick a specific child

+                    &nbs= p;                 device to start.=

+

+  @retval EFI_SUCCESS             =    This driver is added to ControllerHandle

+  @retval EFI_DEVICE_ERROR            T= his driver could not be started due to a device error

+  @retval EFI_OUT_OF_RESOURCES        The driver = could not install successfully due to a lack of resources.

+  @retval other               = ;        This driver does not support this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  USB_RNDIS_DEVICE              *U= sbRndisDevice;

+  EFI_DEVICE_PATH_PROTOCOL      *UsbEthPath;

+  EFI_USB_IO_PROTOCOL           *UsbIo;=

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_HANDLE                &= nbsp;   RndisHandle =3D ControllerHandle;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiDe= vicePathProtocolGuid,

+                  (VOID **)&a= mp;UsbEthPath,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_BY_DRIVER

+                  );

+  if (EFI_ERROR (Status)) {

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return Status;

+  }

+

+  gBS->CloseProtocol (

+         ControllerHandle,

+         &gEfiDevicePathProtocolGuid,

+         This->DriverBindingHandle,

+         ControllerHandle

+         );

+

+  DEBUG ((EFI_D_ERROR, "UsbRndisDriverStart %x\n", Controll= erHandle));

+

+  // Controls come here for RNDIS and CDC. If it is CDC, check whethe= r RNDIS is present on the same controller or not.

+  if (IsUsbCdcData (UsbIo)) {

+    // Find the parent RNDIS and update the UsbIo for the CDC de= vice

+    Status =3D UpdateRndisDevice (UsbEthPath, &UsbRndisDevic= e);

+

+    if (!EFI_ERROR (Status)) {

+      DEBUG ((EFI_D_VERBOSE, "Rndis Matching interface= found\n"));

+      UsbRndisDevice->UsbCdcDataHandle =3D ControllerHan= dle;

+      UsbRndisDevice->UsbIoCdcData     = =3D UsbIo;

+      GetEndpoint (UsbRndisDevice->UsbIoCdcData, UsbRndi= sDevice);

+      return Status;

+    } else {

+      // Check if RnDis exist

+      Status =3D FindMatchingRndisDev (ControllerHandle, &a= mp;UsbIo, &RndisHandle);

+

+      if (EFI_ERROR (Status)) {

+        gBS->CloseProtocol (

+               ControllerHandle,
+               &gEfiUsbIoProto= colGuid,

+               This->DriverBind= ingHandle,

+               ControllerHandle
+               );

+        return Status;

+      }

+    }

+  }

+

+  UsbRndisDevice =3D AllocateZeroPool (sizeof (USB_RNDIS_DEVICE));
+

+  if (!UsbRndisDevice) {

+    DEBUG ((EFI_D_ERROR, "AllocateZeroPool Fail\n"));<= br>
+

+    gBS->CloseProtocol (

+           ControllerHandle,

+           &gEfiUsbIoProtocolGuid,

+           This->DriverBindingHandle,

+           ControllerHandle

+           );

+    return EFI_OUT_OF_RESOURCES;

+  }

+

+  Status =3D LoadAllDescriptor (UsbIo, &UsbRndisDevice->Config= );

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  UsbRndisDevice->Signature          &nbs= p;               =3D USB_RNDIS_SIGNATURE= ;

+  UsbRndisDevice->NumOfInterface         =            =3D Interface.InterfaceNumber;
+  UsbRndisDevice->UsbRndisHandle         =            =3D RndisHandle;

+  UsbRndisDevice->UsbCdcDataHandle        &nbs= p;          =3D 0;

+  UsbRndisDevice->UsbIo            &= nbsp;                 =3D UsbIo;
+  UsbRndisDevice->UsbEth.UsbEthReceive        =        =3D RndisUndiReceive;

+  UsbRndisDevice->UsbEth.UsbEthTransmit       =       =3D RndisUndiTransmit;

+  UsbRndisDevice->UsbEth.UsbEthInterrupt       = ;      =3D UsbRndisInterrupt;

+  UsbRndisDevice->UsbEth.UsbEthMacAddress      &nbs= p;     =3D GetUsbEthMacAddress;

+  UsbRndisDevice->UsbEth.UsbEthMaxBulkSize      &nb= sp;    =3D UsbEthBulkSize;

+  UsbRndisDevice->UsbEth.UsbHeaderFunDescriptor     = ; =3D GetUsbHeaderFunDescriptor;

+  UsbRndisDevice->UsbEth.UsbUnionFunDescriptor     =  =3D GetUsbUnionFunDescriptor;

+  UsbRndisDevice->UsbEth.UsbEthFunDescriptor      &= nbsp;  =3D GetUsbRndisFunDescriptor;

+  UsbRndisDevice->UsbEth.SetUsbEthMcastFilter      =   =3D SetUsbRndisMcastFilter;

+  UsbRndisDevice->UsbEth.SetUsbEthPowerPatternFilter =3D SetUsbRnd= isPowerFilter;

+  UsbRndisDevice->UsbEth.GetUsbEthPoewrPatternFilter =3D GetUsbRnd= isPowerFilter;

+  UsbRndisDevice->UsbEth.SetUsbEthPacketFilter     =  =3D SetUsbRndisPacketFilter;

+  UsbRndisDevice->UsbEth.GetUsbEthStatistic      &n= bsp;   =3D GetRndisStatistic;

+

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiGetState   = ;     =3D RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiStart    &= nbsp;      =3D RndisUndiStart;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiStop    &n= bsp;       =3D RndisUndiStop;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiGetInitInfo  &n= bsp;  =3D RndisUndiGetInitInfo;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiGetConfigInfo  =  =3D RndisUndiGetConfigInfo;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiInitialize  &nb= sp;   =3D RndisUndiInitialize;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiReset    &= nbsp;      =3D RndisUndiReset;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiShutdown   = ;     =3D RndisUndiShutdown;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiInterruptEnable =3D = RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiReceiveFilter  =  =3D RndisUndiReceiveFilter;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiStationAddress = =3D RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiStatistics  &nb= sp;   =3D NULL;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiMcastIp2Mac  &n= bsp;  =3D RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiNvData    =       =3D RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiGetStatus  &nbs= p;    =3D RndisUndiGetStatus;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiFillHeader  &nb= sp;   =3D RndisDummyReturn;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiTransmit   = ;     =3D NULL;

+  UsbRndisDevice->UsbEth.UsbEthUndi.UsbEthUndiReceive   =      =3D NULL;

+

+  UsbRndisDevice->MaxTransferSize       =3D RN= DIS_MAX_TRANSFER_SIZE;

+  UsbRndisDevice->MaxPacketsPerTransfer =3D 1;

+  UsbRndisDevice->PacketAlignmentFactor =3D 0;

+

+  InitializeListHead (&UsbRndisDevice->ReceivePacketList);

+

+  // This is a RNDIS interface. See whether CDC-DATA interface has al= ready been connected or not

+  FindMatchingCdcData (UsbRndisDevice);

+

+  if (UsbRndisDevice->UsbIoCdcData) {

+    Status =3D gBS->InstallProtocolInterface (

+                    &= ;ControllerHandle,

+                    &= ;gUsbEthProtocolGuid,

+                    EFI_= NATIVE_INTERFACE,

+                    &= ;(UsbRndisDevice->UsbEth)

+                    );
+    if (EFI_ERROR (Status)) {

+      gBS->CloseProtocol (

+             ControllerHandle,

+             &gEfiUsbIoProtocolGuid= ,

+             This->DriverBindingHand= le,

+             ControllerHandle

+             );

+

+      gBS->FreePool (UsbRndisDevice->Config);

+      gBS->FreePool (UsbRndisDevice);

+      return Status;

+    }

+

+    GetEndpoint (UsbRndisDevice->UsbIo, UsbRndisDevice);

+

+    DEBUG ((EFI_D_ERROR, "Rndis DeviceHandle %r\n", Us= bRndisDevice->UsbRndisHandle));

+    DEBUG ((EFI_D_ERROR, "CDC DeviceHandle %r\n", UsbR= ndisDevice->UsbCdcDataHandle));

+    return EFI_SUCCESS;

+  }

+

+  gBS->FreePool (UsbRndisDevice->Config);

+  gBS->FreePool (UsbRndisDevice);

+

+  return EFI_SUCCESS;

+}

+

+/**

+  CheckandStopRndisDevice

+

+  @param[in]  This            &nbs= p;    Protocol instance pointer.

+  @param[in]  ControllerHandle     Handle of devi= ce to bind driver to.

+

+  @retval EFI_SUCCESS          This driver i= s added to ControllerHandle

+  @retval EFI_DEVICE_ERROR     This driver could not b= e started due to a device error

+  @retval other               = ; This driver does not support this device

+

+**/

+EFI_STATUS

+EFIAPI

+CheckandStopRndisDevice (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle

+  )

+{

+  EFI_STATUS           Status;

+  EFI_USB_IO_PROTOCOL  *UsbIo;

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  (VOID **)&a= mp;UsbIo,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (IsUsbRndis (UsbIo)) {

+    Status =3D gBS->CloseProtocol (

+                    Cont= rollerHandle,

+                    &= ;gEfiUsbIoProtocolGuid,

+                    This= ->DriverBindingHandle,

+                    Cont= rollerHandle

+                    );
+    DEBUG ((EFI_D_ERROR, "Rndis ControllerHandle Stop %r\n&= quot;, Status));

+    return Status;

+  }

+

+  return EFI_UNSUPPORTED;

+}

+

+/**

+  USB Rndis Driver Binding Stop.

+

+  @param[in]  This            &nbs= p;     Protocol instance pointer.

+  @param[in]  ControllerHandle      Handle of dev= ice to stop driver on

+  @param[in]  NumberOfChildren      Number of Han= dles in ChildHandleBuffer. If number of

+                    &nbs= p;               children is zero stop t= he entire bus driver.

+  @param[in]  ChildHandleBuffer     List of Child= Handles to Stop.

+

+  @retval EFI_SUCCESS             =  This driver is removed ControllerHandle

+  @retval other               = ;      This driver was not removed from this device

+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  )

+{

+  EFI_STATUS             Status;
+  USB_ETHERNET_PROTOCOL  *UsbEthProtocol;

+  USB_RNDIS_DEVICE       *UsbRndisDevice;

+

+  DEBUG ((EFI_D_ERROR, "UsbRndisDriverStop ControllerHandle %lx\= n", ControllerHandle));

+

+  Status =3D gBS->OpenProtocol (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  (VOID **)&a= mp;UsbEthProtocol,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle,

+                  EFI_OPEN_PR= OTOCOL_GET_PROTOCOL

+                  );

+  if (EFI_ERROR (Status)) {

+    Status =3D CheckandStopRndisDevice (This, ControllerHandle);=

+

+    DEBUG ((EFI_D_ERROR, "CheckandStopRndisDevice %r\n"= ;, Status));

+

+    return Status;

+  }

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (UsbEthProtocol);

+

+  Status =3D gBS->CloseProtocol (

+                  UsbRndisDev= ice->UsbCdcDataHandle,

+                  &gEfiUs= bIoProtocolGuid,

+                  This->Dr= iverBindingHandle,

+                  UsbRndisDev= ice->UsbCdcDataHandle

+                  );

+

+  Status =3D gBS->UninstallProtocolInterface (

+                  ControllerH= andle,

+                  &gUsbEt= hProtocolGuid,

+                  UsbEthProto= col

+                  );

+  if (EFI_ERROR (Status)) {

+    DEBUG ((EFI_D_ERROR, "EFI_ERROR %r\n", Status));
+

+    return Status;

+  }

+

+  Status =3D gBS->CloseProtocol (

+                  ControllerH= andle,

+                  &gEfiUs= bIoProtocolGuid,

+                  This->Dr= iverBindingHandle,

+                  ControllerH= andle

+                  );

+

+  gBS->FreePool (UsbRndisDevice->Config);

+  gBS->FreePool (UsbRndisDevice);

+

+  DEBUG ((EFI_D_ERROR, "UsbRndisDriverStop %r\n", Status));=

+  return Status;

+}

+

+/**

+  Entrypoint of RNDIS Driver.

+

+  This function is the entrypoint of RNDIS Driver. It installs Driver= Binding

+  Protocols together with Component Name Protocols.

+

+  @param[in]  ImageHandle       The firmware= allocated handle for the EFI image.

+  @param[in]  SystemTable       A pointer to= the EFI System Table.

+

+  @retval EFI_SUCCESS           The ent= ry point is executed successfully.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisEntry (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  gUsbRndisDriverBinding.DriverBindingHandle =3D ImageHandle;

+  gUsbRndisDriverBinding.ImageHandle         = ;=3D ImageHandle;

+

+  return gBS->InstallMultipleProtocolInterfaces (

+                &gUsbRndisDriv= erBinding.DriverBindingHandle,

+                &gEfiDriverBin= dingProtocolGuid,

+                &gUsbRndisDriv= erBinding,

+                &gEfiComponent= Name2ProtocolGuid,

+                &gUsbRndisComp= onentName2,

+                NULL

+                );

+}

diff --git a/UsbNetworkPkg/UsbRndis/UsbRndis.h b/UsbNetworkPkg/UsbRndis/Usb= Rndis.h
new file mode 100644
index 0000000000..680a9e67c9
--- /dev/null
+++ b/UsbNetworkPkg/UsbRndis/UsbRndis.h
@@ -0,0 +1,569 @@
+/** @file

+  Header file for for USB Rndis driver

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#ifndef _USB_RNDIS_H_

+#define _USB_RNDIS_H_

+

+#include <Library/UefiDriverEntryPoint.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiLib.h>

+#include <Library/DevicePathLib.h>

+#include <Library/DebugLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/UefiUsbLib.h>

+#include <Protocol/UsbIo.h>

+#include <Protocol/UsbEthernetProtocol.h>

+

+typedef struct _REMOTE_NDIS_MSG_HEADER REMOTE_NDIS_MSG_HEADER;

+

+typedef struct {

+  UINT32                 = ;      Signature;

+  USB_ETHERNET_PROTOCOL        UsbEth;

+  EFI_HANDLE                &= nbsp;  UsbCdcDataHandle;

+  EFI_HANDLE                &= nbsp;  UsbRndisHandle;

+  EFI_USB_IO_PROTOCOL          *UsbIo;

+  EFI_USB_IO_PROTOCOL          *UsbIoCdcData= ;

+  EFI_USB_CONFIG_DESCRIPTOR    *Config;

+  UINT8                 =       NumOfInterface;

+  UINT8                 =       BulkInEndpoint;

+  UINT8                 =       BulkOutEndpoint;

+  UINT8                 =       InterrupEndpoint;

+  EFI_MAC_ADDRESS              Mac= Address;

+  UINT32                 = ;      RequestId;

+  UINT32                 = ;      Medium;

+  UINT32                 = ;      MaxPacketsPerTransfer;

+  UINT32                 = ;      MaxTransferSize;

+  UINT32                 = ;      PacketAlignmentFactor;

+  LIST_ENTRY                &= nbsp;  ReceivePacketList;

+} USB_RNDIS_DEVICE;

+

+#define USB_RNDIS_DRIVER_VERSION       1

+#define USB_TX_ETHERNET_BULK_TIMEOUT   3000

+#define USB_RX_ETHERNET_BULK_TIMEOUT   3

+#define USB_ETHERNET_TRANSFER_TIMEOUT  200

+

+#define LAN_BULKIN_CMD_CONTROL  1

+#define MAXIMUM_STOPBULKIN_CNT  300         =   // Indicating maximum counts for waiting bulk in command

+#define MINIMUM_STOPBULKIN_CNT  3          &= nbsp;   // Indicating minimum counts for waiting bulk in command

+#define BULKIN_CMD_POLLING_CNT  300         =   // Indicating the waiting counts for send bulk in command when syst= em pending

+

+#define USB_RNDIS_SIGNATURE  SIGNATURE_32('r', 'n', 'd', 's')

+#define USB_RNDIS_DEVICE_FROM_THIS(a)  CR (a, USB_RNDIS_DEVICE, UsbEt= h, USB_RNDIS_SIGNATURE)

+

+struct BIT_MAP {

+  unsigned int    Src;

+  unsigned int    Dst;

+};

+

+EFI_STATUS

+EFIAPI

+UsbRndisDriverSupported (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbRndisDriverStart (

+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN EFI_HANDLE               = ;    ControllerHandle,

+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath=

+  );

+

+EFI_STATUS

+EFIAPI

+UsbRndisDriverStop (

+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

+  IN  EFI_HANDLE             =      ControllerHandle,

+  IN  UINTN              &nbs= p;         NumberOfChildren,

+  IN  EFI_HANDLE             =      *ChildHandleBuffer

+  );

+

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  );

+

+BOOLEAN

+NextDescriptor (

+  IN EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT UINTN               =   *Offset

+  );

+

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  );

+

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_RNDIS_DEVICE     *UsbRndisDevice
+  );

+

+EFI_STATUS

+EFIAPI

+UsbRndisInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Requst

+  );

+

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  );

+

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  );

+

+EFI_STATUS

+EFIAPI

+RndisDummyReturn (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiStart (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiStop (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiGetInitInfo (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiGetConfigInfo (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiInitialize (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *BulkOutData,

+  IN OUT  UINTN              =     *DataLength

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *BulkInData,

+  IN OUT UINTN               =   *DataLength

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiReset (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiShutdown (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiReceiveFilter (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+RndisUndiGetStatus (

+  IN PXE_CDB   *Cdb,

+  IN NIC_DATA  *Nic

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbRndisFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbRndisMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbRndisPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  );

+

+EFI_STATUS

+EFIAPI

+GetUsbRndisPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN BOOLEAN                *= PatternActive

+  );

+

+EFI_STATUS

+EFIAPI

+SetUsbRndisPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  );

+

+EFI_STATUS

+EFIAPI

+GetRndisStatistic (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *Statistic

+  );

+

+EFI_STATUS

+SendRndisSetMsg (

+  IN  USB_RNDIS_DEVICE  *UsbRndisDevice,

+  UINT8                 = Oid,

+  UINT32                Lengt= h,

+  UINT8                 = *Buf

+  );

+

+EFI_STATUS

+RndisControlMsg (

+  IN  USB_RNDIS_DEVICE        *UsbRndisDevic= e,

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  OUT REMOTE_NDIS_MSG_HEADER  *RndisMsgResponse

+  );

+

+EFI_STATUS

+RndisTransmitDataMsg (

+  IN  USB_RNDIS_DEVICE        *UsbRndisDevic= e,

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  UINTN                 =      *TransferLength

+  );

+

+EFI_STATUS

+RndisReceiveDataMsg (

+  IN  USB_RNDIS_DEVICE        *UsbRndisDevic= e,

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  UINTN                 =      *TransferLength

+  );

+

+VOID

+PrintRndisMsg (

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg

+  );

+

+#define RNDIS_MAJOR_VERSION      0x00000001

+#define RNDIS_MINOR_VERSION      0x00000000

+#define RNDIS_MAX_TRANSFER_SIZE  0x4000

+

+#define RNDIS_PACKET_MSG           0x0000000= 1

+#define RNDIS_INITIALIZE_MSG       0x00000002

+#define RNDIS_INITIALIZE_CMPLT     0x80000002

+#define RNDIS_HLT_MSG              0x00= 000003

+#define RNDIS_QUERY_MSG            0x0000000= 4

+#define RNDIS_QUERY_CMPLT          0x80000004

+#define RNDIS_SET_MSG              0x00= 000005

+#define RNDIS_SET_CMPLT            0x8000000= 5

+#define RNDIS_RESET_MSG            0x0000000= 6

+#define RNDIS_RESET_CMPLT          0x80000006

+#define RNDIS_INDICATE_STATUS_MSG  0x00000007

+#define RNDIS_KEEPALIVE_MSG        0x00000008

+#define RNDIS_KEEPALIVE_CMPLT      0x80000008

+

+#define RNDIS_STATUS_SUCCESS           0x000= 00000

+#define RNDIS_STATUS_FAILURE           0xC00= 00001

+#define RNDIS_STATUS_INVALID_DATA      0xC0010015

+#define RNDIS_STATUS_NOT_SUPPORTED     0xC00000BB

+#define RNDIS_STATUS_MEDIA_CONNECT     0x4001000B

+#define RNDIS_STATUS_MEDIA_DISCONNECT  0x4001000C

+

+#define RNDIS_CONTROL_TIMEOUT    10000       = ;     // 10sec

+#define RNDIS_KEEPALIVE_TIMEOUT  5000        &nbs= p;    // 5sec

+

+#define SEND_ENCAPSULATED_COMMAND  0x00000000

+#define GET_ENCAPSULATED_RESPONSE  0x00000001

+

+//

+// General Objects

+//

+// Taken from NTDDNDIS.H

+#define OID_GEN_SUPPORTED_LIST         0x00010101=

+#define OID_GEN_HARDWARE_STATUS        0x00010102

+#define OID_GEN_MEDIA_SUPPORTED        0x00010103

+#define OID_GEN_MEDIA_IN_USE           0x000= 10104

+#define OID_GEN_MAXIMUM_LOOKAHEAD      0x00010105

+#define OID_GEN_MAXIMUM_FRAME_SIZE     0x00010106

+#define OID_GEN_LINK_SPEED             = 0x00010107

+#define OID_GEN_TRANSMIT_BUFFER_SPACE  0x00010108

+#define OID_GEN_RECEIVE_BUFFER_SPACE   0x00010109

+#define OID_GEN_TRANSMIT_BLOCK_SIZE    0x0001010A

+#define OID_GEN_RECEIVE_BLOCK_SIZE     0x0001010B

+#define OID_GEN_VENDOR_ID              = 0x0001010C

+#define OID_GEN_VENDOR_DESCRIPTION     0x0001010D

+#define OID_GEN_CURRENT_PACKET_FILTER  0x0001010E

+#define OID_GEN_CURRENT_LOOKAHEAD      0x0001010F

+#define OID_GEN_DRIVER_VERSION         0x00010110=

+#define OID_GEN_MAXIMUM_TOTAL_SIZE     0x00010111

+#define OID_GEN_PROTOCOL_OPTIONS       0x00010112

+#define OID_GEN_MAC_OPTIONS            0x000= 10113

+#define OID_GEN_MEDIA_CONNECT_STATUS   0x00010114

+#define OID_GEN_MAXIMUM_SEND_PACKETS   0x00010115

+#define OID_GEN_VENDOR_DRIVER_VERSION  0x00010116

+

+#define OID_GEN_XMIT_OK        0x00020101

+#define OID_GEN_RCV_OK         0x00020102

+#define OID_GEN_XMIT_ERROR     0x00020103

+#define OID_GEN_RCV_ERROR      0x00020104

+#define OID_GEN_RCV_NO_BUFFER  0x00020105

+

+#define OID_GEN_DIRECTED_BYTES_XMIT    0x00020201

+#define OID_GEN_DIRECTED_FRAMES_XMIT   0x00020202

+#define OID_GEN_MULTICAST_BYTES_XMIT   0x00020203

+#define OID_GEN_MULTICAST_FRAMES_XMIT  0x00020204

+#define OID_GEN_BROADCAST_BYTES_XMIT   0x00020205

+#define OID_GEN_BROADCAST_FRAMES_XMIT  0x00020206

+#define OID_GEN_DIRECTED_BYTES_RCV     0x00020207

+#define OID_GEN_DIRECTED_FRAMES_RCV    0x00020208

+#define OID_GEN_MULTICAST_BYTES_RCV    0x00020209

+#define OID_GEN_MULTICAST_FRAMES_RCV   0x0002020A

+#define OID_GEN_BROADCAST_BYTES_RCV    0x0002020B

+#define OID_GEN_BROADCAST_FRAMES_RCV   0x0002020C

+#define OID_GEN_RCV_CRC_ERROR          0x0002020D=

+#define OID_GEN_TRANSMIT_QUEUE_LENGTH  0x0002020E

+

+//

+// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER).

+//

+#define NDIS_PACKET_TYPE_DIRECTED        0x0001

+#define NDIS_PACKET_TYPE_MULTICAST       0x0002

+#define NDIS_PACKET_TYPE_ALL_MULTICAST   0x0004

+#define NDIS_PACKET_TYPE_BROADCAST       0x0008

+#define NDIS_PACKET_TYPE_SOURCE_ROUTING  0x0010

+#define NDIS_PACKET_TYPE_PROMISCUOUS     0x0020

+#define NDIS_PACKET_TYPE_SMT            &nbs= p;0x0040

+#define NDIS_PACKET_TYPE_ALL_LOCAL       0x0080

+#define NDIS_PACKET_TYPE_MAC_FRAME       0x8000

+#define NDIS_PACKET_TYPE_FUNCTIONAL      0x4000

+#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL  0x2000

+#define NDIS_PACKET_TYPE_GROUP           0x1= 000

+

+#pragma pack(1)

+

+typedef struct _REMOTE_NDIS_MSG_HEADER {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+} REMOTE_NDIS_MSG_HEADER;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    MajorVersion;

+  UINT32    MinorVersion;

+  UINT32    MaxTransferSize;

+} REMOTE_NDIS_INITIALIZE_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+} REMOTE_NDIS_HALT_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Oid;

+  UINT32    InformationBufferLength;

+  UINT32    InformationBufferOffset;

+  UINT32    Reserved;

+} REMOTE_NDIS_QUERY_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Oid;

+  UINT32    InformationBufferLength;

+  UINT32    InformationBufferOffset;

+  UINT32    Reserved;

+} REMOTE_NDIS_SET_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    Reserved;

+} REMOTE_NDIS_RESET_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    Status;

+  UINT32    StatusBufferLength;

+  UINT32    StatusBufferOffset;

+} REMOTE_NDIS_INDICATE_STATUS_MSG;

+

+typedef struct {

+  UINT32    DiagStatus;

+  UINT32    ErrorOffset;

+} RNDIS_DIAGNOSTIC_INFO;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+} REMOTE_NDIS_KEEPALIVE_MSG;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Status;

+  UINT32    MajorVersion;

+  UINT32    MinorVersion;

+  UINT32    DeviceFlags;

+  UINT32    Medium;

+  UINT32    MaxPacketsPerTransfer;

+  UINT32    MaxTransferSize;

+  UINT32    PacketAlignmentFactor;

+  UINT64    Reserved;

+} REMOTE_NDIS_INITIALIZE_CMPLT;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Status;

+  UINT32    InformationBufferLength;

+  UINT32    InformationBufferOffset;

+} REMOTE_NDIS_QUERY_CMPLT;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Status;

+} REMOTE_NDIS_SET_CMPLT;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    Status;

+  UINT32    AddressingReset;

+} REMOTE_NDIS_RESET_CMPLT;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    RequestID;

+  UINT32    Status;

+} REMOTE_NDIS_KEEPALIVE_CMPLT;

+

+typedef struct {

+  UINT32    MessageType;

+  UINT32    MessageLength;

+  UINT32    DataOffset;

+  UINT32    DataLength;

+  UINT32    OutOfBandDataOffset;

+  UINT32    OutOfBandDataLength;

+  UINT32    NumOutOfBandDataElements;

+  UINT32    PerPacketInfoOffset;

+  UINT32    PerPacketInfoLength;

+  UINT32    Reserved1;

+  UINT32    Reserved2;

+} REMOTE_NDIS_PACKET_MSG;

+

+typedef struct {

+  UINT32    Size;

+  UINT32    Type;

+  UINT32    ClassInformationOffset;

+} OUT_OF_BAND_DATA_RECORD;

+

+typedef struct {

+  UINT32    Size;

+  UINT32    Type;

+  UINT32    ClassInformationOffset;

+} PER_PACKET_INFO_DATA_RECORD;

+

+typedef struct {

+  LIST_ENTRY    PacketList;

+  UINT8         *OrgBuffer;

+  UINTN         RemainingLength;

+} PACKET_LIST;

+

+#pragma pack()

+

+#endif

diff --git a/UsbNetworkPkg/UsbRndis/UsbRndis.inf b/UsbNetworkPkg/UsbRndis/U= sbRndis.inf
new file mode 100644
index 0000000000..909b106059
--- /dev/null
+++ b/UsbNetworkPkg/UsbRndis/UsbRndis.inf
@@ -0,0 +1,41 @@
+## @file
+#   This is Usb Rndis driver for DXE phase.
+#
+# Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>
+# Subject to AMI licensing agreement.
+##
+
+[Defines]
+  INF_VERSION                =     =3D 0x00010005
+  BASE_NAME                &n= bsp;     =3D UsbRndis
+  FILE_GUID                &n= bsp;     =3D 11E32C34-60B5-4991-8DEA-63D3E8C876DE
+  MODULE_TYPE                =     =3D DXE_DRIVER
+  VERSION_STRING              &nbs= p;  =3D 1.0
+  ENTRY_POINT                =     =3D UsbRndisEntry
+
+[Sources]
+  UsbRndis.c
+  UsbRndis.h
+  UsbRndisFunction.c
+  ComponentName.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UsbNetworkPkg/UsbNetworkPkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  UefiBootServicesTableLib
+  UefiLib
+  DebugLib
+  UefiUsbLib
+  MemoryAllocationLib
+  BaseMemoryLib
+
+[Protocols]
+  gEfiUsbIoProtocolGuid
+  gEfiDevicePathProtocolGuid
+  gEfiDriverBindingProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/UsbNetworkPkg/UsbRndis/UsbRndisFunction.c b/UsbNetworkPkg/UsbR= ndis/UsbRndisFunction.c
new file mode 100644
index 0000000000..a9b7b54f6a
--- /dev/null
+++ b/UsbNetworkPkg/UsbRndis/UsbRndisFunction.c
@@ -0,0 +1,1587 @@
+/** @file

+  This file contains code for USB Ethernet descriptor

+  and specific requests implement.

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.<BR>

+  Subject to AMI licensing agreement.

+**/

+

+#include "UsbRndis.h"

+

+UINT16  StopBulkInCnt  =3D 0;

+UINT16  BlockBulkInCnt =3D 0;

+

+/**

+  Load All of device descriptor.

+

+  @param[in]  UsbIo            &nb= sp;    A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[out] ConfigDesc            A p= ointer to the configuration descriptor.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_OUT_OF_RESOURCES  The request could not be complet= ed because the

+                    &nbs= p;           buffer specified by DescriptorLength = and Descriptor

+                    &nbs= p;           is not large enough to hold the resul= t of the request.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error. The transfer

+                    &nbs= p;           status is returned in Status.

+**/

+EFI_STATUS

+LoadAllDescriptor (

+  IN  EFI_USB_IO_PROTOCOL        *UsbIo,

+  OUT EFI_USB_CONFIG_DESCRIPTOR  **ConfigDesc

+  )

+{

+  EFI_STATUS                &= nbsp;Status;

+  UINT32                 = ;    TransStatus;

+  EFI_USB_CONFIG_DESCRIPTOR  Tmp;

+

+  Status =3D UsbIo->UsbGetConfigDescriptor (UsbIo, &Tmp);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D gBS->AllocatePool (

+                  EfiBootServ= icesData,

+                  Tmp.TotalLe= ngth,

+                  (VOID **)Co= nfigDesc

+                  );

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbGetDescriptor (

+             UsbIo,

+             USB_DESC_TYPE_CONFIG <&= lt; 8 | (Tmp.ConfigurationValue - 1),          &nb= sp;      // zero based

+             0,

+             Tmp.TotalLength,

+             *ConfigDesc,

+             &TransStatus

+             );

+  return Status;

+}

+

+/**

+  Returns pointer to the next descriptor for the pack of USB descript= ors

+  located in continues memory segment

+

+  @param[in]      Desc   A pointer to the CO= NFIG_DESCRIPTOR instance.

+  @param[in, out] Offset A pointer to the sum of descriptor length.
+

+  @retval TRUE   The request executed successfully.

+  @retval FALSE  No next descriptor.

+

+**/

+BOOLEAN

+NextDescriptor (

+  IN      EFI_USB_CONFIG_DESCRIPTOR  *Desc,

+  IN OUT  UINTN              =         *Offset

+  )

+{

+  if ((Desc =3D=3D NULL) || (*Offset >=3D Desc->TotalLength)) {=

+    return FALSE;

+  }

+

+  if (((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))->Lengt= h =3D=3D 0) {

+    return FALSE;

+  }

+

+  *Offset +=3D ((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))-= >Length;

+  if ( *Offset >=3D Desc->TotalLength ) {

+    return FALSE;

+  }

+

+  return TRUE;

+}

+

+/**

+  Read Function descriptor

+

+  @param[in]  Config            &n= bsp;A pointer to all of configuration.

+  @param[in]  FunDescriptorType  USB CDC class descriptor S= ubType.

+  @param[out] DataBuffer         A pointer t= o the Data of corresponding to device capability.

+

+  @retval EFI_SUCCESS        The device capabilit= y descriptor was retrieved

+                    &nbs= p;        successfully.

+  @retval EFI_UNSUPPORTED    No supported.

+  @retval EFI_NOT_FOUND      The device capability des= criptor was not found.

+

+**/

+EFI_STATUS

+GetFunctionalDescriptor (

+  IN  EFI_USB_CONFIG_DESCRIPTOR  *Config,

+  IN  UINT8              &nbs= p;       FunDescriptorType,

+  OUT VOID                &nb= sp;      *DataBuffer

+  )

+{

+  EFI_STATUS                &= nbsp;   Status =3D EFI_NOT_FOUND;

+  UINTN                 =        Offset;

+  EFI_USB_INTERFACE_DESCRIPTOR  *Interface;

+

+  for (Offset =3D 0; NextDescriptor (Config, &Offset);) {

+    Interface =3D (EFI_USB_INTERFACE_DESCRIPTOR *)((UINT8 *)Conf= ig + Offset);

+    if (Interface->DescriptorType =3D=3D CS_INTERFACE) {

+      if (((USB_HEADER_FUN_DESCRIPTOR *)Interface)->Desc= riptorSubtype =3D=3D FunDescriptorType) {

+        switch (FunDescriptorType) {

+          case HEADER_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_HEADER_FUN_DESCRIPTO= R *)Interface,

+              sizeof (USB_HEADER_FUN_DE= SCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          case UNION_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_UNION_FUN_DESCRIPTOR= *)Interface,

+              ((USB_UNION_FUN_DESCRIPTO= R *)Interface)->FunctionLength

+              );

+            return EFI_SUCCESS;

+          case ETHERNET_FUN_DESCRIPTOR:

+            CopyMem (

+              DataBuffer,

+              (USB_ETHERNET_FUN_DESCRIP= TOR *)Interface,

+              sizeof (USB_ETHERNET_FUN_= DESCRIPTOR)

+              );

+            return EFI_SUCCESS;

+          default:

+            Status =3D EFI_UNSUPPORTED;

+            break;

+        }

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Get USB Ethernet IO endpoint and USB CDC data IO endpoint.

+

+  @param[in]      UsbIo        &nb= sp;  A pointer to the EFI_USB_IO_PROTOCOL instance.

+  @param[in, out] UsbRndisDevice  A pointer to the USB_RNDIS_DEV= ICE instance.

+

+**/

+VOID

+GetEndpoint (

+  IN      EFI_USB_IO_PROTOCOL  *UsbIo,

+  IN OUT  USB_RNDIS_DEVICE     *UsbRndisDevice
+  )

+{

+  EFI_STATUS                &= nbsp;   Status;

+  UINT8                 =        Index;

+  UINT32                 = ;       Result;

+  EFI_USB_INTERFACE_DESCRIPTOR  Interface;

+  EFI_USB_ENDPOINT_DESCRIPTOR   Endpoint;

+

+  Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interfa= ce);

+  ASSERT_EFI_ERROR (Status);

+

+  if (Interface.NumEndpoints =3D=3D 0 ) {

+    Status =3D UsbSetInterface (UsbIo, 1, 0, &Result);

+    ASSERT_EFI_ERROR (Status);

+

+    Status =3D UsbIo->UsbGetInterfaceDescriptor (UsbIo, &= Interface);

+    ASSERT_EFI_ERROR (Status);

+  }

+

+  for (Index =3D 0; Index < Interface.NumEndpoints; Index++) {

+    Status =3D UsbIo->UsbGetEndpointDescriptor (UsbIo, Index,= &Endpoint);

+

+    ASSERT_EFI_ERROR (Status);

+

+    switch ((Endpoint.Attributes & (BIT0 | BIT1))) {

+      case USB_ENDPOINT_BULK:

+        if (Endpoint.EndpointAddress & BIT7) {

+          UsbRndisDevice->BulkInEndpoint =3D E= ndpoint.EndpointAddress;

+        } else {

+          UsbRndisDevice->BulkOutEndpoint =3D = Endpoint.EndpointAddress;

+        }

+

+        break;

+      case USB_ENDPOINT_INTERRUPT:

+        UsbRndisDevice->InterrupEndpoint =3D Endpoi= nt.EndpointAddress;

+        break;

+    }

+  }

+}

+

+/**

+  Async USB transfer callback routine.

+

+  @param[in]  Data            Data= received or sent via the USB Asynchronous Transfer, if the

+                    &nbs= p;         transfer completed successfully.

+  @param[in]  DataLength      The length of Data = received or sent via the Asynchronous

+                    &nbs= p;         Transfer, if transfer successfully completes= .

+  @param[in]  Context         Data pass= ed from UsbAsyncInterruptTransfer() request.

+  @param[in]  Status          Indicates= the result of the asynchronous transfer.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+InterruptCallback (

+  IN  VOID    *Data,

+  IN  UINTN   DataLength,

+  IN  VOID    *Context,

+  IN  UINT32  Status

+  )

+{

+  if (((EFI_USB_DEVICE_REQUEST *)Data)->Request =3D=3D 0) {

+    CopyMem (

+      (EFI_USB_DEVICE_REQUEST *)Context,

+      (EFI_USB_DEVICE_REQUEST *)Data,

+      sizeof (EFI_USB_DEVICE_REQUEST)

+      );

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is used to manage a USB device with an interrupt tran= sfer pipe.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  IsNewTransfer     If TRUE, a new tr= ansfer will be submitted to USB controller. If

+                    &nbs= p;           FALSE, the interrupt transfer is dele= ted from the device's interrupt

+                    &nbs= p;           transfer queue.

+  @param[in]  PollingInterval   Indicates the periodic= rate, in milliseconds, that the transfer is to be

+                    &nbs= p;           executed.This parameter is required w= hen IsNewTransfer is TRUE. The

+                    &nbs= p;           value must be between 1 to 255, other= wise EFI_INVALID_PARAMETER is returned.

+                    &nbs= p;           The units are in milliseconds.

+  @param[in]  Request           A = pointer to the EFI_USB_DEVICE_REQUEST data.

+

+  @retval EFI_SUCCESS           The asy= nchronous USB transfer request transfer has been successfully executed.

+  @retval EFI_DEVICE_ERROR      The asynchronous USB t= ransfer request failed.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbRndisInterrupt (

+  IN USB_ETHERNET_PROTOCOL   *This,

+  IN BOOLEAN                &= nbsp;IsNewTransfer,

+  IN UINTN                &nb= sp;  PollingInterval,

+  IN EFI_USB_DEVICE_REQUEST  *Requst

+  )

+{

+  EFI_STATUS        Status;

+  USB_RNDIS_DEVICE  *UsbRndisDevice;

+  UINTN             DataLength =3D= 0;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  if (IsNewTransfer =3D=3D TRUE) {

+    DataLength =3D sizeof (EFI_USB_DEVICE_REQUEST) + sizeof (USB= _CONNECT_SPEED_CHANGE);

+    Status     =3D UsbRndisDevice->UsbIo->U= sbAsyncInterruptTransfer (

+                    &nbs= p;                     Us= bRndisDevice->UsbIo,

+                    &nbs= p;                     Us= bRndisDevice->InterrupEndpoint,

+                    &nbs= p;                     Is= NewTransfer,

+                    &nbs= p;                     Po= llingInterval,

+                    &nbs= p;                     Da= taLength,

+                    &nbs= p;                     In= terruptCallback,

+                    &nbs= p;                     Re= qust

+                    &nbs= p;                     );=

+

+    if (Status =3D=3D EFI_INVALID_PARAMETER) {

+      // Because of Stacked AsyncInterrupt request are not = supported

+      Status =3D UsbRndisDevice->UsbIo->UsbAsyncInter= ruptTransfer (

+                    &nbs= p;                   UsbRndisD= evice->UsbIo,

+                    &nbs= p;                   UsbRndisD= evice->InterrupEndpoint,

+                    &nbs= p;                   0,

+                    &nbs= p;                   0,

+                    &nbs= p;                   0,

+                    &nbs= p;                   NULL,

+                    &nbs= p;                   NULL

+                    &nbs= p;                   );

+    }

+  } else {

+    Status =3D UsbRndisDevice->UsbIo->UsbAsyncInterruptTra= nsfer (

+                    &nbs= p;                 UsbRndisDevice-&= gt;UsbIo,

+                    &nbs= p;                 UsbRndisDevice-&= gt;InterrupEndpoint,

+                    &nbs= p;                 IsNewTransfer,
+                    &nbs= p;                 0,

+                    &nbs= p;                 0,

+                    &nbs= p;                 NULL,

+                    &nbs= p;                 NULL

+                    &nbs= p;                 );

+  }

+

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet Mac Address.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] MacAddress    A pointer to the caller allocat= ed USB Ethernet Mac Address.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbEthMacAddress (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT EFI_MAC_ADDRESS        *MacAddress

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_RNDIS_DEVICE             *Us= bRndisDevice;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthDescriptor;

+  CHAR16                 = ;      *Data;

+  CHAR16                 = ;      *DataPtr;

+  CHAR16                 = ;      TmpStr[1];

+  UINT8                 =       Index;

+  UINT8                 =       Hi;

+  UINT8                 =       Low;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthDescripto= r);

+  ASSERT_EFI_ERROR (Status);

+

+  Status =3D UsbRndisDevice->UsbIo->UsbGetStringDescriptor (
+                    &nbs= p;               UsbRndisDevice->UsbI= o,

+                    &nbs= p;               0x409,    &nb= sp;                  // Englis= h-US Language ID

+                    &nbs= p;               UsbEthDescriptor.MacAdd= ress,

+                    &nbs= p;               &Data

+                    &nbs= p;               );

+  ASSERT_EFI_ERROR (Status);

+

+  DataPtr =3D Data;

+  for (Index =3D 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Hi =3D (UINT8)StrHexToUintn (TmpStr);

+    CopyMem (TmpStr, DataPtr, sizeof (CHAR16));

+    DataPtr++;

+    Low                &= nbsp;    =3D (UINT8)StrHexToUintn (TmpStr);

+    MacAddress->Addr[Index] =3D (Hi << 4) | Low;

+  }

+

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet Bulk transfer data size.

+

+  @param[in]  This          A pointer t= o the USB_ETHERNET_PROTOCOL instance.

+  @param[out] BulkSize      A pointer to the Bulk tran= sfer data size.

+

+  @retval EFI_SUCCESS       The bulk transfer dat= a size was retrieved successfully.

+  @retval other             Failed= to retrieve the bulk transfer data size.

+

+**/

+EFI_STATUS

+EFIAPI

+UsbEthBulkSize (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  OUT UINTN                &n= bsp; *BulkSize

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  *BulkSize =3D (UINTN)UsbEthFunDescriptor.MaxSegmentSize;

+  return Status;

+}

+

+/**

+  Retrieves the USB Header functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbHeaderFunDescriptor A pointer to the caller allocate= d USB Header Functional Descriptor.

+

+  @retval EFI_SUCCESS           The USB= Header Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER UsbHeaderFunDescriptor is NULL.

+  @retval EFI_NOT_FOUND         The USB Head= er Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbHeaderFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL      *This,

+  OUT USB_HEADER_FUN_DESCRIPTOR  *UsbHeaderFunDescriptor

+  )

+{

+  EFI_STATUS        Status;

+  USB_RNDIS_DEVICE  *UsbRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  if (UsbHeaderFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (

+             UsbRndisDevice->Config,=

+             HEADER_FUN_DESCRIPTOR,

+             UsbHeaderFunDescriptor

+             );

+  return Status;

+}

+

+/**

+  Retrieves the USB Union functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbUnionFunDescriptor  A pointer to the caller all= ocated USB Union Functional Descriptor.

+

+  @retval EFI_SUCCESS            The US= B Union Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER  UsbUnionFunDescriptor is NULL.<= br>
+  @retval EFI_NOT_FOUND          The USB Uni= on Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbUnionFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL     *This,

+  OUT USB_UNION_FUN_DESCRIPTOR  *UsbUnionFunDescriptor

+  )

+{

+  EFI_STATUS        Status;

+  USB_RNDIS_DEVICE  *UsbRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  if (UsbUnionFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (

+             UsbRndisDevice->Config,=

+             UNION_FUN_DESCRIPTOR,

+             UsbUnionFunDescriptor

+             );

+  return Status;

+}

+

+/**

+  Retrieves the USB Ethernet functional Descriptor.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[out] UsbEthFunDescriptor    A pointer to the calle= r allocated USB Ethernet Functional Descriptor.

+

+  @retval EFI_SUCCESS            The US= B Ethernet Functional descriptor was retrieved successfully.

+  @retval EFI_INVALID_PARAMETER  UsbEthFunDescriptor is NULL.
+  @retval EFI_NOT_FOUND          The USB Eth= ernet Functional descriptor was not found.

+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbRndisFunDescriptor (

+  IN  USB_ETHERNET_PROTOCOL        *This,
+  OUT USB_ETHERNET_FUN_DESCRIPTOR  *UsbEthFunDescriptor

+  )

+{

+  EFI_STATUS        Status;

+  USB_RNDIS_DEVICE  *UsbRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  if (UsbEthFunDescriptor =3D=3D NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status =3D GetFunctionalDescriptor (

+             UsbRndisDevice->Config,=

+             ETHERNET_FUN_DESCRIPTOR,
+             UsbEthFunDescriptor

+             );

+  return Status;

+}

+

+/**

+  This request sets the Ethernet device multicast filters as specifie= d in the

+  sequential list of 48 bit Ethernet multicast addresses.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     Number of filters.

+  @param[in]  McastAddr           =   A pointer to the value of the multicast addresses.

+

+  @retval EFI_SUCCESS            The re= quest executed successfully.

+  @retval EFI_TIMEOUT            A time= out occurred executing the request.

+  @retval EFI_DEVICE_ERROR       The request fail= ed due to a device error.

+  @retval EFI_INVALID_PARAMETER  One of the parameters has an in= valid value.

+  @retval EFI_UNSUPPORTED        Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbRndisMcastFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN VOID                &nbs= p;  *McastAddr

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  EFI_USB_DEVICE_REQUEST       Request;

+  UINT32                 = ;      TransStatus;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+  USB_RNDIS_DEVICE             *Us= bRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  Status =3D This->UsbEthFunDescriptor (This, &UsbEthFunDescri= ptor);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if ((UsbEthFunDescriptor.NumberMcFilters << 1) =3D=3D 0) {
+    return EFI_UNSUPPORTED;

+  }

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_MULTICAST_FILTERS_RE= Q;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbRndisDevice->NumO= fInterface;

+  Request.Length      =3D Value * 6;

+

+  return UsbRndisDevice->UsbIo->UsbControlTransfer (

+                    &nbs= p;             UsbRndisDevice->UsbIo,

+                    &nbs= p;             &Request,

+                    &nbs= p;             EfiUsbDataOut,

+                    &nbs= p;             USB_ETHERNET_TRANSFER_TIMEOUT,=

+                    &nbs= p;             McastAddr,

+                    &nbs= p;             Request.Length,

+                    &nbs= p;             &TransStatus

+                    &nbs= p;             );

+}

+

+/**

+  This request sets up the specified Ethernet power management patter= n filter as

+  described in the data structure.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;    Number of filters.

+  @param[in]  Length            &n= bsp;   Size of the power management pattern filter data.

+  @param[in]  PatternFilter         A p= ointer to the power management pattern filter structure.

+

+  @retval EFI_SUCCESS            The re= quest executed successfully.

+  @retval EFI_TIMEOUT            A time= out occurred executing the request.

+  @retval EFI_DEVICE_ERROR       The request fail= ed due to a device error.

+  @retval EFI_INVALID_PARAMETER  One of the parameters has an in= valid value.

+  @retval EFI_UNSUPPORTED        Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbRndisPowerFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value,

+  IN UINT16                &n= bsp;Length,

+  IN VOID                &nbs= p;  *PatternFilter

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_RNDIS_DEVICE        *UsbRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHRTNET_SET_REQ_TYPE;

+  Request.Request     =3D SET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbRndisDevice->NumO= fInterface;

+  Request.Length      =3D Length;

+

+  return UsbRndisDevice->UsbIo->UsbControlTransfer (

+                    &nbs= p;             UsbRndisDevice->UsbIo,

+                    &nbs= p;             &Request,

+                    &nbs= p;             EfiUsbDataOut,

+                    &nbs= p;             USB_ETHERNET_TRANSFER_TIMEOUT,=

+                    &nbs= p;             PatternFilter,

+                    &nbs= p;             Length,

+                    &nbs= p;             &TransStatus

+                    &nbs= p;             );

+}

+

+/**

+  This request retrieves the status of the specified Ethernet power m= anagement

+  pattern filter from the device.

+

+  @param[in]  This            &nbs= p;      A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;     The filter number.

+  @param[out] PatternActive          A point= er to the pattern active boolean.

+

+  @retval EFI_SUCCESS            The re= quest executed successfully.

+  @retval EFI_TIMEOUT            A time= out occurred executing the request.

+  @retval EFI_DEVICE_ERROR       The request fail= ed due to a device error.

+  @retval EFI_INVALID_PARAMETER  One of the parameters has an in= valid value.

+  @retval EFI_UNSUPPORTED        Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetUsbRndisPowerFilter (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  Value,

+  OUT BOOLEAN                = *PatternActive

+  )

+{

+  EFI_USB_DEVICE_REQUEST  Request;

+  UINT32                 = ; TransStatus;

+  USB_RNDIS_DEVICE        *UsbRndisDevice;

+

+  UsbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (This);

+

+  Request.RequestType =3D USB_ETHERNET_GET_REQ_TYPE;

+  Request.Request     =3D GET_ETH_POWER_MANAGEMENT_PAT= TERN_FILTER_REQ;

+  Request.Value       =3D Value;

+  Request.Index       =3D UsbRndisDevice->NumO= fInterface;

+  Request.Length      =3D USB_ETH_POWER_FILTER_LENGTH;=

+

+  return UsbRndisDevice->UsbIo->UsbControlTransfer (

+                    &nbs= p;             UsbRndisDevice->UsbIo,

+                    &nbs= p;             &Request,

+                    &nbs= p;             EfiUsbDataIn,

+                    &nbs= p;             USB_ETHERNET_TRANSFER_TIMEOUT,=

+                    &nbs= p;             PatternActive,

+                    &nbs= p;             USB_ETH_POWER_FILTER_LENGTH,
+                    &nbs= p;             &TransStatus

+                    &nbs= p;             );

+}

+

+/**

+

+  Converts PXE filter settings to RNDIS values

+

+  @param[in]  Value      PXE filter data.

+  @param[out] CdcFilter  A pointer to the Ethernet Packet Filter= Bitmap value converted by PXE_OPFLAGS.

+

+**/

+VOID

+ConvertFilter (

+  IN  UINT16  Value,

+  OUT UINT16  *CdcFilter

+  )

+{

+  UINT32                 = ;Index;

+  UINT32                 = ;Count;

+  static struct BIT_MAP  Table[] =3D {

+    { PXE_OPFLAGS_RECEIVE_FILTER_UNICAST,      &n= bsp;     NDIS_PACKET_TYPE_DIRECTED      },

+    { PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST,      =     NDIS_PACKET_TYPE_BROADCAST     },

+    { PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST, NDIS_PACKET= _TYPE_MULTICAST     },

+    { PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS,     = ;   NDIS_PACKET_TYPE_PROMISCUOUS   },

+    { PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST,    &nb= sp; NDIS_PACKET_TYPE_ALL_MULTICAST },

+  };

+

+  Count =3D sizeof (Table)/sizeof (Table[0]);

+

+  for (Index =3D 0; (Table[Index].Src !=3D 0) && (Index < = Count); Index++) {

+    if (Table[Index].Src & Value) {

+      *CdcFilter |=3D Table[Index].Dst;

+    }

+  }

+}

+

+/**

+

+  Updates Filter settings on the device.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_STATUS

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiReceiveFilter (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS                &= nbsp;  Status;

+  UINT8                 =       *McastList;

+  UINT8                 =       Count =3D 0;

+  UINT8                 =       Index1;

+  UINT8                 =       Index2;

+  UINT64                 = ;      CpbAddr   =3D Cdb->CPBaddr;

+  UINT32                 = ;      CpbSize   =3D Cdb->CPBsize;

+  UINT16                 = ;      SetFilter =3D (UINT16)(Cdb->OpFlags & 0x1F);
+  PXE_CPB_RECEIVE_FILTERS      *Cpb     = ; =3D (PXE_CPB_RECEIVE_FILTERS *)(UINTN)CpbAddr;

+  USB_ETHERNET_FUN_DESCRIPTOR  UsbEthFunDescriptor;

+

+  // The Cpb could be NULL.(ref:PXE_CPBADDR_NOT_USED)

+  Nic->RxFilter =3D (UINT8)SetFilter;

+

+  if (((SetFilter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST= ) !=3D 0) || (Cpb !=3D NULL)) {

+    if (Cpb !=3D NULL) {

+      Nic->McastCount =3D (UINT8)(CpbSize / PXE_MAC_LENG= TH);

+      CopyMem (&Nic->McastList, Cpb, Nic->McastCo= unt);

+    } else {

+      Nic->McastCount =3D 0;

+    }

+

+    if (Nic->CanReceive) {

+      Nic->CanReceive =3D FALSE;

+    }

+

+    Nic->UsbEth->UsbEthFunDescriptor (Nic->UsbEth, &= ;UsbEthFunDescriptor);

+    if ((UsbEthFunDescriptor.NumberMcFilters << 1) =3D=3D = 0) {

+      Nic->RxFilter |=3D PXE_OPFLAGS_RECEIVE_FILTER_ALL_= MULTICAST;

+      DEBUG ((DEBUG_INFO, "SetUsbEthPacketFilter Nic %= lx Nic->UsbEth %lx ", Nic, Nic->UsbEth));

+      Nic->UsbEth->SetUsbEthPacketFilter (Nic->Usb= Eth, Nic->RxFilter);

+    } else {

+      Status =3D gBS->AllocatePool (EfiBootServicesData,= Nic->McastCount * 6, (VOID **)&McastList);

+      if (EFI_ERROR (Status)) {

+        return PXE_STATCODE_INVALID_PARAMETER;

+      }

+

+      if (Cpb !=3D NULL) {

+        for (Index1 =3D 0; Index1 < Nic->McastCo= unt; Index1++) {

+          for (Index2 =3D 0; Index2 < 6; Index= 2++) {

+            McastList[Count++] =3D Cpb->M= CastList[Index1][Index2];

+          }

+        }

+      }

+

+      Nic->RxFilter |=3D PXE_OPFLAGS_RECEIVE_FILTER_FILT= ERED_MULTICAST;

+      if (Cpb !=3D NULL) {

+        Nic->UsbEth->SetUsbEthMcastFilter (Nic-&= gt;UsbEth, Nic->McastCount, McastList);

+      }

+

+      Nic->UsbEth->SetUsbEthPacketFilter (Nic->Usb= Eth, Nic->RxFilter);

+      gBS->FreePool (McastList);

+    }

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This request is used to configure device Ethernet packet filter set= tings.

+

+  @param[in]  This            &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  Value            &nb= sp;Packet Filter Bitmap.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+SetUsbRndisPacketFilter (

+  IN USB_ETHERNET_PROTOCOL  *This,

+  IN UINT16                &n= bsp;Value

+  )

+{

+  return EFI_SUCCESS;

+}

+

+/**

+  This request is used to retrieve a statistic based on the feature s= elector.

+

+  @param[in]  This            &nbs= p;     A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]  FeatureSelector       Value of= the feature selector.

+  @param[out] Statistic            &nbs= p;A pointer to the 32 bit unsigned integer.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_TIMEOUT           A timeo= ut occurred executing the request.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+  @retval EFI_INVALID_PARAMETER One of the parameters has an invalid = value.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+GetRndisStatistic (

+  IN  USB_ETHERNET_PROTOCOL  *This,

+  IN  UINT16              &nb= sp;  FeatureSelector,

+  OUT VOID                &nb= sp;  *Statistic

+  )

+{

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when UndiStart is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiStart (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  EFI_STATUS  Status;

+

+  DEBUG ((DEBUG_INFO, "RndisUndiStart Nic %lx Cdb %lx Nic State = %x\n", Nic, Cdb, Nic->State));

+

+  // Issue Rndis Reset and bring the device to RNDIS_BUS_INITIALIZED = state

+  Status =3D RndisUndiReset (Cdb, Nic);

+  if (EFI_ERROR (Status)) {

+    RndisUndiReset (Cdb, Nic);

+  }

+

+  Status =3D RndisUndiInitialize (Cdb, Nic);

+  if (EFI_ERROR (Status)) {

+    RndisUndiInitialize (Cdb, Nic);

+  }

+

+  RndisUndiShutdown (Cdb, Nic);

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when Undistop is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiStop (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  DEBUG ((DEBUG_INFO, "RndisUndiStop State %x\n", Nic->S= tate));

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when UndiGetInitInfo is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiGetInitInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  USB_ETHERNET_PROTOCOL  *UsbEthDevice   =3D Nic->U= sbEth;

+  USB_RNDIS_DEVICE       *UsbRndisDevice =3D USB_= RNDIS_DEVICE_FROM_THIS (UsbEthDevice);

+  PXE_DB_GET_INIT_INFO   *Db;

+

+  DEBUG ((DEBUG_INFO, "RndisUndiGetInitInfo\n"));

+

+  Db =3D (PXE_DB_GET_INIT_INFO *)(UINTN)Cdb->DBaddr;

+

+  Db->FrameDataLen =3D UsbRndisDevice->MaxTransferSize - sizeof= (REMOTE_NDIS_PACKET_MSG) - PXE_MAC_HEADER_LEN_ETHER;

+  // Limit Max MTU size to 1500 bytes as RNDIS spec.

+  if (Db->FrameDataLen > PXE_MAX_TXRX_UNIT_ETHER) {

+    Db->FrameDataLen =3D PXE_MAX_TXRX_UNIT_ETHER;

+  }

+

+  DEBUG ((DEBUG_INFO, "Db->FrameDataLen %x\n", Db->Fr= ameDataLen));

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when RndisUndiGetConfigInfo is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiGetConfigInfo (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  DEBUG ((DEBUG_INFO, "RndisUndiGetConfigInfo\n"));

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when UndiInitialize is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_UNSUPPORTED       Not supported.
+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiInitialize (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  USB_ETHERNET_PROTOCOL         *UsbEthDrive= r   =3D Nic->UsbEth;

+  USB_RNDIS_DEVICE              *U= sbRndisDevice =3D USB_RNDIS_DEVICE_FROM_THIS (UsbEthDriver);

+  REMOTE_NDIS_INITIALIZE_MSG    RndisInitMsg;

+  REMOTE_NDIS_INITIALIZE_CMPLT  RndisInitMsgCmplt;

+  EFI_STATUS                &= nbsp;   Status;

+

+  DEBUG ((DEBUG_INFO, "RndisUndiInitialize\n"));

+

+  ZeroMem (&RndisInitMsg, sizeof (REMOTE_NDIS_INITIALIZE_MSG));
+  ZeroMem (&RndisInitMsgCmplt, sizeof (REMOTE_NDIS_INITIALIZE_CMP= LT));

+

+  RndisInitMsg.MessageType     =3D RNDIS_INITIALIZE_MS= G;

+  RndisInitMsg.MessageLength   =3D sizeof (REMOTE_NDIS_INIT= IALIZE_MSG);

+  RndisInitMsg.RequestID       =3D UsbRndisDevice= ->RequestId;

+  RndisInitMsg.MajorVersion    =3D RNDIS_MAJOR_VERSION;

+  RndisInitMsg.MinorVersion    =3D RNDIS_MINOR_VERSION;

+  RndisInitMsg.MaxTransferSize =3D RNDIS_MAX_TRANSFER_SIZE;

+

+  RndisInitMsgCmplt.MessageType   =3D RNDIS_INITIALIZE_CMPL= T;

+  RndisInitMsgCmplt.MessageLength =3D sizeof (REMOTE_NDIS_INITIALIZE_= CMPLT);

+

+  Status =3D RndisControlMsg (UsbRndisDevice, (REMOTE_NDIS_MSG_HEADER= *)&RndisInitMsg, (REMOTE_NDIS_MSG_HEADER *)&RndisInitMsgCmplt);
+

+  UsbRndisDevice->RequestId++;

+

+  if (EFI_ERROR (Status) || (RndisInitMsgCmplt.Status & 0x8000000= 0)) {

+    return Status;

+  }

+

+  // Only Wired Medium is supported

+  if (RndisInitMsgCmplt.Medium) {

+    return EFI_UNSUPPORTED;

+  }

+

+  UsbRndisDevice->Medium            =     =3D RndisInitMsgCmplt.Medium;

+  UsbRndisDevice->MaxPacketsPerTransfer =3D RndisInitMsgCmplt.MaxP= acketsPerTransfer;

+  UsbRndisDevice->MaxTransferSize       =3D Rn= disInitMsgCmplt.MaxTransferSize;

+  UsbRndisDevice->PacketAlignmentFactor =3D RndisInitMsgCmplt.Pack= etAlignmentFactor;

+

+  DEBUG ((DEBUG_INFO, "Medium : %x \n", RndisInitMsgCmplt.M= edium));

+  DEBUG ((DEBUG_INFO, "MaxPacketsPerTransfer : %x \n", Rndi= sInitMsgCmplt.MaxPacketsPerTransfer));

+  DEBUG ((DEBUG_INFO, "MaxTransferSize : %x\n", RndisInitMs= gCmplt.MaxTransferSize));

+  DEBUG ((DEBUG_INFO, "PacketAlignmentFactor : %x\n", Rndis= InitMsgCmplt.PacketAlignmentFactor));

+

+  return Status;

+}

+

+/**

+  This function is called when UndiReset is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_DEVICE_ERROR      The request failed due= to a device error.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiReset (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  USB_ETHERNET_PROTOCOL    *UsbEthDriver   =3D Ni= c->UsbEth;

+  USB_RNDIS_DEVICE         *UsbRndisDevice = =3D USB_RNDIS_DEVICE_FROM_THIS (UsbEthDriver);

+  REMOTE_NDIS_RESET_MSG    RndisResetMsg;

+  REMOTE_NDIS_RESET_CMPLT  RndisResetCmplt;

+  EFI_STATUS               St= atus;

+

+  DEBUG ((DEBUG_INFO, "RndisUndiReset\n"));

+

+  ZeroMem (&RndisResetMsg, sizeof (REMOTE_NDIS_RESET_MSG));

+  ZeroMem (&RndisResetCmplt, sizeof (REMOTE_NDIS_RESET_CMPLT));
+

+  RndisResetMsg.MessageType   =3D RNDIS_RESET_MSG;

+  RndisResetMsg.MessageLength =3D sizeof (REMOTE_NDIS_RESET_MSG);

+

+  RndisResetCmplt.MessageType   =3D RNDIS_RESET_CMPLT;

+  RndisResetCmplt.MessageLength =3D sizeof (REMOTE_NDIS_RESET_CMPLT);=

+

+  Status =3D RndisControlMsg (UsbRndisDevice, (REMOTE_NDIS_MSG_HEADER= *)&RndisResetMsg, (REMOTE_NDIS_MSG_HEADER *)&RndisResetCmplt);

+

+  UsbRndisDevice->RequestId =3D 1;        &nbs= p; // Let's start with 1

+

+  if (EFI_ERROR (Status) || (RndisResetCmplt.Status & 0x80000000)= ) {

+    return EFI_DEVICE_ERROR;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This function is called when UndiShutdown is invoked.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiShutdown (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  USB_ETHERNET_PROTOCOL  *UsbEthDriver   =3D Nic->U= sbEth;

+  USB_RNDIS_DEVICE       *UsbRndisDevice =3D USB_= RNDIS_DEVICE_FROM_THIS (UsbEthDriver);

+  REMOTE_NDIS_HALT_MSG   RndisHltMsg;

+  EFI_STATUS             Status;
+

+  DEBUG ((DEBUG_INFO, "RndisUndiShutdown\n"));

+

+  ZeroMem (&RndisHltMsg, sizeof (REMOTE_NDIS_HALT_MSG));

+

+  RndisHltMsg.MessageType   =3D RNDIS_HLT_MSG;

+  RndisHltMsg.MessageLength =3D sizeof (REMOTE_NDIS_HALT_MSG);

+

+  Status =3D RndisControlMsg (UsbRndisDevice, (REMOTE_NDIS_MSG_HEADER= *)&RndisHltMsg, NULL);

+

+  if (Status =3D=3D EFI_DEVICE_ERROR) {

+    Status =3D EFI_SUCCESS;

+  }

+

+  UsbRndisDevice->RequestId =3D 1;

+  return Status;

+}

+

+/**

+  Update the Media connection.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiGetStatus (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  Cdb->StatFlags &=3D ~(PXE_STATFLAGS_GET_STATUS_NO_MEDIA);
+  return EFI_SUCCESS;

+}

+

+/**

+  Transmit the data after appending RNDIS header.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in]      BulkOutData   A pointer to= the buffer of data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] DataLength    A pointer to the PacketLeng= th.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiTransmit (

+  IN      PXE_CDB          &n= bsp;     *Cdb,

+  IN      USB_ETHERNET_PROTOCOL  *This,

+  IN      VOID           = ;        *BulkOutData,

+  IN OUT  UINTN              =     *DataLength

+  )

+{

+  EFI_STATUS              Status;<= br>
+  USB_RNDIS_DEVICE        *UsbRndisDevice =3D USB= _RNDIS_DEVICE_FROM_THIS (This);

+  REMOTE_NDIS_PACKET_MSG  *RndisPacketMsg;

+  UINTN                 =  TransferLength;

+

+  DEBUG ((DEBUG_INFO, "RndisUndiTransmit DataLength : %x\n"= , *DataLength));

+

+  Status =3D gBS->AllocatePool (EfiBootServicesData, sizeof (REMOT= E_NDIS_PACKET_MSG) + *DataLength, (VOID **)&RndisPacketMsg);

+

+  ZeroMem (RndisPacketMsg, sizeof (REMOTE_NDIS_PACKET_MSG));

+

+  RndisPacketMsg->MessageType   =3D RNDIS_PACKET_MSG;
+  RndisPacketMsg->MessageLength =3D sizeof (REMOTE_NDIS_PACKET_MSG= ) + (UINT32)*DataLength;

+  RndisPacketMsg->DataOffset    =3D sizeof (REMOTE_NDIS_= PACKET_MSG) - 8;

+  RndisPacketMsg->DataLength    =3D (UINT32)*DataLength;=

+

+  gBS->CopyMem (((UINT8 *)RndisPacketMsg) + sizeof (REMOTE_NDIS_PA= CKET_MSG), BulkOutData, *DataLength);

+

+  TransferLength =3D RndisPacketMsg->MessageLength;

+

+  Status =3D RndisTransmitDataMsg (UsbRndisDevice, (REMOTE_NDIS_MSG_H= EADER *)RndisPacketMsg, &TransferLength);

+

+  DEBUG ((DEBUG_INFO, "\nRndisUndiTransmit TransferLength %lx\n&= quot;, TransferLength));

+

+  gBS->FreePool (RndisPacketMsg);

+

+  return Status;

+}

+

+/**

+  Receives and removes RNDIS header and returns the raw data.

+

+  @param[in]      Cdb         = ;  A pointer to the command descriptor block.

+  @param[in]      This        &nbs= p; A pointer to the USB_ETHERNET_PROTOCOL instance.

+  @param[in, out] BulkInData    A pointer to the buffer of = data that will be transmitted to USB

+                    &nbs= p;           device or received from USB device.
+  @param[in, out] DataLength    A pointer to the PacketLeng= th.

+

+  @retval EFI_SUCCESS           The req= uest executed successfully.

+  @retval EFI_BUFFER_TOO_SMALL  The user provided buffer is too = small

+  @retval EFI_NOT_FOUND         No buffer wa= s found in the list.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisUndiReceive (

+  IN     PXE_CDB          &nb= sp;     *Cdb,

+  IN     USB_ETHERNET_PROTOCOL  *This,

+  IN OUT VOID                =    *BulkInData,

+  IN OUT UINTN               =   *DataLength

+  )

+{

+  EFI_STATUS              Status;<= br>
+  USB_RNDIS_DEVICE        *UsbRndisDevice =3D USB= _RNDIS_DEVICE_FROM_THIS (This);

+  REMOTE_NDIS_PACKET_MSG  *RndisPacketMsg;

+  UINTN                 =  TransferLength;

+  VOID                  =   *Buffer;

+  PACKET_LIST             *HeadPac= ket =3D NULL;

+  PACKET_LIST             *PacketL= ist;

+  UINT32                 = ; ReceivedBytes =3D 0;

+

+  // Check if there is any outstanding packet to receive

+  // The buffer allocated has a linked List followed by the packet.
+  do {

+    Status         =3D gBS->Allocate= Pool (EfiBootServicesData, sizeof (PACKET_LIST) + sizeof (REMOTE_NDIS_PACKE= T_MSG) + UsbRndisDevice->MaxTransferSize, &Buffer);

+    RndisPacketMsg =3D (REMOTE_NDIS_PACKET_MSG *)(sizeof (PACKET= _LIST) + (UINT8 *)Buffer);

+    PacketList     =3D (PACKET_LIST *)Buffer;

+    // Save the original address for freeing it up

+    PacketList->OrgBuffer       =3D Buffe= r;

+    PacketList->RemainingLength =3D UsbRndisDevice->MaxTra= nsferSize;

+

+    ZeroMem (RndisPacketMsg, sizeof (REMOTE_NDIS_PACKET_MSG));
+    TransferLength =3D UsbRndisDevice->MaxTransferSize;

+

+    Status =3D RndisReceiveDataMsg (UsbRndisDevice, (REMOTE_NDIS= _MSG_HEADER *)RndisPacketMsg, &TransferLength);

+

+    if (EFI_ERROR (Status) || (TransferLength =3D=3D 0)) {

+      gBS->FreePool (Buffer);

+      break;

+    }

+

+    // Handle Multiple packets

+    if ((RndisPacketMsg->MessageType =3D=3D RNDIS_PACKET_MSG)= && (RndisPacketMsg->DataOffset =3D=3D sizeof (REMOTE_NDIS_PACKE= T_MSG) - 8)) {

+      // Insert Packet

+      InsertTailList (&UsbRndisDevice->ReceivePacket= List, Buffer);

+    }

+  } while (1);

+

+  // Check if they linked list has any received buffer. If yes report= it.

+  if (IsListEmpty (&UsbRndisDevice->ReceivePacketList)) {

+    return EFI_NOT_FOUND;

+  }

+

+  HeadPacket =3D (PACKET_LIST *)GetFirstNode (&UsbRndisDevice->= ;ReceivePacketList);

+

+  RndisPacketMsg =3D (REMOTE_NDIS_PACKET_MSG *)((UINT8 *)HeadPacket += sizeof (PACKET_LIST));

+

+  PrintRndisMsg ((REMOTE_NDIS_MSG_HEADER *)RndisPacketMsg);

+

+  if ((RndisPacketMsg->MessageType =3D=3D RNDIS_PACKET_MSG) &&= amp; (RndisPacketMsg->DataOffset =3D=3D sizeof (REMOTE_NDIS_PACKET_MSG) = - 8)) {

+    if (*DataLength >=3D RndisPacketMsg->DataLength) {

+      gBS->CopyMem (BulkInData, (UINT8 *)RndisPacketMsg = + RndisPacketMsg->DataOffset + 8, RndisPacketMsg->DataLength);

+

+      ReceivedBytes           = ;                     += =3D RndisPacketMsg->DataLength;

+      BulkInData            &= nbsp;                    =   =3D ((UINT8 *)BulkInData) + RndisPacketMsg->DataLength;

+      ((PACKET_LIST *)HeadPacket)->RemainingLength -=3D = RndisPacketMsg->DataLength;

+    } else {

+      DEBUG ((EFI_D_ERROR, "RndisUndiReceive:Buffer to= o small %x\n", RndisPacketMsg->DataLength));

+      *DataLength =3D RndisPacketMsg->DataLength;

+      return EFI_BUFFER_TOO_SMALL;

+    }

+

+    // check if there this is a multi-packet message. If so upda= te the pointer so that next Receive call will return that data.

+    RndisPacketMsg =3D (REMOTE_NDIS_PACKET_MSG *)((UINT8 *)Rndis= PacketMsg + RndisPacketMsg->DataLength);

+    PacketList     =3D (PACKET_LIST *)((UINT8 *)R= ndisPacketMsg - sizeof (PACKET_LIST));

+

+    if ((HeadPacket->RemainingLength > sizeof (REMOTE_NDIS= _PACKET_MSG)) && \

+        (RndisPacketMsg->MessageType =3D=3D RNDIS_P= ACKET_MSG) && \

+        (RndisPacketMsg->DataOffset =3D=3D sizeof (= REMOTE_NDIS_PACKET_MSG) - 8))

+    {

+      // Multi-Packet msg is found. Since the first packet = is consumed, update the linked list to point this new packet.

+      PacketList->OrgBuffer       = =3D HeadPacket->OrgBuffer;

+      PacketList->RemainingLength =3D HeadPacket->Rem= ainingLength;

+      RemoveEntryList (&HeadPacket->PacketList);

+      InsertHeadList (&UsbRndisDevice->ReceivePacket= List, &(PacketList->PacketList));

+    } else {

+      RemoveEntryList (&HeadPacket->PacketList);

+      gBS->FreePool ((PACKET_LIST *)HeadPacket->OrgBu= ffer);

+    }

+  } else {

+    // Packet doesn't contain valid header

+    DEBUG ((DEBUG_INFO, "RndisUndiReceive:Invalid RNDIS Pac= ket received\n"));

+    RemoveEntryList (&(HeadPacket->PacketList));

+    gBS->FreePool ((PACKET_LIST *)HeadPacket->OrgBuffer);<= br>
+  }

+

+  if (ReceivedBytes) {

+    *DataLength =3D ReceivedBytes;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  This is a dummy function which just returns. Unimplimented USB_ETHE= RNET_PROTOCOL functions

+  point to this function.

+

+  @param[in]  Cdb  A pointer to the command descriptor bloc= k.

+  @param[in]  Nic  A pointer to the Network interface contr= oller data.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+EFIAPI

+RndisDummyReturn (

+  IN  PXE_CDB   *Cdb,

+  IN  NIC_DATA  *Nic

+  )

+{

+  DEBUG ((DEBUG_INFO, "RndisDummyReturn called\n"));

+  return EFI_SUCCESS;

+}

+

+/**

+  This function sends the RNDIS SET_MSG cmd

+

+  @param[in]  UsbRndisDevice  A pointer to the USB_RNDIS_DE= VICE instance.

+  @param[in]  Oid             = ;Value of the OID.

+  @param[in]  Length          Length of= the data buffer.

+  @param[in]  Buf             = ;A pointer to the data buffer.

+

+  @retval EFI_SUCCESS         The request ex= ecuted successfully.

+

+**/

+EFI_STATUS

+SendRndisSetMsg (

+  IN  USB_RNDIS_DEVICE  *UsbRndisDevice,

+  IN  UINT8             Oid,<= br>
+  IN  UINT32            Length,
+  IN  UINT8             *Buf<= br>
+  )

+{

+  REMOTE_NDIS_SET_MSG  *RndisSetMsg;

+  EFI_STATUS           Status;

+

+  RndisSetMsg =3D AllocateZeroPool (sizeof (USB_RNDIS_DEVICE) + Lengt= h);

+

+  RndisSetMsg->MessageType           = ;  =3D RNDIS_SET_MSG;

+  RndisSetMsg->MessageLength          &nb= sp;=3D sizeof (REMOTE_NDIS_SET_MSG) + Length;

+  RndisSetMsg->RequestID            =    =3D UsbRndisDevice->RequestId;

+  RndisSetMsg->Oid             =        =3D Oid;

+  RndisSetMsg->InformationBufferLength =3D Length;

+  RndisSetMsg->InformationBufferOffset =3D sizeof (REMOTE_NDIS_SET= _MSG) - 8;

+

+  gBS->CopyMem (((UINT8 *)RndisSetMsg) + sizeof (REMOTE_NDIS_SET_M= SG), Buf, Length);

+

+  Status =3D RndisControlMsg (UsbRndisDevice, (REMOTE_NDIS_MSG_HEADER= *)RndisSetMsg, NULL);

+

+  gBS->FreePool (RndisSetMsg);

+

+  return Status;

+}

+

+/**

+  This function send the RNDIS command through the device's control e= ndpoint

+

+  @param[in]  UsbRndisDevice    A pointer to the USB_R= NDIS_DEVICE instance.

+  @param[in]  RndisMsg          A point= er to the REMOTE_NDIS_MSG_HEADER data.

+  @param[out] RndisMsgResponse  A pointer to the REMOTE_NDIS_MSG= _HEADER data for getting responses.

+

+  @retval EFI_SUCCESS           The bul= k transfer has been successfully executed.

+

+**/

+EFI_STATUS

+RndisControlMsg (

+  IN  USB_RNDIS_DEVICE        *UsbRndisDevic= e,

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  OUT REMOTE_NDIS_MSG_HEADER  *RndisMsgResponse

+  )

+{

+  EFI_USB_IO_PROTOCOL           *UsbIo = =3D UsbRndisDevice->UsbIo;

+  EFI_USB_DEVICE_REQUEST        DevReq;

+  UINT32                 = ;       UsbStatus;

+  EFI_STATUS                &= nbsp;   Status;

+  UINT32                 = ;       SaveResponseType   =3D 0;

+  UINT32                 = ;       SaveResponseLength =3D 0;

+  UINT32                 = ;       Index;

+  REMOTE_NDIS_INITIALIZE_CMPLT  *RndisInitCmplt =3D (REMOTE_NDIS= _INITIALIZE_CMPLT *)RndisMsgResponse;

+

+  if (RndisMsgResponse) {

+    SaveResponseType   =3D RndisMsgResponse->Messag= eType;

+    SaveResponseLength =3D RndisMsgResponse->MessageLength;
+  }

+

+  ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));

+

+  DevReq.RequestType =3D USB_REQ_TYPE_CLASS | USB_TARGET_INTERFACE;
+  DevReq.Request     =3D SEND_ENCAPSULATED_COMMAND;
+  DevReq.Value       =3D 0;

+  DevReq.Index       =3D 0;

+  DevReq.Length      =3D (UINT16)RndisMsg->MessageL= ength;

+

+  PrintRndisMsg (RndisMsg);

+

+  Status =3D UsbIo->UsbControlTransfer (

+                    UsbI= o,

+                    &= ;DevReq,

+                    EfiU= sbDataOut,

+                    USB_= ETHERNET_TRANSFER_TIMEOUT,

+                    Rndi= sMsg,

+                    Rndi= sMsg->MessageLength,

+                    &= ;UsbStatus

+                    );
+

+  DEBUG ((DEBUG_INFO, "RndisControlMsg: UsbStatus : %x Status : = %r RndisMsgResponse : %lx\n", UsbStatus, Status, RndisMsgResponse));
+

+  // Error or no response expected

+  if ((EFI_ERROR (Status)) || (RndisMsgResponse =3D=3D NULL)) {

+    DEBUG ((DEBUG_INFO, "RndisControlMsg: UsbStatus : %x St= atus : %r\n", UsbStatus, Status));

+    return Status;

+  }

+

+  for (Index =3D 0; Index < (RNDIS_CONTROL_TIMEOUT/100); Index++) = {

+    ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));

+

+    DevReq.RequestType =3D USB_ENDPOINT_DIR_IN | USB_REQ_TYPE_CL= ASS | USB_TARGET_INTERFACE;

+    DevReq.Request     =3D GET_ENCAPSULATED_RESPO= NSE;

+    DevReq.Value       =3D 0;

+    DevReq.Index       =3D 0;

+    DevReq.Length      =3D (UINT16)RndisMsgRespon= se->MessageLength;

+

+    Status =3D UsbIo->UsbControlTransfer (

+                    &nbs= p; UsbIo,

+                    &nbs= p; &DevReq,

+                    &nbs= p; EfiUsbDataIn,

+                    &nbs= p; USB_ETHERNET_TRANSFER_TIMEOUT,

+                    &nbs= p; RndisMsgResponse,

+                    &nbs= p; RndisMsgResponse->MessageLength,

+                    &nbs= p; &UsbStatus

+                    &nbs= p; );

+

+    DEBUG ((DEBUG_INFO, "RndisControlMsg Response: UsbStatu= s : %x Status : %r \n", UsbStatus, Status));

+

+    PrintRndisMsg (RndisMsgResponse);

+

+    if (!EFI_ERROR (Status)) {

+      if ((RndisInitCmplt->RequestID !=3D ((REMOTE_NDIS_= INITIALIZE_CMPLT *)RndisMsg)->RequestID) || (RndisInitCmplt->MessageT= ype !=3D SaveResponseType)) {

+        DEBUG ((DEBUG_INFO, "Retry the response\n= "));

+        continue;

+      }

+

+      return Status;

+    }

+

+    RndisMsgResponse->MessageType   =3D SaveRespons= eType;

+    RndisMsgResponse->MessageLength =3D SaveResponseLength;
+

+    gBS->Stall (100000);    // 100msec

+  }

+

+  DEBUG ((DEBUG_INFO, "RndisControlMsg: TimeOut\n"));

+

+  return EFI_TIMEOUT;

+}

+

+/**

+  This function send the RNDIS command through the device's Data endp= oint

+

+  @param[in]      UsbRndisDevice  A pointer to th= e USB_RNDIS_DEVICE instance.

+  @param[in]      RndisMsg        = A pointer to the REMOTE_NDIS_MSG_HEADER to send out.

+  @param[in, out] TransferLength  The length of the RndisMsg dat= a to transfer.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+RndisTransmitDataMsg (

+  IN      USB_RNDIS_DEVICE        = *UsbRndisDevice,

+  IN      REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  IN OUT  UINTN              =      *TransferLength

+  )

+{

+  EFI_STATUS  Status;

+  UINT32      UsbStatus;

+

+  if (UsbRndisDevice->BulkInEndpoint =3D=3D 0) {

+    GetEndpoint (UsbRndisDevice->UsbIoCdcData, UsbRndisDevice= );

+  }

+

+  PrintRndisMsg (RndisMsg);

+

+  Status =3D UsbRndisDevice->UsbIoCdcData->UsbBulkTransfer (
+                    &nbs= p;                     &n= bsp;UsbRndisDevice->UsbIoCdcData,

+                    &nbs= p;                     &n= bsp;UsbRndisDevice->BulkOutEndpoint,

+                    &nbs= p;                     &n= bsp;RndisMsg,

+                    &nbs= p;                     &n= bsp;TransferLength,

+                    &nbs= p;                     &n= bsp;USB_TX_ETHERNET_BULK_TIMEOUT,

+                    &nbs= p;                     &n= bsp;&UsbStatus

+                    &nbs= p;                     &n= bsp;);

+

+  if (Status =3D=3D EFI_SUCCESS) {

+    StopBulkInCnt =3D MAXIMUM_STOPBULKIN_CNT;     = ;// After sending cmd ,we will polling receive package for MAXIMUM_STOPBULK= IN_CNT times

+  }

+

+  return Status;

+}

+

+/**

+  This function send the RNDIS command through the device's Data endp= oint

+

+  @param[in]      UsbRndisDevice    A pointe= r to the USB_RNDIS_DEVICE instance.

+  @param[in, out] RndisMsg          A pointe= r to the REMOTE_NDIS_MSG_HEADER to send out.

+  @param[in, out] TransferLength    The length of the Rndis= Msg data to transfer.

+

+  @retval EFI_SUCCESS     The request executed success= fully.

+

+**/

+EFI_STATUS

+RndisReceiveDataMsg (

+  IN      USB_RNDIS_DEVICE        = *UsbRndisDevice,

+  IN OUT  REMOTE_NDIS_MSG_HEADER  *RndisMsg,

+  IN OUT  UINTN              =      *TransferLength

+  )

+{

+  EFI_STATUS  Status;

+  UINT32      UsbStatus =3D 0;

+

+  if (UsbRndisDevice->BulkInEndpoint =3D=3D 0) {

+    GetEndpoint (UsbRndisDevice->UsbIoCdcData, UsbRndisDevice= );

+  }

+

+  // Use StopBulkInCnt to stop BulkIn command

+  if (StopBulkInCnt || LAN_BULKIN_CMD_CONTROL) {

+    Status =3D UsbRndisDevice->UsbIoCdcData->UsbBulkTransf= er (

+                    &nbs= p;                     &n= bsp;  UsbRndisDevice->UsbIoCdcData,

+                    &nbs= p;                     &n= bsp;  UsbRndisDevice->BulkInEndpoint,

+                    &nbs= p;                     &n= bsp;  RndisMsg,

+                    &nbs= p;                     &n= bsp;  TransferLength,

+                    &nbs= p;                     &n= bsp;  USB_RX_ETHERNET_BULK_TIMEOUT,

+                    &nbs= p;                     &n= bsp;  &UsbStatus

+                    &nbs= p;                     &n= bsp;  );

+

+    if (!EFI_ERROR (Status)) {

+      StopBulkInCnt =3D MINIMUM_STOPBULKIN_CNT;

+    } else {

+      StopBulkInCnt--;

+    }

+  } else {

+    Status          =3D EFI_TIMEOUT;
+    *TransferLength =3D 0;

+    BlockBulkInCnt++;

+  }

+

+  if (BlockBulkInCnt > BULKIN_CMD_POLLING_CNT) {

+    StopBulkInCnt  =3D MINIMUM_STOPBULKIN_CNT;

+    BlockBulkInCnt =3D 0;

+  }

+

+  PrintRndisMsg (RndisMsg);

+

+  return Status;

+}

+

+/**

+  Prints RNDIS Header and Data

+

+  @param[in] RndisMsg    A pointer to the REMOTE_NDIS_MSG_H= EADER data.

+

+**/

+VOID

+PrintRndisMsg (

+  IN  REMOTE_NDIS_MSG_HEADER  *RndisMsg

+  )

+{

+  UINTN  Length =3D 0;

+

+  switch (RndisMsg->MessageType) {

+    case RNDIS_PACKET_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_PACKET_MSG:\n"))= ;

+      Length =3D sizeof (REMOTE_NDIS_PACKET_MSG) + 0x14;
+      break;

+    case RNDIS_INITIALIZE_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_INITIALIZE_MSG:\n&quo= t;));

+      Length =3D sizeof (REMOTE_NDIS_INITIALIZE_MSG);

+      break;

+    case RNDIS_INITIALIZE_CMPLT:

+      DEBUG ((DEBUG_INFO, "RNDIS_INITIALIZE_CMPLT:\n&q= uot;));

+      Length =3D sizeof (REMOTE_NDIS_INITIALIZE_CMPLT);

+      break;

+    case RNDIS_HLT_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_HLT_MSG:\n"));
+      Length =3D sizeof (REMOTE_NDIS_HALT_MSG);

+      break;

+    case RNDIS_QUERY_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_QUERY_MSG:\n"));=

+      Length =3D sizeof (REMOTE_NDIS_QUERY_MSG);

+      break;

+    case RNDIS_QUERY_CMPLT:

+      DEBUG ((DEBUG_INFO, "RNDIS_QUERY_CMPLT:\n")= );

+      Length =3D sizeof (REMOTE_NDIS_QUERY_CMPLT);

+      break;

+    case RNDIS_SET_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_SET_MSG:\n"));
+      Length =3D sizeof (REMOTE_NDIS_SET_MSG);

+      break;

+    case RNDIS_SET_CMPLT:

+      DEBUG ((DEBUG_INFO, "RNDIS_SET_CMPLT:\n"));=

+      Length =3D sizeof (REMOTE_NDIS_SET_CMPLT);

+      break;

+    case RNDIS_RESET_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_RESET_MSG:\n"));=

+      Length =3D sizeof (REMOTE_NDIS_RESET_MSG);

+      break;

+    case RNDIS_RESET_CMPLT:

+      DEBUG ((DEBUG_INFO, "RNDIS_RESET_CMPLT:\n")= );

+      Length =3D sizeof (REMOTE_NDIS_RESET_CMPLT);

+      break;

+    case RNDIS_INDICATE_STATUS_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_INDICATE_STATUS_MSG:\= n"));

+      Length =3D sizeof (REMOTE_NDIS_INDICATE_STATUS_MSG);<= br>
+      break;

+    case RNDIS_KEEPALIVE_MSG:

+      DEBUG ((DEBUG_INFO, "RNDIS_KEEPALIVE_MSG:\n"= ;));

+      Length =3D sizeof (REMOTE_NDIS_KEEPALIVE_MSG);

+      break;

+    case RNDIS_KEEPALIVE_CMPLT:

+      DEBUG ((DEBUG_INFO, "RNDIS_KEEPALIVE_CMPLT:\n&qu= ot;));

+      Length =3D sizeof (REMOTE_NDIS_KEEPALIVE_CMPLT);

+  }

+

+  if (Length) {

+    UINTN  Index =3D 0;

+    for ( ; Length; Length -=3D 4, Index++) {

+      DEBUG ((DEBUG_INFO, "%8X\t", RndisMsg[Index= ]));

+      if (((Index % 4) =3D=3D 3) && (Index !=3D 0))= {

+        DEBUG ((DEBUG_INFO, "\n"));

+      }

+    }

+

+    if (Index % 4) {

+      DEBUG ((DEBUG_INFO, "\n"));

+    }

+  }

+}

--
2.35.1.windows.2
-The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are on notice that any distribution of = this message, in any form, is strictly prohibited. Please promptly notify t= he sender by reply e-mail or by telephone at 770-246-8600, and then delete = or destroy all copies of the transmission.





 

--

Pedro Falcato


 

--

Pedro Falcato

-The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are on notice that any distribution of = this message, in any form, is strictly prohibited. Please promptly notify t= he sender by reply e-mail or by telephone at 770-246-8600, and then delete = or destroy all copies of the transmission. --_000_DM5PR10MB1660C39610362F92EE374C2EB0769DM5PR10MB1660namp_--