Puts SMM variable common definitions in SmmVariableCommon.h.
Fixed a bug that SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY was misused as SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11339 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
implements an SMI handler to communicate with the DXE runtime driver
|
||||
to provide variable services.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. 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
|
||||
@@ -14,18 +14,20 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
#include <Protocol/SmmVariable.h>
|
||||
#include <Protocol/SmmFirmwareVolumeBlock.h>
|
||||
#include <Protocol/SmmFaultTolerantWrite.h>
|
||||
#include <Library/SmmServicesTableLib.h>
|
||||
|
||||
#include <Guid/VariableFormat.h>
|
||||
#include <Guid/SmmVariableCommon.h>
|
||||
#include "Variable.h"
|
||||
#include "VariableSmmCommon.h"
|
||||
|
||||
extern SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY *gVariableInfo;
|
||||
extern VARIABLE_INFO_ENTRY *gVariableInfo;
|
||||
EFI_HANDLE mSmmVariableHandle = NULL;
|
||||
EFI_HANDLE mVariableHandle = NULL;
|
||||
BOOLEAN mAtRuntime = FALSE;
|
||||
EFI_GUID mZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
EFI_GUID mSmmVariableWriteGuid = EFI_SMM_VARIABLE_WRITE_GUID;
|
||||
|
||||
EFI_SMM_VARIABLE_PROTOCOL gSmmVariable = {
|
||||
VariableServiceGetVariable,
|
||||
@@ -254,11 +256,11 @@ GetFvbCountAndBuffer (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SmmVariableGetStatistics (
|
||||
IN OUT SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY *InfoEntry,
|
||||
IN OUT VARIABLE_INFO_ENTRY *InfoEntry,
|
||||
IN OUT UINTN *InfoSize
|
||||
)
|
||||
{
|
||||
SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
UINTN NameLength;
|
||||
UINTN StatisticsInfoSize;
|
||||
CHAR16 *InfoName;
|
||||
@@ -269,8 +271,8 @@ SmmVariableGetStatistics (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
StatisticsInfoSize = sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY) + StrSize (VariableInfo->Name);
|
||||
if (*InfoSize < sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY)) {
|
||||
StatisticsInfoSize = sizeof (VARIABLE_INFO_ENTRY) + StrSize (VariableInfo->Name);
|
||||
if (*InfoSize < sizeof (VARIABLE_INFO_ENTRY)) {
|
||||
*InfoSize = StatisticsInfoSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
@@ -280,7 +282,7 @@ SmmVariableGetStatistics (
|
||||
//
|
||||
// Return the first variable info
|
||||
//
|
||||
CopyMem (InfoEntry, VariableInfo, sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY));
|
||||
CopyMem (InfoEntry, VariableInfo, sizeof (VARIABLE_INFO_ENTRY));
|
||||
CopyMem (InfoName, VariableInfo->Name, StrSize (VariableInfo->Name));
|
||||
*InfoSize = StatisticsInfoSize;
|
||||
return EFI_SUCCESS;
|
||||
@@ -313,13 +315,13 @@ SmmVariableGetStatistics (
|
||||
//
|
||||
// Output the new variable info
|
||||
//
|
||||
StatisticsInfoSize = sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY) + StrSize (VariableInfo->Name);
|
||||
StatisticsInfoSize = sizeof (VARIABLE_INFO_ENTRY) + StrSize (VariableInfo->Name);
|
||||
if (*InfoSize < StatisticsInfoSize) {
|
||||
*InfoSize = StatisticsInfoSize;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
CopyMem (InfoEntry, VariableInfo, sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY));
|
||||
CopyMem (InfoEntry, VariableInfo, sizeof (VARIABLE_INFO_ENTRY));
|
||||
CopyMem (InfoName, VariableInfo->Name, StrSize (VariableInfo->Name));
|
||||
*InfoSize = StatisticsInfoSize;
|
||||
|
||||
@@ -361,7 +363,7 @@ SmmVariableHandler (
|
||||
SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE *SmmVariableHeader;
|
||||
SMM_VARIABLE_COMMUNICATE_GET_NEXT_VARIABLE_NAME *GetNextVariableName;
|
||||
SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO *QueryVariableInfo;
|
||||
SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
VARIABLE_INFO_ENTRY *VariableInfo;
|
||||
UINTN InfoSize;
|
||||
|
||||
ASSERT (CommBuffer != NULL);
|
||||
@@ -420,7 +422,7 @@ SmmVariableHandler (
|
||||
break;
|
||||
|
||||
case SMM_VARIABLE_FUNCTION_GET_STATISTICS:
|
||||
VariableInfo = (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY *) SmmVariableFunctionHeader->Data;
|
||||
VariableInfo = (VARIABLE_INFO_ENTRY *) SmmVariableFunctionHeader->Data;
|
||||
InfoSize = *CommBufferSize - OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data);
|
||||
Status = SmmVariableGetStatistics (VariableInfo, &InfoSize);
|
||||
*CommBufferSize = InfoSize + OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data);
|
||||
@@ -498,7 +500,7 @@ SmmFtwNotificationEvent (
|
||||
//
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&mSmmVariableHandle,
|
||||
&mSmmVariableWriteGuid,
|
||||
&gSmmVariableWriteGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
@@ -511,7 +513,7 @@ SmmFtwNotificationEvent (
|
||||
/**
|
||||
Variable Driver main entry point. The Variable driver places the 4 EFI
|
||||
runtime services in the EFI System Table and installs arch protocols
|
||||
for variable read and write services being availible. It also registers
|
||||
for variable read and write services being available. It also registers
|
||||
a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# This module should be used with SMM Runtime DXE module together. The
|
||||
# SMM Runtime DXE module would install variable arch protocol and variable
|
||||
# write arch protocol based on SMM variable module.
|
||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -41,7 +41,6 @@
|
||||
Variable.c
|
||||
VariableSmm.c
|
||||
Variable.h
|
||||
VariableSmmCommon.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
@@ -66,6 +65,7 @@
|
||||
[Guids]
|
||||
gEfiVariableGuid ## PRODUCES ## Configuration Table Guid
|
||||
gEfiGlobalVariableGuid ## PRODUCES ## Variable Guid
|
||||
gSmmVariableWriteGuid ## PRODUCES ## SMM Variable Write Guid
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
|
@@ -1,40 +0,0 @@
|
||||
/** @file
|
||||
|
||||
The internal header file includes the common header files shared
|
||||
by VariableSmm module and VariableSmmRuntimeDxe module.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. 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 _VARIABLE_SMM_COMMON_H_
|
||||
#define _VARIABLE_SMM_COMMON_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/SmmVariable.h>
|
||||
#include <Protocol/SmmFirmwareVolumeBlock.h>
|
||||
#include <Guid/VariableFormat.h>
|
||||
|
||||
#define EFI_SMM_VARIABLE_WRITE_GUID \
|
||||
{ 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 } }
|
||||
|
||||
///
|
||||
/// Size of SMM communicate header, without including the payload.
|
||||
///
|
||||
#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data))
|
||||
|
||||
///
|
||||
/// Size of SMM variable communicate header, without including the payload.
|
||||
///
|
||||
#define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE (OFFSET_OF (SMM_VARIABLE_COMMUNICATE_HEADER, Data))
|
||||
|
||||
|
||||
#endif
|
@@ -4,7 +4,7 @@
|
||||
and volatile storage space and install variable architecture protocol
|
||||
based on SMM variable module.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. 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
|
||||
@@ -14,10 +14,11 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Protocol/VariableWrite.h>
|
||||
#include <Protocol/Variable.h>
|
||||
#include <Protocol/SmmCommunication.h>
|
||||
#include <Protocol/SmmVariable.h>
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
@@ -31,7 +32,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/BaseLib.h>
|
||||
|
||||
#include <Guid/EventGroup.h>
|
||||
#include "VariableSmmCommon.h"
|
||||
#include <Guid/VariableFormat.h>
|
||||
#include <Guid/SmmVariableCommon.h>
|
||||
|
||||
EFI_HANDLE mHandle = NULL;
|
||||
EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable = NULL;
|
||||
@@ -39,7 +41,6 @@ EFI_EVENT mVirtualAddressChangeEvent = NULL;
|
||||
EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
|
||||
UINT8 *mVariableBuffer = NULL;
|
||||
UINT8 *mVariableBufferPhysical = NULL;
|
||||
EFI_GUID mSmmVariableWriteGuid = EFI_SMM_VARIABLE_WRITE_GUID;
|
||||
UINTN mVariableBufferSize;
|
||||
|
||||
|
||||
@@ -367,7 +368,7 @@ RuntimeServiceQueryVariableInfo (
|
||||
// Init the communicate buffer. The buffer data size is:
|
||||
// SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE + PayloadSize;
|
||||
//
|
||||
PayloadSize = sizeof (SMM_VARIABLE_COMMUNICATE_VARIABLE_INFO_ENTRY);
|
||||
PayloadSize = sizeof (SMM_VARIABLE_COMMUNICATE_QUERY_VARIABLE_INFO);
|
||||
Status = InitCommunicateBuffer ((VOID **)&SmmQueryVariableInfo, PayloadSize, SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -550,7 +551,7 @@ SmmVariableWriteReady (
|
||||
//
|
||||
// Check whether the protocol is installed or not.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&mSmmVariableWriteGuid, NULL, (VOID **) &ProtocolOps);
|
||||
Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **) &ProtocolOps);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
@@ -568,7 +569,7 @@ SmmVariableWriteReady (
|
||||
/**
|
||||
Variable Driver main entry point. The Variable driver places the 4 EFI
|
||||
runtime services in the EFI System Table and installs arch protocols
|
||||
for variable read and write services being availible. It also registers
|
||||
for variable read and write services being available. It also registers
|
||||
a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@@ -604,7 +605,7 @@ VariableSmmRuntimeInitialize (
|
||||
// Smm Non-Volatile variable write service is ready
|
||||
//
|
||||
EfiCreateProtocolNotifyEvent (
|
||||
&mSmmVariableWriteGuid,
|
||||
&gSmmVariableWriteGuid,
|
||||
TPL_CALLBACK,
|
||||
SmmVariableWriteReady,
|
||||
NULL,
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# This module is the Runtime DXE part correspond to SMM variable module. It
|
||||
# installs variable arch protocol and variable write arch protocol and works
|
||||
# with SMM variable module together.
|
||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
[Sources]
|
||||
VariableSmmRuntimeDxe.c
|
||||
VariableSmmCommon.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
@@ -58,6 +57,7 @@
|
||||
|
||||
[Guids]
|
||||
gEfiEventVirtualAddressChangeGuid ## PRODUCES ## Event
|
||||
gSmmVariableWriteGuid
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize
|
||||
|
Reference in New Issue
Block a user