Use Memory Allocation Library instance for modules of type DXE_SMM_DRIVER

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10013 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2010-02-16 04:04:58 +00:00
parent 8e90dd6b54
commit 300240b62b
2 changed files with 9 additions and 14 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Report Status Code Library for SMM Phase. Report Status Code Library for SMM Phase.
Copyright (c) 2009, Intel Corporation<BR> Copyright (c) 2009 -2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
@ -18,6 +18,7 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Guid/StatusCodeDataTypeId.h> #include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h> #include <Guid/StatusCodeDataTypeDebug.h>
@ -436,15 +437,10 @@ ReportStatusCodeEx (
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0))); ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0))); ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
if (gSmst == NULL || gSmst->SmmAllocatePool == NULL || gSmst->SmmFreePool == NULL) {
return EFI_UNSUPPORTED;
}
// //
// Allocate space for the Status Code Header and its buffer // Allocate space for the Status Code Header and its buffer
// //
StatusCodeData = NULL; StatusCodeData = AllocatePool (sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize);
gSmst->SmmAllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);
if (StatusCodeData == NULL) { if (StatusCodeData == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
@ -477,7 +473,7 @@ ReportStatusCodeEx (
// //
// Free the allocated buffer // Free the allocated buffer
// //
gSmst->SmmFreePool (StatusCodeData); FreePool (StatusCodeData);
return Status; return Status;
} }

View File

@ -2,7 +2,7 @@
# SMM report status code library # SMM report status code library
# #
# Retrieve status code and report status code in SMM phase # Retrieve status code and report status code in SMM phase
# Copyright (c) 2009, Intel Corporation. # Copyright (c) 2009 -2010, Intel Corporation.
# #
# All rights reserved. This program and the accompanying materials # All rights reserved. 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
@ -21,7 +21,6 @@
MODULE_TYPE = DXE_SMM_DRIVER MODULE_TYPE = DXE_SMM_DRIVER
VERSION_STRING = 1.0 VERSION_STRING = 1.0
PI_SPECIFICATION_VERSION = 0x0001000A PI_SPECIFICATION_VERSION = 0x0001000A
LIBRARY_CLASS = ReportStatusCodeLib|DXE_SMM_DRIVER SMM_CORE LIBRARY_CLASS = ReportStatusCodeLib|DXE_SMM_DRIVER SMM_CORE
# #
@ -30,7 +29,7 @@
# VALID_ARCHITECTURES = IA32 X64 # VALID_ARCHITECTURES = IA32 X64
# #
[Sources.common] [Sources]
ReportStatusCodeLib.c ReportStatusCodeLib.c
[Packages] [Packages]
@ -43,6 +42,7 @@
SmmServicesTableLib SmmServicesTableLib
DebugLib DebugLib
UefiDriverEntryPoint UefiDriverEntryPoint
MemoryAllocationLib
[Guids] [Guids]
gEfiStatusCodeSpecificDataGuid ## CONSUMES gEfiStatusCodeSpecificDataGuid ## CONSUMES
@ -51,6 +51,5 @@
[Protocols] [Protocols]
gEfiSmmStatusCodeProtocolGuid ## CONSUMES gEfiSmmStatusCodeProtocolGuid ## CONSUMES
[Pcd.common] [Pcd]
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask