apmvar.h revision 1.8 1 1.8 cegger /* $NetBSD: apmvar.h,v 1.8 2009/04/05 08:33:04 cegger 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.8 cegger #include <sys/selinfo.h> /* for struct selinfo */
36 1.1 takemura
37 1.1 takemura struct apm_accessops {
38 1.3 christos void (*aa_disconnect)(void *);
39 1.3 christos void (*aa_enable)(void *, int);
40 1.3 christos int (*aa_set_powstate)(void *, u_int, u_int);
41 1.3 christos int (*aa_get_powstat)(void *, u_int, struct apm_power_info *);
42 1.3 christos int (*aa_get_event)(void *, u_int *, u_int *);
43 1.3 christos void (*aa_cpu_busy)(void *);
44 1.3 christos void (*aa_cpu_idle)(void *);
45 1.3 christos void (*aa_get_capabilities)(void *, u_int *, u_int *);
46 1.3 christos };
47 1.3 christos
48 1.3 christos #define APM_NEVENTS 16
49 1.3 christos
50 1.3 christos struct apm_softc {
51 1.6 cube device_t sc_dev;
52 1.3 christos struct selinfo sc_rsel;
53 1.3 christos struct selinfo sc_xsel;
54 1.3 christos int sc_flags;
55 1.3 christos int sc_event_count;
56 1.3 christos int sc_event_ptr;
57 1.3 christos int sc_power_state;
58 1.4 ad lwp_t *sc_thread;
59 1.5 ad kmutex_t sc_lock;
60 1.3 christos struct apm_event_info sc_event_list[APM_NEVENTS];
61 1.3 christos struct apm_accessops *sc_ops;
62 1.3 christos int sc_hwflags;
63 1.3 christos int sc_vers;
64 1.3 christos int sc_detail;
65 1.3 christos void *sc_cookie;
66 1.3 christos };
67 1.3 christos
68 1.3 christos #define APM_F_DONT_RUN_HOOKS 0x01
69 1.3 christos
70 1.3 christos int apm_match(void);
71 1.3 christos void apm_attach(struct apm_softc *);
72 1.3 christos const char *apm_strerror(int);
73 1.1 takemura
74 1.3 christos #endif /* _DEV_APM_APMVAR_H_ */
75