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
This commit is contained in:
mdkinney 2008-10-27 02:11:49 +00:00
parent 03c110536d
commit 0f25cc149a
2 changed files with 3 additions and 79 deletions

View File

@ -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.

View File

@ -27,11 +27,11 @@ Abstract:
//
#include <PiDxe.h>
#include <Protocol/CpuIo.h>
#include <Protocol/Metronome.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/IoLib.h>
//
// Private definitions