Home | History | Annotate | Line # | Download | only in apm
apmvar.h revision 1.2.26.1
      1  1.2.26.1      yamt /*	$NetBSD: apmvar.h,v 1.2.26.1 2006/12/30 20:47:54 yamt Exp $	*/
      2       1.1  takemura /*-
      3  1.2.26.1      yamt  * 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.2.26.1      yamt  * 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.2.26.1      yamt #ifndef _DEV_APM_APMVAR_H_
     38  1.2.26.1      yamt #define _DEV_APM_APMVAR_H_
     39       1.1  takemura 
     40  1.2.26.1      yamt #include <dev/apm/apmbios.h>
     41  1.2.26.1      yamt #include <dev/apm/apmio.h>
     42       1.1  takemura 
     43       1.1  takemura struct apm_accessops {
     44  1.2.26.1      yamt 	void	(*aa_disconnect)(void *);
     45  1.2.26.1      yamt 	void	(*aa_enable)(void *, int);
     46  1.2.26.1      yamt 	int	(*aa_set_powstate)(void *, u_int, u_int);
     47  1.2.26.1      yamt 	int	(*aa_get_powstat)(void *, u_int, struct apm_power_info *);
     48  1.2.26.1      yamt 	int	(*aa_get_event)(void *, u_int *, u_int *);
     49  1.2.26.1      yamt 	void	(*aa_cpu_busy)(void *);
     50  1.2.26.1      yamt 	void	(*aa_cpu_idle)(void *);
     51  1.2.26.1      yamt 	void	(*aa_get_capabilities)(void *, u_int *, u_int *);
     52  1.2.26.1      yamt };
     53  1.2.26.1      yamt 
     54  1.2.26.1      yamt #define APM_NEVENTS 16
     55  1.2.26.1      yamt 
     56  1.2.26.1      yamt struct apm_softc {
     57  1.2.26.1      yamt 	struct device sc_dev;
     58  1.2.26.1      yamt 	struct selinfo sc_rsel;
     59  1.2.26.1      yamt 	struct selinfo sc_xsel;
     60  1.2.26.1      yamt 	int	sc_flags;
     61  1.2.26.1      yamt 	int	sc_event_count;
     62  1.2.26.1      yamt 	int	sc_event_ptr;
     63  1.2.26.1      yamt 	int	sc_power_state;
     64  1.2.26.1      yamt 	struct proc *sc_thread;
     65  1.2.26.1      yamt 	struct lock sc_lock;
     66  1.2.26.1      yamt 	struct apm_event_info sc_event_list[APM_NEVENTS];
     67  1.2.26.1      yamt 	struct apm_accessops *sc_ops;
     68  1.2.26.1      yamt 	int	sc_hwflags;
     69  1.2.26.1      yamt 	int	sc_vers;
     70  1.2.26.1      yamt 	int	sc_detail;
     71  1.2.26.1      yamt 	void *sc_cookie;
     72  1.2.26.1      yamt };
     73  1.2.26.1      yamt 
     74  1.2.26.1      yamt #define	APM_F_DONT_RUN_HOOKS	0x01
     75  1.2.26.1      yamt 
     76  1.2.26.1      yamt int apm_match(void);
     77  1.2.26.1      yamt void apm_attach(struct apm_softc *);
     78  1.2.26.1      yamt const char *apm_strerror(int);
     79       1.1  takemura 
     80  1.2.26.1      yamt #endif /* _DEV_APM_APMVAR_H_ */
     81