• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Include file for basic command line parser for EBL (Embedded Boot Loader)
3 
4   Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
5   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6   (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
7 
8   This program and the accompanying materials
9   are licensed and made available under the terms and conditions of the BSD License
10   which accompanies this distribution.  The full text of the license may be found at
11   http://opensource.org/licenses/bsd-license.php
12 
13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16 **/
17 
18 #ifndef __EBL_H__
19 #define __EBL_H__
20 
21 #include <PiDxe.h>
22 #include <Protocol/BlockIo.h>
23 #include <Protocol/SimpleFileSystem.h>
24 #include <Protocol/FirmwareVolume2.h>
25 #include <Protocol/LoadFile.h>
26 #include <Protocol/FirmwareVolumeBlock.h>
27 #include <Protocol/PxeBaseCode.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/EblAddCommand.h>
30 #include <Protocol/PciIo.h>
31 #include <Protocol/DevicePath.h>
32 
33 #include <Guid/FileInfo.h>
34 #include <Guid/DxeServices.h>
35 #include <Guid/MemoryTypeInformation.h>
36 #include <Guid/MemoryAllocationHob.h>
37 #include <Library/BaseLib.h>
38 #include <Library/MemoryAllocationLib.h>
39 #include <Library/DevicePathLib.h>
40 #include <Library/PrintLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/UefiLib.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/UefiRuntimeServicesTableLib.h>
45 #include <Library/DebugLib.h>
46 #include <Library/EfiFileLib.h>
47 #include <Library/HobLib.h>
48 #include <Library/DebugLib.h>
49 #include <Library/IoLib.h>
50 #include <Library/PcdLib.h>
51 #include <Library/EblCmdLib.h>
52 #include <Library/DevicePathLib.h>
53 #include <Library/UefiLib.h>
54 #include <Library/EblNetworkLib.h>
55 #include <Library/TimerLib.h>
56 
57 #include <IndustryStandard/Pci.h>
58 
59 //
60 // Prompt for the command line
61 //
62 #define CMD_SEPARATOR             ';'
63 #define EBL_MAX_COMMAND_COUNT     0x100
64 #define MAX_CMD_HISTORY           16
65 #define MAX_CMD_LINE              256
66 #define MAX_ARGS                  32
67 
68 #define EBL_CR                    0x0a
69 #define EBL_LF                    0x0d
70 
71 #define EFI_SET_TIMER_TO_SECOND   10000000
72 
73 
74 
75 EBL_COMMAND_TABLE *
76 EblGetCommand (
77   IN CHAR8                        *CommandName
78   );
79 
80 
81 EFI_STATUS
82 EblPathToDevice (
83   IN  CHAR8                       *Path,
84   OUT EFI_HANDLE                  *DeviceHandle,
85   OUT EFI_DEVICE_PATH_PROTOCOL    **PathDevicePath,
86   OUT VOID                        **Buffer,
87   OUT UINTN                       *BufferSize
88   );
89 
90 BOOLEAN
91 EFIAPI
92 EblAnyKeyToContinueQtoQuit (
93   IN  UINTN                       *CurrentRow,
94   IN  BOOLEAN                     PrefixNewline
95   );
96 
97 VOID
98 EblUpdateDeviceLists (
99   VOID
100   );
101 
102 VOID
103 EblInitializeCmdTable (
104   VOID
105   );
106 
107 VOID
108 EblShutdownExternalCmdTable (
109   VOID
110   );
111 
112 VOID
113 EblSetTextColor (
114   UINTN                           Attribute
115   );
116 
117 
118 EFI_STATUS
119 EFIAPI
120 EblGetCharKey (
121   IN OUT EFI_INPUT_KEY            *Key,
122   IN     UINTN                    TimoutInSec,
123   IN     EBL_GET_CHAR_CALL_BACK   CallBack   OPTIONAL
124   );
125 
126 // BugBug: Move me to a library
127 INTN
128 EFIAPI
129 AsciiStrniCmp (
130   IN      CONST CHAR8             *FirstString,
131   IN      CONST CHAR8             *SecondString,
132   IN      UINTN                   Length
133   );
134 
135 
136 VOID
137 EblInitializeDeviceCmd (
138   VOID
139   );
140 
141 VOID
142 EblInitializemdHwDebugCmds (
143   VOID
144   );
145 
146 VOID
147 EblInitializeDirCmd (
148   VOID
149   );
150 
151 VOID
152 EblInitializeHobCmd (
153   VOID
154   );
155 
156 VOID
157 EblInitializemdHwIoDebugCmds (
158   VOID
159   );
160 
161 VOID
162 EblInitializeScriptCmd (
163   VOID
164   );
165 
166 VOID
167 EblInitializeNetworkCmd (
168   VOID
169   );
170 
171 VOID
172 EblInitializeVariableCmds (
173   VOID
174   );
175 
176 CHAR8 *
177 ParseArguments (
178   IN  CHAR8                       *CmdLine,
179   OUT UINTN                       *Argc,
180   OUT CHAR8                       **Argv
181   );
182 
183 EFI_STATUS
184 ProcessCmdLine (
185   IN CHAR8                        *CmdLine,
186   IN UINTN                        MaxCmdLineSize
187   );
188 
189 EFI_STATUS
190 OutputData (
191   IN UINT8                        *Address,
192   IN UINTN                        Length,
193   IN UINTN                         Width,
194   IN UINTN                        Offset
195   );
196 
197 UINTN
198 WidthFromCommandName (
199   IN CHAR8                        *Argv,
200   IN UINTN                        Default
201   );
202 
203 
204 extern UINTN                      gScreenColumns;
205 extern UINTN                      gScreenRows;
206 extern BOOLEAN                    gPageBreak;
207 extern CHAR8                      *gMemMapType[];
208 
209 #endif
210 
211