Home | History | Annotate | Line # | Download | only in pnpbios
pnpbiosvar.h revision 1.10
      1 /* $NetBSD: pnpbiosvar.h,v 1.10 2005/12/26 19:24:00 perry Exp $ */
      2 /*
      3  * Copyright (c) 1999
      4  * 	Matthias Drochner.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions, and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25  * SUCH DAMAGE.
     26  */
     27 
     28 struct pnpbios_attach_args {
     29 	isa_chipset_tag_t paa_ic;
     30 };
     31 
     32 int pnpbios_probe(void);
     33 
     34 struct pnp_compatid {
     35 	char idstr[8];
     36 	struct pnp_compatid *next;
     37 };
     38 
     39 struct pnp_mem {
     40 	SIMPLEQ_ENTRY(pnp_mem) next;
     41 	uint32_t minbase, maxbase, align, len;
     42 	int flags;
     43 };
     44 struct pnp_io {
     45 	SIMPLEQ_ENTRY(pnp_io) next;
     46 	uint16_t minbase, maxbase, align, len;
     47 	int flags;
     48 };
     49 struct pnp_irq {
     50 	SIMPLEQ_ENTRY(pnp_irq) next;
     51 	uint16_t mask;
     52 	int flags;
     53 };
     54 struct pnp_dma {
     55 	SIMPLEQ_ENTRY(pnp_dma) next;
     56 	uint8_t mask;
     57 	int flags;
     58 };
     59 
     60 #define PNP_MAXMEM 4
     61 #define PNP_MAXIOPORT 8
     62 #define PNP_MAXIRQ 2
     63 #define PNP_MAXDMA 2
     64 
     65 struct pnpresources {
     66 	int nummem, numio, numirq, numdma;
     67 	SIMPLEQ_HEAD(, pnp_mem) mem;
     68 	SIMPLEQ_HEAD(, pnp_io) io;
     69 	SIMPLEQ_HEAD(, pnp_irq) irq;
     70 	SIMPLEQ_HEAD(, pnp_dma) dma;
     71 	struct pnpresources *dependant_link;
     72 	struct pnp_compatid *compatids;
     73 	char *longname;
     74 };
     75 
     76 typedef void *pnpbios_tag_t; /* driver private */
     77 
     78 struct pnpbiosdev_attach_args {
     79 	pnpbios_tag_t pbt;
     80 	isa_chipset_tag_t ic;
     81 	int idx;
     82 	struct pnpresources *resc;
     83 	char *idstr;
     84 	char *primid;
     85 };
     86 
     87 int pnpbios_io_map(pnpbios_tag_t, struct pnpresources *, int,
     88 			bus_space_tag_t *, bus_space_handle_t *);
     89 void pnpbios_io_unmap(pnpbios_tag_t, struct pnpresources *, int,
     90 			bus_space_tag_t, bus_space_handle_t);
     91 void *pnpbios_intr_establish(pnpbios_tag_t, struct pnpresources *, int,
     92 				  int, int (*)(void *), void *);
     93 
     94 int pnpbios_getiobase(pnpbios_tag_t, struct pnpresources *, int,
     95 			   bus_space_tag_t *, int *);
     96 int pnpbios_getiosize(pnpbios_tag_t, struct pnpresources *, int, int *);
     97 int pnpbios_getirqnum(pnpbios_tag_t, struct pnpresources *, int, int *, int *);
     98 int pnpbios_getdmachan(pnpbios_tag_t, struct pnpresources *, int, int *);
     99 void pnpbios_print_devres(struct device *, struct pnpbiosdev_attach_args *);
    100