blob: 9be72426e6646336ab0eca46291a4435ae5cb8b0 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 EFI Timestamp Protocol as defined in UEFI2.4 Specification.
3 Used to provide a platform independent interface for retrieving a high resolution timestamp counter.
4
5 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 @par Revision Reference:
15 This Protocol is introduced in UEFI Specification 2.4
16
17**/
18
19#ifndef __EFI_TIME_STAMP_PROTOCOL_H__
20#define __EFI_TIME_STAMP_PROTOCOL_H__
21
22
23#define EFI_TIMESTAMP_PROTOCOL_GUID \
24 { 0xafbfde41, 0x2e6e, 0x4262, {0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 } }
25
26///
27/// Declare forward reference for the Time Stamp Protocol
28///
29typedef struct _EFI_TIMESTAMP_PROTOCOL EFI_TIMESTAMP_PROTOCOL;
30
31///
32/// EFI_TIMESTAMP_PROPERTIES
33///
34typedef struct {
35 ///
36 /// The frequency of the timestamp counter in Hz.
37 ///
38 UINT64 Frequency;
39 ///
40 /// The value that the timestamp counter ends with immediately before it rolls over.
41 /// For example, a 64-bit free running counter would have an EndValue of 0xFFFFFFFFFFFFFFFF.
42 /// A 24-bit free running counter would have an EndValue of 0xFFFFFF.
43 ///
44 UINT64 EndValue;
45} EFI_TIMESTAMP_PROPERTIES;
46
47/**
48 Retrieves the current value of a 64-bit free running timestamp counter.
49
50 The counter shall count up in proportion to the amount of time that has passed. The counter value
51 will always roll over to zero. The properties of the counter can be retrieved from GetProperties().
52 The caller should be prepared for the function to return the same value twice across successive calls.
53 The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties().
54 The frequency of the returned timestamp counter value must remain constant. Power management operations that
55 affect clocking must not change the returned counter frequency. The quantization of counter value updates may
56 vary as long as the value reflecting time passed remains consistent.
57
58 @param None.
59
60 @retval The current value of the free running timestamp counter.
61
62**/
63typedef
64UINT64
65(EFIAPI *TIMESTAMP_GET)(
66 VOID
67 );
68
69/**
70 Obtains timestamp counter properties including frequency and value limits.
71
72 @param[out] Properties The properties of the timestamp counter.
73
74 @retval EFI_SUCCESS The properties were successfully retrieved.
75 @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp
76 counter subsystem. Properties is not pedated.
77 @retval EFI_INVALID_PARAMETER Properties is NULL.
78
79**/
80typedef
81EFI_STATUS
82(EFIAPI *TIMESTAMP_GET_PROPERTIES)(
83 OUT EFI_TIMESTAMP_PROPERTIES *Properties
84 );
85
86
87
88///
89/// EFI_TIMESTAMP_PROTOCOL
90/// The protocol provides a platform independent interface for retrieving a high resolution
91/// timestamp counter.
92///
93struct _EFI_TIMESTAMP_PROTOCOL {
94 TIMESTAMP_GET GetTimestamp;
95 TIMESTAMP_GET_PROPERTIES GetProperties;
96};
97
98extern EFI_GUID gEfiTimestampProtocolGuid;
99
100#endif
101