Deleted Added
full compact
psm.c (41181) psm.c (43105)
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:

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

15 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
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:

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

15 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * $Id: psm.c,v 1.1 1998/11/08 18:43:03 dfr Exp $
23 * $Id: psm.c,v 1.2 1998/11/15 18:25:17 dfr Exp $
24 */
25
26/*
27 * Ported to 386bsd Oct 17, 1992
28 * Sandi Donno, Computer Science, University of Cape Town, South Africa
29 * Please send bug reports to sandi@cs.uct.ac.za
30 *
31 * Thanks are also due to Rick Macklem, rick@snowhite.cis.uoguelph.ca -

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

85
86#include <machine/clock.h>
87#include <machine/limits.h>
88#include <machine/mouse.h>
89#include <machine/resource.h>
90
91#include <isa/isareg.h>
92#include <isa/isavar.h>
24 */
25
26/*
27 * Ported to 386bsd Oct 17, 1992
28 * Sandi Donno, Computer Science, University of Cape Town, South Africa
29 * Please send bug reports to sandi@cs.uct.ac.za
30 *
31 * Thanks are also due to Rick Macklem, rick@snowhite.cis.uoguelph.ca -

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

85
86#include <machine/clock.h>
87#include <machine/limits.h>
88#include <machine/mouse.h>
89#include <machine/resource.h>
90
91#include <isa/isareg.h>
92#include <isa/isavar.h>
93#include <isa/kbdio.h>
93#include <dev/kbd/atkbdcreg.h>
94
95/*
96 * Driver specific options: the following options may be set by
97 * `options' statements in the kernel configuration file.
98 */
99
100/* debugging */
101#ifndef PSM_DEBUG

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

735 return (v); \
736 }
737
738static int
739psmprobe(device_t dev)
740{
741 int unit = device_get_unit(dev);
742 struct psm_softc *sc = device_get_softc(dev);
94
95/*
96 * Driver specific options: the following options may be set by
97 * `options' statements in the kernel configuration file.
98 */
99
100/* debugging */
101#ifndef PSM_DEBUG

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

735 return (v); \
736 }
737
738static int
739psmprobe(device_t dev)
740{
741 int unit = device_get_unit(dev);
742 struct psm_softc *sc = device_get_softc(dev);
743 u_long port;
744 u_long flags;
743 int stat[3];
744 int command_byte;
745 int mask;
746 int i;
747
748#if 0
749 kbdc_debug(TRUE);
750#endif
745 int stat[3];
746 int command_byte;
747 int mask;
748 int i;
749
750#if 0
751 kbdc_debug(TRUE);
752#endif
751 sc->addr = isa_get_port(dev);
753 BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
754 BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
755
756 sc->addr = port;
752 sc->kbdc = kbdc_open(sc->addr);
757 sc->kbdc = kbdc_open(sc->addr);
753 sc->config = isa_get_flags(dev) & PSM_CONFIG_FLAGS;
758 sc->config = flags & PSM_CONFIG_FLAGS;
754 sc->flags = 0;
755 if (bootverbose)
756 ++verbose;
757
759 sc->flags = 0;
760 if (bootverbose)
761 ++verbose;
762
763 device_set_desc(dev, "PS/2 Mouse");
764
758 if (!kbdc_lock(sc->kbdc, TRUE)) {
759 printf("psm%d: unable to lock the controller.\n", unit);
760 if (bootverbose)
761 --verbose;
762 return (ENXIO);
763 }
764
765 /*

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

979
980static int
981psmattach(device_t dev)
982{
983 int unit = device_get_unit(dev);
984 struct psm_softc *sc = device_get_softc(dev);
985 void *ih;
986 struct resource *res;
765 if (!kbdc_lock(sc->kbdc, TRUE)) {
766 printf("psm%d: unable to lock the controller.\n", unit);
767 if (bootverbose)
768 --verbose;
769 return (ENXIO);
770 }
771
772 /*

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

986
987static int
988psmattach(device_t dev)
989{
990 int unit = device_get_unit(dev);
991 struct psm_softc *sc = device_get_softc(dev);
992 void *ih;
993 struct resource *res;
994 u_long irq;
987 int zero = 0;
988
989 if (sc == NULL) /* shouldn't happen */
990 return (ENXIO);
991
992 /* Setup initial state */
993 sc->state = PSM_VALID;
994

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

1022 unit, sc->config, sc->flags, sc->mode.packetsize);
1023 printf("psm%d: syncmask:%02x, syncbits:%02x\n",
1024 unit, sc->mode.syncmask[0], sc->mode.syncmask[1]);
1025 }
1026
1027 if (bootverbose)
1028 --verbose;
1029
995 int zero = 0;
996
997 if (sc == NULL) /* shouldn't happen */
998 return (ENXIO);
999
1000 /* Setup initial state */
1001 sc->state = PSM_VALID;
1002

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

1030 unit, sc->config, sc->flags, sc->mode.packetsize);
1031 printf("psm%d: syncmask:%02x, syncbits:%02x\n",
1032 unit, sc->mode.syncmask[0], sc->mode.syncmask[1]);
1033 }
1034
1035 if (bootverbose)
1036 --verbose;
1037
1030 res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1,
1038 BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
1039 res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
1031 RF_SHAREABLE | RF_ACTIVE);
1032 BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc,
1033 &ih);
1034
1035 return (0);
1036}
1037
1038static int

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

2211
2212 if (verbose >= 2)
2213 log(LOG_DEBUG, "psm%d: APM resume hook exiting.\n", unit);
2214
2215 return (err);
2216}
2217#endif /* PSM_HOOKAPM */
2218
1040 RF_SHAREABLE | RF_ACTIVE);
1041 BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc,
1042 &ih);
1043
1044 return (0);
1045}
1046
1047static int

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

2220
2221 if (verbose >= 2)
2222 log(LOG_DEBUG, "psm%d: APM resume hook exiting.\n", unit);
2223
2224 return (err);
2225}
2226#endif /* PSM_HOOKAPM */
2227
2219CDEV_DRIVER_MODULE(psm, isa, psm_driver, psm_devclass,
2228CDEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
2220 CDEV_MAJOR, psm_cdevsw, 0, 0);
2221
2222#endif /* NPSM > 0 */
2229 CDEV_MAJOR, psm_cdevsw, 0, 0);
2230
2231#endif /* NPSM > 0 */