Deleted Added
full compact
psm.c (147263) psm.c (147271)
1/*-
2 * Copyright (c) 1992, 1993 Erik Forsberg.
3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 45 unchanged lines hidden (view full) ---

54 * HiNote UltraII/Latitude/Armada laptops.
55 * - 30 July 1997. Added APM support.
56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX).
57 * Improved sync check logic.
58 * Vendor specific support routines.
59 */
60
61#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1992, 1993 Erik Forsberg.
3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 45 unchanged lines hidden (view full) ---

54 * HiNote UltraII/Latitude/Armada laptops.
55 * - 30 July 1997. Added APM support.
56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX).
57 * Improved sync check logic.
58 * Vendor specific support routines.
59 */
60
61#include <sys/cdefs.h>
62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 139982 2005-01-10 13:05:58Z philip $");
62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 147271 2005-06-10 20:56:38Z marius $");
63
63
64#include "opt_isa.h"
64#include "opt_psm.h"
65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/kernel.h>
69#include <sys/module.h>
70#include <sys/bus.h>
71#include <sys/conf.h>

--- 5 unchanged lines hidden (view full) ---

77#include <sys/sysctl.h>
78#include <sys/time.h>
79#include <sys/uio.h>
80
81#include <sys/limits.h>
82#include <sys/mouse.h>
83#include <machine/resource.h>
84
65#include "opt_psm.h"
66
67#include <sys/param.h>
68#include <sys/systm.h>
69#include <sys/kernel.h>
70#include <sys/module.h>
71#include <sys/bus.h>
72#include <sys/conf.h>

--- 5 unchanged lines hidden (view full) ---

78#include <sys/sysctl.h>
79#include <sys/time.h>
80#include <sys/uio.h>
81
82#include <sys/limits.h>
83#include <sys/mouse.h>
84#include <machine/resource.h>
85
86#ifdef DEV_ISA
85#include <isa/isavar.h>
87#include <isa/isavar.h>
86#include <dev/kbd/atkbdcreg.h>
88#endif
87
89
90#include <dev/atkbdc/atkbdcreg.h>
91#include <dev/atkbdc/psm.h>
92
88/*
89 * Driver specific options: the following options may be set by
90 * `options' statements in the kernel configuration file.
91 */
92
93/* debugging */
94#ifndef PSM_DEBUG
95#define PSM_DEBUG 0 /*

--- 16 unchanged lines hidden (view full) ---

112#endif
113
114#ifndef PSM_TAP_THRESHOLD
115#define PSM_TAP_THRESHOLD 25
116#endif
117
118/* end of driver specific options */
119
93/*
94 * Driver specific options: the following options may be set by
95 * `options' statements in the kernel configuration file.
96 */
97
98/* debugging */
99#ifndef PSM_DEBUG
100#define PSM_DEBUG 0 /*

--- 16 unchanged lines hidden (view full) ---

117#endif
118
119#ifndef PSM_TAP_THRESHOLD
120#define PSM_TAP_THRESHOLD 25
121#endif
122
123/* end of driver specific options */
124
120#define PSM_DRIVER_NAME "psm"
121#define PSMCPNP_DRIVER_NAME "psmcpnp"
122
123/* input queue */
124#define PSM_BUFSIZE 960
125#define PSM_SMALLBUFSIZE 240
126
127/* operation levels */
128#define PSM_LEVEL_BASE 0

--- 3335 unchanged lines hidden (view full) ---

3464 return FALSE;
3465 set_mouse_scaling(kbdc, 1); /* set scale 1:1 */
3466
3467 sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND;
3468
3469 return TRUE; /* PS/2 absolute mode */
3470}
3471
125#define PSMCPNP_DRIVER_NAME "psmcpnp"
126
127/* input queue */
128#define PSM_BUFSIZE 960
129#define PSM_SMALLBUFSIZE 240
130
131/* operation levels */
132#define PSM_LEVEL_BASE 0

--- 3335 unchanged lines hidden (view full) ---

