3 Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 This contains the installation function for the driver.
21 #include "Metronome.h"
24 // Handle for the Metronome Architectural Protocol instance produced by this driver
26 EFI_HANDLE mMetronomeHandle
= NULL
;
29 // The Metronome Architectural Protocol instance produced by this driver
31 EFI_METRONOME_ARCH_PROTOCOL mMetronome
= {
42 IN EFI_METRONOME_ARCH_PROTOCOL
*This
,
49 Waits for the TickNumber of ticks from a known platform time source.
53 This Pointer to the protocol instance.
57 EFI_SUCCESS If number of ticks occurred.
58 EFI_NOT_FOUND Could not locate CPU IO protocol
61 // TODO: TickNumber - add argument and description to function comment
64 // Wait for TickNumber toggles of the Refresh bit
66 for (; TickNumber
!= 0x00; TickNumber
--) {
67 while ((IoRead8(REFRESH_PORT
) & REFRESH_ON
) == REFRESH_ON
);
68 while ((IoRead8(REFRESH_PORT
) & REFRESH_ON
) == REFRESH_OFF
);
77 IN EFI_HANDLE ImageHandle
,
78 IN EFI_SYSTEM_TABLE
*SystemTable
84 Install the LegacyMetronome driver. Loads a Metronome Arch Protocol based
89 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
93 EFI_SUCCESS - Metronome Architectural Protocol Installed
96 // TODO: ImageHandle - add argument and description to function comment
97 // TODO: SystemTable - add argument and description to function comment
102 // Make sure the Metronome Architectural Protocol is not already installed in the system
104 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiMetronomeArchProtocolGuid
);
107 // Program port 61 timer 1 as refresh timer. We could use ACPI timer in the
110 IoWrite8 (TIMER1_CONTROL_PORT
, LOAD_COUNTER1_LSB
);
111 IoWrite8 (TIMER1_COUNT_PORT
, COUNTER1_COUNT
);
114 // Install on a new handle
116 Status
= gBS
->InstallMultipleProtocolInterfaces (
118 &gEfiMetronomeArchProtocolGuid
,
122 ASSERT_EFI_ERROR (Status
);