blob: 33906bd3f0f382ad8cded44e9539bc8232f5f913 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2020 Joyent, Inc.
*/
#ifndef _HPET_H
#define _HPET_H
#include <sys/hpet_acpi.h>
/*
* Interface for HPET access.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* HPET_INFINITY is used for timers that will never expire.
*/
#define HPET_INFINITY (INT64_MAX)
/*
* State of initialization.
*/
#define HPET_NO_SUPPORT (0)
#define HPET_TIMER_SUPPORT (1) /* supports main counter reads */
#define HPET_INTERRUPT_SUPPORT (2) /* supports interrupt/timer */
#define HPET_FULL_SUPPORT (3) /* supports counter and timer intr */
typedef struct hpet {
uint_t supported;
boolean_t (*install_proxy)(void);
boolean_t (*callback)(int);
/*
* Next two function pointers allow CPUs to use the HPET's timer
* as a proxy for their LAPIC timers which stop during Deep C-State.
*/
boolean_t (*use_hpet_timer)(hrtime_t *);
void (*use_lapic_timer)(hrtime_t);
} hpet_t;
#define CST_EVENT_MULTIPLE_CSTATES (128) /* callbacks for _CST changes */
#define CST_EVENT_ONE_CSTATE (129)
/*
* unix access to the HPET is done through the hpet structure.
*/
extern hpet_t hpet;
int hpet_early_init(void);
boolean_t hpet_timer_is_readable(void);
uint64_t hpet_read_timer(void);
int hpet_acpi_init(int *hpet_vect, iflag_t *hpet_flags, hrtime_t (*)(void),
void (*)(hrtime_t));
void hpet_acpi_fini(void);
uint32_t hpet_proxy_ipl(void);
#ifdef __cplusplus
}
#endif
#endif /* _HPET_H */
|