joy_pnpbios.c revision 1.6
11.6Sthorpej/*	$NetBSD: joy_pnpbios.c,v 1.6 2002/10/02 05:47:16 thorpej Exp $	*/
21.1Snathanw
31.1Snathanw/*-
41.1Snathanw * Copyright (c) 2001 The NetBSD Foundation, Inc.
51.1Snathanw * All rights reserved.
61.1Snathanw *
71.1Snathanw * This code is derived from software contributed to The NetBSD Foundation
81.1Snathanw * by Nathan J. Williams.
91.1Snathanw *
101.1Snathanw * Redistribution and use in source and binary forms, with or without
111.1Snathanw * modification, are permitted provided that the following conditions
121.1Snathanw * are met:
131.1Snathanw * 1. Redistributions of source code must retain the above copyright
141.1Snathanw *    notice, this list of conditions and the following disclaimer.
151.1Snathanw * 2. Redistributions in binary form must reproduce the above copyright
161.1Snathanw *    notice, this list of conditions and the following disclaimer in the
171.1Snathanw *    documentation and/or other materials provided with the distribution.
181.1Snathanw * 3. All advertising materials mentioning features or use of this software
191.1Snathanw *    must display the following acknowledgement:
201.1Snathanw *        This product includes software developed by the NetBSD
211.1Snathanw *        Foundation, Inc. and its contributors.
221.1Snathanw * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Snathanw *    contributors may be used to endorse or promote products derived
241.1Snathanw *    from this software without specific prior written permission.
251.1Snathanw *
261.1Snathanw * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Snathanw * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Snathanw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Snathanw * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Snathanw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Snathanw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Snathanw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Snathanw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Snathanw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Snathanw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Snathanw * POSSIBILITY OF SUCH DAMAGE.
371.1Snathanw */
381.1Snathanw
391.2Slukem#include <sys/cdefs.h>
401.6Sthorpej__KERNEL_RCSID(0, "$NetBSD: joy_pnpbios.c,v 1.6 2002/10/02 05:47:16 thorpej Exp $");
411.1Snathanw
421.1Snathanw#include <sys/param.h>
431.1Snathanw#include <sys/systm.h>
441.1Snathanw#include <sys/kernel.h>
451.1Snathanw#include <sys/device.h>
461.1Snathanw
471.1Snathanw#include <machine/bus.h>
481.1Snathanw
491.1Snathanw#include <dev/isa/isavar.h>
501.1Snathanw#include <dev/isa/isadmavar.h>
511.1Snathanw
521.1Snathanw#include <i386/pnpbios/pnpbiosvar.h>
531.1Snathanw
541.3Sjdolecek#include <dev/ic/joyvar.h>
551.1Snathanw
561.1Snathanwint	joy_pnpbios_match __P((struct device *, struct cfdata *, void *));
571.1Snathanwvoid	joy_pnpbios_attach __P((struct device *, struct device *, void *));
581.1Snathanw
591.6SthorpejCFATTACH_DECL(joy_pnpbios, sizeof(struct joy_softc),
601.6Sthorpej    joy_pnpbios_match, joy_pnpbios_attach, NULL, NULL);
611.1Snathanw
621.1Snathanwint
631.1Snathanwjoy_pnpbios_match(parent, match, aux)
641.1Snathanw	struct device *parent;
651.1Snathanw	struct cfdata *match;
661.1Snathanw	void *aux;
671.1Snathanw{
681.1Snathanw	struct pnpbiosdev_attach_args *aa = aux;
691.1Snathanw
701.1Snathanw	if (strcmp(aa->idstr, "PNPB02F"))
711.1Snathanw		return (0);
721.1Snathanw
731.1Snathanw	return (1);
741.1Snathanw}
751.1Snathanw
761.1Snathanwvoid
771.1Snathanwjoy_pnpbios_attach(parent, self, aux)
781.1Snathanw	struct device *parent, *self;
791.1Snathanw	void *aux;
801.1Snathanw{
811.1Snathanw	struct joy_softc *sc = (struct joy_softc *)self;
821.1Snathanw	struct pnpbiosdev_attach_args *aa = aux;
831.1Snathanw
841.1Snathanw	if (pnpbios_io_map(aa->pbt, aa->resc, 0, &sc->sc_iot, &sc->sc_ioh)) {
851.1Snathanw		printf(": can't map i/o space\n");
861.1Snathanw		return;
871.1Snathanw	}
881.1Snathanw
891.1Snathanw	printf("\n");
901.1Snathanw	pnpbios_print_devres(self, aa);
911.1Snathanw
921.1Snathanw	joyattach(sc);
931.1Snathanw}
94