\r
#include "SmmCpuIoLibInternal.h"\r
\r
-//\r
-// Globle varible to cache pointer to CpuIo protocol.\r
-//\r
-EFI_SMM_CPU_IO2_PROTOCOL *mCpuIo2 = NULL;\r
-\r
-/**\r
- The constructor function caches the pointer to CpuIo protocol.\r
-\r
- The constructor function locates CpuIo protocol from protocol database.\r
- It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
-\r
- @param ImageHandle The firmware allocated handle for the EFI image.\r
- @param SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-IoLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuIo2ProtocolGuid, NULL, (VOID **) &mCpuIo2);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return Status;\r
-}\r
-\r
/**\r
Reads registers in the EFI CPU I/O space.\r
\r
EFI_STATUS Status;\r
UINT64 Data;\r
\r
- Status = mCpuIo2->Io.Read (mCpuIo2, Width, Port, 1, &Data);\r
+ Status = gSmst->SmmIo.Io.Read (&gSmst->SmmIo, Width, Port, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
{\r
EFI_STATUS Status;\r
\r
- Status = mCpuIo2->Io.Write (mCpuIo2, Width, Port, 1, &Data);\r
+ Status = gSmst->SmmIo.Io.Write (&gSmst->SmmIo, Width, Port, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
EFI_STATUS Status;\r
UINT64 Data;\r
\r
- Status = mCpuIo2->Mem.Read (mCpuIo2, Width, Address, 1, &Data);\r
+ Status = gSmst->SmmIo.Mem.Read (&gSmst->SmmIo, Width, Address, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
{\r
EFI_STATUS Status;\r
\r
- Status = mCpuIo2->Mem.Write (mCpuIo2, Width, Address, 1, &Data);\r
+ Status = gSmst->SmmIo.Mem.Write (&gSmst->SmmIo, Width, Address, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r