]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update Metronome driver to use the IoLib instead of the CPU I/O Protocol.
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Oct 2008 02:11:49 +0000 (02:11 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Oct 2008 02:11:49 +0000 (02:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6242 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/LegacyMetronome/Metronome.c
DuetPkg/LegacyMetronome/Metronome.h

index acc0dad45cf63e5f6567f87c54ad78bc4f3f8f92..2307529e2a1bf0a7e7ee26d332ded957cb29ecf4 100644 (file)
@@ -33,75 +33,9 @@ EFI_METRONOME_ARCH_PROTOCOL mMetronome = {
   TICK_PERIOD\r
 };\r
 \r
-//\r
-// The CPU I/O Protocol used to access system hardware\r
-//\r
-EFI_CPU_IO_PROTOCOL         *mCpuIo = NULL;\r
-\r
 //\r
 // Worker Functions\r
 //\r
-VOID\r
-IoWrite8 (\r
-  UINT16  Port,\r
-  UINT8   Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Write an 8 bit value to an I/O port and save it to the S3 script\r
-\r
-Arguments:\r
-\r
-Returns: \r
-\r
-  None.\r
-\r
---*/\r
-// TODO:    Port - add argument and description to function comment\r
-// TODO:    Data - add argument and description to function comment\r
-{\r
-  mCpuIo->Io.Write (\r
-              mCpuIo,\r
-              EfiCpuIoWidthUint8,\r
-              Port,\r
-              1,\r
-              &Data\r
-              );\r
-\r
-}\r
-\r
-UINT8\r
-ReadRefresh (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Read the refresh bit from the REFRESH_PORT\r
-\r
-Arguments:\r
-\r
-Returns: \r
-\r
-  None.\r
-\r
---*/\r
-{\r
-  UINT8 Data;\r
-\r
-  mCpuIo->Io.Read (\r
-              mCpuIo,\r
-              EfiCpuIoWidthUint8,\r
-              REFRESH_PORT,\r
-              1,\r
-              &Data\r
-              );\r
-  return (UINT8) (Data & REFRESH_ON);\r
-}\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 WaitForTick (\r
@@ -130,10 +64,8 @@ Returns:
   // Wait for TickNumber toggles of the Refresh bit\r
   //\r
   for (; TickNumber != 0x00; TickNumber--) {\r
-    while (ReadRefresh () == REFRESH_ON)\r
-      ;\r
-    while (ReadRefresh () == REFRESH_OFF)\r
-      ;\r
+    while ((IoRead8(REFRESH_PORT) & REFRESH_ON) == REFRESH_ON);\r
+    while ((IoRead8(REFRESH_PORT) & REFRESH_ON) == REFRESH_OFF);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -171,14 +103,6 @@ Returns:
   //\r
   ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiMetronomeArchProtocolGuid);\r
 \r
-  //\r
-  // Get the CPU I/O Protocol that this driver requires\r
-  // If the CPU I/O Protocol is not found, then ASSERT because the dependency expression\r
-  // should guarantee that it is present in the handle database.\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &mCpuIo);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\r
   // Program port 61 timer 1 as refresh timer. We could use ACPI timer in the\r
   // future.\r
index 87a12cbc34f5f8169fde8f0d2c3df9921227511e..df8d58d05cb8f8fbe6acd9bd5b50ad6e0b924982 100644 (file)
@@ -27,11 +27,11 @@ Abstract:
 //\r
 #include <PiDxe.h>\r
 \r
-#include <Protocol/CpuIo.h>\r
 #include <Protocol/Metronome.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/IoLib.h>\r
 \r
 //\r
 // Private definitions\r