Home | History | Annotate | Line # | Download | only in apm
apmvar.h revision 1.6
      1  1.6      cube /*	$NetBSD: apmvar.h,v 1.6 2008/03/07 21:45:08 cube Exp $	*/
      2  1.1  takemura /*-
      3  1.3  christos  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
      4  1.1  takemura  * All rights reserved.
      5  1.1  takemura  *
      6  1.1  takemura  * This code is derived from software contributed to The NetBSD Foundation
      7  1.3  christos  * by TAKEMURA Shin.
      8  1.1  takemura  *
      9  1.1  takemura  * Redistribution and use in source and binary forms, with or without
     10  1.1  takemura  * modification, are permitted provided that the following conditions
     11  1.1  takemura  * are met:
     12  1.1  takemura  * 1. Redistributions of source code must retain the above copyright
     13  1.1  takemura  *    notice, this list of conditions and the following disclaimer.
     14  1.1  takemura  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  takemura  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  takemura  *    documentation and/or other materials provided with the distribution.
     17  1.1  takemura  * 3. All advertising materials mentioning features or use of this software
     18  1.1  takemura  *    must display the following acknowledgement:
     19  1.1  takemura  *        This product includes software developed by the NetBSD
     20  1.1  takemura  *        Foundation, Inc. and its contributors.
     21  1.1  takemura  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.1  takemura  *    contributors may be used to endorse or promote products derived
     23  1.1  takemura  *    from this software without specific prior written permission.
     24  1.1  takemura  *
     25  1.1  takemura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.1  takemura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1  takemura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1  takemura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.1  takemura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1  takemura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1  takemura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1  takemura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1  takemura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1  takemura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1  takemura  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1  takemura  */
     37  1.3  christos #ifndef _DEV_APM_APMVAR_H_
     38  1.3  christos #define _DEV_APM_APMVAR_H_
     39  1.1  takemura 
     40  1.3  christos #include <dev/apm/apmbios.h>
     41  1.3  christos #include <dev/apm/apmio.h>
     42  1.1  takemura 
     43  1.1  takemura struct apm_accessops {
     44  1.3  christos 	void	(*aa_disconnect)(void *);
     45  1.3  christos 	void	(*aa_enable)(void *, int);
     46  1.3  christos 	int	(*aa_set_powstate)(void *, u_int, u_int);
     47  1.3  christos 	int	(*aa_get_powstat)(void *, u_int, struct apm_power_info *);
     48  1.3  christos 	int	(*aa_get_event)(void *, u_int *, u_int *);
     49  1.3  christos 	void	(*aa_cpu_busy)(void *);
     50  1.3  christos 	void	(*aa_cpu_idle)(void *);
     51  1.3  christos 	void	(*aa_get_capabilities)(void *, u_int *, u_int *);
     52  1.3  christos };
     53  1.3  christos 
     54  1.3  christos #define APM_NEVENTS 16
     55  1.3  christos 
     56  1.3  christos struct apm_softc {
     57  1.6      cube 	device_t sc_dev;
     58  1.3  christos 	struct selinfo sc_rsel;
     59  1.3  christos 	struct selinfo sc_xsel;
     60  1.3  christos 	int	sc_flags;
     61  1.3  christos 	int	sc_event_count;
     62  1.3  christos 	int	sc_event_ptr;
     63  1.3  christos 	int	sc_power_state;
     64  1.4        ad 	lwp_t	*sc_thread;
     65  1.5        ad 	kmutex_t sc_lock;
     66  1.3  christos 	struct apm_event_info sc_event_list[APM_NEVENTS];
     67  1.3  christos 	struct apm_accessops *sc_ops;
     68  1.3  christos 	int	sc_hwflags;
     69  1.3  christos 	int	sc_vers;
     70  1.3  christos 	int	sc_detail;
     71  1.3  christos 	void *sc_cookie;
     72  1.3  christos };
     73  1.3  christos 
     74  1.3  christos #define	APM_F_DONT_RUN_HOOKS	0x01
     75  1.3  christos 
     76  1.3  christos int apm_match(void);
     77  1.3  christos void apm_attach(struct apm_softc *);
     78  1.3  christos const char *apm_strerror(int);
     79  1.1  takemura 
     80  1.3  christos #endif /* _DEV_APM_APMVAR_H_ */
     81