atrtc.c (247101) | atrtc.c (247463) |
---|---|
1/*- 2 * Copyright (c) 2008 Poul-Henning Kamp 3 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2008 Poul-Henning Kamp 3 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/x86/isa/atrtc.c 247101 2013-02-21 15:35:48Z imp $ | 27 * $FreeBSD: head/sys/x86/isa/atrtc.c 247463 2013-02-28 13:46:03Z mav $ |
28 */ 29 30#include <sys/cdefs.h> | 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/x86/isa/atrtc.c 247101 2013-02-21 15:35:48Z imp $"); | 31__FBSDID("$FreeBSD: head/sys/x86/isa/atrtc.c 247463 2013-02-28 13:46:03Z mav $"); |
32 33#include "opt_isa.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/bus.h> 38#include <sys/clock.h> 39#include <sys/lock.h> --- 119 unchanged lines hidden (view full) --- 159 int port_rid, intr_rid; 160 struct resource *port_res; 161 struct resource *intr_res; 162 void *intr_handler; 163 struct eventtimer et; 164}; 165 166static int | 32 33#include "opt_isa.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/bus.h> 38#include <sys/clock.h> 39#include <sys/lock.h> --- 119 unchanged lines hidden (view full) --- 159 int port_rid, intr_rid; 160 struct resource *port_res; 161 struct resource *intr_res; 162 void *intr_handler; 163 struct eventtimer et; 164}; 165 166static int |
167rtc_start(struct eventtimer *et, 168 struct bintime *first, struct bintime *period) | 167rtc_start(struct eventtimer *et, sbintime_t first, sbintime_t period) |
169{ 170 | 168{ 169 |
171 atrtc_rate(max(fls((period->frac + (period->frac >> 1)) >> 32) - 17, 1)); | 170 atrtc_rate(max(fls(period + (period >> 1)) - 17, 1)); |
172 atrtc_enable_intr(); 173 return (0); 174} 175 176static int 177rtc_stop(struct eventtimer *et) 178{ 179 --- 92 unchanged lines hidden (view full) --- 272 } else { 273 /* Bind IRQ to BSP to avoid live migration. */ 274 bus_bind_intr(dev, sc->intr_res, 0); 275 } 276 sc->et.et_name = "RTC"; 277 sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_POW2DIV; 278 sc->et.et_quality = 0; 279 sc->et.et_frequency = 32768; | 171 atrtc_enable_intr(); 172 return (0); 173} 174 175static int 176rtc_stop(struct eventtimer *et) 177{ 178 --- 92 unchanged lines hidden (view full) --- 271 } else { 272 /* Bind IRQ to BSP to avoid live migration. */ 273 bus_bind_intr(dev, sc->intr_res, 0); 274 } 275 sc->et.et_name = "RTC"; 276 sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_POW2DIV; 277 sc->et.et_quality = 0; 278 sc->et.et_frequency = 32768; |
280 sc->et.et_min_period.sec = 0; 281 sc->et.et_min_period.frac = 0x0008LLU << 48; 282 sc->et.et_max_period.sec = 0; 283 sc->et.et_max_period.frac = 0x8000LLU << 48; | 279 sc->et.et_min_period = 0x00080000; 280 sc->et.et_max_period = 0x80000000; |
284 sc->et.et_start = rtc_start; 285 sc->et.et_stop = rtc_stop; 286 sc->et.et_priv = dev; 287 et_register(&sc->et); 288 } 289 return(0); 290} 291 --- 116 unchanged lines hidden --- | 281 sc->et.et_start = rtc_start; 282 sc->et.et_stop = rtc_stop; 283 sc->et.et_priv = dev; 284 et_register(&sc->et); 285 } 286 return(0); 287} 288 --- 116 unchanged lines hidden --- |