xref: /netbsd-src/sys/dev/ic/hpetvar.h (revision 3187bd1ecb51cf005f86e2bd1058e8484511a8a4)
1*3187bd1eSad /* $NetBSD: hpetvar.h,v 1.7 2020/05/08 22:01:54 ad Exp $ */
290b3c9e7Snjoly 
390b3c9e7Snjoly /*
490b3c9e7Snjoly  * Copyright (c) 2006 Nicolas Joly
590b3c9e7Snjoly  * All rights reserved.
690b3c9e7Snjoly  *
790b3c9e7Snjoly  * Redistribution and use in source and binary forms, with or without
890b3c9e7Snjoly  * modification, are permitted provided that the following conditions
990b3c9e7Snjoly  * are met:
1090b3c9e7Snjoly  * 1. Redistributions of source code must retain the above copyright
1190b3c9e7Snjoly  *    notice, this list of conditions and the following disclaimer.
1290b3c9e7Snjoly  * 2. Redistributions in binary form must reproduce the above copyright
1390b3c9e7Snjoly  *    notice, this list of conditions and the following disclaimer in the
1490b3c9e7Snjoly  *    documentation and/or other materials provided with the distribution.
1590b3c9e7Snjoly  * 3. The name of the author may not be used to endorse or promote products
1690b3c9e7Snjoly  *    derived from this software without specific prior written permission.
1790b3c9e7Snjoly  *
1890b3c9e7Snjoly  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
1990b3c9e7Snjoly  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2090b3c9e7Snjoly  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2190b3c9e7Snjoly  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2290b3c9e7Snjoly  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2390b3c9e7Snjoly  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2490b3c9e7Snjoly  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2590b3c9e7Snjoly  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2690b3c9e7Snjoly  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2790b3c9e7Snjoly  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2890b3c9e7Snjoly  * POSSIBILITY OF SUCH DAMAGE.
2990b3c9e7Snjoly  */
3090b3c9e7Snjoly 
3190b3c9e7Snjoly #ifndef _DEV_IC_HPETVAR_H_
3290b3c9e7Snjoly #define _DEV_IC_HPETVAR_H_
3390b3c9e7Snjoly 
34e5210a69Sad #include <sys/timetc.h>
35e5210a69Sad 
3690b3c9e7Snjoly struct hpet_softc {
37aad85e10Sjruoho 	bus_size_t		sc_mems;
3890b3c9e7Snjoly 	bus_space_tag_t		sc_memt;
3990b3c9e7Snjoly 	bus_space_handle_t	sc_memh;
4090b3c9e7Snjoly 
41aad85e10Sjruoho 	bool			sc_mapped;
4262dca010Sdyoung 	uint32_t		sc_config;
43e5210a69Sad 	int32_t			sc_period;
44e2a03ec5Sad 	int64_t			sc_adj;
4590b3c9e7Snjoly 	struct			timecounter sc_tc;
4690b3c9e7Snjoly };
4790b3c9e7Snjoly 
48d749da91Sxtraeme void	hpet_attach_subr(device_t);
4962dca010Sdyoung int	hpet_detach(device_t, int flags);
50e5210a69Sad void	hpet_delay(unsigned int);
51e5210a69Sad bool	hpet_delay_p(void);
52*3187bd1eSad uint64_t hpet_tsc_freq(void);
5390b3c9e7Snjoly 
5490b3c9e7Snjoly #endif /* _DEV_IC_HPETVAR_H_ */
55