TianoCore EDK2 master
Loading...
Searching...
No Matches
Mm.c
Go to the documentation of this file.
1
11#include <Library/ShellLib.h>
12#include <Library/IoLib.h>
14#include <Protocol/DeviceIo.h>
15
16typedef enum {
17 ShellMmMemory,
18 ShellMmMemoryMappedIo,
19 ShellMmIo,
20 ShellMmPci,
21 ShellMmPciExpress
22} SHELL_MM_ACCESS_TYPE;
23
24CONST UINT16 mShellMmAccessTypeStr[] = {
25 STRING_TOKEN (STR_MM_MEM),
26 STRING_TOKEN (STR_MM_MMIO),
27 STRING_TOKEN (STR_MM_IO),
28 STRING_TOKEN (STR_MM_PCI),
29 STRING_TOKEN (STR_MM_PCIE)
30};
31
32STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
33 { L"-mmio", TypeFlag },
34 { L"-mem", TypeFlag },
35 { L"-io", TypeFlag },
36 { L"-pci", TypeFlag },
37 { L"-pcie", TypeFlag },
38 { L"-n", TypeFlag },
39 { L"-w", TypeValue },
40 { NULL, TypeMax }
41};
42
43CONST UINT64 mShellMmMaxNumber[] = {
44 0, MAX_UINT8, MAX_UINT16, 0, MAX_UINT32, 0, 0, 0, MAX_UINT64
45};
46CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth[] = {
47 0, EfiPciWidthUint8, EfiPciWidthUint16, 0, EfiPciWidthUint32, 0, 0, 0, EfiPciWidthUint64
48};
49CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[] = {
50 0, EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, 0, EfiCpuIoWidthUint32, 0, 0, 0, EfiCpuIoWidthUint64
51};
52
65VOID
67 IN BOOLEAN PciFormat,
68 IN UINT64 Address,
69 OUT UINT32 *Segment,
70 OUT UINT8 *Bus,
71 OUT UINT8 *Device OPTIONAL,
72 OUT UINT8 *Function OPTIONAL,
73 OUT UINT32 *Register OPTIONAL
74 )
75{
76 if (PciFormat) {
77 //
78 // PCI Configuration Space.The address will have the format ssssbbddffrr,
79 // where ssss = Segment, bb = Bus, dd = Device, ff = Function and rr = Register.
80 //
81 *Segment = (UINT32)(RShiftU64 (Address, 32) & 0xFFFF);
82 *Bus = (UINT8)(((UINT32)Address) >> 24);
83
84 if (Device != NULL) {
85 *Device = (UINT8)(((UINT32)Address) >> 16);
86 }
87
88 if (Function != NULL) {
89 *Function = (UINT8)(((UINT32)Address) >> 8);
90 }
91
92 if (Register != NULL) {
93 *Register = (UINT8)Address;
94 }
95 } else {
96 //
97 // PCI Express Configuration Space.The address will have the format ssssssbbddffrrr,
98 // where ssss = Segment, bb = Bus, dd = Device, ff = Function and rrr = Register.
99 //
100 *Segment = (UINT32)(RShiftU64 (Address, 36) & 0xFFFF);
101 *Bus = (UINT8)RShiftU64 (Address, 28);
102 if (Device != NULL) {
103 *Device = (UINT8)(((UINT32)Address) >> 20);
104 }
105
106 if (Function != NULL) {
107 *Function = (UINT8)(((UINT32)Address) >> 12);
108 }
109
110 if (Register != NULL) {
111 *Register = (UINT32)(Address & 0xFFF);
112 }
113 }
114}
115
127VOID
129 IN SHELL_MM_ACCESS_TYPE AccessType,
130 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
132 IN BOOLEAN Read,
133 IN UINT64 Address,
134 IN UINTN Size,
135 IN OUT VOID *Buffer
136 )
137{
138 EFI_STATUS Status;
141 UINT32 Segment;
142 UINT8 Bus;
143 UINT8 Device;
144 UINT8 Function;
145 UINT32 Register;
146
147 if (AccessType == ShellMmMemory) {
148 if (Read) {
149 CopyMem (Buffer, (VOID *)(UINTN)Address, Size);
150 } else {
151 CopyMem ((VOID *)(UINTN)Address, Buffer, Size);
152 }
153 } else {
154 RootBridgeIoMem = NULL;
155 CpuIoMem = NULL;
156 switch (AccessType) {
157 case ShellMmPci:
158 case ShellMmPciExpress:
159 ASSERT (PciRootBridgeIo != NULL);
160 ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register);
161 if (Read) {
162 Status = PciRootBridgeIo->Pci.Read (
163 PciRootBridgeIo,
164 mShellMmRootBridgeIoWidth[Size],
165 EFI_PCI_ADDRESS (Bus, Device, Function, Register),
166 1,
167 Buffer
168 );
169 } else {
170 Status = PciRootBridgeIo->Pci.Write (
171 PciRootBridgeIo,
172 mShellMmRootBridgeIoWidth[Size],
173 EFI_PCI_ADDRESS (Bus, Device, Function, Register),
174 1,
175 Buffer
176 );
177 }
178
179 ASSERT_EFI_ERROR (Status);
180 return;
181
182 case ShellMmMemoryMappedIo:
183 if (PciRootBridgeIo != NULL) {
184 RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write;
185 }
186
187 if (CpuIo != NULL) {
188 CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write;
189 }
190
191 break;
192
193 case ShellMmIo:
194 if (PciRootBridgeIo != NULL) {
195 RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write;
196 }
197
198 if (CpuIo != NULL) {
199 CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write;
200 }
201
202 break;
203 default:
204 ASSERT (FALSE);
205 break;
206 }
207
208 Status = EFI_UNSUPPORTED;
209 if (RootBridgeIoMem != NULL) {
210 Status = RootBridgeIoMem (PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], Address, 1, Buffer);
211 }
212
213 if (EFI_ERROR (Status) && (CpuIoMem != NULL)) {
214 Status = CpuIoMem (CpuIo, mShellMmCpuIoWidth[Size], Address, 1, Buffer);
215 }
216
217 if (EFI_ERROR (Status)) {
218 if (AccessType == ShellMmIo) {
219 switch (Size) {
220 case 1:
221 if (Read) {
222 *(UINT8 *)Buffer = IoRead8 ((UINTN)Address);
223 } else {
224 IoWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
225 }
226
227 break;
228 case 2:
229 if (Read) {
230 *(UINT16 *)Buffer = IoRead16 ((UINTN)Address);
231 } else {
232 IoWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
233 }
234
235 break;
236 case 4:
237 if (Read) {
238 *(UINT32 *)Buffer = IoRead32 ((UINTN)Address);
239 } else {
240 IoWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
241 }
242
243 break;
244 case 8:
245 if (Read) {
246 *(UINT64 *)Buffer = IoRead64 ((UINTN)Address);
247 } else {
248 IoWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
249 }
250
251 break;
252 default:
253 ASSERT (FALSE);
254 break;
255 }
256 } else {
257 switch (Size) {
258 case 1:
259 if (Read) {
260 *(UINT8 *)Buffer = MmioRead8 ((UINTN)Address);
261 } else {
262 MmioWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
263 }
264
265 break;
266 case 2:
267 if (Read) {
268 *(UINT16 *)Buffer = MmioRead16 ((UINTN)Address);
269 } else {
270 MmioWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
271 }
272
273 break;
274 case 4:
275 if (Read) {
276 *(UINT32 *)Buffer = MmioRead32 ((UINTN)Address);
277 } else {
278 MmioWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
279 }
280
281 break;
282 case 8:
283 if (Read) {
284 *(UINT64 *)Buffer = MmioRead64 ((UINTN)Address);
285 } else {
286 MmioWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
287 }
288
289 break;
290 default:
291 ASSERT (FALSE);
292 break;
293 }
294 }
295 }
296 }
297}
298
312BOOLEAN
314 IN SHELL_MM_ACCESS_TYPE AccessType,
315 IN UINT64 Address,
317 OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **PciRootBridgeIo
318 )
319{
320 EFI_STATUS Status;
321 UINTN Index;
322 UINTN HandleCount;
323 EFI_HANDLE *HandleBuffer;
325 UINT32 Segment;
326 UINT8 Bus;
328
329 Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)CpuIo);
330 if (EFI_ERROR (Status)) {
331 *CpuIo = NULL;
332 }
333
334 *PciRootBridgeIo = NULL;
335 HandleBuffer = NULL;
336 Status = gBS->LocateHandleBuffer (
338 &gEfiPciRootBridgeIoProtocolGuid,
339 NULL,
340 &HandleCount,
341 &HandleBuffer
342 );
343 if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) {
344 return FALSE;
345 }
346
347 Segment = 0;
348 Bus = 0;
349 if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) {
350 ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, NULL, NULL, NULL);
351 }
352
353 //
354 // Find the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL of the specified segment & bus number
355 //
356 for (Index = 0; (Index < HandleCount) && (*PciRootBridgeIo == NULL); Index++) {
357 Status = gBS->HandleProtocol (
358 HandleBuffer[Index],
359 &gEfiPciRootBridgeIoProtocolGuid,
360 (VOID *)&Io
361 );
362 if (EFI_ERROR (Status)) {
363 continue;
364 }
365
366 if ((((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && (Io->SegmentNumber == Segment)) ||
367 ((AccessType == ShellMmIo) || (AccessType == ShellMmMemoryMappedIo))
368 )
369 {
370 Status = Io->Configuration (Io, (VOID **)&Descriptors);
371 if (!EFI_ERROR (Status)) {
372 while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) {
373 //
374 // Compare the segment and bus range for PCI/PCIE access
375 //
376 if ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) &&
377 ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) &&
378 ((Bus >= Descriptors->AddrRangeMin) && (Bus <= Descriptors->AddrRangeMax))
379 )
380 {
381 *PciRootBridgeIo = Io;
382 break;
383
384 //
385 // Compare the address range for MMIO/IO access
386 //
387 } else if ((((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) && (AccessType == ShellMmIo)) ||
388 ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && (AccessType == ShellMmMemoryMappedIo))
389 ) && ((Address >= Descriptors->AddrRangeMin) && (Address <= Descriptors->AddrRangeMax))
390 )
391 {
392 *PciRootBridgeIo = Io;
393 break;
394 }
395
396 Descriptors++;
397 }
398 }
399 }
400 }
401
402 if (HandleBuffer != NULL) {
403 FreePool (HandleBuffer);
404 }
405
406 return TRUE;
407}
408
416EFIAPI
418 IN EFI_HANDLE ImageHandle,
419 IN EFI_SYSTEM_TABLE *SystemTable
420 )
421{
422 EFI_STATUS Status;
423 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
425 UINT64 Address;
426 UINT64 Value;
427 SHELL_MM_ACCESS_TYPE AccessType;
428 UINT64 Buffer;
429 UINTN Index;
430 UINTN Size;
431 BOOLEAN Complete;
432 CHAR16 *InputStr;
433 BOOLEAN Interactive;
434 LIST_ENTRY *Package;
435 CHAR16 *ProblemParam;
436 SHELL_STATUS ShellStatus;
437 CONST CHAR16 *Temp;
438 BOOLEAN HasPciRootBridgeIo;
439
440 Value = 0;
441 Address = 0;
442 ShellStatus = SHELL_SUCCESS;
443 InputStr = NULL;
444 Size = 1;
445 AccessType = ShellMmMemory;
446
447 //
448 // Parse arguments
449 //
450 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
451 if (EFI_ERROR (Status)) {
452 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
453 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", ProblemParam);
454 FreePool (ProblemParam);
455 ShellStatus = SHELL_INVALID_PARAMETER;
456 goto Done;
457 } else {
458 ASSERT (FALSE);
459 }
460 } else {
461 if (ShellCommandLineGetCount (Package) < 2) {
462 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"mm");
463 ShellStatus = SHELL_INVALID_PARAMETER;
464 goto Done;
465 } else if (ShellCommandLineGetCount (Package) > 3) {
466 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
467 ShellStatus = SHELL_INVALID_PARAMETER;
468 goto Done;
469 } else if (ShellCommandLineGetFlag (Package, L"-w") && (ShellCommandLineGetValue (Package, L"-w") == NULL)) {
470 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"mm", L"-w");
471 ShellStatus = SHELL_INVALID_PARAMETER;
472 goto Done;
473 } else {
474 if (ShellCommandLineGetFlag (Package, L"-mmio")) {
475 AccessType = ShellMmMemoryMappedIo;
476 if ( ShellCommandLineGetFlag (Package, L"-mem")
477 || ShellCommandLineGetFlag (Package, L"-io")
478 || ShellCommandLineGetFlag (Package, L"-pci")
479 || ShellCommandLineGetFlag (Package, L"-pcie")
480 )
481 {
482 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
483 ShellStatus = SHELL_INVALID_PARAMETER;
484 goto Done;
485 }
486 } else if (ShellCommandLineGetFlag (Package, L"-mem")) {
487 AccessType = ShellMmMemory;
488 if ( ShellCommandLineGetFlag (Package, L"-io")
489 || ShellCommandLineGetFlag (Package, L"-pci")
490 || ShellCommandLineGetFlag (Package, L"-pcie")
491 )
492 {
493 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
494 ShellStatus = SHELL_INVALID_PARAMETER;
495 goto Done;
496 }
497 } else if (ShellCommandLineGetFlag (Package, L"-io")) {
498 AccessType = ShellMmIo;
499 if ( ShellCommandLineGetFlag (Package, L"-pci")
500 || ShellCommandLineGetFlag (Package, L"-pcie")
501 )
502 {
503 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
504 ShellStatus = SHELL_INVALID_PARAMETER;
505 goto Done;
506 }
507 } else if (ShellCommandLineGetFlag (Package, L"-pci")) {
508 AccessType = ShellMmPci;
509 if (ShellCommandLineGetFlag (Package, L"-pcie")
510 )
511 {
512 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
513 ShellStatus = SHELL_INVALID_PARAMETER;
514 goto Done;
515 }
516 } else if (ShellCommandLineGetFlag (Package, L"-pcie")) {
517 AccessType = ShellMmPciExpress;
518 }
519 }
520
521 //
522 // Non interactive for a script file or for the specific parameter
523 //
524 Interactive = TRUE;
525 if (gEfiShellProtocol->BatchIsActive () || ShellCommandLineGetFlag (Package, L"-n")) {
526 Interactive = FALSE;
527 }
528
529 Temp = ShellCommandLineGetValue (Package, L"-w");
530 if (Temp != NULL) {
531 Size = ShellStrToUintn (Temp);
532 }
533
534 if ((Size != 1) && (Size != 2) && (Size != 4) && (Size != 8)) {
535 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"mm", Temp, L"-w");
536 ShellStatus = SHELL_INVALID_PARAMETER;
537 goto Done;
538 }
539
540 Temp = ShellCommandLineGetRawValue (Package, 1);
541 if (Temp == NULL) {
542 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", L"NULL");
543 ShellStatus = SHELL_INVALID_PARAMETER;
544 goto Done;
545 }
546
547 Status = ShellConvertStringToUint64 (Temp, &Address, TRUE, FALSE);
548 if (EFI_ERROR (Status)) {
549 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp);
550 ShellStatus = SHELL_INVALID_PARAMETER;
551 goto Done;
552 }
553
554 if ((Address & (Size - 1)) != 0) {
555 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_NOT_ALIGNED), gShellDebug1HiiHandle, L"mm", Address);
556 ShellStatus = SHELL_INVALID_PARAMETER;
557 goto Done;
558 }
559
560 //
561 // locate IO protocol interface
562 //
563 HasPciRootBridgeIo = ShellMmLocateIoProtocol (AccessType, Address, &CpuIo, &PciRootBridgeIo);
564 if ((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) {
565 if (!HasPciRootBridgeIo) {
566 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"mm");
567 ShellStatus = SHELL_NOT_FOUND;
568 goto Done;
569 }
570
571 if (PciRootBridgeIo == NULL) {
572 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm", Address);
573 ShellStatus = SHELL_INVALID_PARAMETER;
574 goto Done;
575 }
576 }
577
578 //
579 // Mode 1: Directly set a value
580 //
581 Temp = ShellCommandLineGetRawValue (Package, 2);
582 if (Temp != NULL) {
583 Status = ShellConvertStringToUint64 (Temp, &Value, TRUE, FALSE);
584 if (EFI_ERROR (Status)) {
585 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp);
586 ShellStatus = SHELL_INVALID_PARAMETER;
587 goto Done;
588 }
589
590 if (Value > mShellMmMaxNumber[Size]) {
591 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mm", Temp);
592 ShellStatus = SHELL_INVALID_PARAMETER;
593 goto Done;
594 }
595
596 ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Value);
597 goto Done;
598 }
599
600 //
601 // Mode 2: Directly show a value
602 //
603 if (!Interactive) {
604 if (!gEfiShellProtocol->BatchIsActive ()) {
605 ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
606 }
607
608 ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
609
610 if (!gEfiShellProtocol->BatchIsActive ()) {
611 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
612 }
613
614 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]);
615 ShellPrintEx (-1, -1, L"\r\n");
616 goto Done;
617 }
618
619 //
620 // Mode 3: Show or set values in interactive mode
621 //
622 Complete = FALSE;
623 do {
624 ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
625 ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
626 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
627 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]);
628 ShellPrintEx (-1, -1, L" > ");
629 //
630 // wait user input to modify
631 //
632 if (InputStr != NULL) {
633 FreePool (InputStr);
634 InputStr = NULL;
635 }
636
637 ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID **)&InputStr);
638
639 if (InputStr != NULL) {
640 //
641 // skip space characters
642 //
643 for (Index = 0; InputStr[Index] == ' '; Index++) {
644 }
645
646 if (InputStr[Index] != CHAR_NULL) {
647 if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {
648 Complete = TRUE;
649 } else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&
650 (Buffer <= mShellMmMaxNumber[Size])
651 )
652 {
653 ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);
654 } else {
655 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");
656 continue;
657 }
658 }
659 }
660
661 Address += Size;
662 ShellPrintEx (-1, -1, L"\r\n");
663 } while (!Complete);
664 }
665
666 ASSERT (ShellStatus == SHELL_SUCCESS);
667
668Done:
669 if (InputStr != NULL) {
670 FreePool (InputStr);
671 }
672
673 if (Package != NULL) {
675 }
676
677 return ShellStatus;
678}
UINT64 UINTN
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
Definition: RShiftU64.c:28
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS(EFIAPI * EFI_CPU_IO_PROTOCOL_IO_MEM)(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
Definition: CpuIo2.h:97
EFI_CPU_IO_PROTOCOL_WIDTH
Definition: CpuIo2.h:37
VOID EFIAPI FreePool(IN VOID *Buffer)
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
Definition: IoLibArmVirt.c:200
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
Definition: IoLib.c:400
UINT64 EFIAPI IoRead64(IN UINTN Port)
Definition: IoLib.c:29
UINT64 EFIAPI IoWrite64(IN UINTN Port, IN UINT64 Value)
Definition: IoLib.c:55
UINT64 EFIAPI MmioRead64(IN UINTN Address)
Definition: IoLib.c:355
UINT16 EFIAPI MmioRead16(IN UINTN Address)
Definition: IoLib.c:170
UINT8 EFIAPI MmioRead8(IN UINTN Address)
Definition: IoLib.c:82
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
Definition: IoLib.c:126
UINT8 EFIAPI IoRead8(IN UINTN Port)
Definition: IoLibArmVirt.c:175
UINT32 EFIAPI MmioRead32(IN UINTN Address)
Definition: IoLib.c:262
UINT16 EFIAPI IoRead16(IN UINTN Port)
Definition: IoLibArmVirt.c:225
UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
Definition: IoLib.c:216
UINT32 EFIAPI IoRead32(IN UINTN Port)
Definition: IoLibArmVirt.c:275
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
Definition: IoLibArmVirt.c:300
UINT16 EFIAPI IoWrite16(IN UINTN Port, IN UINT16 Value)
Definition: IoLibArmVirt.c:250
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
Definition: IoLib.c:309
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
SHELL_STATUS
Definition: Shell.h:21
@ SHELL_SUCCESS
Definition: Shell.h:25
@ SHELL_NOT_FOUND
Definition: Shell.h:101
@ SHELL_INVALID_PARAMETER
Definition: Shell.h:35
BOOLEAN ShellMmLocateIoProtocol(IN SHELL_MM_ACCESS_TYPE AccessType, IN UINT64 Address, OUT EFI_CPU_IO2_PROTOCOL **CpuIo, OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **PciRootBridgeIo)
Definition: Mm.c:313
VOID ShellMmAccess(IN SHELL_MM_ACCESS_TYPE AccessType, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, IN EFI_CPU_IO2_PROTOCOL *CpuIo, IN BOOLEAN Read, IN UINT64 Address, IN UINTN Size, IN OUT VOID *Buffer)
Definition: Mm.c:128
VOID ShellMmDecodePciAddress(IN BOOLEAN PciFormat, IN UINT64 Address, OUT UINT32 *Segment, OUT UINT8 *Bus, OUT UINT8 *Device OPTIONAL, OUT UINT8 *Function OPTIONAL, OUT UINT32 *Register OPTIONAL)
Definition: Mm.c:66
SHELL_STATUS EFIAPI ShellCommandRunMm(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: Mm.c:417
EFI_STATUS(EFIAPI * EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM)(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
Definition: ShellLib.h:755
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699
EFI_STATUS EFIAPI ShellPromptForResponse(IN SHELL_PROMPT_REQUEST_TYPE Type, IN CHAR16 *Prompt OPTIONAL, IN OUT VOID **Response OPTIONAL)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellConvertStringToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS
#define STRING_TOKEN(t)
@ ByProtocol
Definition: UefiSpec.h:1518