From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6387320D77DC3 for ; Thu, 6 Apr 2017 13:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491511936; x=1523047936; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=y5fGhiqC0zrMBZYM+ax43nxRkRsBcwQxVTmn0vkZDfk=; b=OAYzSLPiZ+NOgLnuPHB9JyqU72dHxN0xAQQlVR0QpEUmdaII/1iacd6a L26I+tZ/oaFB/UCNO+T61mFIcI1oqw==; Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2017 13:52:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,161,1488873600"; d="scan'208,217";a="84303607" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 06 Apr 2017 13:52:15 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.246]) by FMSMSX106.amr.corp.intel.com ([169.254.5.54]) with mapi id 14.03.0319.002; Thu, 6 Apr 2017 13:52:15 -0700 From: "Carsey, Jaben" To: "afish@apple.com" CC: Amit kumar , "edk2-devel@lists.01.org" Thread-Topic: [edk2] How to get fs index from controller handle. Thread-Index: AQHSrr3tutVovAtWfUWhYEt1ieg82aG4pFkAgABdrwD//8msUIAAeokA//+K0pA= Date: Thu, 6 Apr 2017 20:52:15 +0000 Message-ID: References: <58C65DD8-D073-4112-8ADE-FFA2F4DD8B45@apple.com> In-Reply-To: <58C65DD8-D073-4112-8ADE-FFA2F4DD8B45@apple.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWE1YWVjZDAtY2Y4Zi00MzNmLTljYWUtMmIwNWE3YmJlOWUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImpZMGJMVUJcL2J5SEI5VFZIbnNpaWkzMXBtQVVtZXhZU1pYMGdcL1Y1ZlgxQT0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 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: Thu, 06 Apr 2017 20:52:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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