Home | History | Annotate | Line # | Download | only in isa
isapnp_machdep.c revision 1.1.2.2
      1 /*	$NetBSD: isapnp_machdep.c,v 1.1.2.2 1997/01/18 04:15:42 thorpej Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996 Jason R. Thorpe.  All rights reserved.
      5  * Copyright (c) 1996 Christos Zoulas.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *	This product includes software developed by Christos Zoulas
     18  *	and Jason R. Thorpe.
     19  * 4. The name of the author may not be used to endorse or promote products
     20  *    derived from this software without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 /*
     35  * Machine-dependent portions of ISA PnP bus autoconfiguration.
     36  *
     37  * N.B. This file exists mostly to get around some lameness surrounding
     38  * the PnP spec.  ISA PnP registers live where some `normal' ISA
     39  * devices do, but are e.g. write-only registers where the normal
     40  * device has a read-only register.  This breaks in the presence of
     41  * i/o port accounting.  This file takes care of mapping ISA PnP
     42  * registers without actually allocating them in extent maps.
     43  *
     44  * Since this is a machine-dependent file, we make all sorts of
     45  * assumptions about bus.h's guts.  Beware!
     46  */
     47 
     48 #include <sys/param.h>
     49 #include <sys/systm.h>
     50 #include <sys/device.h>
     51 #include <sys/malloc.h>
     52 
     53 #include <machine/bus.h>
     54 
     55 #include <dev/isa/isavar.h>
     56 
     57 #include <dev/isapnp/isapnpreg.h>
     58 #include <dev/isapnp/isapnpvar.h>
     59 
     60 /* isapnp_map():
     61  *	Map I/O regions used by PnP
     62  */
     63 int
     64 isapnp_map(sc)
     65 	struct isapnp_softc *sc;
     66 {
     67 
     68 	if (sc->sc_iot != I386_BUS_SPACE_IO)
     69 		panic("isapnp_map: bogus bus space tag");
     70 
     71 	sc->sc_addr_ioh = ISAPNP_ADDR;
     72 	sc->sc_wrdata_ioh = ISAPNP_WRDATA;
     73 	return (0);
     74 }
     75 
     76 /* isapnp_unmap():
     77  *	Unmap I/O regions used by PnP
     78  */
     79 void
     80 isapnp_unmap(sc)
     81 	struct isapnp_softc *sc;
     82 {
     83 
     84 	/* Do nothing. */
     85 }
     86 
     87 /* isapnp_map_readport():
     88  *	Called to map the PnP `read port', which is mapped independently
     89  *	of the `write' and `addr' ports.
     90  *
     91  *	NOTE: assumes the caller has filled in sc->sc_read_port!
     92  */
     93 int
     94 isapnp_map_readport(sc)
     95 	struct isapnp_softc *sc;
     96 {
     97 
     98 	if (sc->sc_iot != I386_BUS_SPACE_IO)
     99 		panic("isapnp_map_readport: bogus bus space tag");
    100 
    101 	sc->sc_read_ioh = sc->sc_read_port;
    102 	return (0);
    103 }
    104 
    105 /* isapnp_unmap_readport():
    106  *	Unmap a previously mapped `read port'.
    107  */
    108 void
    109 isapnp_unmap_readport(sc)
    110 	struct isapnp_softc *sc;
    111 {
    112 
    113 	/* Do nothing. */
    114 }
    115