Lines Matching +full:high +full:- +full:resolution

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
30 * initially for Android but now also used for RISC-V's virt machine.
32 …* https://android.googlesource.com/platform/external/qemu/+/master/docs/GOLDFISH-VIRTUAL-HARDWARE.…
70 if (ofw_bus_is_compatible(dev, "google,goldfish-rtc")) { in goldfish_rtc_probe()
85 sc->rid = 0; in goldfish_rtc_attach()
86 sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, in goldfish_rtc_attach()
88 if (sc->res == NULL) { in goldfish_rtc_attach()
93 mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); in goldfish_rtc_attach()
96 * Register as a system realtime clock with 1 second resolution. in goldfish_rtc_attach()
112 mtx_destroy(&sc->mtx); in goldfish_rtc_detach()
113 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res); in goldfish_rtc_detach()
122 uint64_t low, high, nsec; in goldfish_rtc_gettime() local
127 * Reading TIME_HIGH is defined in the documentation to give the high in goldfish_rtc_gettime()
131 mtx_lock(&sc->mtx); in goldfish_rtc_gettime()
132 low = bus_read_4(sc->res, GOLDFISH_RTC_TIME_LOW); in goldfish_rtc_gettime()
133 high = bus_read_4(sc->res, GOLDFISH_RTC_TIME_HIGH); in goldfish_rtc_gettime()
134 mtx_unlock(&sc->mtx); in goldfish_rtc_gettime()
136 nsec = (high << 32) | low; in goldfish_rtc_gettime()
137 ts->tv_sec = nsec / 1000000000; in goldfish_rtc_gettime()
138 ts->tv_nsec = nsec % 1000000000; in goldfish_rtc_gettime()
152 * We request a timespec with no resolution-adjustment. That also in goldfish_rtc_settime()
155 ts->tv_sec -= utc_offset(); in goldfish_rtc_settime()
156 nsec = (uint64_t)ts->tv_sec * 1000000000 + ts->tv_nsec; in goldfish_rtc_settime()
158 mtx_lock(&sc->mtx); in goldfish_rtc_settime()
159 bus_write_4(sc->res, GOLDFISH_RTC_TIME_HIGH, nsec >> 32); in goldfish_rtc_settime()
160 bus_write_4(sc->res, GOLDFISH_RTC_TIME_LOW, nsec); in goldfish_rtc_settime()
161 mtx_unlock(&sc->mtx); in goldfish_rtc_settime()