* LocateHandle for gEfiShellProtocolGuid is failing in my application @ 2016-12-21 7:32 GN Keshava 2016-12-21 18:36 ` Carsey, Jaben ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: GN Keshava @ 2016-12-21 7:32 UTC (permalink / raw) To: edk2-devel@lists.01.org Hi, I'm developing a shell application. A call to LocateHandle for gEfiShellProtocolGuid is failing with Status 0x0E. Below is my code. Please let me know what I'm doing wrong. Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, &BufferSize, Buffer); // Get BufferSize if (EFI_ERROR(Status)) Print(L"LocateHandle Status 0x%x\n",Status); Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, (void**)&Buffer); if (EFI_ERROR(Status)) Print(L"AllocatePool Status 0x%x\n",Status); Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, &BufferSize, Buffer); if (EFI_ERROR(Status)) Print(L"LocateHandle Status 0x%x\n",Status); All calls failing with Status being 0x0E. Please help me to solve this. Is there any special requirement for using this protocol? Thanks. Regards, Keshava ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-21 7:32 LocateHandle for gEfiShellProtocolGuid is failing in my application GN Keshava @ 2016-12-21 18:36 ` Carsey, Jaben 2016-12-22 9:35 ` GN Keshava 2016-12-21 18:59 ` Andrew Fish 2016-12-21 19:13 ` Andrew Fish 2 siblings, 1 reply; 12+ messages in thread From: Carsey, Jaben @ 2016-12-21 18:36 UTC (permalink / raw) To: GN Keshava, edk2-devel@lists.01.org; +Cc: Carsey, Jaben Hi Keshava, few questions: Is there a reason that you are not using ShellLib to facilitate your app functionality? That library makes lots of things a lot easier. Why do you use LocateHandle and not LocateProtocol? Are you sure about that return code? Usually most-sig-bit is set for error returns. Does the following snippet of code find a valid instance? Status = gBS->LocateProtocol( &gEfiShellProtocolGuid, NULL, (VOID **)&gEfiShellProtocol ); if (EFI_ERROR(Status)) { gEfiShellProtocol = NULL; } Are you running the UEFI Shell and then your application? -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > GN Keshava > Sent: Tuesday, December 20, 2016 11:32 PM > To: edk2-devel@lists.01.org > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > application > Importance: High > > Hi, > > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. > > Below is my code. Please let me know what I'm doing wrong. > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > All calls failing with Status being 0x0E. Please help me to solve this. Is > there any special requirement for using this protocol? > > Thanks. > Regards, > Keshava > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-21 18:36 ` Carsey, Jaben @ 2016-12-22 9:35 ` GN Keshava 2016-12-22 10:07 ` GN Keshava 0 siblings, 1 reply; 12+ messages in thread From: GN Keshava @ 2016-12-22 9:35 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org Hi Jaben, *>> Is there a reason that you are not using ShellLib to facilitate your app functionality? That library makes lots of things a lot easier.* I want to use EFI_SHELL_PROTOCOL->GetMapFromDevicePath in my app. Is there any way to use it using ShellLib ? *>> Why do you use LocateHandle and not LocateProtocol?* Got LocateHandle in my reference. I would like to know more about difference and usage of these in different scenario. *>> Are you running the UEFI Shell and then your application?* Yes. I'm running my application from UEFI shell as : *fs1:\> MyApp.exe Arg1 Arg2* Thanks for the help.. Regards, Keshava On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> wrote: > Hi Keshava, > > few questions: > Is there a reason that you are not using ShellLib to facilitate your app > functionality? That library makes lots of things a lot easier. > Why do you use LocateHandle and not LocateProtocol? > Are you sure about that return code? Usually most-sig-bit is set for > error returns. > > Does the following snippet of code find a valid instance? > > Status = gBS->LocateProtocol( > &gEfiShellProtocolGuid, > NULL, > (VOID **)&gEfiShellProtocol > ); > if (EFI_ERROR(Status)) { > gEfiShellProtocol = NULL; > } > > Are you running the UEFI Shell and then your application? > > > -Jaben > > > > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > GN Keshava > > Sent: Tuesday, December 20, 2016 11:32 PM > > To: edk2-devel@lists.01.org > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > > application > > Importance: High > > > > Hi, > > > > I'm developing a shell application. A call to LocateHandle for > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > Below is my code. Please let me know what I'm doing wrong. > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); // Get BufferSize > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > (void**)&Buffer); > > if (EFI_ERROR(Status)) > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > All calls failing with Status being 0x0E. Please help me to solve this. > Is > > there any special requirement for using this protocol? > > > > Thanks. > > Regards, > > Keshava > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-22 9:35 ` GN Keshava @ 2016-12-22 10:07 ` GN Keshava 2016-12-22 16:56 ` Carsey, Jaben 0 siblings, 1 reply; 12+ messages in thread From: GN Keshava @ 2016-12-22 10:07 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org Hi Jaben and Andrew, Thanks for the replies. Here's a small update. I tried using *LocateProtocol*, and I get "*Status Not Found*" (%r would print "Status Not Found"). I'm getting the same error status for *LocateHandle *too. I'm using *BufferSize=0* and *Buffer=NULL* for getting the BufferSize. What this would mean? Is there any specific requirement my application should meet, to use ShellProtocol? Or, as I mentioned in previous mail, I want to use GetMapFromDevicePath function. Is there any alternate way to do it? Thanks for your help. Regards, Keshava On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com> wrote: > Hi Jaben, > > *>> Is there a reason that you are not using ShellLib to facilitate your > app functionality? That library makes lots of things a lot easier.* > > I want to use EFI_SHELL_PROTOCOL->GetMapFromDevicePath in my app. Is > there any way to use it using ShellLib ? > > > *>> Why do you use LocateHandle and not LocateProtocol?* > > Got LocateHandle in my reference. I would like to know more about > difference and usage of these in different scenario. > > > *>> Are you running the UEFI Shell and then your application?* > > Yes. I'm running my application from UEFI shell as : > > *fs1:\> MyApp.exe Arg1 Arg2* > > Thanks for the help.. > > Regards, > Keshava > > > On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> wrote: > > Hi Keshava, > > few questions: > Is there a reason that you are not using ShellLib to facilitate your app > functionality? That library makes lots of things a lot easier. > Why do you use LocateHandle and not LocateProtocol? > Are you sure about that return code? Usually most-sig-bit is set for > error returns. > > Does the following snippet of code find a valid instance? > > Status = gBS->LocateProtocol( > &gEfiShellProtocolGuid, > NULL, > (VOID **)&gEfiShellProtocol > ); > if (EFI_ERROR(Status)) { > gEfiShellProtocol = NULL; > } > > Are you running the UEFI Shell and then your application? > > > -Jaben > > > > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > GN Keshava > > Sent: Tuesday, December 20, 2016 11:32 PM > > To: edk2-devel@lists.01.org > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > > application > > Importance: High > > > > Hi, > > > > I'm developing a shell application. A call to LocateHandle for > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > Below is my code. Please let me know what I'm doing wrong. > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); // Get BufferSize > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > (void**)&Buffer); > > if (EFI_ERROR(Status)) > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > All calls failing with Status being 0x0E. Please help me to solve this. > Is > > there any special requirement for using this protocol? > > > > Thanks. > > Regards, > > Keshava > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-22 10:07 ` GN Keshava @ 2016-12-22 16:56 ` Carsey, Jaben 2016-12-23 4:06 ` GN Keshava 0 siblings, 1 reply; 12+ messages in thread From: Carsey, Jaben @ 2016-12-22 16:56 UTC (permalink / raw) To: GN Keshava, edk2-devel@lists.01.org; +Cc: Carsey, Jaben That function is not in the shell library. LocateHandle would be useful is you wanted to find the image handle for the shell binary whereas LocaetProtocol would be just getting a pointer to the protocol. Which version of the UEFI Shell are you using? (what does “ver” command say) -Jaben From: GN Keshava [mailto:keshava.gn@gmail.com] Sent: Thursday, December 22, 2016 2:07 AM To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org Subject: Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my application Importance: High Hi Jaben and Andrew, Thanks for the replies. Here's a small update. I tried using LocateProtocol, and I get "Status Not Found" (%r would print "Status Not Found"). I'm getting the same error status for LocateHandle too. I'm using BufferSize=0 and Buffer=NULL for getting the BufferSize. What this would mean? Is there any specific requirement my application should meet, to use ShellProtocol? Or, as I mentioned in previous mail, I want to use GetMapFromDevicePath function. Is there any alternate way to do it? Thanks for your help. Regards, Keshava On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com<mailto:keshava.gn@gmail.com>> wrote: Hi Jaben, >> Is there a reason that you are not using ShellLib to facilitate your app functionality? That library makes lots of things a lot easier. I want to use EFI_SHELL_PROTOCOL->GetMapFromDevicePath in my app. Is there any way to use it using ShellLib ? >> Why do you use LocateHandle and not LocateProtocol? Got LocateHandle in my reference. I would like to know more about difference and usage of these in different scenario. >> Are you running the UEFI Shell and then your application? Yes. I'm running my application from UEFI shell as : fs1:\> MyApp.exe Arg1 Arg2 Thanks for the help.. Regards, Keshava On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com<mailto:jaben.carsey@intel.com>> wrote: Hi Keshava, few questions: Is there a reason that you are not using ShellLib to facilitate your app functionality? That library makes lots of things a lot easier. Why do you use LocateHandle and not LocateProtocol? Are you sure about that return code? Usually most-sig-bit is set for error returns. Does the following snippet of code find a valid instance? Status = gBS->LocateProtocol( &gEfiShellProtocolGuid, NULL, (VOID **)&gEfiShellProtocol ); if (EFI_ERROR(Status)) { gEfiShellProtocol = NULL; } Are you running the UEFI Shell and then your application? -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org<mailto:edk2-devel-bounces@lists.01.org>] On Behalf Of > GN Keshava > Sent: Tuesday, December 20, 2016 11:32 PM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > application > Importance: High > > Hi, > > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. > > Below is my code. Please let me know what I'm doing wrong. > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > All calls failing with Status being 0x0E. Please help me to solve this. Is > there any special requirement for using this protocol? > > Thanks. > Regards, > Keshava > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-22 16:56 ` Carsey, Jaben @ 2016-12-23 4:06 ` GN Keshava 2016-12-27 23:28 ` Carsey, Jaben 0 siblings, 1 reply; 12+ messages in thread From: GN Keshava @ 2016-12-23 4:06 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org Hi Jaben, Version is 2.31... Revision is 4.653 Thanks. Regards, Keshava On Thu, 22 Dec 2016 at 22:26 Carsey, Jaben <jaben.carsey@intel.com> wrote: > That function is not in the shell library. > > > > LocateHandle would be useful is you wanted to find the image handle for > the shell binary whereas LocaetProtocol would be just getting a pointer to > the protocol. > > > > Which version of the UEFI Shell are you using? (what does “ver” command > say) > > > > -Jaben > > > > *From:* GN Keshava [mailto:keshava.gn@gmail.com] > *Sent:* Thursday, December 22, 2016 2:07 AM > *To:* Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > *Subject:* Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing > in my application > *Importance:* High > > > > Hi Jaben and Andrew, Thanks for the replies. Here's a small update. > > > > I tried using *LocateProtocol*, and I get "*Status Not Found*" (%r would > print "Status Not Found"). > > I'm getting the same error status for *LocateHandle *too. I'm using > *BufferSize=0* and *Buffer=NULL* for getting the BufferSize. > > What this would mean? Is there any specific requirement my application > should meet, to use ShellProtocol? Or, as I mentioned in previous mail, I > want to use GetMapFromDevicePath function. Is there any alternate way to do > it? > > > > Thanks for your help. > > Regards, > > Keshava > > > > On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com> wrote: > > Hi Jaben, > > > > *>> Is there a reason that you are not using ShellLib to facilitate your > app functionality? That library makes lots of things a lot easier.* > > > > I want to use EFI_SHELL_PROTOCOL->*GetMapFromDevicePath* in my app. Is > there any way to use it using ShellLib ? > > > > *>> Why do you use LocateHandle and not LocateProtocol?* > > > > Got LocateHandle in my reference. I would like to know more about > difference and usage of these in different scenario. > > > > *>> Are you running the UEFI Shell and then your application?* > > > > Yes. I'm running my application from UEFI shell as : > > > > *fs1:\> MyApp.exe Arg1 Arg2* > > > > Thanks for the help.. > > > > Regards, > > Keshava > > > > On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> wrote: > > Hi Keshava, > > few questions: > Is there a reason that you are not using ShellLib to facilitate your app > functionality? That library makes lots of things a lot easier. > Why do you use LocateHandle and not LocateProtocol? > Are you sure about that return code? Usually most-sig-bit is set for > error returns. > > Does the following snippet of code find a valid instance? > > Status = gBS->LocateProtocol( > &gEfiShellProtocolGuid, > NULL, > (VOID **)&gEfiShellProtocol > ); > if (EFI_ERROR(Status)) { > gEfiShellProtocol = NULL; > } > > Are you running the UEFI Shell and then your application? > > > -Jaben > > > > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > GN Keshava > > Sent: Tuesday, December 20, 2016 11:32 PM > > To: edk2-devel@lists.01.org > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > > application > > Importance: High > > > > Hi, > > > > I'm developing a shell application. A call to LocateHandle for > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > Below is my code. Please let me know what I'm doing wrong. > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); // Get BufferSize > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > (void**)&Buffer); > > if (EFI_ERROR(Status)) > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > &BufferSize, Buffer); > > if (EFI_ERROR(Status)) > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > All calls failing with Status being 0x0E. Please help me to solve this. > Is > > there any special requirement for using this protocol? > > > > Thanks. > > Regards, > > Keshava > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-23 4:06 ` GN Keshava @ 2016-12-27 23:28 ` Carsey, Jaben 2016-12-28 4:16 ` GN Keshava 0 siblings, 1 reply; 12+ messages in thread From: Carsey, Jaben @ 2016-12-27 23:28 UTC (permalink / raw) To: GN Keshava, edk2-devel@lists.01.org; +Cc: Carsey, Jaben I wonder if the firmware supplier is using an older version of the shell binary? Maybe it is EDK Shell and not UEFI Shell? I am unsure how to fix the issue. -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > GN Keshava > Sent: Thursday, December 22, 2016 8:07 PM > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > Subject: Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > application > Importance: High > > Hi Jaben, > > Version is 2.31... Revision is 4.653 > > Thanks. > Regards, > Keshava > > On Thu, 22 Dec 2016 at 22:26 Carsey, Jaben <jaben.carsey@intel.com> wrote: > > > That function is not in the shell library. > > > > > > > > LocateHandle would be useful is you wanted to find the image handle for > > the shell binary whereas LocaetProtocol would be just getting a pointer to > > the protocol. > > > > > > > > Which version of the UEFI Shell are you using? (what does “ver” command > > say) > > > > > > > > -Jaben > > > > > > > > *From:* GN Keshava [mailto:keshava.gn@gmail.com] > > *Sent:* Thursday, December 22, 2016 2:07 AM > > *To:* Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > > *Subject:* Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing > > in my application > > *Importance:* High > > > > > > > > Hi Jaben and Andrew, Thanks for the replies. Here's a small update. > > > > > > > > I tried using *LocateProtocol*, and I get "*Status Not Found*" (%r would > > print "Status Not Found"). > > > > I'm getting the same error status for *LocateHandle *too. I'm using > > *BufferSize=0* and *Buffer=NULL* for getting the BufferSize. > > > > What this would mean? Is there any specific requirement my application > > should meet, to use ShellProtocol? Or, as I mentioned in previous mail, I > > want to use GetMapFromDevicePath function. Is there any alternate way > to do > > it? > > > > > > > > Thanks for your help. > > > > Regards, > > > > Keshava > > > > > > > > On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com> wrote: > > > > Hi Jaben, > > > > > > > > *>> Is there a reason that you are not using ShellLib to facilitate your > > app functionality? That library makes lots of things a lot easier.* > > > > > > > > I want to use EFI_SHELL_PROTOCOL->*GetMapFromDevicePath* in my > app. Is > > there any way to use it using ShellLib ? > > > > > > > > *>> Why do you use LocateHandle and not LocateProtocol?* > > > > > > > > Got LocateHandle in my reference. I would like to know more about > > difference and usage of these in different scenario. > > > > > > > > *>> Are you running the UEFI Shell and then your application?* > > > > > > > > Yes. I'm running my application from UEFI shell as : > > > > > > > > *fs1:\> MyApp.exe Arg1 Arg2* > > > > > > > > Thanks for the help.. > > > > > > > > Regards, > > > > Keshava > > > > > > > > On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> > wrote: > > > > Hi Keshava, > > > > few questions: > > Is there a reason that you are not using ShellLib to facilitate your app > > functionality? That library makes lots of things a lot easier. > > Why do you use LocateHandle and not LocateProtocol? > > Are you sure about that return code? Usually most-sig-bit is set for > > error returns. > > > > Does the following snippet of code find a valid instance? > > > > Status = gBS->LocateProtocol( > > &gEfiShellProtocolGuid, > > NULL, > > (VOID **)&gEfiShellProtocol > > ); > > if (EFI_ERROR(Status)) { > > gEfiShellProtocol = NULL; > > } > > > > Are you running the UEFI Shell and then your application? > > > > > > -Jaben > > > > > > > > > > > -----Original Message----- > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > > GN Keshava > > > Sent: Tuesday, December 20, 2016 11:32 PM > > > To: edk2-devel@lists.01.org > > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > > > application > > > Importance: High > > > > > > Hi, > > > > > > I'm developing a shell application. A call to LocateHandle for > > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > > > Below is my code. Please let me know what I'm doing wrong. > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > > &BufferSize, Buffer); // Get BufferSize > > > if (EFI_ERROR(Status)) > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > > (void**)&Buffer); > > > if (EFI_ERROR(Status)) > > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > > &BufferSize, Buffer); > > > if (EFI_ERROR(Status)) > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > All calls failing with Status being 0x0E. Please help me to solve this. > > Is > > > there any special requirement for using this protocol? > > > > > > Thanks. > > > Regards, > > > Keshava > > > _______________________________________________ > > > 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-27 23:28 ` Carsey, Jaben @ 2016-12-28 4:16 ` GN Keshava 2016-12-28 14:56 ` Carsey, Jaben 0 siblings, 1 reply; 12+ messages in thread From: GN Keshava @ 2016-12-28 4:16 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org Thanks a lot for the help, Jaben. *>>Maybe it is EDK Shell and not UEFI Shell?* How I can understand if it is EDK shell or UEFI shell? (I'm using *UEFI x86 Shell *or *MinShell *from efi\MyWorkSpace\ShellBinPkg\ directory). Is it OK to use this? Is it possible for you to give me an UEFI shell binary for x86 (Intel i5 3470), so that I can try it right away? *>>I wonder if the firmware supplier is using an older version of the shell binary?* For Intel i5 3470, how to check what is the firmware version? Thanks again. Regards, Keshava GN On Wed, 28 Dec 2016 at 04:58 Carsey, Jaben <jaben.carsey@intel.com> wrote: > I wonder if the firmware supplier is using an older version of the shell > binary? Maybe it is EDK Shell and not UEFI Shell? I am unsure how to fix > the issue. > > -Jaben > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > GN Keshava > > Sent: Thursday, December 22, 2016 8:07 PM > > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > > Subject: Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in > my > > application > > Importance: High > > > > Hi Jaben, > > > > Version is 2.31... Revision is 4.653 > > > > Thanks. > > Regards, > > Keshava > > > > On Thu, 22 Dec 2016 at 22:26 Carsey, Jaben <jaben.carsey@intel.com> > wrote: > > > > > That function is not in the shell library. > > > > > > > > > > > > LocateHandle would be useful is you wanted to find the image handle for > > > the shell binary whereas LocaetProtocol would be just getting a > pointer to > > > the protocol. > > > > > > > > > > > > Which version of the UEFI Shell are you using? (what does “ver” > command > > > say) > > > > > > > > > > > > -Jaben > > > > > > > > > > > > *From:* GN Keshava [mailto:keshava.gn@gmail.com] > > > *Sent:* Thursday, December 22, 2016 2:07 AM > > > *To:* Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > > > *Subject:* Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing > > > in my application > > > *Importance:* High > > > > > > > > > > > > Hi Jaben and Andrew, Thanks for the replies. Here's a small update. > > > > > > > > > > > > I tried using *LocateProtocol*, and I get "*Status Not Found*" (%r > would > > > print "Status Not Found"). > > > > > > I'm getting the same error status for *LocateHandle *too. I'm using > > > *BufferSize=0* and *Buffer=NULL* for getting the BufferSize. > > > > > > What this would mean? Is there any specific requirement my application > > > should meet, to use ShellProtocol? Or, as I mentioned in previous > mail, I > > > want to use GetMapFromDevicePath function. Is there any alternate way > > to do > > > it? > > > > > > > > > > > > Thanks for your help. > > > > > > Regards, > > > > > > Keshava > > > > > > > > > > > > On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com> wrote: > > > > > > Hi Jaben, > > > > > > > > > > > > *>> Is there a reason that you are not using ShellLib to facilitate > your > > > app functionality? That library makes lots of things a lot easier.* > > > > > > > > > > > > I want to use EFI_SHELL_PROTOCOL->*GetMapFromDevicePath* in my > > app. Is > > > there any way to use it using ShellLib ? > > > > > > > > > > > > *>> Why do you use LocateHandle and not LocateProtocol?* > > > > > > > > > > > > Got LocateHandle in my reference. I would like to know more about > > > difference and usage of these in different scenario. > > > > > > > > > > > > *>> Are you running the UEFI Shell and then your application?* > > > > > > > > > > > > Yes. I'm running my application from UEFI shell as : > > > > > > > > > > > > *fs1:\> MyApp.exe Arg1 Arg2* > > > > > > > > > > > > Thanks for the help.. > > > > > > > > > > > > Regards, > > > > > > Keshava > > > > > > > > > > > > On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> > > wrote: > > > > > > Hi Keshava, > > > > > > few questions: > > > Is there a reason that you are not using ShellLib to facilitate your > app > > > functionality? That library makes lots of things a lot easier. > > > Why do you use LocateHandle and not LocateProtocol? > > > Are you sure about that return code? Usually most-sig-bit is set for > > > error returns. > > > > > > Does the following snippet of code find a valid instance? > > > > > > Status = gBS->LocateProtocol( > > > &gEfiShellProtocolGuid, > > > NULL, > > > (VOID **)&gEfiShellProtocol > > > ); > > > if (EFI_ERROR(Status)) { > > > gEfiShellProtocol = NULL; > > > } > > > > > > Are you running the UEFI Shell and then your application? > > > > > > > > > -Jaben > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf > Of > > > > GN Keshava > > > > Sent: Tuesday, December 20, 2016 11:32 PM > > > > To: edk2-devel@lists.01.org > > > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in > my > > > > application > > > > Importance: High > > > > > > > > Hi, > > > > > > > > I'm developing a shell application. A call to LocateHandle for > > > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > > > > > Below is my code. Please let me know what I'm doing wrong. > > > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > > > &BufferSize, Buffer); // Get BufferSize > > > > if (EFI_ERROR(Status)) > > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > > > (void**)&Buffer); > > > > if (EFI_ERROR(Status)) > > > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > > > > &BufferSize, Buffer); > > > > if (EFI_ERROR(Status)) > > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > > > All calls failing with Status being 0x0E. Please help me to solve > this. > > > Is > > > > there any special requirement for using this protocol? > > > > > > > > Thanks. > > > > Regards, > > > > Keshava > > > > _______________________________________________ > > > > 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 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-28 4:16 ` GN Keshava @ 2016-12-28 14:56 ` Carsey, Jaben 0 siblings, 0 replies; 12+ messages in thread From: Carsey, Jaben @ 2016-12-28 14:56 UTC (permalink / raw) To: GN Keshava, edk2-devel@lists.01.org; +Cc: Carsey, Jaben ShellBinPkg should be the right location to get a UEFI Shell from (for the record the EdkShellBinPkg would be the old version). If you do "ver -s" the ourput will provide additional version information about the shell itself. Have you updated your git version recently? -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > GN Keshava > Sent: Tuesday, December 27, 2016 8:16 PM > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > Subject: Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > application > Importance: High > > Thanks a lot for the help, Jaben. > > *>>Maybe it is EDK Shell and not UEFI Shell?* > How I can understand if it is EDK shell or UEFI shell? > (I'm using *UEFI x86 Shell *or *MinShell *from > efi\MyWorkSpace\ShellBinPkg\ > directory). Is it OK to use this? > Is it possible for you to give me an UEFI shell binary for x86 (Intel i5 > 3470), so that I can try it right away? > > *>>I wonder if the firmware supplier is using an older version of the shell > binary?* > For Intel i5 3470, how to check what is the firmware version? > > Thanks again. > Regards, > Keshava GN > > On Wed, 28 Dec 2016 at 04:58 Carsey, Jaben <jaben.carsey@intel.com> > wrote: > > > I wonder if the firmware supplier is using an older version of the shell > > binary? Maybe it is EDK Shell and not UEFI Shell? I am unsure how to fix > > the issue. > > > > -Jaben > > > > > -----Original Message----- > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > > GN Keshava > > > Sent: Thursday, December 22, 2016 8:07 PM > > > To: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org > > > Subject: Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in > > my > > > application > > > Importance: High > > > > > > Hi Jaben, > > > > > > Version is 2.31... Revision is 4.653 > > > > > > Thanks. > > > Regards, > > > Keshava > > > > > > On Thu, 22 Dec 2016 at 22:26 Carsey, Jaben <jaben.carsey@intel.com> > > wrote: > > > > > > > That function is not in the shell library. > > > > > > > > > > > > > > > > LocateHandle would be useful is you wanted to find the image handle > for > > > > the shell binary whereas LocaetProtocol would be just getting a > > pointer to > > > > the protocol. > > > > > > > > > > > > > > > > Which version of the UEFI Shell are you using? (what does “ver” > > command > > > > say) > > > > > > > > > > > > > > > > -Jaben > > > > > > > > > > > > > > > > *From:* GN Keshava [mailto:keshava.gn@gmail.com] > > > > *Sent:* Thursday, December 22, 2016 2:07 AM > > > > *To:* Carsey, Jaben <jaben.carsey@intel.com>; edk2- > devel@lists.01.org > > > > *Subject:* Re: [edk2] LocateHandle for gEfiShellProtocolGuid is failing > > > > in my application > > > > *Importance:* High > > > > > > > > > > > > > > > > Hi Jaben and Andrew, Thanks for the replies. Here's a small update. > > > > > > > > > > > > > > > > I tried using *LocateProtocol*, and I get "*Status Not Found*" (%r > > would > > > > print "Status Not Found"). > > > > > > > > I'm getting the same error status for *LocateHandle *too. I'm using > > > > *BufferSize=0* and *Buffer=NULL* for getting the BufferSize. > > > > > > > > What this would mean? Is there any specific requirement my > application > > > > should meet, to use ShellProtocol? Or, as I mentioned in previous > > mail, I > > > > want to use GetMapFromDevicePath function. Is there any alternate > way > > > to do > > > > it? > > > > > > > > > > > > > > > > Thanks for your help. > > > > > > > > Regards, > > > > > > > > Keshava > > > > > > > > > > > > > > > > On Thu, 22 Dec 2016 at 15:01 GN Keshava <keshava.gn@gmail.com> > wrote: > > > > > > > > Hi Jaben, > > > > > > > > > > > > > > > > *>> Is there a reason that you are not using ShellLib to facilitate > > your > > > > app functionality? That library makes lots of things a lot easier.* > > > > > > > > > > > > > > > > I want to use EFI_SHELL_PROTOCOL->*GetMapFromDevicePath* in my > > > app. Is > > > > there any way to use it using ShellLib ? > > > > > > > > > > > > > > > > *>> Why do you use LocateHandle and not LocateProtocol?* > > > > > > > > > > > > > > > > Got LocateHandle in my reference. I would like to know more about > > > > difference and usage of these in different scenario. > > > > > > > > > > > > > > > > *>> Are you running the UEFI Shell and then your application?* > > > > > > > > > > > > > > > > Yes. I'm running my application from UEFI shell as : > > > > > > > > > > > > > > > > *fs1:\> MyApp.exe Arg1 Arg2* > > > > > > > > > > > > > > > > Thanks for the help.. > > > > > > > > > > > > > > > > Regards, > > > > > > > > Keshava > > > > > > > > > > > > > > > > On Thu, 22 Dec 2016 at 00:06 Carsey, Jaben <jaben.carsey@intel.com> > > > wrote: > > > > > > > > Hi Keshava, > > > > > > > > few questions: > > > > Is there a reason that you are not using ShellLib to facilitate your > > app > > > > functionality? That library makes lots of things a lot easier. > > > > Why do you use LocateHandle and not LocateProtocol? > > > > Are you sure about that return code? Usually most-sig-bit is set for > > > > error returns. > > > > > > > > Does the following snippet of code find a valid instance? > > > > > > > > Status = gBS->LocateProtocol( > > > > &gEfiShellProtocolGuid, > > > > NULL, > > > > (VOID **)&gEfiShellProtocol > > > > ); > > > > if (EFI_ERROR(Status)) { > > > > gEfiShellProtocol = NULL; > > > > } > > > > > > > > Are you running the UEFI Shell and then your application? > > > > > > > > > > > > -Jaben > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On > Behalf > > Of > > > > > GN Keshava > > > > > Sent: Tuesday, December 20, 2016 11:32 PM > > > > > To: edk2-devel@lists.01.org > > > > > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in > > my > > > > > application > > > > > Importance: High > > > > > > > > > > Hi, > > > > > > > > > > I'm developing a shell application. A call to LocateHandle for > > > > > gEfiShellProtocolGuid is failing with Status 0x0E. > > > > > > > > > > Below is my code. Please let me know what I'm doing wrong. > > > > > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, > NULL, > > > > > &BufferSize, Buffer); // Get BufferSize > > > > > if (EFI_ERROR(Status)) > > > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > > > > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > > > > > (void**)&Buffer); > > > > > if (EFI_ERROR(Status)) > > > > > Print(L"AllocatePool Status 0x%x\n",Status); > > > > > > > > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, > NULL, > > > > > &BufferSize, Buffer); > > > > > if (EFI_ERROR(Status)) > > > > > Print(L"LocateHandle Status 0x%x\n",Status); > > > > > > > > > > All calls failing with Status being 0x0E. Please help me to solve > > this. > > > > Is > > > > > there any special requirement for using this protocol? > > > > > > > > > > Thanks. > > > > > Regards, > > > > > Keshava > > > > > _______________________________________________ > > > > > 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-21 7:32 LocateHandle for gEfiShellProtocolGuid is failing in my application GN Keshava 2016-12-21 18:36 ` Carsey, Jaben @ 2016-12-21 18:59 ` Andrew Fish 2016-12-21 19:13 ` Andrew Fish 2 siblings, 0 replies; 12+ messages in thread From: Andrew Fish @ 2016-12-21 18:59 UTC (permalink / raw) To: GN Keshava; +Cc: edk2-devel@lists.01.org > On Dec 20, 2016, at 11:32 PM, GN Keshava <keshava.gn@gmail.com> wrote: > > Hi, > > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. > > Below is my code. Please let me know what I'm doing wrong. > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > You can use %r with Print() to decode the error. https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h <https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h> - r - The argument is a RETURN_STATUS value. This value is converted to a string following the table below. This does not follow ANSI C. - RETURN_SUCCESS - "Success" - RETURN_LOAD_ERROR - "Load Error" - RETURN_INVALID_PARAMETER - "Invalid Parameter" - RETURN_UNSUPPORTED - "Unsupported" - RETURN_BAD_BUFFER_SIZE - "Bad Buffer Size" - RETURN_BUFFER_TOO_SMALL - "Buffer Too Small" - RETURN_NOT_READY - "Not Ready" Thanks, Andrew Fish > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > All calls failing with Status being 0x0E. Please help me to solve this. Is > there any special requirement for using this protocol? > > Thanks. > Regards, > Keshava > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-21 7:32 LocateHandle for gEfiShellProtocolGuid is failing in my application GN Keshava 2016-12-21 18:36 ` Carsey, Jaben 2016-12-21 18:59 ` Andrew Fish @ 2016-12-21 19:13 ` Andrew Fish 2016-12-22 2:00 ` GN Keshava 2 siblings, 1 reply; 12+ messages in thread From: Andrew Fish @ 2016-12-21 19:13 UTC (permalink / raw) To: GN Keshava; +Cc: edk2-devel@lists.01.org > On Dec 20, 2016, at 11:32 PM, GN Keshava <keshava.gn@gmail.com> wrote: > > Hi, > > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. > > Below is my code. Please let me know what I'm doing wrong. > Assuming this is your entire code fragment you are passing 2 uninitialized values If you want to probe the size you need to: BufferSize = 0; > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) Per the spec you would expect to get Status = EFI_BUFFER_TOO_SMALL if you need to grow the size. You should only allocate the buffer and retry if you get EFI_BUFFER_TOO_SMALL. You don't handle the case of EFI_NOT_FOUND. FYI the error codes are defined in the UEFI Spec and exist here in the code: https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h <https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h> /// /// The buffer was not large enough to hold the requested data. /// The required buffer size is returned in the appropriate /// parameter when this error occurs. /// #define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5) ... /// /// The item was not found. /// #define RETURN_NOT_FOUND ENCODE_ERROR (14) #define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | (StatusCode))) MAX_BIT is going to be defined as BIT63 or BIT31 depending on the CPU architecture you are using. > Print(L"LocateHandle Status 0x%x\n",Status); > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); > I mentioned in the other mail that you can use %r to get a string for the error. Thanks, Andrew Fish > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > All calls failing with Status being 0x0E. Please help me to solve this. Is > there any special requirement for using this protocol? > > Thanks. > Regards, > Keshava > ___________________________________ ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: LocateHandle for gEfiShellProtocolGuid is failing in my application 2016-12-21 19:13 ` Andrew Fish @ 2016-12-22 2:00 ` GN Keshava 0 siblings, 0 replies; 12+ messages in thread From: GN Keshava @ 2016-12-22 2:00 UTC (permalink / raw) To: Andrew Fish, Carsey, Jaben; +Cc: edk2-devel Thanks a lot, Andrew and Jaben. I will check these and get back... Thanks again. :) Regards, Keshava On ಗುರು, ಡಿಸೆಂ 22, 2016 12:43 ಪೂರ್ವಾಹ್ನ Andrew Fish <afish@apple.com> wrote: > On Dec 20, 2016, at 11:32 PM, GN Keshava <keshava.gn@gmail.com> wrote: > > Hi, > > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. > > Below is my code. Please let me know what I'm doing wrong. > > > Assuming this is your entire code fragment you are passing 2 uninitialized > values > > If you want to probe the size you need to: > BufferSize = 0; > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) > > > Per the spec you would expect to get Status = EFI_BUFFER_TOO_SMALL if you > need to grow the size. You should only allocate the buffer and retry if you > get EFI_BUFFER_TOO_SMALL. > > You don't handle the case of EFI_NOT_FOUND. > > FYI the error codes are defined in the UEFI Spec and exist here in the > code: > https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h > > > /// > /// The buffer was not large enough to hold the requested data. > /// The required buffer size is returned in the appropriate > /// parameter when this error occurs. > /// > #define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5) > > > ... > > /// > /// The item was not found. > /// > #define RETURN_NOT_FOUND ENCODE_ERROR (14) > > > #define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | (StatusCode))) > > > MAX_BIT is going to be defined as BIT63 or BIT31 depending on the CPU > architecture you are using. > > > Print(L"LocateHandle Status 0x%x\n",Status); > > Status = gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); > > > I mentioned in the other mail that you can use %r to get a string for the > error. > > Thanks, > > Andrew Fish > > > Status = gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); > > All calls failing with Status being 0x0E. Please help me to solve this. Is > there any special requirement for using this protocol? > > Thanks. > Regards, > Keshava > > ___________________________________ > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-12-28 14:56 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-12-21 7:32 LocateHandle for gEfiShellProtocolGuid is failing in my application GN Keshava 2016-12-21 18:36 ` Carsey, Jaben 2016-12-22 9:35 ` GN Keshava 2016-12-22 10:07 ` GN Keshava 2016-12-22 16:56 ` Carsey, Jaben 2016-12-23 4:06 ` GN Keshava 2016-12-27 23:28 ` Carsey, Jaben 2016-12-28 4:16 ` GN Keshava 2016-12-28 14:56 ` Carsey, Jaben 2016-12-21 18:59 ` Andrew Fish 2016-12-21 19:13 ` Andrew Fish 2016-12-22 2:00 ` GN Keshava
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox