From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02olkn0817.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe44::817]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1245E21942349 for ; Fri, 7 Apr 2017 08:23:16 -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=V7LTr7jsaAEYHN7roq73z6FqM6WiPKgaKgUXijfbSiY=; b=tTx8hQoXxid+yytvIQMczGa9oooy4u9HlUutaNQSsqpCR0pKeR3JSgJ3Zk9U/atscX5OJ9XkE7sqNSL4RUgpyfL2CcRHGMIziotLtEEO/MjX7MINfTPOGAqoxT5esZltVVagFMeRgxOQTzQBhD2/o/bSvrYGwIIobGxnPyxYVrP83LQ3q84syua4KKiCLIKEYZTsxMufKKkrB/1Sp/wKb39zXinZtXBTCgCswE1cLWb8CM+tYkJyfHB94wPBV3CV0+6BB7knd8myoxwpWckDN7PUgkXqwEpXKRz3sH/2uJywekbvUvGKRg0NnLGFs1WmwNjaqiXzjJ2OBbnZ24il6g== Received: from CY1NAM02FT018.eop-nam02.prod.protection.outlook.com (10.152.74.59) by CY1NAM02HT099.eop-nam02.prod.protection.outlook.com (10.152.74.208) 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 15:23:14 +0000 Received: from MWHPR11MB1822.namprd11.prod.outlook.com (10.152.74.57) by CY1NAM02FT018.mail.protection.outlook.com (10.152.75.183) 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 15:23:14 +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.021; Fri, 7 Apr 2017 15:23:14 +0000 From: Amit kumar To: Andrew Fish , Jaben Carsey , "edk2-devel@lists.01.org" Thread-Topic: [edk2] How to get fs index from controller handle. Thread-Index: AQHSrr3tutVovAtWfUWhYEt1ieg82aG4LwAAgABbsgCAAEEpAIAABQoAgAAA9oCAAN1f6IAACZurgABEIACAAAr6iA== Date: Fri, 7 Apr 2017 15:23:14 +0000 Message-ID: References: <58C65DD8-D073-4112-8ADE-FFA2F4DD8B45@apple.com> , <4A8F6E14-A49C-4258-9F2B-ECB7E1A9155E@apple.com> In-Reply-To: <4A8F6E14-A49C-4258-9F2B-ECB7E1A9155E@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:AC3162ED6192A086775809BDCB5476876BE3F4B1A513FDBA57224F4F80FA00F5; UpperCasedChecksum:14A9D1AC421C7FE2218DAFA0FC716CEE018D17B7E2C5B83A8EA71705E7418D1A; SizeAsReceived:8720; Count:42 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [XVmqAj7wIhAUSNvoZ3ZTvyjK64fP/Ev+] x-microsoft-exchange-diagnostics: 1; CY1NAM02HT099; 5:cWOuhWJLEL5WQfPK8/itR9fiFk0FXOJ8S3/BjlsDMEZB6Yvatz9PT8XTpRtmtK0iq4u52FHahzD4lu/i3k2/hv/pR3+e/Hn0Uo6MW/lR2Few0G+/8EqaO4Wypy0KJmFWPM80SSDZPmr+xUa0nH16FQ==; 24:MT3bI4ogL87uHRDpMUC8mIywPs3YToRqM99ZVp1ncL4KGsxdVnnC3iYUxkMx3hqCyavD0Gup+n2ZwBnNCmHshmMlCiDcI4nOlG/wV9ZOIFE=; 7:mppSWlukuSbcPTo38TubuwIOE0ed5Ab7ERe+x6eJ3sZCw3YffPhNpYhOsYSQAAi8xbvIeuvYXJqdEPhnsXQVP9MEA5cBBIjSVT9sSGI4Hl0F0dVCQdNOGsMUXNJf/msN2u6dFFKXpoqoOaHPErtcTU9BTX/sWaWGkWn7OsYkeFla3Gy4Al1LMwyhl3sB1VHXmBgm7Yxj8T84uyNM0QuqDmqiZIX/8qXymxryprybYh1So8pIQGtHuzg9t0O4z6zyc0FTp1mdjwhHO6J+7BsoJ1pf09dleuqq0v+ds5KU2I12UFwVXmL+63YpVAj9UQeH x-incomingheadercount: 42 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:CY1NAM02HT099; H:MWHPR11MB1822.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: ee644387-70ff-405c-e3d0-08d47dca0285 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322274)(1603101448)(1601125374)(1701031045); SRVR:CY1NAM02HT099; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:CY1NAM02HT099; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT099; 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 15:23:14.3856 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT099 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 15:23:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for correction. FileDevicePath(devicepath,L"XYZ\\Par\\Chld\\filename.efi "); Amit ________________________________ From: afish@apple.com on behalf of Andrew Fish Sent: Friday, April 7, 2017 8:12:46 PM To: Amit kumar Cc: Carsey, Jaben; edk2-devel@lists.01.org Subject: Re: [edk2] How to get fs index from controller handle. On Apr 7, 2017, at 3:40 AM, Amit kumar > wrote: 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 "); I think it is 2 \\ not 3 and you have a space at the end of the string. Thanks, Andrew Fish 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-de= vel@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 A= ndrew 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