aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hardware/hwtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/hardware/hwtimer.c')
-rw-r--r--drivers/acpi/hardware/hwtimer.c77
1 files changed, 30 insertions, 47 deletions
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index 49d7b395322e..aff6dc141784 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -46,8 +46,7 @@
46#include <acpi/acpi.h> 46#include <acpi/acpi.h>
47 47
48#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
49 ACPI_MODULE_NAME ("hwtimer") 49ACPI_MODULE_NAME("hwtimer")
50
51 50
52/****************************************************************************** 51/******************************************************************************
53 * 52 *
@@ -60,29 +59,23 @@
60 * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits). 59 * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
61 * 60 *
62 ******************************************************************************/ 61 ******************************************************************************/
63 62acpi_status acpi_get_timer_resolution(u32 * resolution)
64acpi_status
65acpi_get_timer_resolution (
66 u32 *resolution)
67{ 63{
68 ACPI_FUNCTION_TRACE ("acpi_get_timer_resolution"); 64 ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
69
70 65
71 if (!resolution) { 66 if (!resolution) {
72 return_ACPI_STATUS (AE_BAD_PARAMETER); 67 return_ACPI_STATUS(AE_BAD_PARAMETER);
73 } 68 }
74 69
75 if (0 == acpi_gbl_FADT->tmr_val_ext) { 70 if (0 == acpi_gbl_FADT->tmr_val_ext) {
76 *resolution = 24; 71 *resolution = 24;
77 } 72 } else {
78 else {
79 *resolution = 32; 73 *resolution = 32;
80 } 74 }
81 75
82 return_ACPI_STATUS (AE_OK); 76 return_ACPI_STATUS(AE_OK);
83} 77}
84 78
85
86/****************************************************************************** 79/******************************************************************************
87 * 80 *
88 * FUNCTION: acpi_get_timer 81 * FUNCTION: acpi_get_timer
@@ -95,26 +88,22 @@ acpi_get_timer_resolution (
95 * 88 *
96 ******************************************************************************/ 89 ******************************************************************************/
97 90
98acpi_status 91acpi_status acpi_get_timer(u32 * ticks)
99acpi_get_timer (
100 u32 *ticks)
101{ 92{
102 acpi_status status; 93 acpi_status status;
103
104
105 ACPI_FUNCTION_TRACE ("acpi_get_timer");
106 94
95 ACPI_FUNCTION_TRACE("acpi_get_timer");
107 96
108 if (!ticks) { 97 if (!ticks) {
109 return_ACPI_STATUS (AE_BAD_PARAMETER); 98 return_ACPI_STATUS(AE_BAD_PARAMETER);
110 } 99 }
111 100
112 status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk); 101 status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
113 102
114 return_ACPI_STATUS (status); 103 return_ACPI_STATUS(status);
115} 104}
116EXPORT_SYMBOL(acpi_get_timer);
117 105
106EXPORT_SYMBOL(acpi_get_timer);
118 107
119/****************************************************************************** 108/******************************************************************************
120 * 109 *
@@ -146,21 +135,16 @@ EXPORT_SYMBOL(acpi_get_timer);
146 ******************************************************************************/ 135 ******************************************************************************/
147 136
148acpi_status 137acpi_status
149acpi_get_timer_duration ( 138acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
150 u32 start_ticks,
151 u32 end_ticks,
152 u32 *time_elapsed)
153{ 139{
154 acpi_status status; 140 acpi_status status;
155 u32 delta_ticks; 141 u32 delta_ticks;
156 acpi_integer quotient; 142 acpi_integer quotient;
157
158
159 ACPI_FUNCTION_TRACE ("acpi_get_timer_duration");
160 143
144 ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
161 145
162 if (!time_elapsed) { 146 if (!time_elapsed) {
163 return_ACPI_STATUS (AE_BAD_PARAMETER); 147 return_ACPI_STATUS(AE_BAD_PARAMETER);
164 } 148 }
165 149
166 /* 150 /*
@@ -169,22 +153,22 @@ acpi_get_timer_duration (
169 */ 153 */
170 if (start_ticks < end_ticks) { 154 if (start_ticks < end_ticks) {
171 delta_ticks = end_ticks - start_ticks; 155 delta_ticks = end_ticks - start_ticks;
172 } 156 } else if (start_ticks > end_ticks) {
173 else if (start_ticks > end_ticks) {
174 if (0 == acpi_gbl_FADT->tmr_val_ext) { 157 if (0 == acpi_gbl_FADT->tmr_val_ext) {
175 /* 24-bit Timer */ 158 /* 24-bit Timer */
176 159
177 delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF); 160 delta_ticks =
178 } 161 (((0x00FFFFFF - start_ticks) +
179 else { 162 end_ticks) & 0x00FFFFFF);
163 } else {
180 /* 32-bit Timer */ 164 /* 32-bit Timer */
181 165
182 delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; 166 delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
183 } 167 }
184 } 168 } else { /* start_ticks == end_ticks */
185 else /* start_ticks == end_ticks */ { 169
186 *time_elapsed = 0; 170 *time_elapsed = 0;
187 return_ACPI_STATUS (AE_OK); 171 return_ACPI_STATUS(AE_OK);
188 } 172 }
189 173
190 /* 174 /*
@@ -192,12 +176,11 @@ acpi_get_timer_duration (
192 * 176 *
193 * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; 177 * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
194 */ 178 */
195 status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000, 179 status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000,
196 PM_TIMER_FREQUENCY, &quotient, NULL); 180 PM_TIMER_FREQUENCY, &quotient, NULL);
197 181
198 *time_elapsed = (u32) quotient; 182 *time_elapsed = (u32) quotient;
199 return_ACPI_STATUS (status); 183 return_ACPI_STATUS(status);
200} 184}
201 185
202EXPORT_SYMBOL(acpi_get_timer_duration); 186EXPORT_SYMBOL(acpi_get_timer_duration);
203