Home | History | Annotate | Line # | Download | only in pci
sio.c revision 1.1
      1 /*	$NetBSD: sio.c,v 1.1 1995/06/28 01:26:07 cgd Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 #include <sys/param.h>
     31 #include <sys/systm.h>
     32 #include <sys/kernel.h>
     33 #include <sys/device.h>
     34 
     35 #include <dev/pci/pcireg.h>
     36 #include <dev/pci/pcivar.h>
     37 #include <dev/pci/pcidevs.h>
     38 
     39 #include <machine/autoconf.h>
     40 
     41 int	siomatch __P((struct device *, void *, void *));
     42 void	sioattach __P((struct device *, struct device *, void *));
     43 
     44 struct cfdriver siocd = {
     45 	NULL, "sio", siomatch, sioattach, DV_DULL, sizeof(struct device)
     46 };
     47 
     48 static int	sioprint __P((void *, char *pnp));
     49 
     50 int
     51 siomatch(parent, match, aux)
     52 	struct device *parent;
     53 	void *match, *aux;
     54 {
     55 	struct cfdata *cf = match;
     56 	struct pci_attach_args *pa = aux;
     57 
     58 	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL ||
     59 	    PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_INTEL_SIO)
     60 		return (0);
     61 
     62 	return (1);
     63 }
     64 
     65 void
     66 sioattach(parent, self, aux)
     67 	struct device *parent, *self;
     68 	void *aux;
     69 {
     70 	struct pci_attach_args *pa = aux;
     71 	struct confargs nca;
     72 	u_int rev;
     73 	char *type;
     74 
     75 	rev = pa->pa_class & 0xff;
     76 	if (rev < 3) {
     77 		type = "I";
     78 		/* XXX PCI IRQ MAPPING FUNCTION */
     79 	} else {
     80 		type = "II";
     81 		/* XXX PCI IRQ MAPPING FUNCTION */
     82 	}
     83 	printf(": Saturn %s PCI->ISA bridge (revision 0x%x)\n", type, rev);
     84 	if (rev < 3)
     85 		printf("%s: WARNING: SIO I SUPPORT UNTESTED\n",
     86 		    parent->dv_xname);
     87 
     88 	/* attach the ISA bus that hangs off of it... */
     89 	nca.ca_name = "isa";
     90 	nca.ca_slot = 0;
     91 	nca.ca_offset = 0;
     92 	nca.ca_bus = NULL;
     93 	if (!config_found(self, &nca, sioprint))
     94 		panic("sioattach: couldn't attach ISA bus");
     95 }
     96 
     97 static int
     98 sioprint(aux, pnp)
     99 	void *aux;
    100 	char *pnp;
    101 {
    102         register struct confargs *ca = aux;
    103 
    104         if (pnp)
    105                 printf("%s at %s", ca->ca_name, pnp);
    106         return (UNCONF);
    107 }
    108