Home | History | Annotate | Line # | Download | only in apm
apmvar.h revision 1.5.12.2
      1  1.5.12.1       mjf /*	$NetBSD: apmvar.h,v 1.5.12.2 2008/06/02 13:23:13 mjf 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  *
     18       1.1  takemura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19       1.1  takemura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20       1.1  takemura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21       1.1  takemura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22       1.1  takemura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23       1.1  takemura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24       1.1  takemura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25       1.1  takemura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26       1.1  takemura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27       1.1  takemura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28       1.1  takemura  * POSSIBILITY OF SUCH DAMAGE.
     29       1.1  takemura  */
     30       1.3  christos #ifndef _DEV_APM_APMVAR_H_
     31       1.3  christos #define _DEV_APM_APMVAR_H_
     32       1.1  takemura 
     33       1.3  christos #include <dev/apm/apmbios.h>
     34       1.3  christos #include <dev/apm/apmio.h>
     35       1.1  takemura 
     36       1.1  takemura struct apm_accessops {
     37       1.3  christos 	void	(*aa_disconnect)(void *);
     38       1.3  christos 	void	(*aa_enable)(void *, int);
     39       1.3  christos 	int	(*aa_set_powstate)(void *, u_int, u_int);
     40       1.3  christos 	int	(*aa_get_powstat)(void *, u_int, struct apm_power_info *);
     41       1.3  christos 	int	(*aa_get_event)(void *, u_int *, u_int *);
     42       1.3  christos 	void	(*aa_cpu_busy)(void *);
     43       1.3  christos 	void	(*aa_cpu_idle)(void *);
     44       1.3  christos 	void	(*aa_get_capabilities)(void *, u_int *, u_int *);
     45       1.3  christos };
     46       1.3  christos 
     47       1.3  christos #define APM_NEVENTS 16
     48       1.3  christos 
     49       1.3  christos struct apm_softc {
     50  1.5.12.1       mjf 	device_t sc_dev;
     51       1.3  christos 	struct selinfo sc_rsel;
     52       1.3  christos 	struct selinfo sc_xsel;
     53       1.3  christos 	int	sc_flags;
     54       1.3  christos 	int	sc_event_count;
     55       1.3  christos 	int	sc_event_ptr;
     56       1.3  christos 	int	sc_power_state;
     57       1.4        ad 	lwp_t	*sc_thread;
     58       1.5        ad 	kmutex_t sc_lock;
     59       1.3  christos 	struct apm_event_info sc_event_list[APM_NEVENTS];
     60       1.3  christos 	struct apm_accessops *sc_ops;
     61       1.3  christos 	int	sc_hwflags;
     62       1.3  christos 	int	sc_vers;
     63       1.3  christos 	int	sc_detail;
     64       1.3  christos 	void *sc_cookie;
     65       1.3  christos };
     66       1.3  christos 
     67       1.3  christos #define	APM_F_DONT_RUN_HOOKS	0x01
     68       1.3  christos 
     69       1.3  christos int apm_match(void);
     70       1.3  christos void apm_attach(struct apm_softc *);
     71       1.3  christos const char *apm_strerror(int);
     72       1.1  takemura 
     73       1.3  christos #endif /* _DEV_APM_APMVAR_H_ */
     74