summaryrefslogtreecommitdiffstats
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.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c
index 1b5a161..76fbd5a 100644
--- a/sys/dev/acpica/acpi_hpet.c
+++ b/sys/dev/acpica/acpi_hpet.c
@@ -85,6 +85,7 @@ struct hpet_softc {
struct resource *intr_res;
void *intr_handle;
ACPI_HANDLE handle;
+ uint32_t acpi_uid;
uint64_t freq;
uint32_t caps;
struct timecounter tc;
@@ -295,6 +296,15 @@ hpet_intr(void *arg)
return (FILTER_STRAY);
}
+uint32_t
+hpet_get_uid(device_t dev)
+{
+ struct hpet_softc *sc;
+
+ sc = device_get_softc(dev);
+ return (sc->acpi_uid);
+}
+
static ACPI_STATUS
hpet_find(ACPI_HANDLE handle, UINT32 level, void *context,
void **status)
@@ -422,8 +432,9 @@ hpet_attach(device_t dev)
{
struct hpet_softc *sc;
struct hpet_timer *t;
+ struct make_dev_args mda;
int i, j, num_msi, num_timers, num_percpu_et, num_percpu_t, cur_cpu;
- int pcpu_master;
+ int pcpu_master, error;
static int maxhpetet = 0;
uint32_t val, val2, cvectors, dvectors;
uint16_t vendor, rev;
@@ -745,11 +756,16 @@ hpet_attach(device_t dev)
maxhpetet++;
}
}
-
- sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL,
- 0600, "hpet%d", device_get_unit(dev));
- if (sc->pdev) {
- sc->pdev->si_drv1 = sc;
+ acpi_GetInteger(sc->handle, "_UID", &sc->acpi_uid);
+
+ make_dev_args_init(&mda);
+ mda.mda_devsw = &hpet_cdevsw;
+ mda.mda_uid = UID_ROOT;
+ mda.mda_gid = GID_WHEEL;
+ mda.mda_mode = 0600;
+ 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);
@@ -766,9 +782,10 @@ hpet_attach(device_t dev)
OID_AUTO, "mmap_allow_write",
CTLFLAG_RW, &sc->mmap_allow_write, 0,
"Allow userland write to the HPET register space");
- } else
- device_printf(dev, "could not create /dev/hpet%d\n",
- device_get_unit(dev));
+ } else {
+ device_printf(dev, "could not create /dev/hpet%d, error %d\n",
+ device_get_unit(dev), error);
+ }
return (0);
}
OpenPOWER on IntegriCloud