aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/isa/atrtc.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2010-06-22 19:42:27 +0000
committerAlexander Motin <mav@FreeBSD.org>2010-06-22 19:42:27 +0000
commit49ed68bbf3cfe3afae8c02592f11c1c59dc470cb (patch)
treea4a0e64c2b9b08481cd4dd8fb84674dc9f7f92d4 /sys/x86/isa/atrtc.c
parent25eb1b8c15cd2612250341af60b4c5525ec45de4 (diff)
downloadsrc-49ed68bbf3cfe3afae8c02592f11c1c59dc470cb.tar.gz
src-49ed68bbf3cfe3afae8c02592f11c1c59dc470cb.zip
Add "legacy route" support to HPET driver. When enabled, this mode makes
HPET to steal IRQ0 from i8254 and IRQ8 from RTC timers. It can be suitable for HPETs without FSB interrupts support, as it gives them two unshared IRQs. It allows them to provide one per-CPU event timer on dual-CPU system, that should be suitable for further tickless kernels. To enable it, such lines may be added to /boot/loader.conf: hint.atrtc.0.clock=0 hint.attimer.0.clock=0 hint.hpet.0.legacy_route=1
Notes
Notes: svn path=/head/; revision=209440
Diffstat (limited to 'sys/x86/isa/atrtc.c')
-rw-r--r--sys/x86/isa/atrtc.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c
index fe2a8768bb9a..dc0a89b3e341 100644
--- a/sys/x86/isa/atrtc.c
+++ b/sys/x86/isa/atrtc.c
@@ -244,34 +244,35 @@ static int
atrtc_attach(device_t dev)
{
struct atrtc_softc *sc;
- int i, diag, haveirq = 0;
+ int i, diag;
sc = device_get_softc(dev);
if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT,
&sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE)))
device_printf(dev,"Warning: Couldn't map I/O.\n");
- if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
- &sc->intr_rid, 8, 8, 1, RF_ACTIVE)))
- device_printf(dev,"Couldn't map Interrupt.\n");
- else if ((bus_setup_intr(dev, sc->intr_res,
- INTR_MPSAFE | INTR_TYPE_CLK, (driver_filter_t *)rtc_intr, NULL,
- sc, &sc->intr_handler))) {
- device_printf(dev, "Can't setup interrupt.\n");
- } else {
- haveirq = 1;
- /* Bind IRQ to BSP to avoid live migration. */
- bus_bind_intr(dev, sc->intr_res, 0);
- }
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
atrtc_start();
clock_register(dev, 1000000);
bzero(&sc->et, sizeof(struct eventtimer));
- if (haveirq &&
- !atrtcclock_disable &&
+ if (!atrtcclock_disable &&
(resource_int_value(device_get_name(dev), device_get_unit(dev),
"clock", &i) != 0 || i != 0)) {
+ if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ,
+ &sc->intr_rid, 8, 8, 1, RF_ACTIVE))) {
+ device_printf(dev,"Can't map interrupt.\n");
+ return (0);
+ } else if ((bus_setup_intr(dev, sc->intr_res,
+ INTR_MPSAFE | INTR_TYPE_CLK,
+ (driver_filter_t *)rtc_intr, NULL,
+ sc, &sc->intr_handler))) {
+ device_printf(dev, "Can't setup interrupt.\n");
+ return (0);
+ } else {
+ /* Bind IRQ to BSP to avoid live migration. */
+ bus_bind_intr(dev, sc->intr_res, 0);
+ }
sc->et.et_name = "RTC";
sc->et.et_flags = ET_FLAGS_PERIODIC;
sc->et.et_quality = 0;