Deleted Added
full compact
atrtc.c (12941) atrtc.c (13000)
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz and Don Ahn.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz and Don Ahn.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91
37 * $Id: clock.c,v 1.41 1995/12/14 23:01:51 bde Exp $
37 * $Id: clock.c,v 1.42 1995/12/20 20:57:33 wollman Exp $
38 */
39
40/*
41 * inittodr, settodr and support routines written
42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
43 *
44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
45 */

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

88 * TIMER0_LATCH_COUNT so that we don't have to worry about underflow in
89 * the calculation of timer0_overflow_threshold.
90 */
91#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
92
93int adjkerntz = 0; /* offset from CMOS clock */
94int disable_rtc_set = 0; /* disable resettodr() if != 0 */
95u_int idelayed;
38 */
39
40/*
41 * inittodr, settodr and support routines written
42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
43 *
44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
45 */

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

88 * TIMER0_LATCH_COUNT so that we don't have to worry about underflow in
89 * the calculation of timer0_overflow_threshold.
90 */
91#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
92
93int adjkerntz = 0; /* offset from CMOS clock */
94int disable_rtc_set = 0; /* disable resettodr() if != 0 */
95u_int idelayed;
96#ifdef I586_CPU
96#if defined(I586_CPU) || defined(I686_CPU)
97unsigned i586_ctr_rate;
98long long i586_ctr_bias;
99long long i586_last_tick;
100#endif
101u_int stat_imask = SWI_CLOCK_MASK;
102int timer0_max_count;
103u_int timer0_overflow_threshold;
104u_int timer0_prescaler_count;

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

275 /* select timer0 and latch counter value */
276 outb(TIMER_MODE, TIMER_SEL0);
277 low = inb(TIMER_CNTR0);
278 high = inb(TIMER_CNTR0);
279 enable_intr();
280 return ((high << 8) | low);
281}
282
97unsigned i586_ctr_rate;
98long long i586_ctr_bias;
99long long i586_last_tick;
100#endif
101u_int stat_imask = SWI_CLOCK_MASK;
102int timer0_max_count;
103u_int timer0_overflow_threshold;
104u_int timer0_prescaler_count;

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

275 /* select timer0 and latch counter value */
276 outb(TIMER_MODE, TIMER_SEL0);
277 low = inb(TIMER_CNTR0);
278 high = inb(TIMER_CNTR0);
279 enable_intr();
280 return ((high << 8) | low);
281}
282
283#ifdef I586_CPU
283#if defined(I586_CPU) || defined(I686_CPU)
284/*
285 * Figure out how fast the cyclecounter runs. This must be run with
286 * clock interrupts disabled, but with the timer/counter programmed
287 * and running.
288 */
289void
290calibrate_cyclecounter(void)
291{

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

564 stathz = RTC_NOPROFRATE;
565 profhz = RTC_PROFRATE;
566
567 /* Finish initializing 8253 timer 0. */
568 register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
569 /* XXX */ (inthand2_t *)clkintr, &clk_imask,
570 /* unit */ 0);
571 INTREN(IRQ0);
284/*
285 * Figure out how fast the cyclecounter runs. This must be run with
286 * clock interrupts disabled, but with the timer/counter programmed
287 * and running.
288 */
289void
290calibrate_cyclecounter(void)
291{

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

564 stathz = RTC_NOPROFRATE;
565 profhz = RTC_PROFRATE;
566
567 /* Finish initializing 8253 timer 0. */
568 register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0,
569 /* XXX */ (inthand2_t *)clkintr, &clk_imask,
570 /* unit */ 0);
571 INTREN(IRQ0);
572#ifdef I586_CPU
572#if defined(I586_CPU) || defined(I686_CPU)
573 /*
574 * Finish setting up anti-jitter measures.
575 */
576 if (i586_ctr_rate) {
577 I586_CYCLECTR(i586_last_tick);
578 i586_ctr_bias = i586_last_tick;
579 }
580#endif

--- 23 unchanged lines hidden ---
573 /*
574 * Finish setting up anti-jitter measures.
575 */
576 if (i586_ctr_rate) {
577 I586_CYCLECTR(i586_last_tick);
578 i586_ctr_bias = i586_last_tick;
579 }
580#endif

--- 23 unchanged lines hidden ---