lpt_pnpbios.c revision 1.2
11.2Ssoren/* $NetBSD: lpt_pnpbios.c,v 1.2 1999/11/14 18:03:38 soren Exp $ */ 21.1Sthorpej/* 31.1Sthorpej * Copyright (c) 1999 41.1Sthorpej * Matthias Drochner. All rights reserved. 51.1Sthorpej * 61.1Sthorpej * Redistribution and use in source and binary forms, with or without 71.1Sthorpej * modification, are permitted provided that the following conditions 81.1Sthorpej * are met: 91.1Sthorpej * 1. Redistributions of source code must retain the above copyright 101.1Sthorpej * notice, this list of conditions, and the following disclaimer. 111.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 121.1Sthorpej * notice, this list of conditions and the following disclaimer in the 131.1Sthorpej * documentation and/or other materials provided with the distribution. 141.1Sthorpej * 151.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 161.1Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 171.1Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 181.1Sthorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 191.1Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 201.1Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 211.1Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 221.1Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 231.1Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 241.1Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 251.1Sthorpej * SUCH DAMAGE. 261.1Sthorpej */ 271.1Sthorpej 281.1Sthorpej#include <sys/param.h> 291.1Sthorpej#include <sys/systm.h> 301.1Sthorpej#include <sys/errno.h> 311.1Sthorpej#include <sys/ioctl.h> 321.1Sthorpej#include <sys/syslog.h> 331.1Sthorpej#include <sys/device.h> 341.1Sthorpej#include <sys/proc.h> 351.1Sthorpej#include <sys/termios.h> 361.1Sthorpej 371.1Sthorpej#include <machine/bus.h> 381.1Sthorpej 391.1Sthorpej#include <dev/isa/isavar.h> 401.1Sthorpej#include <dev/isa/isadmavar.h> 411.1Sthorpej 421.1Sthorpej#include <i386/pnpbios/pnpbiosvar.h> 431.1Sthorpej 441.1Sthorpej#include <dev/ic/lptvar.h> 451.1Sthorpej 461.1Sthorpejstruct lpt_pnpbios_softc { 471.1Sthorpej struct lpt_softc sc_lpt; 481.1Sthorpej}; 491.1Sthorpej 501.1Sthorpejint lpt_pnpbios_match __P((struct device *, struct cfdata *, void *)); 511.1Sthorpejvoid lpt_pnpbios_attach __P((struct device *, struct device *, void *)); 521.1Sthorpej 531.1Sthorpejstruct cfattach lpt_pnpbios_ca = { 541.1Sthorpej sizeof(struct lpt_pnpbios_softc), lpt_pnpbios_match, lpt_pnpbios_attach 551.1Sthorpej}; 561.1Sthorpej 571.1Sthorpejint 581.1Sthorpejlpt_pnpbios_match(parent, match, aux) 591.1Sthorpej struct device *parent; 601.1Sthorpej struct cfdata *match; 611.1Sthorpej void *aux; 621.1Sthorpej{ 631.1Sthorpej struct pnpbiosdev_attach_args *aa = aux; 641.1Sthorpej 651.2Ssoren if (strcmp(aa->idstr, "PNP0400") && 661.2Ssoren strcmp(aa->idstr, "PNP0401")) 671.1Sthorpej return (0); 681.1Sthorpej 691.1Sthorpej return (1); 701.1Sthorpej} 711.1Sthorpej 721.1Sthorpejvoid 731.1Sthorpejlpt_pnpbios_attach(parent, self, aux) 741.1Sthorpej struct device *parent, *self; 751.1Sthorpej void *aux; 761.1Sthorpej{ 771.1Sthorpej struct lpt_pnpbios_softc *psc = (void *)self; 781.1Sthorpej struct lpt_softc *sc = &psc->sc_lpt; 791.1Sthorpej struct pnpbiosdev_attach_args *aa = aux; 801.1Sthorpej 811.1Sthorpej if (pnpbios_io_map(aa->pbt, aa->resc, 0, &sc->sc_iot, &sc->sc_ioh)) { 821.1Sthorpej printf(": can't map i/o space\n"); 831.1Sthorpej return; 841.1Sthorpej } 851.1Sthorpej 861.1Sthorpej printf("\n"); 871.1Sthorpej pnpbios_print_devres(self, aa); 881.1Sthorpej 891.1Sthorpej lpt_attach_subr(sc); 901.1Sthorpej 911.1Sthorpej sc->sc_ih = pnpbios_intr_establish(aa->pbt, aa->resc, 0, IPL_TTY, 921.1Sthorpej lptintr, sc); 931.1Sthorpej} 94