Home | History | Annotate | Line # | Download | only in include
isa_machdep.h revision 1.13.64.1
      1  1.13.64.1     yamt /*	$NetBSD: isa_machdep.h,v 1.13.64.1 2009/08/19 18:45:58 yamt Exp $	*/
      2        1.1     soda /*      $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $  */
      3        1.1     soda 
      4        1.1     soda /*
      5        1.1     soda  * Copyright (c) 1996 Per Fogelstrom
      6        1.1     soda  * All rights reserved.
      7        1.1     soda  *
      8        1.1     soda  * Redistribution and use in source and binary forms, with or without
      9        1.1     soda  * modification, are permitted provided that the following conditions
     10        1.1     soda  * are met:
     11        1.1     soda  * 1. Redistributions of source code must retain the above copyright
     12        1.1     soda  *    notice, this list of conditions and the following disclaimer.
     13        1.1     soda  * 2. Redistributions in binary form must reproduce the above copyright
     14        1.1     soda  *    notice, this list of conditions and the following disclaimer in the
     15        1.1     soda  *    documentation and/or other materials provided with the distribution.
     16        1.1     soda  * 3. All advertising materials mentioning features or use of this software
     17        1.1     soda  *    must display the following acknowledgement:
     18        1.1     soda  *      This product includes software developed by Per Fogelstrom
     19        1.1     soda  * 4. The name of the author may not be used to endorse or promote products
     20        1.1     soda  *    derived from this software without specific prior written permission
     21        1.1     soda  *
     22        1.1     soda  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23        1.1     soda  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24        1.1     soda  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25        1.1     soda  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26        1.1     soda  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27        1.1     soda  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28        1.1     soda  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29        1.1     soda  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30        1.1     soda  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31        1.1     soda  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32        1.1     soda  */
     33        1.1     soda #ifndef _ISA_MACHDEP_H_
     34        1.1     soda #define _ISA_MACHDEP_H_
     35        1.1     soda 
     36        1.6     soda #include <dev/isa/isadmavar.h>
     37        1.6     soda 
     38        1.1     soda typedef struct arc_isa_bus *isa_chipset_tag_t;
     39        1.1     soda 
     40        1.1     soda /*
     41        1.1     soda  *      I/O macros to access isa bus ports/memory.
     42        1.1     soda  *      At the first glance theese macros may seem inefficient.
     43        1.9      wiz  *      However, the CPU executes an instruction every 7.5ns
     44        1.1     soda  *      so the bus is much slower so it doesn't matter, really.
     45        1.1     soda  */
     46        1.5     soda #define isa_outb(x,y)   outb(arc_bus_io.bs_vbase + (x)- arc_bus_io.bs_start, y)
     47        1.5     soda #define isa_inb(x)      inb(arc_bus_io.bs_vbase + (x) - arc_bus_io.bs_start)
     48        1.1     soda 
     49        1.1     soda struct arc_isa_bus {
     50        1.1     soda         void    *ic_data;
     51        1.1     soda 
     52        1.6     soda 	struct isa_dma_state ic_dmastate;
     53        1.6     soda 
     54        1.3      cgd         void    (*ic_attach_hook)(struct device *, struct device *,
     55        1.3      cgd                     struct isabus_attach_args *);
     56        1.5     soda 	const struct evcnt *(*ic_intr_evcnt)(isa_chipset_tag_t, int);
     57        1.3      cgd         void    *(*ic_intr_establish)(isa_chipset_tag_t, int, int, int,
     58        1.3      cgd                     int (*)(void *), void *);
     59        1.3      cgd         void    (*ic_intr_disestablish)(isa_chipset_tag_t, void *);
     60  1.13.64.1     yamt 	void	(*ic_detach_hook)(isa_chipset_tag_t, device_t);
     61        1.1     soda };
     62        1.1     soda 
     63        1.1     soda 
     64        1.1     soda /*
     65        1.1     soda  * Functions provided to machine-independent ISA code.
     66        1.1     soda  */
     67        1.1     soda #define isa_attach_hook(p, s, a)                             /*           \
     68        1.1     soda     (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
     69  1.13.64.1     yamt #define	isa_detach_hook(c, s)						\
     70  1.13.64.1     yamt     (*(c)->ic_detach_hook)((c), (s))
     71        1.4      cgd #define	isa_intr_evcnt(c, i)					\
     72        1.5     soda     (*(c)->ic_intr_evcnt)((c)->ic_data, (i))
     73        1.2     soda #define isa_intr_establish(c, i, t, l, f, a)                         \
     74        1.2     soda     (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a))
     75        1.1     soda #define isa_intr_disestablish(c, h)                                     \
     76        1.1     soda     (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
     77        1.6     soda 
     78        1.6     soda #define	isa_dmainit(ic, bst, dmat, d)					\
     79        1.6     soda 	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
     80  1.13.64.1     yamt #define	isa_dmadestroy(ic)						\
     81  1.13.64.1     yamt 	_isa_dmadestroy(&(ic)->ic_dmastate)
     82        1.6     soda #define	isa_dmacascade(ic, c)						\
     83        1.6     soda 	_isa_dmacascade(&(ic)->ic_dmastate, (c))
     84        1.6     soda #define	isa_dmamaxsize(ic, c)						\
     85        1.6     soda 	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
     86        1.6     soda #define	isa_dmamap_create(ic, c, s, f)					\
     87        1.6     soda 	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
     88        1.6     soda #define	isa_dmamap_destroy(ic, c)					\
     89        1.6     soda 	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
     90        1.6     soda #define	isa_dmastart(ic, c, a, n, p, f, bf)				\
     91        1.6     soda 	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
     92        1.6     soda #define	isa_dmaabort(ic, c)						\
     93        1.6     soda 	_isa_dmaabort(&(ic)->ic_dmastate, (c))
     94        1.6     soda #define	isa_dmacount(ic, c)						\
     95        1.6     soda 	_isa_dmacount(&(ic)->ic_dmastate, (c))
     96        1.6     soda #define	isa_dmafinished(ic, c)						\
     97        1.6     soda 	_isa_dmafinished(&(ic)->ic_dmastate, (c))
     98        1.6     soda #define	isa_dmadone(ic, c)						\
     99        1.6     soda 	_isa_dmadone(&(ic)->ic_dmastate, (c))
    100        1.6     soda #define	isa_dmafreeze(ic)						\
    101        1.6     soda 	_isa_dmafreeze(&(ic)->ic_dmastate)
    102        1.6     soda #define	isa_dmathaw(ic)							\
    103        1.6     soda 	_isa_dmathaw(&(ic)->ic_dmastate)
    104        1.6     soda #define	isa_dmamem_alloc(ic, c, s, ap, f)				\
    105        1.6     soda 	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
    106        1.6     soda #define	isa_dmamem_free(ic, c, a, s)					\
    107        1.6     soda 	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
    108        1.6     soda #define	isa_dmamem_map(ic, c, a, s, kp, f)				\
    109        1.6     soda 	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
    110        1.6     soda #define	isa_dmamem_unmap(ic, c, k, s)					\
    111        1.6     soda 	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
    112        1.6     soda #define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
    113        1.6     soda 	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
    114        1.7     fvdl #define isa_drq_alloc(ic, c)						\
    115        1.7     fvdl 	_isa_drq_alloc(&(ic)->ic_dmastate, c)
    116        1.7     fvdl #define isa_drq_free(ic, c)						\
    117        1.7     fvdl 	_isa_drq_free(&(ic)->ic_dmastate, c)
    118        1.6     soda #define	isa_drq_isfree(ic, c)						\
    119        1.6     soda 	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
    120        1.6     soda #define	isa_malloc(ic, c, s, p, f)					\
    121        1.6     soda 	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
    122        1.6     soda #define	isa_free(a, p)							\
    123        1.6     soda 	_isa_free((a), (p))
    124        1.6     soda #define	isa_mappage(m, o, p)						\
    125        1.6     soda 	_isa_mappage((m), (o), (p))
    126        1.8  tsutsui 
    127        1.8  tsutsui int isa_intr_alloc(isa_chipset_tag_t, int, int, int *);
    128        1.1     soda 
    129        1.3      cgd void sysbeepstop(void *);
    130        1.3      cgd void sysbeep(int, int);
    131        1.1     soda 
    132        1.1     soda 
    133        1.1     soda /*
    134        1.1     soda  *	Interrupt control struct used to control the ICU setup.
    135        1.1     soda  */
    136        1.1     soda 
    137       1.12  tsutsui struct isa_intrhand {
    138       1.12  tsutsui 	struct	isa_intrhand *ih_next;
    139        1.3      cgd 	int	(*ih_fun)(void *);
    140        1.1     soda 	void    *ih_arg;
    141        1.1     soda 	u_long  ih_count;
    142        1.1     soda 	int     ih_level;
    143        1.1     soda 	int     ih_irq;
    144       1.13  tsutsui 	struct evcnt ih_evcnt;
    145       1.13  tsutsui 	char	ih_evname[32];
    146        1.1     soda };
    147        1.1     soda 
    148        1.1     soda #endif /* _ISA_MACHDEP_H_ */
    149