xref: /illumos-gate/usr/src/contrib/bhyve/x86/timerreg.h (revision 32640292339b07090f10ce34d455f98711077343)
1*32640292SAndy Fiddaman /*-
2*32640292SAndy Fiddaman  * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved.
3*32640292SAndy Fiddaman  *
4*32640292SAndy Fiddaman  * Redistribution and use in source and binary forms, with or without
5*32640292SAndy Fiddaman  * modification, are permitted provided that the following conditions
6*32640292SAndy Fiddaman  * are met:
7*32640292SAndy Fiddaman  * 1. Redistributions of source code must retain the above copyright
8*32640292SAndy Fiddaman  *    notice, this list of conditions and the following disclaimer.
9*32640292SAndy Fiddaman  * 2. Redistributions in binary form must reproduce the above copyright
10*32640292SAndy Fiddaman  *    notice, this list of conditions and the following disclaimer in the
11*32640292SAndy Fiddaman  *    documentation and/or other materials provided with the distribution.
12*32640292SAndy Fiddaman  *
13*32640292SAndy Fiddaman  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*32640292SAndy Fiddaman  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*32640292SAndy Fiddaman  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*32640292SAndy Fiddaman  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17*32640292SAndy Fiddaman  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*32640292SAndy Fiddaman  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*32640292SAndy Fiddaman  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*32640292SAndy Fiddaman  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*32640292SAndy Fiddaman  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*32640292SAndy Fiddaman  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*32640292SAndy Fiddaman  * SUCH DAMAGE.
24*32640292SAndy Fiddaman  *
25*32640292SAndy Fiddaman  * $FreeBSD: head/sys/amd64/include/timerreg.h 177642 2008-03-26 20:09:21Z phk $
26*32640292SAndy Fiddaman  */
27*32640292SAndy Fiddaman 
28*32640292SAndy Fiddaman /*
29*32640292SAndy Fiddaman  * The outputs of the three timers are connected as follows:
30*32640292SAndy Fiddaman  *
31*32640292SAndy Fiddaman  *	 timer 0 -> irq 0
32*32640292SAndy Fiddaman  *	 timer 1 -> dma chan 0 (for dram refresh)
33*32640292SAndy Fiddaman  * 	 timer 2 -> speaker (via keyboard controller)
34*32640292SAndy Fiddaman  *
35*32640292SAndy Fiddaman  * Timer 0 is used to call hardclock.
36*32640292SAndy Fiddaman  * Timer 2 is used to generate console beeps.
37*32640292SAndy Fiddaman  */
38*32640292SAndy Fiddaman 
39*32640292SAndy Fiddaman #ifndef _MACHINE_TIMERREG_H_
40*32640292SAndy Fiddaman #define _MACHINE_TIMERREG_H_
41*32640292SAndy Fiddaman 
42*32640292SAndy Fiddaman #ifdef _KERNEL
43*32640292SAndy Fiddaman 
44*32640292SAndy Fiddaman #include <dev/ic/i8253reg.h>
45*32640292SAndy Fiddaman 
46*32640292SAndy Fiddaman #define	IO_TIMER1	0x40		/* 8253 Timer #1 */
47*32640292SAndy Fiddaman #define	TIMER_CNTR0	(IO_TIMER1 + TIMER_REG_CNTR0)
48*32640292SAndy Fiddaman #define	TIMER_CNTR1	(IO_TIMER1 + TIMER_REG_CNTR1)
49*32640292SAndy Fiddaman #define	TIMER_CNTR2	(IO_TIMER1 + TIMER_REG_CNTR2)
50*32640292SAndy Fiddaman #define	TIMER_MODE	(IO_TIMER1 + TIMER_REG_MODE)
51*32640292SAndy Fiddaman 
52*32640292SAndy Fiddaman #endif /* _KERNEL */
53*32640292SAndy Fiddaman 
54*32640292SAndy Fiddaman #endif /* _MACHINE_TIMERREG_H_ */
55