3468 return FALSE;
3469 set_mouse_scaling(kbdc, 1); /* set scale 1:1 */
3470
3471 sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND;
3472
3473 return TRUE; /* PS/2 absolute mode */
3474}
3475
3476/*
3477 * Return true if 'now' is earlier than (start + (secs.usecs)).
3478 * Now may be NULL and the function will fetch the current time from
3479 * getmicrouptime(), or a cached 'now' can be passed in.
3480 * All values should be numbers derived from getmicrouptime().
3481 */
3472static int
3482static int
3483timeelapsed(start, secs, usecs, now)
3484 const struct timeval *start, *now;
3485 int secs, usecs;
3486{
3487 struct timeval snow, tv;
3488
3489 /* if there is no 'now' passed in, the get it as a convience. */
3490 if (now == NULL) {
3491 getmicrouptime(&snow);
3492 now = &snow;
3493 }
3494
3495 tv.tv_sec = secs;
3496 tv.tv_usec = usecs;
3497 timevaladd(&tv, start);
3498 return (timevalcmp(&tv, now, <));
3499}
3500
3501static int
3473psmresume(device_t dev)
3474{
3475 struct psm_softc *sc = device_get_softc(dev);
3476 int unit = device_get_unit(dev);
3477 int err;
3478
3479 VLOG(2, (LOG_NOTICE, "psm%d: system resume hook called.\n", unit));
3480

--- 13 unchanged lines hidden (view full) ---

3494
3495 VLOG(2, (LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit));
3496
3497 return (err);
3498}
3499
3500DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
3501
3502psmresume(device_t dev)
3503{
3504 struct psm_softc *sc = device_get_softc(dev);
3505 int unit = device_get_unit(dev);
3506 int err;
3507
3508 VLOG(2, (LOG_NOTICE, "psm%d: system resume hook called.\n", unit));
3509

--- 13 unchanged lines hidden (view full) ---

3523
3524 VLOG(2, (LOG_DEBUG, "psm%d: system resume hook exiting.\n", unit));
3525
3526 return (err);
3527}
3528
3529DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
3530
3531#ifdef DEV_ISA
3532
3502/*
3503 * This sucks up assignments from PNPBIOS and ACPI.
3504 */
3505
3506/*
3507 * When the PS/2 mouse device is reported by ACPI or PnP BIOS, it may
3508 * appear BEFORE the AT keyboard controller. As the PS/2 mouse device
3509 * can be probed and attached only after the AT keyboard controller is

--- 114 unchanged lines hidden (view full) ---

3624 */
3625 rid = 0;
3626 bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE);
3627 }
3628
3629 return 0;
3630}
3631
3533/*
3534 * This sucks up assignments from PNPBIOS and ACPI.
3535 */
3536
3537/*
3538 * When the PS/2 mouse device is reported by ACPI or PnP BIOS, it may
3539 * appear BEFORE the AT keyboard controller. As the PS/2 mouse device
3540 * can be probed and attached only after the AT keyboard controller is

--- 114 unchanged lines hidden (view full) ---

3655 */
3656 rid = 0;
3657 bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE);
3658 }
3659
3660 return 0;
3661}
3662
3632/*
3633 * Return true if 'now' is earlier than (start + (secs.usecs)).
3634 * Now may be NULL and the function will fetch the current time from
3635 * getmicrouptime(), or a cached 'now' can be passed in.
3636 * All values should be numbers derived from getmicrouptime().
3637 */
3638static int
3639timeelapsed(start, secs, usecs, now)
3640 const struct timeval *start, *now;
3641 int secs, usecs;
3642{
3643 struct timeval snow, tv;
3644
3645 /* if there is no 'now' passed in, the get it as a convience. */
3646 if (now == NULL) {
3647 getmicrouptime(&snow);
3648 now = &snow;
3649 }
3650
3651 tv.tv_sec = secs;
3652 tv.tv_usec = usecs;
3653 timevaladd(&tv, start);
3654 return (timevalcmp(&tv, now, <));
3655}
3656
3657DRIVER_MODULE(psmcpnp, isa, psmcpnp_driver, psmcpnp_devclass, 0, 0);
3658DRIVER_MODULE(psmcpnp, acpi, psmcpnp_driver, psmcpnp_devclass, 0, 0);
3663DRIVER_MODULE(psmcpnp, isa, psmcpnp_driver, psmcpnp_devclass, 0, 0);
3664DRIVER_MODULE(psmcpnp, acpi, psmcpnp_driver, psmcpnp_devclass, 0, 0);
3665
3666#endif /* DEV_ISA */