]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Timestamp.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / Timestamp.h
1 /** @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 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 @par Revision Reference:
9 This Protocol is introduced in UEFI Specification 2.4
10
11 **/
12
13 #ifndef __EFI_TIME_STAMP_PROTOCOL_H__
14 #define __EFI_TIME_STAMP_PROTOCOL_H__
15
16
17 #define EFI_TIMESTAMP_PROTOCOL_GUID \
18 { 0xafbfde41, 0x2e6e, 0x4262, {0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 } }
19
20 ///
21 /// Declare forward reference for the Time Stamp Protocol
22 ///
23 typedef struct _EFI_TIMESTAMP_PROTOCOL EFI_TIMESTAMP_PROTOCOL;
24
25 ///
26 /// EFI_TIMESTAMP_PROPERTIES
27 ///
28 typedef struct {
29 ///
30 /// The frequency of the timestamp counter in Hz.
31 ///
32 UINT64 Frequency;
33 ///
34 /// The value that the timestamp counter ends with immediately before it rolls over.
35 /// For example, a 64-bit free running counter would have an EndValue of 0xFFFFFFFFFFFFFFFF.
36 /// A 24-bit free running counter would have an EndValue of 0xFFFFFF.
37 ///
38 UINT64 EndValue;
39 } EFI_TIMESTAMP_PROPERTIES;
40
41 /**
42 Retrieves the current value of a 64-bit free running timestamp counter.
43
44 The counter shall count up in proportion to the amount of time that has passed. The counter value
45 will always roll over to zero. The properties of the counter can be retrieved from GetProperties().
46 The caller should be prepared for the function to return the same value twice across successive calls.
47 The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties().
48 The frequency of the returned timestamp counter value must remain constant. Power management operations that
49 affect clocking must not change the returned counter frequency. The quantization of counter value updates may
50 vary as long as the value reflecting time passed remains consistent.
51
52 @param None.
53
54 @retval The current value of the free running timestamp counter.
55
56 **/
57 typedef
58 UINT64
59 (EFIAPI *TIMESTAMP_GET)(
60 VOID
61 );
62
63 /**
64 Obtains timestamp counter properties including frequency and value limits.
65
66 @param[out] Properties The properties of the timestamp counter.
67
68 @retval EFI_SUCCESS The properties were successfully retrieved.
69 @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp
70 counter subsystem. Properties is not pedated.
71 @retval EFI_INVALID_PARAMETER Properties is NULL.
72
73 **/
74 typedef
75 EFI_STATUS
76 (EFIAPI *TIMESTAMP_GET_PROPERTIES)(
77 OUT EFI_TIMESTAMP_PROPERTIES *Properties
78 );
79
80
81
82 ///
83 /// EFI_TIMESTAMP_PROTOCOL
84 /// The protocol provides a platform independent interface for retrieving a high resolution
85 /// timestamp counter.
86 ///
87 struct _EFI_TIMESTAMP_PROTOCOL {
88 TIMESTAMP_GET GetTimestamp;
89 TIMESTAMP_GET_PROPERTIES GetProperties;
90 };
91
92 extern EFI_GUID gEfiTimestampProtocolGuid;
93
94 #endif
95