From 0f25cc149a40eefdb91786a018a38056453e702b Mon Sep 17 00:00:00 2001 From: mdkinney Date: Mon, 27 Oct 2008 02:11:49 +0000 Subject: [PATCH] Update Metronome driver to use the IoLib instead of the CPU I/O Protocol. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6242 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/LegacyMetronome/Metronome.c | 80 +---------------------------- DuetPkg/LegacyMetronome/Metronome.h | 2 +- 2 files changed, 3 insertions(+), 79 deletions(-) diff --git a/DuetPkg/LegacyMetronome/Metronome.c b/DuetPkg/LegacyMetronome/Metronome.c index acc0dad45c..2307529e2a 100644 --- a/DuetPkg/LegacyMetronome/Metronome.c +++ b/DuetPkg/LegacyMetronome/Metronome.c @@ -33,75 +33,9 @@ EFI_METRONOME_ARCH_PROTOCOL mMetronome = { TICK_PERIOD }; -// -// The CPU I/O Protocol used to access system hardware -// -EFI_CPU_IO_PROTOCOL *mCpuIo = NULL; - // // Worker Functions // -VOID -IoWrite8 ( - UINT16 Port, - UINT8 Data - ) -/*++ - -Routine Description: - - Write an 8 bit value to an I/O port and save it to the S3 script - -Arguments: - -Returns: - - None. - ---*/ -// TODO: Port - add argument and description to function comment -// TODO: Data - add argument and description to function comment -{ - mCpuIo->Io.Write ( - mCpuIo, - EfiCpuIoWidthUint8, - Port, - 1, - &Data - ); - -} - -UINT8 -ReadRefresh ( - VOID - ) -/*++ - -Routine Description: - - Read the refresh bit from the REFRESH_PORT - -Arguments: - -Returns: - - None. - ---*/ -{ - UINT8 Data; - - mCpuIo->Io.Read ( - mCpuIo, - EfiCpuIoWidthUint8, - REFRESH_PORT, - 1, - &Data - ); - return (UINT8) (Data & REFRESH_ON); -} - EFI_STATUS EFIAPI WaitForTick ( @@ -130,10 +64,8 @@ Returns: // Wait for TickNumber toggles of the Refresh bit // for (; TickNumber != 0x00; TickNumber--) { - while (ReadRefresh () == REFRESH_ON) - ; - while (ReadRefresh () == REFRESH_OFF) - ; + while ((IoRead8(REFRESH_PORT) & REFRESH_ON) == REFRESH_ON); + while ((IoRead8(REFRESH_PORT) & REFRESH_ON) == REFRESH_OFF); } return EFI_SUCCESS; @@ -171,14 +103,6 @@ Returns: // ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiMetronomeArchProtocolGuid); - // - // Get the CPU I/O Protocol that this driver requires - // If the CPU I/O Protocol is not found, then ASSERT because the dependency expression - // should guarantee that it is present in the handle database. - // - Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &mCpuIo); - ASSERT_EFI_ERROR (Status); - // // Program port 61 timer 1 as refresh timer. We could use ACPI timer in the // future. diff --git a/DuetPkg/LegacyMetronome/Metronome.h b/DuetPkg/LegacyMetronome/Metronome.h index 87a12cbc34..df8d58d05c 100644 --- a/DuetPkg/LegacyMetronome/Metronome.h +++ b/DuetPkg/LegacyMetronome/Metronome.h @@ -27,11 +27,11 @@ Abstract: // #include -#include #include #include #include +#include // // Private definitions