diff options
author | mav <mav@FreeBSD.org> | 2010-07-20 10:58:56 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2010-07-20 10:58:56 +0000 |
commit | 1021ed9c1fb242e77973084e90e83ad8f307080a (patch) | |
tree | a2ade1a810689c7741fce55a1e8c698c5abacbdc /sys/x86 | |
parent | 19bed51cff8dcac07d39993556ad270818a248cd (diff) | |
download | FreeBSD-src-1021ed9c1fb242e77973084e90e83ad8f307080a.zip FreeBSD-src-1021ed9c1fb242e77973084e90e83ad8f307080a.tar.gz |
Extend timer driver API to report also minimal and maximal supported period
lengths. Make MI wrapper code to validate periods in request. Make kernel
clock management code to honor these hardware limitations while choosing hz,
stathz and profhz values.
Diffstat (limited to 'sys/x86')
-rw-r--r-- | sys/x86/isa/atrtc.c | 6 | ||||
-rw-r--r-- | sys/x86/isa/clock.c | 5 | ||||
-rw-r--r-- | sys/x86/x86/local_apic.c | 11 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c index 5a5ba63..b01e933 100644 --- a/sys/x86/isa/atrtc.c +++ b/sys/x86/isa/atrtc.c @@ -276,9 +276,13 @@ atrtc_attach(device_t dev) bus_bind_intr(dev, sc->intr_res, 0); } sc->et.et_name = "RTC"; - sc->et.et_flags = ET_FLAGS_PERIODIC; + sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_POW2DIV; sc->et.et_quality = 0; sc->et.et_frequency = 32768; + sc->et.et_min_period.sec = 0; + sc->et.et_min_period.frac = 0x0008LL << 48; + sc->et.et_max_period.sec = 0; + sc->et.et_max_period.frac = 0x8000LL << 48; sc->et.et_start = rtc_start; sc->et.et_stop = rtc_stop; sc->et.et_priv = dev; diff --git a/sys/x86/isa/clock.c b/sys/x86/isa/clock.c index 6b5fede..62869a6 100644 --- a/sys/x86/isa/clock.c +++ b/sys/x86/isa/clock.c @@ -665,6 +665,11 @@ attimer_attach(device_t dev) sc->et.et_flags = ET_FLAGS_PERIODIC; sc->et.et_quality = 100; sc->et.et_frequency = i8254_freq; + sc->et.et_min_period.sec = 0; + sc->et.et_min_period.frac = ((1LL << 62) / i8254_freq) << 2; + sc->et.et_max_period.sec = 0xffff / i8254_freq; + sc->et.et_max_period.frac = + ((0xffffLL << 48) / i8254_freq) << 16; sc->et.et_start = attimer_start; sc->et.et_stop = attimer_stop; sc->et.et_priv = dev; diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 4364fb1..ffa34a5 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -263,6 +263,11 @@ lapic_init(vm_paddr_t addr) lapic_et.et_quality -= 100; } lapic_et.et_frequency = 0; + /* We don't know frequency yet, so trying to guess. */ + lapic_et.et_min_period.sec = 0; + lapic_et.et_min_period.frac = 0x00001000LL << 32; + lapic_et.et_max_period.sec = 1; + lapic_et.et_max_period.frac = 0; lapic_et.et_start = lapic_et_start; lapic_et.et_stop = lapic_et_stop; lapic_et.et_priv = NULL; @@ -493,6 +498,12 @@ lapic_et_start(struct eventtimer *et, printf("lapic: Divisor %lu, Frequency %lu Hz\n", lapic_timer_divisor, value); et->et_frequency = value; + et->et_min_period.sec = 0; + et->et_min_period.frac = + ((1LL << 63) / et->et_frequency) << 1; + et->et_max_period.sec = 0xffffffff / et->et_frequency; + et->et_max_period.frac = + ((0xffffffffLL << 32) / et->et_frequency) << 32; } la = &lapics[lapic_id()]; /* |