Deleted Added
full compact
acpi_hpet.c (193530) acpi_hpet.c (199016)
1/*-
2 * Copyright (c) 2005 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

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

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_hpet.c 193530 2009-06-05 18:44:36Z jkim $");
28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_hpet.c 199016 2009-11-07 11:46:38Z avg $");
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/bus.h>
33#include <sys/kernel.h>
34#include <sys/module.h>
35#include <sys/rman.h>
36#include <sys/time.h>

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

56 ACPI_HANDLE handle;
57};
58
59static u_int hpet_get_timecount(struct timecounter *tc);
60static void acpi_hpet_test(struct acpi_hpet_softc *sc);
61
62static char *hpet_ids[] = { "PNP0103", NULL };
63
29
30#include "opt_acpi.h"
31#include <sys/param.h>
32#include <sys/bus.h>
33#include <sys/kernel.h>
34#include <sys/module.h>
35#include <sys/rman.h>
36#include <sys/time.h>

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

56 ACPI_HANDLE handle;
57};
58
59static u_int hpet_get_timecount(struct timecounter *tc);
60static void acpi_hpet_test(struct acpi_hpet_softc *sc);
61
62static char *hpet_ids[] = { "PNP0103", NULL };
63
64#define DEV_HPET(x) (acpi_get_magic(x) == (uintptr_t)&acpi_hpet_devclass)
65
66struct timecounter hpet_timecounter = {
67 .tc_get_timecount = hpet_get_timecount,
68 .tc_counter_mask = ~0u,
69 .tc_name = "HPET",
70 .tc_quality = 900,
71};
72
73static u_int

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

128 printf("ACPI HPET table warning: Sequence is non-zero (%d)\n",
129 hpet->Sequence);
130 child = BUS_ADD_CHILD(parent, ACPI_DEV_BASE_ORDER, "acpi_hpet", 0);
131 if (child == NULL) {
132 printf("%s: can't add child\n", __func__);
133 return;
134 }
135
64struct timecounter hpet_timecounter = {
65 .tc_get_timecount = hpet_get_timecount,
66 .tc_counter_mask = ~0u,
67 .tc_name = "HPET",
68 .tc_quality = 900,
69};
70
71static u_int

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

126 printf("ACPI HPET table warning: Sequence is non-zero (%d)\n",
127 hpet->Sequence);
128 child = BUS_ADD_CHILD(parent, ACPI_DEV_BASE_ORDER, "acpi_hpet", 0);
129 if (child == NULL) {
130 printf("%s: can't add child\n", __func__);
131 return;
132 }
133
136 /* Record a magic value so we can detect this device later. */
137 acpi_set_magic(child, (uintptr_t)&acpi_hpet_devclass);
138 bus_set_resource(child, SYS_RES_MEMORY, 0, hpet->Address.Address,
139 HPET_MEM_WIDTH);
140}
141
142static int
143acpi_hpet_probe(device_t dev)
144{
145 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
146
147 if (acpi_disabled("hpet"))
148 return (ENXIO);
134 bus_set_resource(child, SYS_RES_MEMORY, 0, hpet->Address.Address,
135 HPET_MEM_WIDTH);
136}
137
138static int
139acpi_hpet_probe(device_t dev)
140{
141 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
142
143 if (acpi_disabled("hpet"))
144 return (ENXIO);
149 if (!DEV_HPET(dev) &&
145 if (acpi_get_handle(dev) != NULL &&
150 (ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL ||
151 device_get_unit(dev) != 0))
152 return (ENXIO);
153
154 device_set_desc(dev, "High Precision Event Timer");
155 return (0);
156}
157

--- 162 unchanged lines hidden ---
146 (ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL ||
147 device_get_unit(dev) != 0))
148 return (ENXIO);
149
150 device_set_desc(dev, "High Precision Event Timer");
151 return (0);
152}
153

--- 162 unchanged lines hidden ---