summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1999-12-15 10:04:05 +0000
committeryokota <yokota@FreeBSD.org>1999-12-15 10:04:05 +0000
commita917920b0c753ac42902c50c3c77ded28e2c4512 (patch)
tree801f81b93e3b00e6a037be0d1603de95e4e194df /sys
parent19ab44d39bd7d4ec22f8b3ae1b32f2394a5b25e6 (diff)
downloadFreeBSD-src-a917920b0c753ac42902c50c3c77ded28e2c4512.zip
FreeBSD-src-a917920b0c753ac42902c50c3c77ded28e2c4512.tar.gz
- Add the device resume method. It supercedes the existing resume
routine which hooks the apm driver. - Rename the PSM_HOOKAPM option to PSM_HOOKRESUME. - Delete unnecessary #include.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/conf/options.alpha2
-rw-r--r--sys/conf/NOTES2
-rw-r--r--sys/conf/options.alpha2
-rw-r--r--sys/conf/options.i3862
-rw-r--r--sys/dev/atkbdc/psm.c54
-rw-r--r--sys/i386/conf/LINT2
-rw-r--r--sys/i386/conf/NOTES2
-rw-r--r--sys/i386/conf/options.i3862
-rw-r--r--sys/isa/psm.c54
9 files changed, 43 insertions, 79 deletions
diff --git a/sys/alpha/conf/options.alpha b/sys/alpha/conf/options.alpha
index 3a998aa..56b8f3e 100644
--- a/sys/alpha/conf/options.alpha
+++ b/sys/alpha/conf/options.alpha
@@ -49,7 +49,7 @@ VGA_NO_MODE_CHANGE opt_vga.h
VGA_SLOW_IOACCESS opt_vga.h
VGA_WIDTH90 opt_vga.h
-PSM_HOOKAPM opt_psm.h
+PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
PSM_DEBUG opt_psm.h
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 099f25c..32f493f 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -933,7 +933,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
device psm0 at atkbdc? irq 12
# Options for psm:
-options PSM_HOOKAPM #hook the APM resume event, useful
+options PSM_HOOKRESUME #hook the system resume event, useful
#for some laptops
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
diff --git a/sys/conf/options.alpha b/sys/conf/options.alpha
index 3a998aa..56b8f3e 100644
--- a/sys/conf/options.alpha
+++ b/sys/conf/options.alpha
@@ -49,7 +49,7 @@ VGA_NO_MODE_CHANGE opt_vga.h
VGA_SLOW_IOACCESS opt_vga.h
VGA_WIDTH90 opt_vga.h
-PSM_HOOKAPM opt_psm.h
+PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
PSM_DEBUG opt_psm.h
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index fe38c4e..384638b 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -94,7 +94,7 @@ VGA_WIDTH90 opt_vga.h
VESA opt_vesa.h
VESA_DEBUG opt_vesa.h
-PSM_HOOKAPM opt_psm.h
+PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
PSM_DEBUG opt_psm.h
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index 28aa4c4..928e920 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -62,9 +62,6 @@
*/
#include "psm.h"
-#ifdef __i386__
-#include "apm.h"
-#endif
#include "opt_psm.h"
#if NPSM > 0
@@ -83,15 +80,11 @@
#include <sys/select.h>
#include <sys/uio.h>
-#ifdef __i386__
-#include <machine/apm_bios.h>
-#endif
#include <machine/clock.h>
#include <machine/limits.h>
#include <machine/mouse.h>
#include <machine/resource.h>
-#include <isa/isareg.h>
#include <isa/isavar.h>
#include <dev/kbd/atkbdcreg.h>
@@ -107,16 +100,17 @@
/* features */
-/* #define PSM_HOOKAPM hook the APM resume event */
+/* #define PSM_HOOKRESUME hook the system resume event */
/* #define PSM_RESETAFTERSUSPEND reset the device at the resume event */
-#if NAPM <= 0
-#undef PSM_HOOKAPM
-#endif /* NAPM */
+#ifdef PSM_HOOKAPM
+#undef PSM_HOOKRESUME
+#define PSM_HOOKRESUME 1
+#endif /* PSM_HOOKAPM */
-#ifndef PSM_HOOKAPM
+#ifndef PSM_HOOKRESUME
#undef PSM_RESETAFTERSUSPEND
-#endif /* PSM_HOOKAPM */
+#endif /* PSM_HOOKRESUME */
/* end of driver specific options */
@@ -177,9 +171,6 @@ struct psm_softc { /* Driver status information */
int button; /* the latest button state */
int xold; /* previous absolute X position */
int yold; /* previous absolute Y position */
-#ifdef PSM_HOOKAPM
- struct apmhook resumehook;
-#endif
};
devclass_t psm_devclass;
#define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit))
@@ -235,9 +226,7 @@ typedef int packetfunc_t __P((struct psm_softc *, unsigned char *,
/* function prototypes */
static int psmprobe __P((device_t));
static int psmattach __P((device_t));
-#ifdef PSM_HOOKAPM
-static int psmresume __P((void *));
-#endif
+static int psmresume __P((device_t));
static d_open_t psmopen;
static d_close_t psmclose;
@@ -309,6 +298,7 @@ static device_method_t psm_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, psmprobe),
DEVMETHOD(device_attach, psmattach),
+ DEVMETHOD(device_resume, psmresume),
{ 0, 0 }
};
@@ -1084,16 +1074,6 @@ psmattach(device_t dev)
make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, "psm%d", unit);
make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, "bpsm%d", unit);
-#ifdef PSM_HOOKAPM
- sc->resumehook.ah_name = "PS/2 mouse";
- sc->resumehook.ah_fun = psmresume;
- sc->resumehook.ah_arg = (void *)unit;
- sc->resumehook.ah_order = APM_MID_ORDER;
- apm_hook_establish(APM_HOOK_RESUME , &sc->resumehook);
- if (verbose)
- printf("psm%d: APM hooks installed.\n", unit);
-#endif /* PSM_HOOKAPM */
-
if (!verbose) {
printf("psm%d: model %s, device ID %d\n",
unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff);
@@ -2368,18 +2348,18 @@ enable_versapad(struct psm_softc *sc)
return TRUE; /* PS/2 absolute mode */
}
-#ifdef PSM_HOOKAPM
static int
-psmresume(void *dummy)
+psmresume(device_t dev)
{
- struct psm_softc *sc = PSM_SOFTC((int)dummy);
- int unit = (int)dummy;
+#ifdef PSM_HOOKRESUME
+ struct psm_softc *sc = device_get_softc(dev);
+ int unit = device_get_unit(dev);
int err = 0;
int s;
int c;
if (verbose >= 2)
- log(LOG_NOTICE, "psm%d: APM resume hook called.\n", unit);
+ log(LOG_NOTICE, "psm%d: system resume hook called.\n", unit);
/* don't let anybody mess with the aux device */
if (!kbdc_lock(sc->kbdc, TRUE))
@@ -2461,11 +2441,13 @@ psmresume(void *dummy)
}
if (verbose >= 2)
- log(LOG_DEBUG, "psm%d: APM resume hook exiting.\n", unit);
+ log(LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit);
return (err);
+#else /* !PSM_HOOKRESUME */
+ return (0);
+#endif /* PSM_HOOKRESUME */
}
-#endif /* PSM_HOOKAPM */
DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT
index 099f25c..32f493f 100644
--- a/sys/i386/conf/LINT
+++ b/sys/i386/conf/LINT
@@ -933,7 +933,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
device psm0 at atkbdc? irq 12
# Options for psm:
-options PSM_HOOKAPM #hook the APM resume event, useful
+options PSM_HOOKRESUME #hook the system resume event, useful
#for some laptops
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 099f25c..32f493f 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -933,7 +933,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
device psm0 at atkbdc? irq 12
# Options for psm:
-options PSM_HOOKAPM #hook the APM resume event, useful
+options PSM_HOOKRESUME #hook the system resume event, useful
#for some laptops
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
diff --git a/sys/i386/conf/options.i386 b/sys/i386/conf/options.i386
index fe38c4e..384638b 100644
--- a/sys/i386/conf/options.i386
+++ b/sys/i386/conf/options.i386
@@ -94,7 +94,7 @@ VGA_WIDTH90 opt_vga.h
VESA opt_vesa.h
VESA_DEBUG opt_vesa.h
-PSM_HOOKAPM opt_psm.h
+PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
PSM_DEBUG opt_psm.h
diff --git a/sys/isa/psm.c b/sys/isa/psm.c
index 28aa4c4..928e920 100644
--- a/sys/isa/psm.c
+++ b/sys/isa/psm.c
@@ -62,9 +62,6 @@
*/
#include "psm.h"
-#ifdef __i386__
-#include "apm.h"
-#endif
#include "opt_psm.h"
#if NPSM > 0
@@ -83,15 +80,11 @@
#include <sys/select.h>
#include <sys/uio.h>
-#ifdef __i386__
-#include <machine/apm_bios.h>
-#endif
#include <machine/clock.h>
#include <machine/limits.h>
#include <machine/mouse.h>
#include <machine/resource.h>
-#include <isa/isareg.h>
#include <isa/isavar.h>
#include <dev/kbd/atkbdcreg.h>
@@ -107,16 +100,17 @@
/* features */
-/* #define PSM_HOOKAPM hook the APM resume event */
+/* #define PSM_HOOKRESUME hook the system resume event */
/* #define PSM_RESETAFTERSUSPEND reset the device at the resume event */
-#if NAPM <= 0
-#undef PSM_HOOKAPM
-#endif /* NAPM */
+#ifdef PSM_HOOKAPM
+#undef PSM_HOOKRESUME
+#define PSM_HOOKRESUME 1
+#endif /* PSM_HOOKAPM */
-#ifndef PSM_HOOKAPM
+#ifndef PSM_HOOKRESUME
#undef PSM_RESETAFTERSUSPEND
-#endif /* PSM_HOOKAPM */
+#endif /* PSM_HOOKRESUME */
/* end of driver specific options */
@@ -177,9 +171,6 @@ struct psm_softc { /* Driver status information */
int button; /* the latest button state */
int xold; /* previous absolute X position */
int yold; /* previous absolute Y position */
-#ifdef PSM_HOOKAPM
- struct apmhook resumehook;
-#endif
};
devclass_t psm_devclass;
#define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit))
@@ -235,9 +226,7 @@ typedef int packetfunc_t __P((struct psm_softc *, unsigned char *,
/* function prototypes */
static int psmprobe __P((device_t));
static int psmattach __P((device_t));
-#ifdef PSM_HOOKAPM
-static int psmresume __P((void *));
-#endif
+static int psmresume __P((device_t));
static d_open_t psmopen;
static d_close_t psmclose;
@@ -309,6 +298,7 @@ static device_method_t psm_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, psmprobe),
DEVMETHOD(device_attach, psmattach),
+ DEVMETHOD(device_resume, psmresume),
{ 0, 0 }
};
@@ -1084,16 +1074,6 @@ psmattach(device_t dev)
make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, "psm%d", unit);
make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, "bpsm%d", unit);
-#ifdef PSM_HOOKAPM
- sc->resumehook.ah_name = "PS/2 mouse";
- sc->resumehook.ah_fun = psmresume;
- sc->resumehook.ah_arg = (void *)unit;
- sc->resumehook.ah_order = APM_MID_ORDER;
- apm_hook_establish(APM_HOOK_RESUME , &sc->resumehook);
- if (verbose)
- printf("psm%d: APM hooks installed.\n", unit);
-#endif /* PSM_HOOKAPM */
-
if (!verbose) {
printf("psm%d: model %s, device ID %d\n",
unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff);
@@ -2368,18 +2348,18 @@ enable_versapad(struct psm_softc *sc)
return TRUE; /* PS/2 absolute mode */
}
-#ifdef PSM_HOOKAPM
static int
-psmresume(void *dummy)
+psmresume(device_t dev)
{
- struct psm_softc *sc = PSM_SOFTC((int)dummy);
- int unit = (int)dummy;
+#ifdef PSM_HOOKRESUME
+ struct psm_softc *sc = device_get_softc(dev);
+ int unit = device_get_unit(dev);
int err = 0;
int s;
int c;
if (verbose >= 2)
- log(LOG_NOTICE, "psm%d: APM resume hook called.\n", unit);
+ log(LOG_NOTICE, "psm%d: system resume hook called.\n", unit);
/* don't let anybody mess with the aux device */
if (!kbdc_lock(sc->kbdc, TRUE))
@@ -2461,11 +2441,13 @@ psmresume(void *dummy)
}
if (verbose >= 2)
- log(LOG_DEBUG, "psm%d: APM resume hook exiting.\n", unit);
+ log(LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit);
return (err);
+#else /* !PSM_HOOKRESUME */
+ return (0);
+#endif /* PSM_HOOKRESUME */
}
-#endif /* PSM_HOOKAPM */
DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
OpenPOWER on IntegriCloud