summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Ebl/Ebl.h
blob: 03b4ba29fb4b1727d9c1af06a0ad4412aaf02e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/** @file
  Include file for basic command line parser for EBL (Embedded Boot Loader)

  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
  Portions copyright (c) 2008 - 2009, Apple Inc. 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.

**/

#ifndef __EBL_H__
#define __EBL_H__

#include <PiDxe.h>
#include <Protocol/BlockIo.h>             
#include <Protocol/SimpleFileSystem.h>      
#include <Protocol/FirmwareVolume2.h>        
#include <Protocol/LoadFile.h>              
#include <Protocol/FirmwareVolumeBlock.h> 
#include <Protocol/PxeBaseCode.h> 
#include <Protocol/LoadedImage.h> 
#include <Protocol/EblAddCommand.h>
#include <Protocol/PciIo.h>
#include <Protocol/DevicePath.h>

#include <Guid/FileInfo.h>
#include <Guid/DxeServices.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/MemoryAllocationHob.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiLib.h>   
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/DebugLib.h>
#include <Library/EfiFileLib.h>
#include <Library/HobLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/EblCmdLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
#include <Library/EblNetworkLib.h>
#include <Library/TimerLib.h>

#include <IndustryStandard/Pci.h>

//
// Prompt for the command line
//
#define CMD_SEPARATOR             ';'
#define EBL_MAX_COMMAND_COUNT     0x100
#define MAX_CMD_HISTORY           16
#define MAX_CMD_LINE              256
#define MAX_ARGS                  32

#define EBL_CR                    0x0a
#define EBL_LF                    0x0d

#define EFI_SET_TIMER_TO_SECOND   10000000



EBL_COMMAND_TABLE *
EblGetCommand (
  IN CHAR8                        *CommandName
  );


EFI_STATUS
EblPathToDevice (
  IN  CHAR8                       *Path,
  OUT EFI_HANDLE                  *DeviceHandle,
  OUT EFI_DEVICE_PATH_PROTOCOL    **PathDevicePath,
  OUT VOID                        **Buffer,
  OUT UINTN                       *BufferSize
  );

BOOLEAN
EblAnyKeyToContinueQtoQuit (
  IN  UINTN                       *CurrentRow,
  IN  BOOLEAN                     PrefixNewline
  );

VOID
EblUpdateDeviceLists (
  VOID
  );

VOID
EblInitializeCmdTable (
  VOID
  );

VOID
EblShutdownExternalCmdTable (
  VOID
  );

VOID
EblSetTextColor (
  UINTN                           Attribute
  );


EFI_STATUS
EblGetCharKey (
  IN OUT EFI_INPUT_KEY            *Key,
  IN     UINTN                    TimoutInSec,
  IN     EBL_GET_CHAR_CALL_BACK   CallBack   OPTIONAL
  );

// BugBug: Move me to a library
INTN
EFIAPI
AsciiStrniCmp (
  IN      CONST CHAR8             *FirstString,
  IN      CONST CHAR8             *SecondString,
  IN      UINTN                   Length
  );


VOID
EblInitializeDeviceCmd (
  VOID
  );

VOID
EblInitializemdHwDebugCmds (
  VOID
  );

VOID
EblInitializeDirCmd (
  VOID
  );

VOID
EblInitializeHobCmd (
  VOID
  );

VOID
EblInitializemdHwIoDebugCmds (
  VOID
  );

VOID
EblInitializeScriptCmd (
  VOID
  );

VOID
EblInitializeNetworkCmd (
  VOID
  );

VOID
EblInitializeVariableCmds (
  VOID
  );

CHAR8 *
ParseArguments (
  IN  CHAR8                       *CmdLine,
  OUT UINTN                       *Argc,
  OUT CHAR8                       **Argv
  );

EFI_STATUS
ProcessCmdLine (
  IN CHAR8                        *CmdLine,
  IN UINTN                        MaxCmdLineSize
  );

EFI_STATUS
OutputData (
  IN UINT8                        *Address,
  IN UINTN                        Length,
  IN UINTN                         Width,
  IN UINTN                        Offset
  );
  
UINTN
WidthFromCommandName (
  IN CHAR8                        *Argv,
  IN UINTN                        Default
  );


extern UINTN                      gScreenColumns;
extern UINTN                      gScreenRows;
extern BOOLEAN                    gPageBreak;
extern CHAR8                      *gMemMapType[];

#endif