summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c40
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf3
2 files changed, 5 insertions, 38 deletions
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
index 53003d1..816592c 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
@@ -16,38 +16,6 @@
#include "SmmCpuIoLibInternal.h"
-//
-// Globle varible to cache pointer to CpuIo protocol.
-//
-EFI_SMM_CPU_IO2_PROTOCOL *mCpuIo2 = NULL;
-
-/**
- The constructor function caches the pointer to CpuIo protocol.
-
- The constructor function locates CpuIo protocol from protocol database.
- It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-IoLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuIo2ProtocolGuid, NULL, (VOID **) &mCpuIo2);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
/**
Reads registers in the EFI CPU I/O space.
@@ -72,7 +40,7 @@ IoReadWorker (
EFI_STATUS Status;
UINT64 Data;
- Status = mCpuIo2->Io.Read (mCpuIo2, Width, Port, 1, &Data);
+ Status = gSmst->SmmIo.Io.Read (&gSmst->SmmIo, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -103,7 +71,7 @@ IoWriteWorker (
{
EFI_STATUS Status;
- Status = mCpuIo2->Io.Write (mCpuIo2, Width, Port, 1, &Data);
+ Status = gSmst->SmmIo.Io.Write (&gSmst->SmmIo, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -133,7 +101,7 @@ MmioReadWorker (
EFI_STATUS Status;
UINT64 Data;
- Status = mCpuIo2->Mem.Read (mCpuIo2, Width, Address, 1, &Data);
+ Status = gSmst->SmmIo.Mem.Read (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -164,7 +132,7 @@ MmioWriteWorker (
{
EFI_STATUS Status;
- Status = mCpuIo2->Mem.Write (mCpuIo2, Width, Address, 1, &Data);
+ Status = gSmst->SmmIo.Mem.Write (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf b/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf
index b9a34a4..a730a96 100644
--- a/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf
+++ b/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf
@@ -22,7 +22,6 @@
VERSION_STRING = 1.0
LIBRARY_CLASS = IoLib|DXE_SMM_DRIVER SMM_CORE
PI_SPECIFICATION_VERSION = 0x0001000A
- CONSTRUCTOR = IoLibConstructor
#
# The following information is for reference only and not required by the build tools.
@@ -48,4 +47,4 @@
gEfiSmmCpuIo2ProtocolGuid ## CONSUMES
[Depex]
- gEfiSmmCpuIo2ProtocolGuid \ No newline at end of file
+ gEfiSmmCpuIo2ProtocolGuid