Deleted Added
full compact
kern_clocksource.c (239036) kern_clocksource.c (241413)
1/*-
2 * Copyright (c) 2010-2012 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2012 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_clocksource.c 239036 2012-08-04 08:06:37Z mav $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_clocksource.c 241413 2012-10-10 19:46:46Z mav $");
29
30/*
31 * Common routines to manage event timers hardware.
32 */
33
34#include "opt_device_polling.h"
35#include "opt_kdtrace.h"
36

--- 560 unchanged lines hidden (view full) ---

597
598 if (et->et_frequency != 0) {
599 div = lmax((et->et_frequency + freq / 2) / freq, 1);
600 if (et->et_flags & ET_FLAGS_POW2DIV)
601 div = 1 << (flsl(div + div / 2) - 1);
602 freq = (et->et_frequency + div / 2) / div;
603 }
604 if (et->et_min_period.sec > 0)
29
30/*
31 * Common routines to manage event timers hardware.
32 */
33
34#include "opt_device_polling.h"
35#include "opt_kdtrace.h"
36

--- 560 unchanged lines hidden (view full) ---

597
598 if (et->et_frequency != 0) {
599 div = lmax((et->et_frequency + freq / 2) / freq, 1);
600 if (et->et_flags & ET_FLAGS_POW2DIV)
601 div = 1 << (flsl(div + div / 2) - 1);
602 freq = (et->et_frequency + div / 2) / div;
603 }
604 if (et->et_min_period.sec > 0)
605 freq = 0;
605 panic("Event timer \"%s\" doesn't support sub-second periods!",
606 et->et_name);
606 else if (et->et_min_period.frac != 0)
607 freq = min(freq, BT2FREQ(&et->et_min_period));
608 if (et->et_max_period.sec == 0 && et->et_max_period.frac != 0)
609 freq = max(freq, BT2FREQ(&et->et_max_period));
610 return (freq);
611}
612
613/*

--- 355 unchanged lines hidden ---
607 else if (et->et_min_period.frac != 0)
608 freq = min(freq, BT2FREQ(&et->et_min_period));
609 if (et->et_max_period.sec == 0 && et->et_max_period.frac != 0)
610 freq = max(freq, BT2FREQ(&et->et_max_period));
611 return (freq);
612}
613
614/*

--- 355 unchanged lines hidden ---