summaryrefslogtreecommitdiff
path: root/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-14 05:47:00 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-14 05:47:00 +0000
commit112af4265f6aca7ac155e4522c75504cba1e4e6c (patch)
treee10ce84d9fa799bee283f25decb8f3abf87df8ff /MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
parent58b23d903e7b2ea2aee87d8c1522c2d5cafa577b (diff)
downloadedk2-platforms-112af4265f6aca7ac155e4522c75504cba1e4e6c.tar.xz
Remove constructor from this library. This library already has SMM CPU I/O 2 in its [Depex], so any module using this library will not be dispatched until the SMM CPU I/O 2 Protocol is installed into the SMM handle database and also copied into the SMM Services Table.
The worker functions in this library have also been updated to simply use the instance of the SMM CPU I/O 2 Protocol that is present in the SMM Services Table. The dependency on the UEFI Boot Services Table Library has also been removed so the gBS, gST, and gImageHandle symbols will not be automatically linked into an SMM Driver that uses this library. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9999 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c')
-rw-r--r--MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c b/MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
index 53003d123d..816592c6f5 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;