Add ACPI joy(4) attachment, based on lpt_acpi.c by jmcneill@,
reviewed and ok'ed by cube@ and martin@.
This commit is contained in:
parent
347378fc9f
commit
76025558e1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: acpi.4,v 1.12 2004/12/02 09:50:41 xtraeme Exp $
|
||||
.\" $NetBSD: acpi.4,v 1.13 2004/12/02 14:33:31 xtraeme Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -47,6 +47,7 @@
|
||||
.Cd "acpitz* at acpi?"
|
||||
.Cd "com* at acpi?"
|
||||
.Cd "fdc* at acpi?"
|
||||
.Cd "joy* at acpi?"
|
||||
.Cd "lpt* at acpi?"
|
||||
.Cd "mpu* at acpi?"
|
||||
.Cd "npx* at acpi?"
|
||||
@ -122,8 +123,12 @@ thermal zones.
|
||||
NS8250-, NS16450-, and NS16550-based serial ports.
|
||||
.It fdc
|
||||
Floppy disk controllers.
|
||||
.It joy
|
||||
Joystick/Game port interface.
|
||||
.It lpt
|
||||
Standard ISA parallel port interface.
|
||||
.It mpu
|
||||
Roland MPU-401 (compatible) MIDI UART.
|
||||
.It wss
|
||||
Windows Sound System-compatible sound cards based on the AD1848 and compatible chips.
|
||||
.El
|
||||
@ -148,7 +153,9 @@ Toshiba Libretto device.
|
||||
.Xr apm 4 ,
|
||||
.Xr com 4 ,
|
||||
.Xr fdc 4 ,
|
||||
.Xr joy 4 ,
|
||||
.Xr lpt 4 ,
|
||||
.Xr mpu 4 ,
|
||||
.Xr npx 4 ,
|
||||
.Xr pci 4 ,
|
||||
.Xr pckbc 4 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: joy.4,v 1.5 2004/05/11 22:42:47 wiz Exp $
|
||||
.\" $NetBSD: joy.4,v 1.6 2004/12/02 14:33:31 xtraeme Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996 Matthieu Herrb
|
||||
.\" All rights reserved.
|
||||
@ -28,7 +28,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 7, 1996
|
||||
.Dd December 2, 2004
|
||||
.Dt JOY 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -41,6 +41,7 @@
|
||||
.Cd "joy* at pci?"
|
||||
.Cd "joy* at pnpbios? index ?"
|
||||
.Cd "joy* at eso?"
|
||||
.Cd "joy* at acpi?"
|
||||
.Sh DESCRIPTION
|
||||
This driver provides access to the game adapter.
|
||||
The lower bit in the
|
||||
@ -133,6 +134,7 @@ first joystick
|
||||
second joystick
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr acpi 4 ,
|
||||
.Xr eso 4 ,
|
||||
.Xr isa 4 ,
|
||||
.Xr isapnp 4 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.33 2004/12/02 09:50:42 xtraeme Exp $
|
||||
# $NetBSD: GENERIC,v 1.34 2004/12/02 14:33:31 xtraeme Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.33 $"
|
||||
#ident "GENERIC-$Revision: 1.34 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -239,6 +239,7 @@ mainbus0 at root
|
||||
# Mainboard devices
|
||||
#com* at acpi? # Serial communications interface
|
||||
#fdc* at acpi? # Floppy disk controller
|
||||
#joy* at acpi? # Joystick/Game port
|
||||
#lpt* at acpi? # Parallel port
|
||||
#mpu* at acpi? # Roland MPU-401 MIDI UART
|
||||
#pckbc* at acpi? # PC keyboard controller
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.644 2004/12/02 09:50:42 xtraeme Exp $
|
||||
# $NetBSD: GENERIC,v 1.645 2004/12/02 14:33:31 xtraeme Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.644 $"
|
||||
#ident "GENERIC-$Revision: 1.645 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -322,6 +322,7 @@ cpu* at mainbus?
|
||||
# Mainboard devices
|
||||
#com* at acpi? # Serial communications interface
|
||||
#fdc* at acpi? # Floppy disk controller
|
||||
#joy* at acpi? # Joystick/Game port
|
||||
#lpt* at acpi? # Parallel port
|
||||
#mpu* at acpi? # Roland MPU-401 MIDI UART
|
||||
#npx* at acpi? # Math coprocessor
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC.MPACPI,v 1.12 2004/12/02 09:50:42 xtraeme Exp $
|
||||
# $NetBSD: GENERIC.MPACPI,v 1.13 2004/12/02 14:33:31 xtraeme Exp $
|
||||
#
|
||||
# GENERIC.MPACPI -- Generic, plus ACPI Multiprocessor support
|
||||
#
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.12 $"
|
||||
#ident "GENERIC-$Revision: 1.13 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -301,6 +301,7 @@ acpitz* at acpi? # ACPI Thermal Zone
|
||||
# Mainboard devices
|
||||
com* at acpi? # Serial communications interface
|
||||
fdc* at acpi? # Floppy disk controller
|
||||
joy* at acpi? # Joystick/Game port
|
||||
lpt* at acpi? # Parallel port
|
||||
mpu* at acpi? # Roland MPU-401 MIDI UART
|
||||
npx* at acpi? # Math coprocessor
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC_LAPTOP,v 1.123 2004/12/02 09:50:42 xtraeme Exp $
|
||||
# $NetBSD: GENERIC_LAPTOP,v 1.124 2004/12/02 14:33:31 xtraeme Exp $
|
||||
# From: NetBSD: GENERIC,v 1.414 2001/07/30 19:59:05 ad Exp
|
||||
#
|
||||
# GENERIC_LAPTOP -- GENERIC with cardbus and some USB devices enabled
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.123 $"
|
||||
#ident "GENERIC-$Revision: 1.124 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -264,6 +264,7 @@ apm0 at mainbus0 # Advanced power management
|
||||
# Mainboard devices
|
||||
#com* at acpi? # Serial communications interface
|
||||
#fdc* at acpi? # Floppy disk controller
|
||||
#joy* at acpi? # Joystick/Game port
|
||||
#lpt* at acpi? # Parallel port
|
||||
#mpu* at acpi? # Roland MPU-401 MIDI UART
|
||||
#npx* at acpi? # Math coprocessor
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.acpi,v 1.28 2004/12/02 09:50:42 xtraeme Exp $
|
||||
# $NetBSD: files.acpi,v 1.29 2004/12/02 14:33:31 xtraeme Exp $
|
||||
|
||||
include "dev/acpi/acpica/files.acpica"
|
||||
|
||||
@ -68,3 +68,7 @@ file dev/acpi/wss_acpi.c wss_acpi
|
||||
# Roland MPU401 (compatible) MIDI UART
|
||||
attach mpu at acpi with mpu_acpi
|
||||
file dev/acpi/mpu_acpi.c mpu_acpi
|
||||
|
||||
# Joystick/Game port
|
||||
attach joy at acpi with joy_acpi
|
||||
file dev/acpi/joy_acpi.c joy_acpi
|
||||
|
159
sys/dev/acpi/joy_acpi.c
Normal file
159
sys/dev/acpi/joy_acpi.c
Normal file
@ -0,0 +1,159 @@
|
||||
/* $NetBSD: joy_acpi.c,v 1.1 2004/12/02 14:33:31 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juan Romero Pardines <xtraeme@NetBSD.org>.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ACPI joy(4) attachment based in lpt_acpi.c by Jared D. McNeill.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: joy_acpi.c,v 1.1 2004/12/02 14:33:31 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/acpi/acpica.h>
|
||||
#include <dev/acpi/acpireg.h>
|
||||
#include <dev/acpi/acpivar.h>
|
||||
|
||||
#include <dev/ic/joyvar.h>
|
||||
|
||||
static int joy_acpi_match(struct device *, struct cfdata *, void *);
|
||||
static void joy_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct joy_acpi_softc {
|
||||
struct joy_softc sc_joy;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(joy_acpi, sizeof(struct joy_acpi_softc), joy_acpi_match,
|
||||
joy_acpi_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Supported device IDs
|
||||
*/
|
||||
|
||||
static const char * const joy_acpi_ids[] = {
|
||||
"PNPB02F", /* Joystick/Game port */
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* joy_acpi_match: autoconf(9) match routine
|
||||
*/
|
||||
static int
|
||||
joy_acpi_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
|
||||
return 0;
|
||||
|
||||
return acpi_match_hid(aa->aa_node->ad_devinfo, joy_acpi_ids);
|
||||
}
|
||||
|
||||
/*
|
||||
* joy_acpi_attach: autoconf(9) attach routine
|
||||
*/
|
||||
static void
|
||||
joy_acpi_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct joy_acpi_softc *asc = (struct joy_acpi_softc *)self;
|
||||
struct joy_softc *sc = &asc->sc_joy;
|
||||
struct acpi_attach_args *aa = aux;
|
||||
struct acpi_resources res;
|
||||
struct acpi_io *io;
|
||||
ACPI_STATUS rv;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* parse resources */
|
||||
rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
|
||||
&res, &acpi_resource_parse_ops_default);
|
||||
if (ACPI_FAILURE(rv))
|
||||
return;
|
||||
|
||||
/* find our i/o registers */
|
||||
io = acpi_res_io(&res, 0);
|
||||
if (io == NULL) {
|
||||
printf("%s: unable to find i/o register resource\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
sc->sc_iot = aa->aa_iot;
|
||||
if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
|
||||
0, &sc->sc_ioh)) {
|
||||
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
joyattach(sc);
|
||||
|
||||
out:
|
||||
acpi_resource_cleanup(&res);
|
||||
}
|
Loading…
Reference in New Issue
Block a user