diff options
author | nsayer <nsayer@FreeBSD.org> | 1999-10-02 03:34:15 +0000 |
---|---|---|
committer | nsayer <nsayer@FreeBSD.org> | 1999-10-02 03:34:15 +0000 |
commit | f8cb01182379dbcbe1bdfe7d387e7354d7a66d27 (patch) | |
tree | d8611db667230122c3a9c1554346b8447ebcf725 /sys | |
parent | 6709241681feb033577eba40d4b46ac5bce1668f (diff) | |
download | FreeBSD-src-f8cb01182379dbcbe1bdfe7d387e7354d7a66d27.zip FreeBSD-src-f8cb01182379dbcbe1bdfe7d387e7354d7a66d27.tar.gz |
Prepare for the apm_saver screen saver module.
1. Break out the definition of the soft state structure into an include
file.
2. un-static the soft state and apm_display(), and group them under a
comment that notes the dependency.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/apm/apm.c | 32 | ||||
-rw-r--r-- | sys/i386/apm/apm.h | 43 | ||||
-rw-r--r-- | sys/i386/bios/apm.c | 32 | ||||
-rw-r--r-- | sys/i386/bios/apm.h | 43 |
4 files changed, 100 insertions, 50 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index d6752b7..a0c5b95 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -44,37 +44,20 @@ #include <machine/pc/bios.h> #include <machine/vm86.h> -static int apm_display __P((int newstate)); +#include <i386/apm/apm.h> + +/* Used by the apm_saver screen saver module */ +int apm_display __P((int newstate)); +struct apm_softc apm_softc; + static void apm_resume __P((void)); static int apm_bioscall(void); static int apm_check_function_supported __P((u_int version, u_int func)); static u_long apm_version; -#define APM_NEVENTS 16 -#define APM_NPMEV 13 - int apm_evindex; -/* static data */ -struct apm_softc { - int initialized, active, bios_busy; - int always_halt_cpu, slow_idle_cpu; - int disabled, disengaged; - int standby_countdown, suspend_countdown; - u_int minorversion, majorversion; - u_int intversion, connectmode; - u_int standbys, suspends; - struct bios_args bios; - struct apmhook sc_suspend; - struct apmhook sc_resume; - struct selinfo sc_rsel; - int sc_flags; - int event_count; - int event_ptr; - struct apm_event_info event_list[APM_NEVENTS]; - u_char event_filter[APM_NPMEV]; -}; #define SCFLAG_ONORMAL 0x0000001 #define SCFLAG_OCTL 0x0000002 #define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL) @@ -83,7 +66,6 @@ struct apm_softc { #define APMDEV_NORMAL 0 #define APMDEV_CTL 8 -static struct apm_softc apm_softc; static struct apmhook *hook[NAPM_HOOK]; /* XXX */ #define is_enabled(foo) ((foo) ? "enabled" : "disabled") @@ -278,7 +260,7 @@ apm_suspend_system(int state) * If your laptop can control the display via APM, please inform me. * HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org> */ -static int +int apm_display(int newstate) { struct apm_softc *sc = &apm_softc; diff --git a/sys/i386/apm/apm.h b/sys/i386/apm/apm.h new file mode 100644 index 0000000..242782f --- /dev/null +++ b/sys/i386/apm/apm.h @@ -0,0 +1,43 @@ +/* + * APM (Advanced Power Management) BIOS Device Driver + * + * Copyright (c) 1994 UKAI, Fumitoshi. + * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org> + * Copyright (c) 1996 Nate Williams <nate@FreeBSD.org> + * Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org> + * + * This software may be used, modified, copied, and distributed, in + * both source and binary form provided that the above copyright and + * these terms are retained. Under no circumstances is the author + * responsible for the proper functioning of this software, nor does + * the author assume any responsibility for damages incurred with its + * use. + * + * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) + * + * $FreeBSD$ + */ + +#define APM_NEVENTS 16 +#define APM_NPMEV 13 + +/* static data */ +struct apm_softc { + int initialized, active, bios_busy; + int always_halt_cpu, slow_idle_cpu; + int disabled, disengaged; + int standby_countdown, suspend_countdown; + u_int minorversion, majorversion; + u_int intversion, connectmode; + u_int standbys, suspends; + struct bios_args bios; + struct apmhook sc_suspend; + struct apmhook sc_resume; + struct selinfo sc_rsel; + int sc_flags; + int event_count; + int event_ptr; + struct apm_event_info event_list[APM_NEVENTS]; + u_char event_filter[APM_NPMEV]; +}; + diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index d6752b7..a0c5b95 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -44,37 +44,20 @@ #include <machine/pc/bios.h> #include <machine/vm86.h> -static int apm_display __P((int newstate)); +#include <i386/apm/apm.h> + +/* Used by the apm_saver screen saver module */ +int apm_display __P((int newstate)); +struct apm_softc apm_softc; + static void apm_resume __P((void)); static int apm_bioscall(void); static int apm_check_function_supported __P((u_int version, u_int func)); static u_long apm_version; -#define APM_NEVENTS 16 -#define APM_NPMEV 13 - int apm_evindex; -/* static data */ -struct apm_softc { - int initialized, active, bios_busy; - int always_halt_cpu, slow_idle_cpu; - int disabled, disengaged; - int standby_countdown, suspend_countdown; - u_int minorversion, majorversion; - u_int intversion, connectmode; - u_int standbys, suspends; - struct bios_args bios; - struct apmhook sc_suspend; - struct apmhook sc_resume; - struct selinfo sc_rsel; - int sc_flags; - int event_count; - int event_ptr; - struct apm_event_info event_list[APM_NEVENTS]; - u_char event_filter[APM_NPMEV]; -}; #define SCFLAG_ONORMAL 0x0000001 #define SCFLAG_OCTL 0x0000002 #define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL) @@ -83,7 +66,6 @@ struct apm_softc { #define APMDEV_NORMAL 0 #define APMDEV_CTL 8 -static struct apm_softc apm_softc; static struct apmhook *hook[NAPM_HOOK]; /* XXX */ #define is_enabled(foo) ((foo) ? "enabled" : "disabled") @@ -278,7 +260,7 @@ apm_suspend_system(int state) * If your laptop can control the display via APM, please inform me. * HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org> */ -static int +int apm_display(int newstate) { struct apm_softc *sc = &apm_softc; diff --git a/sys/i386/bios/apm.h b/sys/i386/bios/apm.h new file mode 100644 index 0000000..242782f --- /dev/null +++ b/sys/i386/bios/apm.h @@ -0,0 +1,43 @@ +/* + * APM (Advanced Power Management) BIOS Device Driver + * + * Copyright (c) 1994 UKAI, Fumitoshi. + * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org> + * Copyright (c) 1996 Nate Williams <nate@FreeBSD.org> + * Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org> + * + * This software may be used, modified, copied, and distributed, in + * both source and binary form provided that the above copyright and + * these terms are retained. Under no circumstances is the author + * responsible for the proper functioning of this software, nor does + * the author assume any responsibility for damages incurred with its + * use. + * + * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) + * + * $FreeBSD$ + */ + +#define APM_NEVENTS 16 +#define APM_NPMEV 13 + +/* static data */ +struct apm_softc { + int initialized, active, bios_busy; + int always_halt_cpu, slow_idle_cpu; + int disabled, disengaged; + int standby_countdown, suspend_countdown; + u_int minorversion, majorversion; + u_int intversion, connectmode; + u_int standbys, suspends; + struct bios_args bios; + struct apmhook sc_suspend; + struct apmhook sc_resume; + struct selinfo sc_rsel; + int sc_flags; + int event_count; + int event_ptr; + struct apm_event_info event_list[APM_NEVENTS]; + u_char event_filter[APM_NPMEV]; +}; + |