MdeModulePkg-FPDT(2): Add SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET in FpdtSmm Handler.
This patch enhance performance data SMM communication by using fixed SMM communication buffer. Update FpdtSmm to handle SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET request. This is designed to meet Microsoft WSMT table definition on FIXED_COMM_BUFFERS requirement. Cc: Liming Gao <liming.gao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
parent
7110e306fa
commit
77a6e6c4f9
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
FpdtSmiHandler() will receive untrusted input and do basic validation.
|
FpdtSmiHandler() will receive untrusted input and do basic validation.
|
||||||
|
|
||||||
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -210,6 +210,7 @@ FpdtSmiHandler (
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
SMM_BOOT_RECORD_COMMUNICATE *SmmCommData;
|
SMM_BOOT_RECORD_COMMUNICATE *SmmCommData;
|
||||||
|
UINTN BootRecordOffset;
|
||||||
UINTN BootRecordSize;
|
UINTN BootRecordSize;
|
||||||
VOID *BootRecordData;
|
VOID *BootRecordData;
|
||||||
UINTN TempCommBufferSize;
|
UINTN TempCommBufferSize;
|
||||||
|
@ -238,36 +239,44 @@ FpdtSmiHandler (
|
||||||
|
|
||||||
switch (SmmCommData->Function) {
|
switch (SmmCommData->Function) {
|
||||||
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
|
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
|
||||||
SmmCommData->BootRecordSize = mBootRecordSize;
|
SmmCommData->BootRecordSize = mBootRecordSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
|
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
|
||||||
BootRecordData = SmmCommData->BootRecordData;
|
Status = EFI_UNSUPPORTED;
|
||||||
BootRecordSize = SmmCommData->BootRecordSize;
|
break;
|
||||||
if (BootRecordData == NULL || BootRecordSize < mBootRecordSize) {
|
|
||||||
Status = EFI_INVALID_PARAMETER;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET :
|
||||||
// Sanity check
|
BootRecordOffset = SmmCommData->BootRecordOffset;
|
||||||
//
|
BootRecordData = SmmCommData->BootRecordData;
|
||||||
SmmCommData->BootRecordSize = mBootRecordSize;
|
BootRecordSize = SmmCommData->BootRecordSize;
|
||||||
if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, mBootRecordSize)) {
|
if (BootRecordData == NULL || BootRecordOffset >= mBootRecordSize) {
|
||||||
DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM Data buffer in SMRAM or overflow!\n"));
|
Status = EFI_INVALID_PARAMETER;
|
||||||
Status = EFI_ACCESS_DENIED;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CopyMem (
|
//
|
||||||
(UINT8*)BootRecordData,
|
// Sanity check
|
||||||
mBootRecordBuffer,
|
//
|
||||||
mBootRecordSize
|
if (BootRecordSize > mBootRecordSize - BootRecordOffset) {
|
||||||
);
|
BootRecordSize = mBootRecordSize - BootRecordOffset;
|
||||||
break;
|
}
|
||||||
|
SmmCommData->BootRecordSize = BootRecordSize;
|
||||||
|
if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, BootRecordSize)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM Data buffer in SMRAM or overflow!\n"));
|
||||||
|
Status = EFI_ACCESS_DENIED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMem (
|
||||||
|
(UINT8*)BootRecordData,
|
||||||
|
mBootRecordBuffer + BootRecordOffset,
|
||||||
|
BootRecordSize
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmmCommData->ReturnStatus = Status;
|
SmmCommData->ReturnStatus = Status;
|
||||||
|
|
Loading…
Reference in New Issue