浏览代码

Move EFI_SHELL_PARAMETERS_PROTOCOL related definitions to efishell.h

As EFI_SHELL_PARAMETERS_PROTOCOL is also defined in UEFI Shell Spec,
put it together with EFI_SHELL_PROTOCOL.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
Jiaqing Zhao 4 年之前
父节点
当前提交
773f30af29
共有 5 个文件被更改,包括 18 次插入68 次删除
  1. 1 0
      inc/efilib.h
  2. 13 0
      inc/efishell.h
  3. 0 63
      inc/efishellparm.h
  4. 2 4
      lib/cmdline.c
  5. 2 1
      lib/data.c

+ 1 - 0
inc/efilib.h

@@ -149,6 +149,7 @@ extern EFI_GUID gEfiDebugSupportProtocolGuid;
 extern EFI_GUID SimpleTextInputExProtocol;
 
 extern EFI_GUID ShellProtocolGuid;
+extern EFI_GUID ShellParametersProtocolGuid;
 
 //
 // EFI Variable strings

+ 13 - 0
inc/efishell.h

@@ -406,4 +406,17 @@ typedef struct _EFI_SHELL_PROTOCOL {
     EFI_SHELL_GET_ENV_EX                      GetEnvEx;
 } EFI_SHELL_PROTOCOL;
 
+#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \
+    { 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } }
+
+INTERFACE_DECL(_EFI_SHELL_PARAMETERS_PROTOCOL);
+
+typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {
+    CHAR16            **Argv;
+    UINTN             Argc;
+    SHELL_FILE_HANDLE StdIn;
+    SHELL_FILE_HANDLE StdOut;
+    SHELL_FILE_HANDLE StdErr;
+} EFI_SHELL_PARAMETERS_PROTOCOL;
+
 #endif

+ 0 - 63
inc/efishellparm.h

@@ -1,63 +0,0 @@
-/** @file
-  EFI_SHELL_PARAMETERS_PROTOCOL as defined in the UEFI Shell 2.0 specification.
-
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD License
-  which accompanies this distribution.  The full text of the license may be found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-/*
- * This is based on ShellPkg/Include/Protocol/EfiShellParameters.h from EDK II.
- */
-
-#ifndef __EFI_SHELL_PARAMETERS_PROTOCOL__
-#define __EFI_SHELL_PARAMETERS_PROTOCOL__
-
-
-// EDK2's ShellBase.h
-typedef VOID *SHELL_FILE_HANDLE;
-
-#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \
-  { \
-  0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } \
-  }
-
-typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {
-  ///
-  /// Points to an Argc-element array of points to NULL-terminated strings containing
-  /// the command-line parameters. The first entry in the array is always the full file
-  /// path of the executable. Any quotation marks that were used to preserve
-  /// whitespace have been removed.
-  ///
-  CHAR16 **Argv;
-
-  ///
-  /// The number of elements in the Argv array.
-  ///
-  UINTN Argc;
-
-  ///
-  /// The file handle for the standard input for this executable. This may be different
-  /// from the ConInHandle in EFI_SYSTEM_TABLE.
-  ///
-  SHELL_FILE_HANDLE StdIn;
-
-  ///
-  /// The file handle for the standard output for this executable. This may be different
-  /// from the ConOutHandle in EFI_SYSTEM_TABLE.
-  ///
-  SHELL_FILE_HANDLE StdOut;
-
-  ///
-  /// The file handle for the standard error output for this executable. This may be
-  /// different from the StdErrHandle in EFI_SYSTEM_TABLE.
-  ///
-  SHELL_FILE_HANDLE StdErr;
-} EFI_SHELL_PARAMETERS_PROTOCOL;
-
-#endif

+ 2 - 4
lib/cmdline.c

@@ -1,8 +1,8 @@
 #include "lib.h"
 
 #include "efiprot.h"
+#include "efishell.h"
 #include "efishellintf.h"
-#include "efishellparm.h"
 
 #ifndef MAX_ARGV_CONTENTS_SIZE
 # define MAX_CMDLINE_SIZE 1024
@@ -77,8 +77,6 @@ INTN GetShellArgcArgv(EFI_HANDLE ImageHandle, CHAR16 **Argv[])
   // Code inspired from EDK2's
   // ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c (BSD)
   EFI_STATUS Status;
-  static const EFI_GUID EfiShellParametersProtocolGuid
-      = EFI_SHELL_PARAMETERS_PROTOCOL_GUID;
   static const EFI_GUID ShellInterfaceProtocolGuid
       = SHELL_INTERFACE_PROTOCOL_GUID;
   EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol = NULL;
@@ -86,7 +84,7 @@ INTN GetShellArgcArgv(EFI_HANDLE ImageHandle, CHAR16 **Argv[])
 
   Status = uefi_call_wrapper(BS->OpenProtocol, 6,
                              ImageHandle,
-                             (EFI_GUID*)&EfiShellParametersProtocolGuid,
+                             (EFI_GUID*)&ShellParametersProtocolGuid,
                              (VOID **)&EfiShellParametersProtocol,
                              ImageHandle,
                              NULL,

+ 2 - 1
lib/data.c

@@ -211,4 +211,5 @@ EFI_GUID SimpleTextInputExProtocol = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
 //
 // Shell protocol GUIDs
 //
-EFI_GUID ShellProtocolGuid = EFI_SHELL_PROTOCOL_GUID;
+EFI_GUID ShellProtocolGuid           = EFI_SHELL_PROTOCOL_GUID;
+EFI_GUID ShellParametersProtocolGuid = EFI_SHELL_PARAMETERS_PROTOCOL_GUID;