public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Improvement at Wiki (EFI_SHELL_INTERFACE)
@ 2017-01-07 21:13 Rafael Machado
  2017-01-09 15:44 ` Carsey, Jaben
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael Machado @ 2017-01-07 21:13 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hi everyone

During a a development I faced the following wiki information at
tianocore's github:

https://github.com/tianocore/tianocore.github.io/wiki/Creating-a-Shell-Application#Using_EFI_SHELL_PROTOCOL

I remember a case when I was working with a system that didn't have a
instance of the EFI_SHELL_PARAMETERS_PROTOCOL, and the solution was to use
the EFI_SHELL_INTERFACE protocol, that seems to be a newer protocol to be
used when doing something like what the wiki presents.

I believe it would be nice to update this wiki adding this information.

Thanks and Regards
Rafael R. Machado


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Improvement at Wiki (EFI_SHELL_INTERFACE)
  2017-01-07 21:13 Improvement at Wiki (EFI_SHELL_INTERFACE) Rafael Machado
@ 2017-01-09 15:44 ` Carsey, Jaben
  2017-01-09 18:22   ` Jarlstrom, Laurie
  0 siblings, 1 reply; 3+ messages in thread
From: Carsey, Jaben @ 2017-01-09 15:44 UTC (permalink / raw)
  To: Rafael Machado, edk2-devel@lists.01.org; +Cc: Carsey, Jaben

Rafael,

Actually it's the opposite.  EFI_SHELL_INTERFACE is the older and deprecated protocol.  I do not know of any active development using that protocol.

-Jaben

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Rafael
> Machado
> Sent: Saturday, January 7, 2017 1:14 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Improvement at Wiki (EFI_SHELL_INTERFACE)
> Importance: High
> 
> Hi everyone
> 
> During a a development I faced the following wiki information at tianocore's
> github:
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Creating-a-Shell-
> Application#Using_EFI_SHELL_PROTOCOL
> 
> I remember a case when I was working with a system that didn't have a instance
> of the EFI_SHELL_PARAMETERS_PROTOCOL, and the solution was to use the
> EFI_SHELL_INTERFACE protocol, that seems to be a newer protocol to be used
> when doing something like what the wiki presents.
> 
> I believe it would be nice to update this wiki adding this information.
> 
> Thanks and Regards
> Rafael R. Machado
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Improvement at Wiki (EFI_SHELL_INTERFACE)
  2017-01-09 15:44 ` Carsey, Jaben
@ 2017-01-09 18:22   ` Jarlstrom, Laurie
  0 siblings, 0 replies; 3+ messages in thread
From: Jarlstrom, Laurie @ 2017-01-09 18:22 UTC (permalink / raw)
  To: Carsey, Jaben, Rafael Machado, edk2-devel@lists.01.org; +Cc: Carsey, Jaben

Rafael,

You may have been referring to the EFI_SHELL_INTERFACE that is the older protocol from the EFI Shell Interface protocol from EDK (1) shell (no Specification).
If you are using older UEFI Firmware with the EDK 1 Shell not the EDK II Shell 2 then you can use this protocol.

You can check which Shell your app is getting called from by checking which of the protocols it getting used:

Here is a snippet of code to determine :

EFI_STATUS
EFIAPI
UefiMain (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
 EFI_STATUS      Status;
 EFI_SHELL_PARAMETERS_PROTOCOL    *EfiShellParametersProtocol;  // EfiShellParameters.h
 EFI_SHELL_INTERFACE              	  *EfiShellInterface;  // EfiShellInterface.h

 UINTN	   Argc;
 CHAR16	   **Argv;
 EFI_GUID  mEfiShellParametersProtocolGuid = EFI_SHELL_PARAMETERS_PROTOCOL_GUID;  // Current UEFI Shell 2.
 EFI_GUID  mEfiShellInterfaceGuid = SHELL_INTERFACE_PROTOCOL_GUID;			// Older EDK Shell 1

 
 //Initialize local protocol pointers
  EfiShellParametersProtocol = NULL;
  EfiShellInterface = NULL;

  // check input parameters from command line using UEFI Shell 2.0
 Status = gBS->OpenProtocol(ImageHandle,
            &mEfiShellParametersProtocolGuid,
            (VOID **)&EfiShellParametersProtocol,
            ImageHandle,
            NULL,
            EFI_OPEN_PROTOCOL_GET_PROTOCOL
            ); 
 if (!EFI_ERROR(Status)) {
  // use shell 2.0 interface
	  Print(L"Using UEFI Shell 2.0 Parameter Protocol\n"); 
      Argc = EfiShellParametersProtocol->Argc;
      Argv = EfiShellParametersProtocol->Argv;
    // Call our main with Argc / Argv parameters 
      SampleMain ( Argc, Argv);  // TODO what you need to do for using UEFI Shell 2
 }else{ // else check if EFI Shell 1.0 
      Status = gBS->OpenProtocol(ImageHandle,
                  &mEfiShellInterfaceGuid,
                  (VOID **)&EfiShellInterface,
                  ImageHandle,
                  NULL,
                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
                  );
	     if (!EFI_ERROR(Status)) 
		{
			Print(L"Using EFI Shell 1.0 Interface Protocol\n"); 
			Argc = EfiShellInterface->Argc;
			Argv = EfiShellInterface->Argv;
			SampleMain ( Argc, Argv);   // TODO What you need to do to use EFI Shell 1.0 
	     }else {
		      Print(L"\nGetting Shell params did NOT work: \n");
	     }
 }

  
	return EFI_SUCCESS;
}



thanks,
Laurie
 
laurie.jarlstrom@intel.com

Intel SSG/STO/EBP
(503) 712-9395


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Carsey, Jaben
Sent: Monday, January 09, 2017 7:44 AM
To: Rafael Machado; edk2-devel@lists.01.org
Cc: Carsey, Jaben
Subject: Re: [edk2] Improvement at Wiki (EFI_SHELL_INTERFACE)

Rafael,

Actually it's the opposite.  EFI_SHELL_INTERFACE is the older and deprecated protocol.  I do not know of any active development using that protocol.

-Jaben

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
> Rafael Machado
> Sent: Saturday, January 7, 2017 1:14 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Improvement at Wiki (EFI_SHELL_INTERFACE)
> Importance: High
> 
> Hi everyone
> 
> During a a development I faced the following wiki information at 
> tianocore's
> github:
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Creating-a-Shell
> -
> Application#Using_EFI_SHELL_PROTOCOL
> 
> I remember a case when I was working with a system that didn't have a 
> instance of the EFI_SHELL_PARAMETERS_PROTOCOL, and the solution was to 
> use the EFI_SHELL_INTERFACE protocol, that seems to be a newer 
> protocol to be used when doing something like what the wiki presents.
> 
> I believe it would be nice to update this wiki adding this information.
> 
> Thanks and Regards
> Rafael R. Machado
> _______________________________________________
> 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] 3+ messages in thread

end of thread, other threads:[~2017-01-09 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-07 21:13 Improvement at Wiki (EFI_SHELL_INTERFACE) Rafael Machado
2017-01-09 15:44 ` Carsey, Jaben
2017-01-09 18:22   ` Jarlstrom, Laurie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox