The implementation of I/O operation for this library instance \r
are based on EFI_CPU_IO_PROTOCOL.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation<BR>\r
- All rights reserved. This program and the accompanying materials\r
+ Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
+ http://opensource.org/licenses/bsd-license.php.\r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\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
@param Width The width of the I/O operation.\r
@param Data The value to write to the I/O port.\r
\r
- @return The paramter of Data.\r
+ @return The parameter of Data.\r
\r
**/\r
UINT64\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