]>
Commit | Line | Data |
---|---|---|
5d5c5d0d A |
1 | /* |
2 | * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
29 | */ | |
30 | #ifdef KERNEL_PRIVATE | |
31 | #ifndef _I386_HPET_H_ | |
32 | #define _I386_HPET_H_ | |
33 | ||
34 | /* | |
35 | * HPET kernel functions to support the HPET KEXT and the | |
36 | * power management KEXT. | |
37 | */ | |
38 | ||
39 | ||
40 | /* | |
41 | * Memory mapped registers for the HPET | |
42 | */ | |
43 | typedef struct hpetReg { | |
44 | uint64_t GCAP_ID; /* General capabilities */ | |
45 | uint64_t rsv1; | |
46 | uint64_t GEN_CONF; /* General configuration */ | |
47 | uint64_t rsv2; | |
48 | uint64_t GINTR_STA; /* General Interrupt status */ | |
49 | uint64_t rsv3[25]; | |
50 | uint64_t MAIN_CNT; /* Main counter */ | |
51 | uint64_t rsv4; | |
52 | uint64_t TIM0_CONF; /* Timer 0 config and cap */ | |
53 | #define TIM_CONF 0 | |
54 | #define Tn_INT_ENB_CNF 4 | |
55 | uint64_t TIM0_COMP; /* Timer 0 comparator */ | |
56 | #define TIM_COMP 8 | |
57 | uint64_t rsv5[2]; | |
58 | uint64_t TIM1_CONF; /* Timer 1 config and cap */ | |
59 | uint64_t TIM1_COMP; /* Timer 1 comparator */ | |
60 | uint64_t rsv6[2]; | |
61 | uint64_t TIM2_CONF; /* Timer 2 config and cap */ | |
62 | uint64_t TIM2_COMP; /* Timer 2 comparator */ | |
63 | uint64_t rsv7[2]; | |
64 | } hpetReg; | |
65 | typedef struct hpetReg hpetReg_t; | |
66 | ||
67 | struct hpetInfo | |
68 | { | |
69 | uint64_t hpetCvtt2n; | |
70 | uint64_t hpetCvtn2t; | |
71 | uint64_t tsc2hpet; | |
72 | uint64_t hpet2tsc; | |
73 | uint64_t bus2hpet; | |
74 | uint64_t hpet2bus; | |
75 | uint32_t rcbaArea; | |
76 | uint32_t rcbaAreap; | |
77 | }; | |
78 | typedef struct hpetInfo hpetInfo_t; | |
79 | ||
80 | extern uint64_t hpetFemto; | |
81 | extern uint64_t hpetFreq; | |
82 | extern uint64_t hpetCvtt2n; | |
83 | extern uint64_t hpetCvtn2t; | |
84 | extern uint64_t tsc2hpet; | |
85 | extern uint64_t hpet2tsc; | |
86 | extern uint64_t bus2hpet; | |
87 | extern uint64_t hpet2bus; | |
88 | ||
89 | extern uint32_t rcbaArea; | |
90 | extern uint32_t rcbaAreap; | |
91 | ||
92 | extern void map_rcbaAread(void); | |
93 | extern void hpet_init(void); | |
94 | ||
95 | extern void hpet_save(void); | |
96 | extern void hpet_restore(void); | |
97 | ||
98 | #ifdef XNU_KERNEL_PRIVATE | |
99 | extern int HPETInterrupt(void); | |
100 | #endif | |
101 | ||
102 | extern uint64_t rdHPET(void); | |
103 | extern void hpet_get_info(hpetInfo_t *info); | |
104 | ||
105 | #define hpetAddr 0xFED00000 | |
106 | #define hptcAE 0x80 | |
107 | ||
108 | #endif /* _I386_HPET_H_ */ | |
109 | ||
110 | #endif /* KERNEL_PRIVATE */ |