aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/acpica/acpi_hpet.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpica/acpi_hpet.c')
-rw-r--r--sys/dev/acpica/acpi_hpet.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c
index da1e160e2036..053b956817a8 100644
--- a/sys/dev/acpica/acpi_hpet.c
+++ b/sys/dev/acpica/acpi_hpet.c
@@ -29,6 +29,8 @@
__FBSDID("$FreeBSD$");
#include "opt_acpi.h"
+#include "opt_compat.h"
+
#if defined(__amd64__)
#define DEV_APIC
#else
@@ -47,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/timeet.h>
#include <sys/timetc.h>
+#include <sys/vdso.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -141,6 +144,35 @@ hpet_get_timecount(struct timecounter *tc)
return (bus_read_4(sc->mem_res, HPET_MAIN_COUNTER));
}
+uint32_t
+hpet_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc)
+{
+ struct hpet_softc *sc;
+
+ sc = tc->tc_priv;
+ vdso_th->th_algo = VDSO_TH_ALGO_X86_HPET;
+ vdso_th->th_x86_shift = 0;
+ vdso_th->th_x86_hpet_idx = device_get_unit(sc->dev);
+ bzero(vdso_th->th_res, sizeof(vdso_th->th_res));
+ return (sc->mmap_allow != 0);
+}
+
+#ifdef COMPAT_FREEBSD32
+uint32_t
+hpet_vdso_timehands32(struct vdso_timehands32 *vdso_th32,
+ struct timecounter *tc)
+{
+ struct hpet_softc *sc;
+
+ sc = tc->tc_priv;
+ vdso_th32->th_algo = VDSO_TH_ALGO_X86_HPET;
+ vdso_th32->th_x86_shift = 0;
+ vdso_th32->th_x86_hpet_idx = device_get_unit(sc->dev);
+ bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res));
+ return (sc->mmap_allow != 0);
+}
+#endif
+
static void
hpet_enable(struct hpet_softc *sc)
{
@@ -537,6 +569,10 @@ hpet_attach(device_t dev)
sc->tc.tc_quality = 950,
sc->tc.tc_frequency = sc->freq;
sc->tc.tc_priv = sc;
+ sc->tc.tc_fill_vdso_timehands = hpet_vdso_timehands;
+#ifdef COMPAT_FREEBSD32
+ sc->tc.tc_fill_vdso_timehands32 = hpet_vdso_timehands32;
+#endif
tc_init(&sc->tc);
}
/* If not disabled - setup and announce event timers. */
@@ -762,14 +798,14 @@ hpet_attach(device_t dev)
mda.mda_devsw = &hpet_cdevsw;
mda.mda_uid = UID_ROOT;
mda.mda_gid = GID_WHEEL;
- mda.mda_mode = 0600;
+ mda.mda_mode = 0644;
mda.mda_si_drv1 = sc;
error = make_dev_s(&mda, &sc->pdev, "hpet%d", device_get_unit(dev));
if (error == 0) {
sc->mmap_allow = 1;
TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow",
&sc->mmap_allow);
- sc->mmap_allow_write = 1;
+ sc->mmap_allow_write = 0;
TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write",
&sc->mmap_allow_write);
SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),