]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove constructor from this library. This library already has SMM CPU I/O 2 in...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Feb 2010 05:47:00 +0000 (05:47 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Feb 2010 05:47:00 +0000 (05:47 +0000)
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

MdePkg/Library/SmmIoLibSmmCpuIo2/IoLib.c
MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf

index 53003d123df97a610378f55493738908516f239f..816592c6f5f8a0c0c6923d0fa40d9bcd68addd45 100644 (file)
 \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
@@ -72,7 +40,7 @@ IoReadWorker (
   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
@@ -103,7 +71,7 @@ IoWriteWorker (
 {\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
@@ -133,7 +101,7 @@ MmioReadWorker (
   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
@@ -164,7 +132,7 @@ MmioWriteWorker (
 {\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
index b9a34a40ee462a4a3bf59f739c7519602898ae7e..a730a96a3455c0c9ce944162e506e97d9e373d3e 100644 (file)
@@ -22,7 +22,6 @@
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = IoLib|DXE_SMM_DRIVER SMM_CORE\r
   PI_SPECIFICATION_VERSION       = 0x0001000A\r
-  CONSTRUCTOR                    = IoLibConstructor\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
@@ -48,4 +47,4 @@
   gEfiSmmCpuIo2ProtocolGuid                         ## CONSUMES\r
 \r
 [Depex]\r
-  gEfiSmmCpuIo2ProtocolGuid
\ No newline at end of file
+  gEfiSmmCpuIo2ProtocolGuid\r