1 | /** @file
|
---|
2 | Main file for Dmem shell Debug1 function.
|
---|
3 |
|
---|
4 | Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
---|
6 | (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 |
|
---|
11 | #include "UefiShellDebug1CommandsLib.h"
|
---|
12 | #include <Protocol/PciRootBridgeIo.h>
|
---|
13 | #include <Protocol/HiiDatabase.h>
|
---|
14 | #include <Guid/Acpi.h>
|
---|
15 | #include <Guid/Mps.h>
|
---|
16 | #include <Guid/SmBios.h>
|
---|
17 | #include <Guid/MemoryAttributesTable.h>
|
---|
18 | #include <Guid/RtPropertiesTable.h>
|
---|
19 | #include <Guid/SystemResourceTable.h>
|
---|
20 | #include <Guid/DebugImageInfoTable.h>
|
---|
21 | #include <Guid/ImageAuthentication.h>
|
---|
22 | #include <Guid/ConformanceProfiles.h>
|
---|
23 |
|
---|
24 | /**
|
---|
25 | Make a printable character.
|
---|
26 |
|
---|
27 | If Char is printable then return it, otherwise return a question mark.
|
---|
28 |
|
---|
29 | @param[in] Char The character to make printable.
|
---|
30 |
|
---|
31 | @return A printable character representing Char.
|
---|
32 | **/
|
---|
33 | CHAR16
|
---|
34 | MakePrintable (
|
---|
35 | IN CONST CHAR16 Char
|
---|
36 | )
|
---|
37 | {
|
---|
38 | if (((Char < 0x20) && (Char > 0)) || (Char > 126)) {
|
---|
39 | return (L'?');
|
---|
40 | }
|
---|
41 |
|
---|
42 | return (Char);
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | Display some Memory-Mapped-IO memory.
|
---|
47 |
|
---|
48 | @param[in] Address The starting address to display.
|
---|
49 | @param[in] Size The length of memory to display.
|
---|
50 | **/
|
---|
51 | SHELL_STATUS
|
---|
52 | DisplayMmioMemory (
|
---|
53 | IN CONST VOID *Address,
|
---|
54 | IN CONST UINTN Size
|
---|
55 | )
|
---|
56 | {
|
---|
57 | EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo;
|
---|
58 | EFI_STATUS Status;
|
---|
59 | VOID *Buffer;
|
---|
60 | SHELL_STATUS ShellStatus;
|
---|
61 |
|
---|
62 | ShellStatus = SHELL_SUCCESS;
|
---|
63 |
|
---|
64 | Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **)&PciRbIo);
|
---|
65 | if (EFI_ERROR (Status)) {
|
---|
66 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
|
---|
67 | return (SHELL_NOT_FOUND);
|
---|
68 | }
|
---|
69 |
|
---|
70 | Buffer = AllocateZeroPool (Size);
|
---|
71 | if (Buffer == NULL) {
|
---|
72 | return SHELL_OUT_OF_RESOURCES;
|
---|
73 | }
|
---|
74 |
|
---|
75 | Status = PciRbIo->Mem.Read (PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
|
---|
76 | if (EFI_ERROR (Status)) {
|
---|
77 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem");
|
---|
78 | ShellStatus = SHELL_NOT_FOUND;
|
---|
79 | } else {
|
---|
80 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
---|
81 | DumpHex (2, (UINTN)Address, Size, Buffer);
|
---|
82 | }
|
---|
83 |
|
---|
84 | FreePool (Buffer);
|
---|
85 | return (ShellStatus);
|
---|
86 | }
|
---|
87 |
|
---|
88 | /**
|
---|
89 | Display the RtPropertiesTable entries
|
---|
90 |
|
---|
91 | @param[in] Address The pointer to the RtPropertiesTable.
|
---|
92 | **/
|
---|
93 | SHELL_STATUS
|
---|
94 | DisplayRtProperties (
|
---|
95 | IN UINT64 Address
|
---|
96 | )
|
---|
97 | {
|
---|
98 | EFI_RT_PROPERTIES_TABLE *RtPropertiesTable;
|
---|
99 | UINT32 RtServices;
|
---|
100 | SHELL_STATUS ShellStatus;
|
---|
101 | EFI_STATUS Status;
|
---|
102 |
|
---|
103 | ShellStatus = SHELL_SUCCESS;
|
---|
104 |
|
---|
105 | if (Address != 0) {
|
---|
106 | EfiGetSystemConfigurationTable (&gEfiRtPropertiesTableGuid, (VOID **)&RtPropertiesTable);
|
---|
107 |
|
---|
108 | RtServices = (UINT32)RtPropertiesTable->RuntimeServicesSupported;
|
---|
109 | Status = ShellPrintHiiEx (
|
---|
110 | -1,
|
---|
111 | -1,
|
---|
112 | NULL,
|
---|
113 | STRING_TOKEN (STR_DMEM_RT_PROPERTIES),
|
---|
114 | gShellDebug1HiiHandle,
|
---|
115 | EFI_RT_PROPERTIES_TABLE_VERSION,
|
---|
116 | (RtServices & EFI_RT_SUPPORTED_GET_TIME) ? 1 : 0,
|
---|
117 | (RtServices & EFI_RT_SUPPORTED_SET_TIME) ? 1 : 0,
|
---|
118 | (RtServices & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) ? 1 : 0,
|
---|
119 | (RtServices & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) ? 1 : 0,
|
---|
120 | (RtServices & EFI_RT_SUPPORTED_GET_VARIABLE) ? 1 : 0,
|
---|
121 | (RtServices & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) ? 1 : 0,
|
---|
122 | (RtServices & EFI_RT_SUPPORTED_SET_VARIABLE) ? 1 : 0,
|
---|
123 | (RtServices & EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP) ? 1 : 0,
|
---|
124 | (RtServices & EFI_RT_SUPPORTED_CONVERT_POINTER) ? 1 : 0,
|
---|
125 | (RtServices & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) ? 1 : 0,
|
---|
126 | (RtServices & EFI_RT_SUPPORTED_RESET_SYSTEM) ? 1 : 0,
|
---|
127 | (RtServices & EFI_RT_SUPPORTED_UPDATE_CAPSULE) ? 1 : 0,
|
---|
128 | (RtServices & EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES) ? 1 : 0,
|
---|
129 | (RtServices & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) ? 1 : 0
|
---|
130 | );
|
---|
131 |
|
---|
132 | if (EFI_ERROR (Status)) {
|
---|
133 | ShellStatus = SHELL_ABORTED;
|
---|
134 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"RtPropertiesTable");
|
---|
135 | }
|
---|
136 | } else {
|
---|
137 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), gShellDebug1HiiHandle, L"RtPropertiesTable");
|
---|
138 | }
|
---|
139 |
|
---|
140 | return (ShellStatus);
|
---|
141 | }
|
---|
142 |
|
---|
143 | /**
|
---|
144 | Retrieve the ImageExecutionTable Entry ImageName from ImagePath
|
---|
145 |
|
---|
146 | @param[in] FileName The full path of the image.
|
---|
147 | @param[out] BaseName The name of the image.
|
---|
148 | **/
|
---|
149 | EFI_STATUS
|
---|
150 | GetBaseName (
|
---|
151 | IN CHAR16 *FileName,
|
---|
152 | OUT CHAR16 **BaseName
|
---|
153 | )
|
---|
154 | {
|
---|
155 | UINTN StrLen;
|
---|
156 | CHAR16 *StrTail;
|
---|
157 |
|
---|
158 | StrLen = StrSize (FileName);
|
---|
159 |
|
---|
160 | for (StrTail = FileName + StrLen - 1; StrTail != FileName && *StrTail != L'\\'; StrTail--) {
|
---|
161 | }
|
---|
162 |
|
---|
163 | if (StrTail == FileName) {
|
---|
164 | return EFI_NOT_FOUND;
|
---|
165 | }
|
---|
166 |
|
---|
167 | *BaseName = StrTail+1;
|
---|
168 |
|
---|
169 | return EFI_SUCCESS;
|
---|
170 | }
|
---|
171 |
|
---|
172 | /**
|
---|
173 | Retrieve the ImageExecutionTable entries.
|
---|
174 | **/
|
---|
175 | EFI_STATUS
|
---|
176 | GetImageExecutionInfo (
|
---|
177 | )
|
---|
178 | {
|
---|
179 | EFI_STATUS Status;
|
---|
180 | EFI_IMAGE_EXECUTION_INFO_TABLE *ExecInfoTablePtr;
|
---|
181 | EFI_IMAGE_EXECUTION_INFO *InfoPtr;
|
---|
182 | CHAR8 *ptr;
|
---|
183 | CHAR16 *ImagePath;
|
---|
184 | CHAR16 *ImageName;
|
---|
185 | UINTN Image;
|
---|
186 | UINTN *NumberOfImages;
|
---|
187 | CHAR16 *ActionType;
|
---|
188 |
|
---|
189 | EfiGetSystemConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID **)&ExecInfoTablePtr);
|
---|
190 |
|
---|
191 | NumberOfImages = &ExecInfoTablePtr->NumberOfImages;
|
---|
192 |
|
---|
193 | ptr = (CHAR8 *)ExecInfoTablePtr + 1;
|
---|
194 |
|
---|
195 | Status = EFI_NOT_FOUND;
|
---|
196 |
|
---|
197 | for (Image = 0; Image < *NumberOfImages; Image++, ptr += InfoPtr->InfoSize) {
|
---|
198 | InfoPtr = (EFI_IMAGE_EXECUTION_INFO *)ptr;
|
---|
199 | ImagePath = (CHAR16 *)(InfoPtr + 1);
|
---|
200 |
|
---|
201 | GetBaseName (ImagePath, &ImageName);
|
---|
202 |
|
---|
203 | switch (InfoPtr->Action) {
|
---|
204 | case EFI_IMAGE_EXECUTION_AUTHENTICATION:
|
---|
205 | ActionType = L"AUTHENTICATION";
|
---|
206 | break;
|
---|
207 | case EFI_IMAGE_EXECUTION_AUTH_UNTESTED:
|
---|
208 | ActionType = L"AUTH_UNTESTED";
|
---|
209 | break;
|
---|
210 | case EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED:
|
---|
211 | ActionType = L"AUTH_SIG_FAILED";
|
---|
212 | break;
|
---|
213 | case EFI_IMAGE_EXECUTION_AUTH_SIG_PASSED:
|
---|
214 | ActionType = L"AUTH_SIG_PASSED";
|
---|
215 | break;
|
---|
216 | case EFI_IMAGE_EXECUTION_AUTH_SIG_NOT_FOUND:
|
---|
217 | ActionType = L"AUTH_SIG_NOT_FOUND";
|
---|
218 | break;
|
---|
219 | case EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND:
|
---|
220 | ActionType = L"AUTH_SIG_FOUND";
|
---|
221 | break;
|
---|
222 | case EFI_IMAGE_EXECUTION_POLICY_FAILED:
|
---|
223 | ActionType = L"POLICY_FAILED";
|
---|
224 | break;
|
---|
225 | case EFI_IMAGE_EXECUTION_INITIALIZED:
|
---|
226 | ActionType = L"INITIALIZED";
|
---|
227 | break;
|
---|
228 | default:
|
---|
229 | ActionType = L"invalid action";
|
---|
230 | }
|
---|
231 |
|
---|
232 | Status = ShellPrintHiiEx (
|
---|
233 | -1,
|
---|
234 | -1,
|
---|
235 | NULL,
|
---|
236 | STRING_TOKEN (STR_DMEM_IMG_EXE_ENTRY),
|
---|
237 | gShellDebug1HiiHandle,
|
---|
238 | ImageName,
|
---|
239 | ActionType
|
---|
240 | );
|
---|
241 | }
|
---|
242 |
|
---|
243 | return Status;
|
---|
244 | }
|
---|
245 |
|
---|
246 | /**
|
---|
247 | Display the ImageExecutionTable entries
|
---|
248 |
|
---|
249 | @param[in] Address The pointer to the ImageExecutionTable.
|
---|
250 | **/
|
---|
251 | SHELL_STATUS
|
---|
252 | DisplayImageExecutionEntries (
|
---|
253 | IN UINT64 Address
|
---|
254 | )
|
---|
255 | {
|
---|
256 | SHELL_STATUS ShellStatus;
|
---|
257 | EFI_STATUS Status;
|
---|
258 |
|
---|
259 | ShellStatus = SHELL_SUCCESS;
|
---|
260 |
|
---|
261 | if (Address != 0) {
|
---|
262 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_IMG_EXE_TABLE), gShellDebug1HiiHandle);
|
---|
263 | Status = GetImageExecutionInfo ();
|
---|
264 | if (EFI_ERROR (Status)) {
|
---|
265 | ShellStatus = SHELL_ABORTED;
|
---|
266 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"ImageExecutionTable");
|
---|
267 | }
|
---|
268 | } else {
|
---|
269 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), gShellDebug1HiiHandle, L"ImageExecutionTable");
|
---|
270 | }
|
---|
271 |
|
---|
272 | return (ShellStatus);
|
---|
273 | }
|
---|
274 |
|
---|
275 | /**
|
---|
276 | Display the ConformanceProfileTable entries
|
---|
277 |
|
---|
278 | @param[in] Address The pointer to the ConformanceProfileTable.
|
---|
279 | **/
|
---|
280 | SHELL_STATUS
|
---|
281 | DisplayConformanceProfiles (
|
---|
282 | IN UINT64 Address
|
---|
283 | )
|
---|
284 | {
|
---|
285 | SHELL_STATUS ShellStatus;
|
---|
286 | EFI_STATUS Status;
|
---|
287 | EFI_GUID *EntryGuid;
|
---|
288 | CHAR16 *GuidName;
|
---|
289 | UINTN Profile;
|
---|
290 | EFI_CONFORMANCE_PROFILES_TABLE *ConfProfTable;
|
---|
291 |
|
---|
292 | Status = EFI_SUCCESS;
|
---|
293 | ShellStatus = SHELL_SUCCESS;
|
---|
294 |
|
---|
295 | if (Address != 0) {
|
---|
296 | EfiGetSystemConfigurationTable (&gEfiConfProfilesTableGuid, (VOID **)&ConfProfTable);
|
---|
297 |
|
---|
298 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle);
|
---|
299 |
|
---|
300 | EntryGuid = (EFI_GUID *)(ConfProfTable + 1);
|
---|
301 |
|
---|
302 | for (Profile = 0; Profile < ConfProfTable->NumberOfProfiles; Profile++, EntryGuid++) {
|
---|
303 | GuidName = L"Unknown_Profile";
|
---|
304 |
|
---|
305 | if (CompareGuid (EntryGuid, &gEfiConfProfilesUefiSpecGuid)) {
|
---|
306 | GuidName = L"EFI_CONFORMANCE_PROFILE_UEFI_SPEC_GUID";
|
---|
307 | }
|
---|
308 |
|
---|
309 | if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec21Guid)) {
|
---|
310 | GuidName = L"EBBR_2.1";
|
---|
311 | }
|
---|
312 |
|
---|
313 | if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec22Guid)) {
|
---|
314 | GuidName = L"EBBR_2.2";
|
---|
315 | }
|
---|
316 |
|
---|
317 | Status = ShellPrintHiiEx (
|
---|
318 | -1,
|
---|
319 | -1,
|
---|
320 | NULL,
|
---|
321 | STRING_TOKEN (STR_DMEM_CONF_PRO_ROW),
|
---|
322 | gShellDebug1HiiHandle,
|
---|
323 | GuidName,
|
---|
324 | EntryGuid
|
---|
325 | );
|
---|
326 | }
|
---|
327 |
|
---|
328 | if (EFI_ERROR (Status)) {
|
---|
329 | ShellStatus = SHELL_ABORTED;
|
---|
330 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"ComformanceProfilesTable");
|
---|
331 | }
|
---|
332 | } else {
|
---|
333 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle);
|
---|
334 | ShellPrintHiiEx (
|
---|
335 | -1,
|
---|
336 | -1,
|
---|
337 | NULL,
|
---|
338 | STRING_TOKEN (STR_DMEM_CONF_PRO_ROW),
|
---|
339 | gShellDebug1HiiHandle,
|
---|
340 | L"EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID",
|
---|
341 | &gEfiConfProfilesUefiSpecGuid
|
---|
342 | );
|
---|
343 | }
|
---|
344 |
|
---|
345 | return (ShellStatus);
|
---|
346 | }
|
---|
347 |
|
---|
348 | STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
---|
349 | { L"-mmio", TypeFlag },
|
---|
350 | { L"-verbose", TypeFlag },
|
---|
351 | { NULL, TypeMax }
|
---|
352 | };
|
---|
353 |
|
---|
354 | /**
|
---|
355 | Function for 'dmem' command.
|
---|
356 |
|
---|
357 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
358 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
359 | **/
|
---|
360 | SHELL_STATUS
|
---|
361 | EFIAPI
|
---|
362 | ShellCommandRunDmem (
|
---|
363 | IN EFI_HANDLE ImageHandle,
|
---|
364 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
365 | )
|
---|
366 | {
|
---|
367 | EFI_STATUS Status;
|
---|
368 | LIST_ENTRY *Package;
|
---|
369 | CHAR16 *ProblemParam;
|
---|
370 | SHELL_STATUS ShellStatus;
|
---|
371 | VOID *Address;
|
---|
372 | UINT64 Size;
|
---|
373 | CONST CHAR16 *Temp1;
|
---|
374 | UINT64 AcpiTableAddress;
|
---|
375 | UINT64 Acpi20TableAddress;
|
---|
376 | UINT64 SalTableAddress;
|
---|
377 | UINT64 SmbiosTableAddress;
|
---|
378 | UINT64 MpsTableAddress;
|
---|
379 | UINT64 DtbTableAddress;
|
---|
380 | UINT64 MemoryAttributesTableAddress;
|
---|
381 | UINT64 RtPropertiesTableAddress;
|
---|
382 | UINT64 SystemResourceTableAddress;
|
---|
383 | UINT64 DebugImageInfoTableAddress;
|
---|
384 | UINT64 ImageExecutionTableAddress;
|
---|
385 | UINT64 JsonConfigDataTableAddress;
|
---|
386 | UINT64 JsonCapsuleDataTableAddress;
|
---|
387 | UINT64 JsonCapsuleResultTableAddress;
|
---|
388 | UINT64 MemoryRangeCapsuleAddress;
|
---|
389 | UINT64 HiiDatabaseExportBufferAddress;
|
---|
390 | UINT64 ConformanceProfileTableAddress;
|
---|
391 | UINTN TableWalker;
|
---|
392 |
|
---|
393 | ShellStatus = SHELL_SUCCESS;
|
---|
394 | Status = EFI_SUCCESS;
|
---|
395 | Address = NULL;
|
---|
396 | Size = 0;
|
---|
397 |
|
---|
398 | //
|
---|
399 | // initialize the shell lib (we must be in non-auto-init...)
|
---|
400 | //
|
---|
401 | Status = ShellInitialize ();
|
---|
402 | ASSERT_EFI_ERROR (Status);
|
---|
403 |
|
---|
404 | Status = CommandInit ();
|
---|
405 | ASSERT_EFI_ERROR (Status);
|
---|
406 |
|
---|
407 | //
|
---|
408 | // parse the command line
|
---|
409 | //
|
---|
410 | Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
---|
411 | if (EFI_ERROR (Status)) {
|
---|
412 | if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
---|
413 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
|
---|
414 | FreePool (ProblemParam);
|
---|
415 | ShellStatus = SHELL_INVALID_PARAMETER;
|
---|
416 | } else {
|
---|
417 | ASSERT (FALSE);
|
---|
418 | }
|
---|
419 | } else {
|
---|
420 | if (ShellCommandLineGetCount (Package) > 3) {
|
---|
421 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem");
|
---|
422 | ShellStatus = SHELL_INVALID_PARAMETER;
|
---|
423 | } else {
|
---|
424 | Temp1 = ShellCommandLineGetRawValue (Package, 1);
|
---|
425 | if (Temp1 == NULL) {
|
---|
426 | Address = gST;
|
---|
427 | Size = sizeof (*gST);
|
---|
428 | } else {
|
---|
429 | if (!ShellIsHexOrDecimalNumber (Temp1, TRUE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, (UINT64 *)&Address, TRUE, FALSE))) {
|
---|
430 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
---|
431 | ShellStatus = SHELL_INVALID_PARAMETER;
|
---|
432 | }
|
---|
433 |
|
---|
434 | Temp1 = ShellCommandLineGetRawValue (Package, 2);
|
---|
435 | if (Temp1 == NULL) {
|
---|
436 | Size = 512;
|
---|
437 | } else {
|
---|
438 | if (!ShellIsHexOrDecimalNumber (Temp1, FALSE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, &Size, TRUE, FALSE))) {
|
---|
439 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
---|
440 | ShellStatus = SHELL_INVALID_PARAMETER;
|
---|
441 | }
|
---|
442 | }
|
---|
443 | }
|
---|
444 | }
|
---|
445 |
|
---|
446 | if (ShellStatus == SHELL_SUCCESS) {
|
---|
447 | if (!ShellCommandLineGetFlag (Package, L"-mmio")) {
|
---|
448 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
---|
449 | DumpHex (2, (UINTN)Address, (UINTN)Size, Address);
|
---|
450 | if (Address == (VOID *)gST) {
|
---|
451 | Acpi20TableAddress = 0;
|
---|
452 | AcpiTableAddress = 0;
|
---|
453 | SalTableAddress = 0;
|
---|
454 | SmbiosTableAddress = 0;
|
---|
455 | MpsTableAddress = 0;
|
---|
456 | DtbTableAddress = 0;
|
---|
457 | MemoryAttributesTableAddress = 0;
|
---|
458 | RtPropertiesTableAddress = 0;
|
---|
459 | SystemResourceTableAddress = 0;
|
---|
460 | DebugImageInfoTableAddress = 0;
|
---|
461 | ImageExecutionTableAddress = 0;
|
---|
462 | JsonConfigDataTableAddress = 0;
|
---|
463 | JsonCapsuleDataTableAddress = 0;
|
---|
464 | JsonCapsuleResultTableAddress = 0;
|
---|
465 | MemoryRangeCapsuleAddress = 0;
|
---|
466 | HiiDatabaseExportBufferAddress = 0;
|
---|
467 | ConformanceProfileTableAddress = 0;
|
---|
468 | for (TableWalker = 0; TableWalker < gST->NumberOfTableEntries; TableWalker++) {
|
---|
469 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
|
---|
470 | Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
471 | continue;
|
---|
472 | }
|
---|
473 |
|
---|
474 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
|
---|
475 | AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
476 | continue;
|
---|
477 | }
|
---|
478 |
|
---|
479 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
|
---|
480 | SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
481 | continue;
|
---|
482 | }
|
---|
483 |
|
---|
484 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
|
---|
485 | SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
486 | continue;
|
---|
487 | }
|
---|
488 |
|
---|
489 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
|
---|
490 | MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
491 | continue;
|
---|
492 | }
|
---|
493 |
|
---|
494 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMemoryAttributesTableGuid)) {
|
---|
495 | MemoryAttributesTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
496 | continue;
|
---|
497 | }
|
---|
498 |
|
---|
499 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiRtPropertiesTableGuid)) {
|
---|
500 | RtPropertiesTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
501 | continue;
|
---|
502 | }
|
---|
503 |
|
---|
504 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSystemResourceTableGuid)) {
|
---|
505 | SystemResourceTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
506 | continue;
|
---|
507 | }
|
---|
508 |
|
---|
509 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiDebugImageInfoTableGuid)) {
|
---|
510 | DebugImageInfoTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
511 | continue;
|
---|
512 | }
|
---|
513 |
|
---|
514 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiImageSecurityDatabaseGuid)) {
|
---|
515 | ImageExecutionTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
516 | continue;
|
---|
517 | }
|
---|
518 |
|
---|
519 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiJsonConfigDataTableGuid)) {
|
---|
520 | JsonConfigDataTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
521 | continue;
|
---|
522 | }
|
---|
523 |
|
---|
524 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiJsonCapsuleDataTableGuid)) {
|
---|
525 | JsonCapsuleDataTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
526 | continue;
|
---|
527 | }
|
---|
528 |
|
---|
529 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiJsonCapsuleResultTableGuid)) {
|
---|
530 | JsonCapsuleResultTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
531 | continue;
|
---|
532 | }
|
---|
533 |
|
---|
534 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiHiiDatabaseProtocolGuid)) {
|
---|
535 | HiiDatabaseExportBufferAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
536 | continue;
|
---|
537 | }
|
---|
538 |
|
---|
539 | if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiConfProfilesTableGuid)) {
|
---|
540 | ConformanceProfileTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
---|
541 | continue;
|
---|
542 | }
|
---|
543 | }
|
---|
544 |
|
---|
545 | ShellPrintHiiEx (
|
---|
546 | -1,
|
---|
547 | -1,
|
---|
548 | NULL,
|
---|
549 | STRING_TOKEN (STR_DMEM_SYSTEM_TABLE),
|
---|
550 | gShellDebug1HiiHandle,
|
---|
551 | (UINT64)(UINTN)Address,
|
---|
552 | gST->Hdr.HeaderSize,
|
---|
553 | gST->Hdr.Revision,
|
---|
554 | (UINT64)(UINTN)gST->ConIn,
|
---|
555 | (UINT64)(UINTN)gST->ConOut,
|
---|
556 | (UINT64)(UINTN)gST->StdErr,
|
---|
557 | (UINT64)(UINTN)gST->RuntimeServices,
|
---|
558 | (UINT64)(UINTN)gST->BootServices,
|
---|
559 | SalTableAddress,
|
---|
560 | AcpiTableAddress,
|
---|
561 | Acpi20TableAddress,
|
---|
562 | MpsTableAddress,
|
---|
563 | SmbiosTableAddress,
|
---|
564 | DtbTableAddress,
|
---|
565 | MemoryAttributesTableAddress,
|
---|
566 | RtPropertiesTableAddress,
|
---|
567 | SystemResourceTableAddress,
|
---|
568 | DebugImageInfoTableAddress,
|
---|
569 | ImageExecutionTableAddress,
|
---|
570 | JsonConfigDataTableAddress,
|
---|
571 | JsonCapsuleDataTableAddress,
|
---|
572 | JsonCapsuleResultTableAddress,
|
---|
573 | MemoryRangeCapsuleAddress,
|
---|
574 | HiiDatabaseExportBufferAddress,
|
---|
575 | ConformanceProfileTableAddress
|
---|
576 | );
|
---|
577 |
|
---|
578 | if (ShellCommandLineGetFlag (Package, L"-verbose")) {
|
---|
579 | if (ShellStatus == SHELL_SUCCESS) {
|
---|
580 | ShellStatus = DisplayRtProperties (RtPropertiesTableAddress);
|
---|
581 | }
|
---|
582 |
|
---|
583 | if (ShellStatus == SHELL_SUCCESS) {
|
---|
584 | ShellStatus = DisplayImageExecutionEntries (ImageExecutionTableAddress);
|
---|
585 | }
|
---|
586 |
|
---|
587 | if (ShellStatus == SHELL_SUCCESS) {
|
---|
588 | ShellStatus = DisplayConformanceProfiles (ConformanceProfileTableAddress);
|
---|
589 | }
|
---|
590 | }
|
---|
591 | }
|
---|
592 | } else {
|
---|
593 | ShellStatus = DisplayMmioMemory (Address, (UINTN)Size);
|
---|
594 | }
|
---|
595 | }
|
---|
596 |
|
---|
597 | ShellCommandLineFreeVarList (Package);
|
---|
598 | }
|
---|
599 |
|
---|
600 | return (ShellStatus);
|
---|
601 | }
|
---|