]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update 8254 Timer driver to use IoLib instead of CPU I/O Protocol
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Oct 2008 02:12:53 +0000 (02:12 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Oct 2008 02:12:53 +0000 (02:12 +0000)
Also change the default tick rate from 54 ms to 10 ms.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6243 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/8254TimerDxe/8254Timer.inf
DuetPkg/8254TimerDxe/Timer.c
DuetPkg/8254TimerDxe/Timer.h

index 5f11112264a827dd846bf7a06ed98427fdb29a97..5781fb63de4e937cd8076155efb96d13009cd1c0 100644 (file)
   BaseLib\r
   DebugLib\r
   UefiDriverEntryPoint\r
+  IoLib\r
 \r
 [Sources.common]\r
   Timer.h\r
   Timer.c\r
 \r
 [Protocols]\r
-  gEfiCpuIoProtocolGuid\r
   gEfiCpuArchProtocolGuid\r
   gEfiLegacy8259ProtocolGuid\r
   gEfiTimerArchProtocolGuid\r
 \r
 [Depex]\r
-  gEfiCpuIoProtocolGuid AND gEfiCpuArchProtocolGuid AND gEfiLegacy8259ProtocolGuid
\ No newline at end of file
+  gEfiCpuArchProtocolGuid AND gEfiLegacy8259ProtocolGuid
\ No newline at end of file
index c7deadd737604b05fb7145c16820292b5d8e768d..5b5fc42d9d962f9e645b3c65268109eedb379f14 100644 (file)
@@ -42,11 +42,6 @@ EFI_TIMER_ARCH_PROTOCOL   mTimer = {
 //\r
 EFI_CPU_ARCH_PROTOCOL     *mCpu;\r
 \r
-//\r
-// Pointer to the CPU I/O Protocol instance\r
-//\r
-EFI_CPU_IO_PROTOCOL       *mCpuIo;\r
-\r
 //\r
 // Pointer to the Legacy 8259 Protocol instance\r
 //\r
@@ -86,11 +81,9 @@ Returns:
 \r
 --*/\r
 {\r
-  UINT8 Data;\r
-\r
-  Data = 0x36;\r
-  mCpuIo->Io.Write (mCpuIo, EfiCpuIoWidthUint8, TIMER_CONTROL_PORT, 1, &Data);\r
-  mCpuIo->Io.Write (mCpuIo, EfiCpuIoWidthFifoUint8, TIMER0_COUNT_PORT, 2, &Count);\r
+  IoWrite8 (TIMER_CONTROL_PORT, 0x36);\r
+  IoWrite8 (TIMER0_COUNT_PORT, (UINT8)(Count & 0xff));\r
+  IoWrite8 (TIMER0_COUNT_PORT, (UINT8)((Count >> 8) & 0xff));\r
 }\r
 \r
 VOID\r
@@ -262,6 +255,7 @@ Returns:
     //\r
     mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);\r
   } else {\r
+\r
     //\r
     // Convert TimerPeriod into 8254 counts\r
     //\r
@@ -433,12 +427,6 @@ Returns:
   //\r
   ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);\r
 \r
-  //\r
-  // Find the CPU I/O Protocol.\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\r
   // Find the CPU architectural protocol.\r
   //\r
@@ -481,11 +469,11 @@ Returns:
   //\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &mTimerHandle,\r
-                  &gEfiTimerArchProtocolGuid,\r
-                  &mTimer,\r
+                  &gEfiTimerArchProtocolGuid, &mTimer,\r
                   NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   return Status;\r
 }\r
+\r
index 390d202d1f47f997a15ab16d11e94504af150952..71e0bd461e6a887ab28ec9bc93ef45dd04c6f9b6 100644 (file)
@@ -26,13 +26,13 @@ Abstract:
 #include <PiDxe.h>\r
 \r
 #include <Protocol/Cpu.h>\r
-#include <Protocol/CpuIo.h>\r
 #include <Protocol/Legacy8259.h>\r
 #include <Protocol/Timer.h>\r
 \r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
 \r
 //\r
 // The PCAT 8253/8254 has an input clock at 1.193182 MHz and Timer 0 is\r
@@ -43,7 +43,9 @@ Abstract:
 // ---------------- * 1,000,000 uS/S = 54925.4 uS = 549254 * 100 ns\r
 //   1,193,182 Hz\r
 //\r
-#define DEFAULT_TIMER_TICK_DURATION 549254\r
+// The default timer tick duration is set to 10 ms = 100000 100 ns units\r
+//\r
+#define DEFAULT_TIMER_TICK_DURATION 100000\r
 #define TIMER_CONTROL_PORT          0x43\r
 #define TIMER0_COUNT_PORT           0x40\r
 \r