From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04olkn0811.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4d::811]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9231821A08D89 for ; Thu, 1 Jun 2017 10:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ie8cAtgpftPtl8sAJLHffykzJ7S8uBOr/l62druNRHE=; b=lOZmZEcF6RMcyA2zxVdR97EPXV7Ik2HSAneONWQh4PDRN0CmRLcayopuVbFJZK34P2YHr3mNb/RKUKBYg8cStWFzzOuXtgRbFXyld9j67NZqNi7rDAPLElkVSG6AwI1iwe3GLrobCS39d9T0FE1h+5mTAWc40qdPl7i7xw9UnBiNdft5Hp7hwu3rBIHjCi70QOfxsdR2Mao0K3nZe8dE7+BzoUvVSSNJAJFvmw6TixJAMIeVTJay8rZSyHy2WSA/v2oQIingljcXV3nfIX5UwIi/yonD5Zwao7RF7DjdEMA7NZZ32s0ryUKAB0B6cxcdY7q3djkon6oOCZ8iBAGCcg== Received: from CO1NAM04FT041.eop-NAM04.prod.protection.outlook.com (10.152.90.52) by CO1NAM04HT090.eop-NAM04.prod.protection.outlook.com (10.152.91.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1101.12; Thu, 1 Jun 2017 17:40:50 +0000 Received: from MWHPR11MB1822.namprd11.prod.outlook.com (10.152.90.56) by CO1NAM04FT041.mail.protection.outlook.com (10.152.91.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.12 via Frontend Transport; Thu, 1 Jun 2017 17:40:50 +0000 Received: from MWHPR11MB1822.namprd11.prod.outlook.com ([10.175.53.137]) by MWHPR11MB1822.namprd11.prod.outlook.com ([10.175.53.137]) with mapi id 15.01.1143.013; Thu, 1 Jun 2017 17:40:50 +0000 From: Amit kumar To: Andrew Fish CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() Thread-Index: AQHS2vyT277Y/Y6Og0KJQ+TlxF8XXaIQRScGgAAAxoCAAABJzQ== Date: Thu, 1 Jun 2017 17:40:50 +0000 Message-ID: References: <6B16DFE0-54D1-4CBF-AC56-F255013B6FA5@apple.com> <19ECB4A0-FFA8-440B-A1B6-79F07BB392F0@apple.com> , <5A5C3E91-A28A-412F-83EC-FCB53DA8EAFA@apple.com> In-Reply-To: <5A5C3E91-A28A-412F-83EC-FCB53DA8EAFA@apple.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: apple.com; dkim=none (message not signed) header.d=none;apple.com; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:DDDB29B1E2AEDF31A267FB5C421A6B1ED04F8F94CE058A2FCB883AA67E45D529; UpperCasedChecksum:0D2352208B83096386F2612A324A6DFDE591E7A2BDA6BF84447A235817F6C873; SizeAsReceived:7635; Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [rb+G5ZZRErDc0FC9IpgeR6jPvQw80x2wIBcCgAOJrRgJB7cEqnaRRQ==] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CO1NAM04HT090; 24:v+Ww5oTpVJf9Nv9xLIw7rA02lXF6emp4A4NWiGTwLfkdx03w2QL93wCWV+P5KoJXwMNs2C4+YArpNrO0w4GrpWbFWA04RL6/bTjNgVR/O10=; 7:5YMqALx2Va8Rp/2Whr1a2j0HmIhGqHmdJS9tb3qZGrxAbpwLfzQGb46ernKP8qHKNhwGjFL7y2uacmYniS8dCBt/AJFegMPo7OVeHdDji96cIhVkp2ou3YyirBTsse8CkXVMseYIb2HKNCajc2pwW+I33XofTldMe1U8Of2lRhVKVBb7SD6WCbikWes2P945t55FC2IDFsjP3PPtahe7MPD3YTA5YDmpWdGqV0FhL1FhxjFOIzaUXBe1eJq04LHirM5LIhf4vjhJHC65oVGNRn5aeZ8rfk+FKK3T5L3rFKc7litMZU5kwuepjH9gAz67 x-incomingheadercount: 46 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:CO1NAM04HT090; H:MWHPR11MB1822.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-traffictypediagnostic: CO1NAM04HT090: x-ms-office365-filtering-correlation-id: 5600bf36-e547-4972-83f8-08d4a9155814 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1603101448)(1601125374)(1701031045); SRVR:CO1NAM04HT090; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031); SRVR:CO1NAM04HT090; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO1NAM04HT090; x-forefront-prvs: 0325F6C77B spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jun 2017 17:40:50.1979 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM04HT090 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: Problem in EFI_BOOT_SERVICES.OpenProtocol() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2017 17:39:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Certainly i will do that. Meanwhile can i submit the patch too ? Amit ________________________________ From: afish@apple.com on behalf of Andrew Fish Sent: Thursday, June 1, 2017 11:08:59 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() On Jun 1, 2017, at 10:37 AM, Amit kumar > wrote: Hello Andrew, Thanks for quick reply and acknowledging my query. Please file a bugzilla against the code. Thanks, Andrew Fish Amit ________________________________ From: afish@apple.com > on behalf of Andrew Fish > Sent: Thursday, June 1, 2017 10:59:03 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > On Jun 1, 2017, at 10:13 AM, Amit kumar > wrote: > > Hello Andrew, > > As per UEFI Spec EFI_ALREADY_STARTED is treated as error code, thus PciIo= (The Interface 3rd parameter ) should remain NULL. > But after OpenProtocol call even though Status =3D EFI_ALREADY_STARTED= PciIo (The Interface 3rd parameter ) is getting modified and it not NULL a= nymore. > Is this not a problem ? > Amit, I agree it looks like the code will fill in the Interface and return EFI_AL= READY_STARTED. And that does seem to conflict with the section of the spec = you quote. Good catch. https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Hand/Ha= ndle.c#L1097 // // This is the protocol interface entry for this protocol // if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { *Interface =3D Prot->Interface; } Status =3D EFI_SUCCESS; ByDriver =3D FALSE; Exclusive =3D FALSE; for ( Link =3D Prot->OpenList.ForwardLink; Link !=3D &Prot->OpenList; Lin= k =3D Link->ForwardLink) { OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIG= NATURE); ExactMatch =3D (BOOLEAN)((OpenData->AgentHandle =3D=3D ImageHandle) && (OpenData->Attributes =3D=3D Attributes) && (OpenData->ControllerHandle =3D=3D ControllerHa= ndle)); if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) !=3D 0) { ByDriver =3D TRUE; if (ExactMatch) { Status =3D EFI_ALREADY_STARTED; goto Done; } } if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) !=3D 0) { Exclusive =3D TRUE; } else if (ExactMatch) { OpenData->OpenCount++; Status =3D EFI_SUCCESS; goto Done; } } Thanks, Andrew Fish > Status =3D gBS->OpenProtocol ( > Controller, > &gEfiPciIoProtocolGuid, > (VOID **) &PciIo, > This->DriverBindingHandle, > Controller, > EFI_OPEN_PROTOCOL_BY_DRIVER > ); > > ________________________________ > From: afish@apple.com > on behalf of Andrew Fish > > Sent: Thursday, June 1, 2017 10:28:16 PM > To: Amit kumar > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Problem in EFI_BOOT_SERVICES.OpenProtocol() > > >> On Jun 1, 2017, at 9:46 AM, Amit kumar > wrote: >> >> Hi, >> I am trying to open PciIoProtocol and facing some issue. >> >> below is the code >> >> EFI_PCI_IO_PROTOCOL *PciIo=3DNULL; >> EFI_STATUS Status; >> >> Status =3D gBS->OpenProtocol ( >> Controller, >> &gEfiPciIoProtocolGuid, >> (VOID **) &PciIo, >> This->DriverBindingHandle, >> Controller, >> EFI_OPEN_PROTOCOL_BY_DRIVER >> ); >> >> it returns Status =3D EFI_ALREADY_STARTED, but PciIo is not NULL. >> Is it not supposed to return PciIo as NULL ? >> As per UEFI 2.6 Spec Section 6.3 page 182. >> > > Amit, > > Look at the Status Codes Returned section at the end of that section. > > Attributes is BY_DRIVER and there is an item on the open list with an att= ribute of BY_DRIVER whose agent handle is the same as AgentHandle. > > Attributes is BY_DRIVER|EXCLUSIVE and there is an item on the open list w= ith an attribute of BY_DRIVER|EXCLUSIVE whose agent handle is the same as A= gentHandle. > > Thanks, > > Andrew Fish > >> There are a number of reasons that this function call can return an erro= r. If an error is returned, then >> AgentHandle, ControllerHandle, and Attributes are not added to the list = of agents >> consuming the protocol interface specified by Handle and Protocol, and I= nterface is >> returned unmodified. >> >> Thanks And Regards >> Amit >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel