TianoCore EDK2 master
Loading...
Searching...
No Matches
Mm.c File Reference

Go to the source code of this file.

Enumerations

enum  SHELL_MM_ACCESS_TYPE {
  ShellMmMemory , ShellMmMemoryMappedIo , ShellMmIo , ShellMmPci ,
  ShellMmPciExpress
}
 

Functions

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)
 
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)
 
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)
 
SHELL_STATUS EFIAPI ShellCommandRunMm (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

CONST UINT16 mShellMmAccessTypeStr []
 
STATIC CONST SHELL_PARAM_ITEM ParamList []
 
CONST UINT64 mShellMmMaxNumber []
 
CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth []
 
CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth []
 

Detailed Description

Main file for Mm shell Debug1 function.

(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Mm.c.

Enumeration Type Documentation

◆ SHELL_MM_ACCESS_TYPE

enum SHELL_MM_ACCESS_TYPE

Definition at line 16 of file Mm.c.

Function Documentation

◆ ShellCommandRunMm()

SHELL_STATUS EFIAPI ShellCommandRunMm ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'mm' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 417 of file Mm.c.

◆ ShellMmAccess()

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 
)

Read or write some data from or into the Address.

Parameters
[in]AccessTypeAccess type.
[in]PciRootBridgeIoPciRootBridgeIo instance.
[in]CpuIoCpuIo instance.
[in]ReadTRUE for read, FALSE for write.
[in]AddresssThe memory location to access.
[in]SizeThe size of Buffer in Width sized units.
[in,out]BufferThe buffer to read into or write from.

Definition at line 128 of file Mm.c.

◆ ShellMmDecodePciAddress()

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 
)

Extract the PCI segment, bus, device, function, register from from a PCI or PCIE format of address..

Parameters
[in]PciFormatWhether the address is of PCI format of PCIE format.
[in]AddressPCI or PCIE address.
[out]SegmentPCI segment number.
[out]BusPCI bus number.
[out]DevicePCI device number.
[out]FunctionPCI function number.
[out]RegisterPCI register offset.

Definition at line 66 of file Mm.c.

◆ ShellMmLocateIoProtocol()

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 
)

Find the CpuIo instance and PciRootBridgeIo instance in the platform. If there are multiple PciRootBridgeIo instances, the instance which manages the Address is returned.

Parameters
[in]AccessTypeAccess type.
[in]AddressAddress to access.
[out]CpuIoReturn the CpuIo instance.
[out]PciRootBridgeIoReturn the proper PciRootBridgeIo instance.
Return values
TRUEThere are PciRootBridgeIo instances in the platform.
FALSEThere isn't PciRootBridgeIo instance in the platform.

Definition at line 313 of file Mm.c.

Variable Documentation

◆ mShellMmAccessTypeStr

CONST UINT16 mShellMmAccessTypeStr[]
Initial value:
= {
STRING_TOKEN (STR_MM_MEM),
STRING_TOKEN (STR_MM_MMIO),
STRING_TOKEN (STR_MM_IO),
STRING_TOKEN (STR_MM_PCI),
}
#define STRING_TOKEN(t)

Definition at line 24 of file Mm.c.

◆ mShellMmCpuIoWidth

CONST EFI_CPU_IO_PROTOCOL_WIDTH mShellMmCpuIoWidth[]
Initial value:
= {
0, EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, 0, EfiCpuIoWidthUint32, 0, 0, 0, EfiCpuIoWidthUint64
}

Definition at line 49 of file Mm.c.

◆ mShellMmMaxNumber

CONST UINT64 mShellMmMaxNumber[]
Initial value:
= {
0, MAX_UINT8, MAX_UINT16, 0, MAX_UINT32, 0, 0, 0, MAX_UINT64
}

Definition at line 43 of file Mm.c.

◆ mShellMmRootBridgeIoWidth

CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH mShellMmRootBridgeIoWidth[]
Initial value:
= {
0, EfiPciWidthUint8, EfiPciWidthUint16, 0, EfiPciWidthUint32, 0, 0, 0, EfiPciWidthUint64
}

Definition at line 46 of file Mm.c.

◆ ParamList

Initial value:
= {
{ L"-mmio", TypeFlag },
{ L"-mem", TypeFlag },
{ L"-io", TypeFlag },
{ L"-pci", TypeFlag },
{ L"-pcie", TypeFlag },
{ L"-n", TypeFlag },
{ L"-w", TypeValue },
{ NULL, TypeMax }
}
#define NULL
Definition: Base.h:319
@ 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

Definition at line 32 of file Mm.c.