summaryrefslogtreecommitdiff
path: root/DuetPkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-27 02:12:53 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-27 02:12:53 +0000
commit2952f72d6da58f9117721e0f8c0ca4147f0d9340 (patch)
treeeb1b8e9fada768b9be3b05f90fbddbced487fc52 /DuetPkg
parent0f25cc149a40eefdb91786a018a38056453e702b (diff)
downloadedk2-platforms-2952f72d6da58f9117721e0f8c0ca4147f0d9340.tar.xz
Update 8254 Timer driver to use IoLib instead of CPU I/O Protocol
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
Diffstat (limited to 'DuetPkg')
-rw-r--r--DuetPkg/8254TimerDxe/8254Timer.inf4
-rw-r--r--DuetPkg/8254TimerDxe/Timer.c24
-rw-r--r--DuetPkg/8254TimerDxe/Timer.h6
3 files changed, 12 insertions, 22 deletions
diff --git a/DuetPkg/8254TimerDxe/8254Timer.inf b/DuetPkg/8254TimerDxe/8254Timer.inf
index 5f11112264..5781fb63de 100644
--- a/DuetPkg/8254TimerDxe/8254Timer.inf
+++ b/DuetPkg/8254TimerDxe/8254Timer.inf
@@ -35,16 +35,16 @@
BaseLib
DebugLib
UefiDriverEntryPoint
+ IoLib
[Sources.common]
Timer.h
Timer.c
[Protocols]
- gEfiCpuIoProtocolGuid
gEfiCpuArchProtocolGuid
gEfiLegacy8259ProtocolGuid
gEfiTimerArchProtocolGuid
[Depex]
- gEfiCpuIoProtocolGuid AND gEfiCpuArchProtocolGuid AND gEfiLegacy8259ProtocolGuid \ No newline at end of file
+ gEfiCpuArchProtocolGuid AND gEfiLegacy8259ProtocolGuid \ No newline at end of file
diff --git a/DuetPkg/8254TimerDxe/Timer.c b/DuetPkg/8254TimerDxe/Timer.c
index c7deadd737..5b5fc42d9d 100644
--- a/DuetPkg/8254TimerDxe/Timer.c
+++ b/DuetPkg/8254TimerDxe/Timer.c
@@ -43,11 +43,6 @@ EFI_TIMER_ARCH_PROTOCOL mTimer = {
EFI_CPU_ARCH_PROTOCOL *mCpu;
//
-// Pointer to the CPU I/O Protocol instance
-//
-EFI_CPU_IO_PROTOCOL *mCpuIo;
-
-//
// Pointer to the Legacy 8259 Protocol instance
//
EFI_LEGACY_8259_PROTOCOL *mLegacy8259;
@@ -86,11 +81,9 @@ Returns:
--*/
{
- UINT8 Data;
-
- Data = 0x36;
- mCpuIo->Io.Write (mCpuIo, EfiCpuIoWidthUint8, TIMER_CONTROL_PORT, 1, &Data);
- mCpuIo->Io.Write (mCpuIo, EfiCpuIoWidthFifoUint8, TIMER0_COUNT_PORT, 2, &Count);
+ IoWrite8 (TIMER_CONTROL_PORT, 0x36);
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8)(Count & 0xff));
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8)((Count >> 8) & 0xff));
}
VOID
@@ -262,6 +255,7 @@ Returns:
//
mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);
} else {
+
//
// Convert TimerPeriod into 8254 counts
//
@@ -434,12 +428,6 @@ Returns:
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);
//
- // Find the CPU I/O Protocol.
- //
- Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);
- ASSERT_EFI_ERROR (Status);
-
- //
// Find the CPU architectural protocol.
//
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mCpu);
@@ -481,11 +469,11 @@ Returns:
//
Status = gBS->InstallMultipleProtocolInterfaces (
&mTimerHandle,
- &gEfiTimerArchProtocolGuid,
- &mTimer,
+ &gEfiTimerArchProtocolGuid, &mTimer,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
}
+
diff --git a/DuetPkg/8254TimerDxe/Timer.h b/DuetPkg/8254TimerDxe/Timer.h
index 390d202d1f..71e0bd461e 100644
--- a/DuetPkg/8254TimerDxe/Timer.h
+++ b/DuetPkg/8254TimerDxe/Timer.h
@@ -26,13 +26,13 @@ Abstract:
#include <PiDxe.h>
#include <Protocol/Cpu.h>
-#include <Protocol/CpuIo.h>
#include <Protocol/Legacy8259.h>
#include <Protocol/Timer.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
//
// The PCAT 8253/8254 has an input clock at 1.193182 MHz and Timer 0 is
@@ -43,7 +43,9 @@ Abstract:
// ---------------- * 1,000,000 uS/S = 54925.4 uS = 549254 * 100 ns
// 1,193,182 Hz
//
-#define DEFAULT_TIMER_TICK_DURATION 549254
+// The default timer tick duration is set to 10 ms = 100000 100 ns units
+//
+#define DEFAULT_TIMER_TICK_DURATION 100000
#define TIMER_CONTROL_PORT 0x43
#define TIMER0_COUNT_PORT 0x40