summaryrefslogtreecommitdiff
path: root/EdkModulePkg
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-06 06:36:47 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-06 06:36:47 +0000
commitabb234751e4fbe58afc5e7c7e203db2a93aac0f8 (patch)
tree4530cb4337a406438d2eeeab28e29399ec2d6a25 /EdkModulePkg
parent18fda0cec0c1bc6b95e15c34dc355457d9a4437a (diff)
downloadedk2-platforms-abb234751e4fbe58afc5e7c7e203db2a93aac0f8.tar.xz
1) Initialize gBS, gST, gImageHandle in UefiBootServicesTableLib.c to NULL
2) Add DxeCore infix to the module local variable gBS, gST, gRT, gDS in DxeMain.c. This is to solve the name conflict with UefiBootServicesTableLib which is defined in MDE Library Spec. 3) Add in check for gBS and gST in UefiDebugLibConOut/DebugLib.c and UefiDebugLibStdErr/DebugLib.c and MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c. If they are not initialized, the API will just return with a error message. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2546 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg')
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain.h10
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c56
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c8
-rw-r--r--EdkModulePkg/Core/Dxe/Hand/handle.c4
-rw-r--r--EdkModulePkg/Core/Dxe/Image/Image.c4
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c6
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c38
7 files changed, 63 insertions, 63 deletions
diff --git a/EdkModulePkg/Core/Dxe/DxeMain.h b/EdkModulePkg/Core/Dxe/DxeMain.h
index d655cd3381..b4cd76a2a1 100644
--- a/EdkModulePkg/Core/Dxe/DxeMain.h
+++ b/EdkModulePkg/Core/Dxe/DxeMain.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. 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
@@ -116,10 +116,10 @@ typedef struct {
//
// DXE Core Global Variables
//
-extern EFI_SYSTEM_TABLE *gST;
-extern EFI_BOOT_SERVICES *gBS;
-extern EFI_RUNTIME_SERVICES *gRT;
-extern EFI_DXE_SERVICES *gDS;
+extern EFI_SYSTEM_TABLE *gDxeCoreST;
+extern EFI_BOOT_SERVICES *gDxeCoreBS;
+extern EFI_RUNTIME_SERVICES *gDxeCoreRT;
+extern EFI_DXE_SERVICES *gDxeCoreDS;
extern EFI_HANDLE gDxeCoreImageHandle;
extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
diff --git a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c b/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 427e6b8ca5..1e31a8899e 100644
--- a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -211,16 +211,16 @@ EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
// DXE Core Global Variables for the EFI System Table, Boot Services Table,
// DXE Services Table, and Runtime Services Table
//
-EFI_BOOT_SERVICES *gBS = &mBootServices;
-EFI_DXE_SERVICES *gDS = &mDxeServices;
-EFI_SYSTEM_TABLE *gST = NULL;
+EFI_BOOT_SERVICES *gDxeCoreBS = &mBootServices;
+EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices;
+EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
//
-// For debug initialize gRT to template. gRT must be allocated from RT memory
-// but gRT is used for ASSERT () and DEBUG () type macros so lets give it
+// For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
+// but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
// a value that will not cause debug infrastructure to crash early on.
//
-EFI_RUNTIME_SERVICES *gRT = &mEfiRuntimeServicesTableTemplate;
+EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
EFI_HANDLE gDxeCoreImageHandle = NULL;
VOID *mHobStart;
@@ -288,13 +288,13 @@ Returns:
// Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
// Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
//
- gST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
- ASSERT (gST != NULL);
+ gDxeCoreST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
+ ASSERT (gDxeCoreST != NULL);
- gRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
- ASSERT (gRT != NULL);
+ gDxeCoreRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
+ ASSERT (gDxeCoreRT != NULL);
- gST->RuntimeServices = gRT;
+ gDxeCoreST->RuntimeServices = gDxeCoreRT;
//
// Start the Image Services.
@@ -305,7 +305,7 @@ Returns:
//
// Call constructor for all libraries
//
- ProcessLibraryConstructorList (gDxeCoreImageHandle, gST);
+ ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
PERF_END (0,PEI_TOK, NULL, 0) ;
PERF_START (0,DXE_TOK, NULL, 0) ;
@@ -318,7 +318,7 @@ Returns:
//
// Install the DXE Services Table into the EFI System Tables's Configuration Table
//
- Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);
+ Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);
ASSERT_EFI_ERROR (Status);
//
@@ -400,16 +400,16 @@ Returns:
//
// Produce Firmware Volume Protocols, one for each FV in the HOB list.
//
- Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gST);
+ Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gDxeCoreST);
ASSERT_EFI_ERROR (Status);
- Status = FwVolDriverInit (gDxeCoreImageHandle, gST);
+ Status = FwVolDriverInit (gDxeCoreImageHandle, gDxeCoreST);
ASSERT_EFI_ERROR (Status);
//
// Produce the Section Extraction Protocol
//
- Status = InitializeSectionExtraction (gDxeCoreImageHandle, gST);
+ Status = InitializeSectionExtraction (gDxeCoreImageHandle, gDxeCoreST);
ASSERT_EFI_ERROR (Status);
//
@@ -742,11 +742,11 @@ Returns:
Hdr->CRC32 = 0;
//
- // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
+ // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
// Crc will come back as zero if we set it to zero here
//
Crc = 0;
- gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
+ gDxeCoreBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
Hdr->CRC32 = Crc;
}
@@ -812,24 +812,24 @@ Returns:
//
// Clear the non-runtime values of the EFI System Table
//
- gST->BootServices = NULL;
- gST->ConIn = NULL;
- gST->ConsoleInHandle = NULL;
- gST->ConOut = NULL;
- gST->ConsoleOutHandle = NULL;
- gST->StdErr = NULL;
- gST->StandardErrorHandle = NULL;
+ gDxeCoreST->BootServices = NULL;
+ gDxeCoreST->ConIn = NULL;
+ gDxeCoreST->ConsoleInHandle = NULL;
+ gDxeCoreST->ConOut = NULL;
+ gDxeCoreST->ConsoleOutHandle = NULL;
+ gDxeCoreST->StdErr = NULL;
+ gDxeCoreST->StandardErrorHandle = NULL;
//
// Recompute the 32-bit CRC of the EFI System Table
//
- CalculateEfiHdrCrc (&gST->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
//
// Zero out the Boot Service Table
//
- SetMem (gBS, sizeof (EFI_BOOT_SERVICES), 0);
- gBS = NULL;
+ SetMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES), 0);
+ gDxeCoreBS = NULL;
//
// Update the AtRuntime field in Runtiem AP.
diff --git a/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
index 24ccc49a9b..8f389d02b4 100644
--- a/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
+++ b/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
@@ -181,10 +181,10 @@ Returns:
// It's over kill to do them all every time, but it saves a lot of code.
//
if (Found) {
- CalculateEfiHdrCrc (&gRT->Hdr);
- CalculateEfiHdrCrc (&gBS->Hdr);
- CalculateEfiHdrCrc (&gST->Hdr);
- CalculateEfiHdrCrc (&gDS->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreBS->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
}
}
diff --git a/EdkModulePkg/Core/Dxe/Hand/handle.c b/EdkModulePkg/Core/Dxe/Hand/handle.c
index 2f43dc02b1..dd0801a96f 100644
--- a/EdkModulePkg/Core/Dxe/Hand/handle.c
+++ b/EdkModulePkg/Core/Dxe/Hand/handle.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. 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
@@ -455,7 +455,7 @@ Returns:
Prot = NULL;
Handle = NULL;
- ASSERT (NULL != gBS);
+ ASSERT (NULL != gDxeCoreBS);
if (*UserHandle != NULL_HANDLE) {
Status = CoreHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface);
diff --git a/EdkModulePkg/Core/Dxe/Image/Image.c b/EdkModulePkg/Core/Dxe/Image/Image.c
index 3696400072..901182e511 100644
--- a/EdkModulePkg/Core/Dxe/Image/Image.c
+++ b/EdkModulePkg/Core/Dxe/Image/Image.c
@@ -132,7 +132,7 @@ Returns:
Image->ImageBasePage = DxeCoreImageBaseAddress;
Image->NumberOfPages = (UINTN)(EFI_SIZE_TO_PAGES((UINTN)(DxeCoreImageLength)));
Image->Tpl = gEfiCurrentTpl;
- Image->Info.SystemTable = gST;
+ Image->Info.SystemTable = gDxeCoreST;
Image->Info.ImageBase = (VOID *)(UINTN)DxeCoreImageBaseAddress;
Image->Info.ImageSize = DxeCoreImageLength;
@@ -650,7 +650,7 @@ Returns:
// Initialize the fields for an internal driver
//
Image->Signature = LOADED_IMAGE_PRIVATE_DATA_SIGNATURE;
- Image->Info.SystemTable = gST;
+ Image->Info.SystemTable = gDxeCoreST;
Image->Info.DeviceHandle = DeviceHandle;
Image->Info.Revision = EFI_LOADED_IMAGE_INFORMATION_REVISION;
Image->Info.FilePath = CoreDuplicateDevicePath (FilePath);
diff --git a/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c
index 3ba1eca418..3512477c8f 100644
--- a/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c
+++ b/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. 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
@@ -97,7 +97,7 @@ Notes:
//
mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(UINTN)Mem;
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
- mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gST;
+ mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
mDebugTable->Crc32 = 0;
Status = CoreInstallConfigurationTable (&gEfiDebugImageInfoTableGuid, &mDebugInfoTableHeader);
ASSERT_EFI_ERROR (Status);
@@ -127,7 +127,7 @@ Returns:
{
ASSERT(mDebugTable != NULL);
mDebugTable->Crc32 = 0;
- gBS->CalculateCrc32 ((VOID *)mDebugTable, sizeof (EFI_SYSTEM_TABLE_POINTER), &mDebugTable->Crc32);
+ gDxeCoreBS->CalculateCrc32 ((VOID *)mDebugTable, sizeof (EFI_SYSTEM_TABLE_POINTER), &mDebugTable->Crc32);
}
VOID
diff --git a/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c b/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
index e81fcad35a..ee42f224e8 100644
--- a/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
+++ b/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. 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
@@ -54,9 +54,9 @@ Returns:
{
UINTN Index;
- for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
- if (CompareGuid (Guid, &(gST->ConfigurationTable[Index].VendorGuid))) {
- *Table = gST->ConfigurationTable[Index].VendorTable;
+ for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
+ if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
+ *Table = gDxeCoreST->ConfigurationTable[Index].VendorTable;
return EFI_SUCCESS;
}
}
@@ -104,18 +104,18 @@ Returns:
return EFI_INVALID_PARAMETER;
}
- EfiConfigurationTable = gST->ConfigurationTable;
+ EfiConfigurationTable = gDxeCoreST->ConfigurationTable;
//
// Search all the table for an entry that matches Guid
//
- for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
- if (CompareGuid (Guid, &(gST->ConfigurationTable[Index].VendorGuid))) {
+ for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
+ if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
break;
}
}
- if (Index < gST->NumberOfTableEntries) {
+ if (Index < gDxeCoreST->NumberOfTableEntries) {
//
// A match was found, so this is either a modify or a delete operation
//
@@ -124,22 +124,22 @@ Returns:
// If Table is not NULL, then this is a modify operation.
// Modify the table enty and return.
//
- gST->ConfigurationTable[Index].VendorTable = Table;
+ gDxeCoreST->ConfigurationTable[Index].VendorTable = Table;
return EFI_SUCCESS;
}
//
// A match was found and Table is NULL, so this is a delete operation.
//
- gST->NumberOfTableEntries--;
+ gDxeCoreST->NumberOfTableEntries--;
//
// Copy over deleted entry
//
CopyMem (
&(EfiConfigurationTable[Index]),
- &(gST->ConfigurationTable[Index + 1]),
- (gST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
+ &(gDxeCoreST->ConfigurationTable[Index + 1]),
+ (gDxeCoreST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
);
} else {
@@ -156,7 +156,7 @@ Returns:
}
//
- // Assume that Index == gST->NumberOfTableEntries
+ // Assume that Index == gDxeCoreST->NumberOfTableEntries
//
if ((Index * sizeof (EFI_CONFIGURATION_TABLE)) >= mSystemTableAllocateSize) {
//
@@ -171,26 +171,26 @@ Returns:
return EFI_OUT_OF_RESOURCES;
}
- if (gST->ConfigurationTable != NULL) {
+ if (gDxeCoreST->ConfigurationTable != NULL) {
//
// Copy the old table to the new table.
//
CopyMem (
EfiConfigurationTable,
- gST->ConfigurationTable,
+ gDxeCoreST->ConfigurationTable,
Index * sizeof (EFI_CONFIGURATION_TABLE)
);
//
// Free Old Table
//
- CoreFreePool (gST->ConfigurationTable);
+ CoreFreePool (gDxeCoreST->ConfigurationTable);
}
//
// Update System Table
//
- gST->ConfigurationTable = EfiConfigurationTable;
+ gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
}
//
@@ -202,13 +202,13 @@ Returns:
//
// This is an add operation, so increment the number of table entries
//
- gST->NumberOfTableEntries++;
+ gDxeCoreST->NumberOfTableEntries++;
}
//
// Fix up the CRC-32 in the EFI System Table
//
- CalculateEfiHdrCrc (&gST->Hdr);
+ CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
return EFI_SUCCESS;
}