Home | History | Annotate | Line # | Download | only in isa
isa_machdep.c revision 1.1
      1 /*	$NetBSD: isa_machdep.c,v 1.1 1995/06/28 01:24:59 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/conf.h>
     34 #include <sys/malloc.h>
     35 #include <sys/device.h>
     36 
     37 #include <machine/autoconf.h>
     38 #include <machine/pio.h>
     39 #include <machine/rpb.h>
     40 #include <machine/vmparam.h>
     41 #include <machine/pte.h>
     42 
     43 #include <dev/isa/isareg.h>
     44 #include <dev/isa/isavar.h>
     45 #include <dev/isa/isadmavar.h>
     46 
     47 #include <alpha/isa/isa_intr.h>
     48 #include <alpha/isa/isa_dma.h>
     49 
     50 int isamatch __P((struct device *, void *, void *));
     51 void isaattach __P((struct device *, struct device *, void *));
     52 
     53 struct cfdriver isacd = {
     54 	NULL, "isa", isamatch, isaattach, DV_DULL, sizeof(struct isa_softc), 1
     55 };
     56 
     57 int
     58 isamatch(parent, cfdata, aux)
     59 	struct device *parent;
     60 	void *cfdata, *aux;
     61 {
     62 	struct cfdata *cf = cfdata;
     63 	struct confargs *ca = aux;
     64 
     65 #if 0 /* XXX -- Assume that it's valid if unit number OK */
     66 	/* It can only occur on the mainbus. */
     67 	if (ca->ca_bus->ab_type != BUS_MAIN)
     68 		return (0);
     69 
     70 	/* Make sure that we're looking for this type of device. */
     71 	if (!BUS_MATCHNAME(ca, "isa"))
     72 		return (0);
     73 #endif /* XXX */
     74 
     75 	/* See if the unit number is valid. */
     76 	switch (hwrpb->rpb_type) {
     77 #if defined(DEC_2100_A50)
     78 	case ST_DEC_2100_A50:
     79 		if (cf->cf_unit > 0)
     80 			return (0);
     81 		break;
     82 #endif
     83 	default:
     84 		return (0);
     85 	}
     86 
     87 	return (1);
     88 }
     89 
     90 void
     91 isaattach(parent, self, aux)
     92 	struct device *parent, *self;
     93 	void *aux;
     94 {
     95 	struct isa_softc *sc = (struct isa_softc *)self;
     96 
     97 	printf("\n");
     98 
     99 	TAILQ_INIT(&sc->sc_subdevs);
    100 
    101 	/* XXX set up ISA DMA controllers? */
    102 
    103 	config_scan(isascan, self);
    104 }
    105 
    106 void *
    107 isa_intr_establish(irq, type, level, ih_fun, ih_arg)
    108 	int irq;
    109 	isa_intrtype type;
    110 	isa_intrlevel level;
    111 	int (*ih_fun)(void *);
    112 	void *ih_arg;
    113 {
    114 
    115 	return (*isa_intr_fcns->isa_intr_establish)(irq, type, level,
    116 	    ih_fun, ih_arg);
    117 }
    118 
    119 void
    120 isa_intr_disestablish(handler)
    121 	void *handler;
    122 {
    123 
    124 	(*isa_intr_fcns->isa_intr_disestablish)(handler);
    125 }
    126 
    127 int
    128 isadma_map(addr, size, mappings, flags)
    129 	caddr_t addr;
    130 	vm_size_t size;
    131 	vm_offset_t *mappings;
    132 	int flags;
    133 {
    134 
    135 	(*isadma_fcns->isadma_map)(addr, size, mappings, flags);
    136 }
    137 
    138 void
    139 isadma_unmap(addr, size, nmappings, mappings)
    140 	caddr_t addr;
    141 	vm_size_t size;
    142 	int nmappings;
    143 	vm_offset_t *mappings;
    144 {
    145 
    146 	(*isadma_fcns->isadma_unmap)(addr, size, nmappings, mappings);
    147 }
    148 
    149 void
    150 isadma_copytobuf(addr, size, nmappings, mappings)
    151 	caddr_t addr;
    152 	vm_size_t size;
    153 	int nmappings;
    154 	vm_offset_t *mappings;
    155 {
    156 
    157 	(*isadma_fcns->isadma_copytobuf)(addr, size, nmappings, mappings);
    158 }
    159 
    160 void
    161 isadma_copyfrombuf(addr, size, nmappings, mappings)
    162 	caddr_t addr;
    163 	vm_size_t size;
    164 	int nmappings;
    165 	vm_offset_t *mappings;
    166 {
    167 
    168 	(*isadma_fcns->isadma_copyfrombuf)(addr, size, nmappings, mappings);
    169 }
    170