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
//\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
\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
//\r
mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);\r
} else {\r
+\r
//\r
// Convert TimerPeriod into 8254 counts\r
//\r
//\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
//\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
#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
// ---------------- * 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