Home | History | Annotate | Line # | Download | only in isa
pccons_isa.c revision 1.1
      1  1.1  soda /* $NetBSD: pccons_isa.c,v 1.1 2001/06/13 15:05:45 soda Exp $ */
      2  1.1  soda /* NetBSD: vga_isa.c,v 1.4 2000/08/14 20:14:51 thorpej Exp  */
      3  1.1  soda 
      4  1.1  soda /*
      5  1.1  soda  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
      6  1.1  soda  * All rights reserved.
      7  1.1  soda  *
      8  1.1  soda  * Author: Chris G. Demetriou
      9  1.1  soda  *
     10  1.1  soda  * Permission to use, copy, modify and distribute this software and
     11  1.1  soda  * its documentation is hereby granted, provided that both the copyright
     12  1.1  soda  * notice and this permission notice appear in all copies of the
     13  1.1  soda  * software, derivative works or modified versions, and any portions
     14  1.1  soda  * thereof, and that both notices appear in supporting documentation.
     15  1.1  soda  *
     16  1.1  soda  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     17  1.1  soda  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     18  1.1  soda  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     19  1.1  soda  *
     20  1.1  soda  * Carnegie Mellon requests users of this software to return to
     21  1.1  soda  *
     22  1.1  soda  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     23  1.1  soda  *  School of Computer Science
     24  1.1  soda  *  Carnegie Mellon University
     25  1.1  soda  *  Pittsburgh PA 15213-3890
     26  1.1  soda  *
     27  1.1  soda  * any improvements or extensions that they make and grant Carnegie the
     28  1.1  soda  * rights to redistribute these changes.
     29  1.1  soda  */
     30  1.1  soda 
     31  1.1  soda #include <sys/param.h>
     32  1.1  soda #include <sys/systm.h>
     33  1.1  soda #include <sys/device.h>
     34  1.1  soda 
     35  1.1  soda #include <machine/bus.h>
     36  1.1  soda 
     37  1.1  soda #include <dev/isa/isavar.h>
     38  1.1  soda 
     39  1.1  soda #include <arc/dev/pcconsvar.h>
     40  1.1  soda #include <arc/isa/pccons_isavar.h>
     41  1.1  soda 
     42  1.1  soda int	pccons_isa_match __P((struct device *, struct cfdata *, void *));
     43  1.1  soda void	pccons_isa_attach __P((struct device *, struct device *, void *));
     44  1.1  soda 
     45  1.1  soda struct cfattach pc_isa_ca = {
     46  1.1  soda 	sizeof(struct pc_softc), pccons_isa_match, pccons_isa_attach,
     47  1.1  soda };
     48  1.1  soda 
     49  1.1  soda struct pccons_config *pccons_isa_conf;
     50  1.1  soda 
     51  1.1  soda int
     52  1.1  soda pccons_isa_match(parent, match, aux)
     53  1.1  soda 	struct device *parent;
     54  1.1  soda 	struct cfdata *match;
     55  1.1  soda 	void *aux;
     56  1.1  soda {
     57  1.1  soda 	struct isa_attach_args *ia = aux;
     58  1.1  soda 	bus_addr_t iobase = 0x3b0;	/* XXX mono 0x3b0 color 0x3c0 */
     59  1.1  soda 	bus_size_t iosize = 0x30;	/* XXX 0x20 */
     60  1.1  soda 	bus_addr_t maddr = 0xa0000;
     61  1.1  soda 	bus_size_t msize = 0x20000;
     62  1.1  soda 	int irq = 1;
     63  1.1  soda 
     64  1.1  soda 	if (ia->ia_iobase != IOBASEUNK)
     65  1.1  soda 		iobase = ia->ia_iobase;
     66  1.1  soda #if 0	/* XXX isa.c */
     67  1.1  soda 	if (ia->ia_iosize != 0)
     68  1.1  soda 		iosize = ia->ia_iosize;
     69  1.1  soda #endif
     70  1.1  soda 	if (ia->ia_maddr != MADDRUNK)
     71  1.1  soda 		maddr = ia->ia_maddr;
     72  1.1  soda 	if (ia->ia_msize != 0)
     73  1.1  soda 		msize = ia->ia_msize;
     74  1.1  soda 	if (ia->ia_irq != IRQUNK)
     75  1.1  soda 		irq = ia->ia_irq;
     76  1.1  soda 
     77  1.1  soda #if 0
     78  1.1  soda 	/* If values are hardwired to something that they can't be, punt. */
     79  1.1  soda 	if (iobase != 0x3b0 || iosize != 0x30 ||
     80  1.1  soda 	    maddr != 0xa0000 || msize != 0x20000 ||
     81  1.1  soda 	    ia->ia_irq != 1 || ia->ia_drq != DRQUNK)
     82  1.1  soda 		return (0);
     83  1.1  soda #endif
     84  1.1  soda 
     85  1.1  soda 	if (pccons_isa_conf == NULL)
     86  1.1  soda 		return (0);
     87  1.1  soda 
     88  1.1  soda 	if (!pccons_common_match(ia->ia_iot, ia->ia_memt, ia->ia_iot,
     89  1.1  soda 	    pccons_isa_conf))
     90  1.1  soda 		return (0);
     91  1.1  soda 
     92  1.1  soda 	ia->ia_iobase = iobase;
     93  1.1  soda 	ia->ia_iosize = iosize;
     94  1.1  soda 	ia->ia_maddr = maddr;
     95  1.1  soda 	ia->ia_msize = msize;
     96  1.1  soda 	return (1);
     97  1.1  soda }
     98  1.1  soda 
     99  1.1  soda void
    100  1.1  soda pccons_isa_attach(parent, self, aux)
    101  1.1  soda 	struct device *parent, *self;
    102  1.1  soda 	void *aux;
    103  1.1  soda {
    104  1.1  soda 	struct pc_softc *sc = (struct pc_softc *)self;
    105  1.1  soda 	struct isa_attach_args *ia = aux;
    106  1.1  soda 
    107  1.1  soda 	isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_TTY,
    108  1.1  soda 	    pcintr, self);
    109  1.1  soda 	pccons_common_attach(sc, ia->ia_iot, ia->ia_memt, ia->ia_iot,
    110  1.1  soda 	    pccons_isa_conf);
    111  1.1  soda }
    112  1.1  soda 
    113  1.1  soda int
    114  1.1  soda pccons_isa_cnattach(iot, memt)
    115  1.1  soda 	bus_space_tag_t iot, memt;
    116  1.1  soda {
    117  1.1  soda 	if (pccons_isa_conf == NULL)
    118  1.1  soda 		return (ENXIO);
    119  1.1  soda 
    120  1.1  soda 	pccons_common_cnattach(iot, memt, iot, pccons_isa_conf);
    121  1.1  soda 	return (0);
    122  1.1  soda }
    123