> On May 31, 2016, at 6:51 AM, Juergen Rall <[email protected]> wrote:
> 
> Hi,
> 
> I want to readout the SMRAM of an existing UEFI-Bios.
> Therefore I wrote a UEFI application inherited by the EDK2 sample
> MemoryProfileInfo:
> 
> EFI_STATUS GetSmramProfileData(VOID)
> {
>    EFI_STATUS Status;
>    UINTN CommSize;
>    UINT8* pCommBuffer;
> 
>    EFI_SMM_COMMUNICATE_HEADER* pCommHeader;
>    SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO* pCommGetProfileInfo;
>    SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA* pCommGetProfileData;
> 
>    EFI_SMM_COMMUNICATION_PROTOCOL* pSmmCommunicationProt;
> 
>    UINT64 ProfileSize;
>    PHYSICAL_ADDRESS ProfileBuffer;
> 
>    //Get SMM communication protocol
>    Status = gBS->LocateProtocol(
>                            &gEfiSmmCommunicationProtocolGuid,
>                            NULL,
>                            (VOID**)&pSmmCommunicationProt);
> 
>    Print(L"LocateProtocol Status: %lx\n", Status);
>    if (EFI_SUCCESS == Status)
>    {
>        //Get buffer
>        CommSize = sizeof (EFI_GUID) + sizeof (UINTN) +
>                   sizeof (SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA);
>        pCommBuffer = AllocateZeroPool(500);
>        if (pCommBuffer)
>        {
>            Print(L"AllocateZeroPool CommSize: %lx\n", CommSize);
> 
>            // Get Size
>            pCommHeader = (EFI_SMM_COMMUNICATE_HEADER*)&pCommBuffer[0];
>            CopyMem (&pCommHeader->HeaderGuid, &gEdkiiMemoryProfileGuid,
> sizeof (gEdkiiMemoryProfileGuid));
>            pCommHeader->MessageLength =
> sizeof(SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO);
> 
>            pCommGetProfileInfo = (SMRAM_PROFILE_PARAMETER_GET_PROFILE_INFO
> *) &pCommBuffer[OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)];
>            pCommGetProfileInfo->Header.Command      =
> SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO;
>            pCommGetProfileInfo->Header.DataLength   = sizeof
> (*pCommGetProfileInfo);
>            pCommGetProfileInfo->Header.ReturnStatus = (UINT64)-1;
>            pCommGetProfileInfo->ProfileSize         = 0;
> 
>            CommSize = sizeof (EFI_GUID) + sizeof (UINTN) +
> pCommHeader->MessageLength;
>            Status = pSmmCommunicationProt->Communicate(
>                                                pSmmCommunicationProt,
>                                                pCommBuffer, &CommSize);
> 
>            Print(L"pSmmCommunicationProt->Communicate Status:%lx\n", Status);
> 
> 
> When I call pSmmCommunicationProt->communicate, I get the error 0x000000e,
> which I suppose is due to the fact, that I use gEdkiiMemoryProfileGuid,
> which isn't existent in the current UEFI Bios (2.40).

gEdkiiMemoryProfileGuid is defined in the MdeModulePkg so it is implementation, 
not UEFI Forum (like things in the MdePkg) defined. It is part of the 
implementation of the DXE and SMM Core. 

~/work/src/edk2(master)>git grep gEdkiiMemoryProfileGuid -- *.h
MdeModulePkg/Include/Guid/MemoryProfile.h:301:extern EFI_GUID 
gEdkiiMemoryProfileGuid;


> Now what should I do instead ?
> 

In general you can't dump SMRAM as only SMM code has access to SMRAM. 

If you want to figure out if your platform locks SMM you can run CHIPSEC. 
CHIPSEC is on github and it can be run from Window, Linux, and UEFI shell. 

Thanks,

Andrew Fish

> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to