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