Deleted Added
full compact
acpi_timer.c (170289) acpi_timer.c (171657)
1/*-
2 * Copyright (c) 2000, 2001 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000, 2001 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_timer.c 170289 2007-06-04 18:25:08Z dwmalone $");
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_timer.c 171657 2007-07-30 15:21:26Z njl $");
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/module.h>
36#include <sys/sysctl.h>
37#include <sys/timetc.h>

--- 53 unchanged lines hidden (view full) ---

91MODULE_DEPEND(acpi_timer, acpi, 1, 1, 1);
92
93static struct timecounter acpi_timer_timecounter = {
94 acpi_timer_get_timecount_safe, /* get_timecount function */
95 0, /* no poll_pps */
96 0, /* no default counter_mask */
97 0, /* no default frequency */
98 "ACPI", /* name */
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/bus.h>
34#include <sys/kernel.h>
35#include <sys/module.h>
36#include <sys/sysctl.h>
37#include <sys/timetc.h>

--- 53 unchanged lines hidden (view full) ---

91MODULE_DEPEND(acpi_timer, acpi, 1, 1, 1);
92
93static struct timecounter acpi_timer_timecounter = {
94 acpi_timer_get_timecount_safe, /* get_timecount function */
95 0, /* no poll_pps */
96 0, /* no default counter_mask */
97 0, /* no default frequency */
98 "ACPI", /* name */
99 1000 /* quality */
99 -1 /* quality (chosen later) */
100};
101
102static u_int
103acpi_timer_read()
104{
105 return (bus_space_read_4(acpi_timer_bst, acpi_timer_bsh, 0));
106}
107

--- 72 unchanged lines hidden (view full) ---

180 printf("ACPI timer:");
181 for (i = 0; i < 10; i++)
182 j += acpi_timer_test();
183 if (bootverbose)
184 printf(" -> %d\n", j);
185 if (j == 10) {
186 acpi_timer_timecounter.tc_name = "ACPI-fast";
187 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
100};
101
102static u_int
103acpi_timer_read()
104{
105 return (bus_space_read_4(acpi_timer_bst, acpi_timer_bsh, 0));
106}
107

--- 72 unchanged lines hidden (view full) ---

180 printf("ACPI timer:");
181 for (i = 0; i < 10; i++)
182 j += acpi_timer_test();
183 if (bootverbose)
184 printf(" -> %d\n", j);
185 if (j == 10) {
186 acpi_timer_timecounter.tc_name = "ACPI-fast";
187 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
188 acpi_timer_timecounter.tc_quality = 1000;
188 } else {
189 acpi_timer_timecounter.tc_name = "ACPI-safe";
190 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
189 } else {
190 acpi_timer_timecounter.tc_name = "ACPI-safe";
191 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
192 acpi_timer_timecounter.tc_quality = 850;
191 }
192 tc_init(&acpi_timer_timecounter);
193
194 sprintf(desc, "%d-bit timer at 3.579545MHz",
195 (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) ? 32 : 24);
196 device_set_desc_copy(dev, desc);
197
198 /* Release the resource, we'll allocate it again during attach. */

--- 170 unchanged lines hidden ---
193 }
194 tc_init(&acpi_timer_timecounter);
195
196 sprintf(desc, "%d-bit timer at 3.579545MHz",
197 (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) ? 32 : 24);
198 device_set_desc_copy(dev, desc);
199
200 /* Release the resource, we'll allocate it again during attach. */

--- 170 unchanged lines hidden ---