From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02olkn0818.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::818]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ABF9D21A04830 for ; Fri, 7 Apr 2017 03:40:46 -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=zcixkAIfL3sljFkYoebT28kLU8ItMq+m+ljBfXm9MwM=; b=Jo45A5d3P3Wl+ToiQi73RDYGOOXs+VxlSLohJ7EgeIv/mgIQSpe2ZtBkcpU8CrYazoQlRIqerCSdzXkU7KLnDMfYsfDz5TugzMxwgeZus2pTW4WWaCuAZqoCbwHXDG0xyG9ZKOPtJr4xmFo2B6ISaNuZ380kdCGgbUwT+PHY3enkduH9Q3zO6XHvA0I/z/nTyMNnefS6Oi0idbm+OfIX/etDQWkSG+JxPuVR+iQBpkuXUkGEeID6u6iDqbZCk0SFFYZCdDGHYINVhbH0s5kfqGi7eIVoJIWL+BKlXXm9R1yCpekt+NVMpK+F4TjgLZNu2Qbplwm8NdNcUUG6fG79NQ== Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (10.152.74.52) by CY1NAM02HT037.eop-nam02.prod.protection.outlook.com (10.152.74.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1005.5; Fri, 7 Apr 2017 10:40:45 +0000 Received: from MWHPR11MB1822.namprd11.prod.outlook.com (10.152.74.52) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.14 via Frontend Transport; Fri, 7 Apr 2017 10:40:45 +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.1019.014; Fri, 7 Apr 2017 10:40:45 +0000 From: Amit kumar To: "Carsey, Jaben" , "afish@apple.com" CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] How to get fs index from controller handle. Thread-Index: AQHSrr3tutVovAtWfUWhYEt1ieg82aG4LwAAgABbsgCAAEEpAIAABQoAgAAA9oCAAN1f6IAACZur Date: Fri, 7 Apr 2017 10:40:45 +0000 Message-ID: References: <58C65DD8-D073-4112-8ADE-FFA2F4DD8B45@apple.com>, , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:6CBD209FF13503222F4EB4C5A7545343B3E1A224EDB93332F14D8F490BDC4AA7; UpperCasedChecksum:3889A9C41D956CC55E765AE749D1E0F4EDCD9CE5EE780847002956431F494CA0; SizeAsReceived:8618; Count:43 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [CQFuTJ1by1NLm92MjWG4ipA8Z8Wt6Fuq] x-microsoft-exchange-diagnostics: 1; CY1NAM02HT037; 5:TQ3OQcjx6e3Tfbovl4wztZv7jOiq/2flZNPQAmwN7spgyxaXXhBGxAU+JUv1j/odGf+MWD1LiaqvZ4AExbLGTN8nRPx7IG9R+IaybH8nYCUo2GZLqkY/c7lafLwTqSDurVs2GCCimUp9qBWf5HQDeQ==; 24:5oCK2L48CJsVSqBPVz1/aoaOCxs4udEGKiLRs5g05fKxGTzXPYC3vgcvjqTL6SnpEyLMnczyXeZgm8v9XkN9emGYEM6+9Ejap0pLERe2UT4=; 7:1blD1SOm3m+i3k4R3NKuPKYac5aKKDyTqu2N/49i38xastzFwTgI/+aToBje2gmncPAxZg4uKmyIzsSeqo57SU8S0I1hH/Hp6CSwbKGVUiB+fQ7WnSOyd8HeQ4XSuH965BzLwoafLhMDaAiNFD2YdEAqTAtSOAVy6dm8CKFKO9KFSgDHSnpNhys1B0GhuZ+nTAkS/4gGNFw0aaaObrz9OJJdvFz0DY7rNIxtvYN+YhC4p4p8Fc5j99p+JqjhzLBSlFw26NIITGX9BdX0Vh2nWRu0ztmROTiL7tt2XOPjz9zRU35HXETjl1csvoFn+iMT x-incomingheadercount: 43 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:CY1NAM02HT037; H:MWHPR11MB1822.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 7d64c340-2ce9-4a19-04d2-08d47da28c04 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322274)(1603101448)(1601125374)(1701031045); SRVR:CY1NAM02HT037; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:CY1NAM02HT037; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT037; x-forefront-prvs: 0270ED2845 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2017 10:40:45.2459 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT037 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: How to get fs index from controller handle. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2017 10:40:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sorry my bad, actually it works instead of FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); i have to use FileDevicePath(devicepath,L"XYZ\\\Par\\\Chld\\filename.efi "); Thanks for your help and support. Amit ________________________________ From: edk2-devel on behalf of Amit kumar = Sent: Friday, April 7, 2017 3:46:37 PM To: Carsey, Jaben; afish@apple.com Cc: edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Andrew, Jaben Thanks for your suggestions. I have one more query , i have a handle that contains a devicepath and i ha= ve a file say filename.efi wich is inside directory structure. say XYZ\Par\Chld\filename.efi NewDevPath =3DFileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); and then i do gBS->LoadImage ( FALSE, ImageHandle, NewDevPath, NULL, 0, &NewHandle ); which returns me Status =3D Not Found; But when i place the filename.efi in volume root NewDevPath =3DFileDevicePath(devicepath,L"filename.efi "); LoadImage succeeds. Can some one tell me how to deal with directories while generating the devi= cepath for a file inside a directory. Amit ________________________________ From: Carsey, Jaben Sent: Friday, April 7, 2017 2:22:15 AM To: afish@apple.com Cc: Amit kumar; edk2-devel@lists.01.org Subject: RE: [edk2] How to get fs index from controller handle. Andrew, I was assuming not wanting ShellExecute() might extend to the rest of the = shell. If the shell is in use, that can definitely help. While those 2 APIs do exi= st in theory, there is a single one that does all I think: GetDevicePathFro= mFilePath. -Jaben From: afish@apple.com [mailto:afish@apple.com] Sent: Thursday, April 06, 2017 1:49 PM To: Carsey, Jaben Cc: Amit kumar ; edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Importance: High On Apr 6, 2017, at 1:30 PM, Carsey, Jaben > wrote: That's the way to do it. the hard work is around finding the DevicePath fo= r the application you want to run to pass to LoadImage. Jaben, It was easy in the old days..... DevPath =3D gSE2->NameToPath (ShellPathName); gSE2->GetFsName (DevPath, FALSE, & ShellPathName); Maybe we should default EFI_SHELL_ENVIRONMENT2 to on :)? Half joking. I used those 2 APIs in the past to glue in shell volume names to a really s= implistic C lib. Also if you have the File System Handle and path you can use the DevicePath= Lib. /** Allocates a device path for a file and appends it to an existing device p= ath. If Device is a valid device handle that contains a device path protocol, = then a device path for the file specified by FileName is allocated and appended to the device p= ath associated with the handle Device. The allocated device path is returned. If Device is NULL= or Device is a handle that does not support the device path protocol, then a device path contai= ning a single device path node for the file specified by FileName is allocated and returned. The memory for the new device path is allocated from EFI boot services me= mory. It is the responsibility of the caller to free the memory allocated. If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). @param Device A pointer to a device handle. This pa= rameter is optional and may be NULL. @param FileName A pointer to a Null-terminated Unicode= string. @return The allocated device path. **/ EFI_DEVICE_PATH_PROTOCOL * EFIAPI FileDevicePath ( IN EFI_HANDLE Device, OPTIONAL IN CONST CHAR16 *FileName ); Thanks, Andrew Fish -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Amit kumar Sent: Thursday, April 06, 2017 9:45 AM To: Andrew Fish > Cc: edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. Importance: High Hi, Can i use gbs->loadimage() and gbs->startimage() to load an efi application and execute it. Suppose i have a app1.efi and from app1.efi i want to execute app2.efi. Or is there some other way to do it ? Not considering ShellExecute(); Amit ________________________________ From: afish@apple.com > on behalf of Andrew Fish > Sent: Thursday, April 6, 2017 4:39:22 PM To: Amit kumar Cc: edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. On Apr 6, 2017, at 3:30 AM, Amit kumar > wrote: Hi, I want to get the fs index from the controller handle. e.g In map command i see my controller is mapped to fs10. So i there any API i can use in my code to get the fs index( which is 10 as= in example) from the controller handle. Amit, It is important to remember that fs0:, and the other device names are a She= ll concept and not an EFI concept. So they only exist in the context of the sh= ell. I took a quick look and I did not see an easy way to do this with the curre= nt Shell APIs. In the older Shell you could use this protocol EfiShellEnvironment2 Proto= col has a function that converts a EFI_DEVICE_PATH_PROTOCOL (would be on your controller handle) to a CHAR16. Thus you can get the volume name the Shell would display to the user. I don't the index exists as a concept. So EFI_SHELL_ENVIRONMENT2.GetFsName() and EFI_SHELL_ENVIRONMENT2.GetFsDevicepath() are the closest thing I can think of. https://github.com/tianocore/edk2/blob/master/ShellPkg/Include/Protocol/ EfiShellEnvironment2.h#L812 The only problem with that is EfiShellEnvironment2 is not produced by the Shell by default. ## This flag is used to control the protocols produced by the shell # If TRUE the shell will produce EFI_SHELL_ENVIRONMENT2 and EFI_SHELL_INTERFACE gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols|FALSE|BOOLEAN |0x00000002 I've use the EFI_SHELL_ENVIRONMENT2 in the past to enable a non Shell application to print out volume names that match the map command of the shell. Hopefully some one knows how to do this in the modern Shell? Thanks, Andrew Fish 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel