Home | History | Annotate | Line # | Download | only in include
isa_machdep.h revision 1.11
      1 /* $NetBSD: isa_machdep.h,v 1.11 2009/08/19 15:00:23 dyoung Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /*
     33  * Copyright (c) 1996 Carnegie-Mellon University.
     34  * All rights reserved.
     35  *
     36  * Author: Chris G. Demetriou
     37  *
     38  * Permission to use, copy, modify and distribute this software and
     39  * its documentation is hereby granted, provided that both the copyright
     40  * notice and this permission notice appear in all copies of the
     41  * software, derivative works or modified versions, and any portions
     42  * thereof, and that both notices appear in supporting documentation.
     43  *
     44  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     45  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     46  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     47  *
     48  * Carnegie Mellon requests users of this software to return to
     49  *
     50  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     51  *  School of Computer Science
     52  *  Carnegie Mellon University
     53  *  Pittsburgh PA 15213-3890
     54  *
     55  * any improvements or extensions that they make and grant Carnegie the
     56  * rights to redistribute these changes.
     57  */
     58 
     59 #include <dev/isa/isadmavar.h>
     60 
     61 /*
     62  * Types provided to machine-independent ISA code.
     63  */
     64 typedef struct alpha_isa_chipset *isa_chipset_tag_t;
     65 
     66 struct alpha_isa_chipset {
     67 	void	*ic_v;
     68 
     69 	struct isa_dma_state ic_dmastate;
     70 
     71 	void	(*ic_attach_hook)(struct device *, struct device *,
     72 		    struct isabus_attach_args *);
     73 	const struct evcnt *(*ic_intr_evcnt)(void *, int);
     74 	void	*(*ic_intr_establish)(void *, int, int, int,
     75 		    int (*)(void *), void *);
     76 	void	(*ic_intr_disestablish)(void *, void *);
     77 	int	(*ic_intr_alloc)(void *, int, int, int *);
     78 };
     79 
     80 
     81 /*
     82  * Functions provided to machine-independent ISA code.
     83  */
     84 #define	isa_attach_hook(p, s, a)					\
     85     (*(a)->iba_ic->ic_attach_hook)((p), (s), (a))
     86 #define	isa_detach_hook(c, s)						\
     87     (*(c)->ic_detach_hook)((c), (s))
     88 #define	isa_intr_evcnt(c, i)					\
     89     (*(c)->ic_intr_evcnt)((c)->ic_v, (i))
     90 #define	isa_intr_establish(c, i, t, l, f, a)				\
     91     (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a))
     92 #define	isa_intr_disestablish(c, h)					\
     93     (*(c)->ic_intr_disestablish)((c)->ic_v, (h))
     94 #define	isa_intr_alloc(c, m, t, i)					\
     95     (*(c)->ic_intr_alloc)((c)->ic_v, (m), (t), (i))
     96 
     97 #define	isa_dmainit(ic, bst, dmat, d)					\
     98 	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
     99 #define	isa_dmadestroy(ic)						\
    100 	_isa_dmadestroy(&(ic)->ic_dmastate)
    101 #define	isa_dmacascade(ic, c)						\
    102 	_isa_dmacascade(&(ic)->ic_dmastate, (c))
    103 #define	isa_dmamaxsize(ic, c)						\
    104 	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
    105 #define	isa_dmamap_create(ic, c, s, f)					\
    106 	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
    107 #define	isa_dmamap_destroy(ic, c)					\
    108 	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
    109 #define	isa_dmastart(ic, c, a, n, p, f, bf)				\
    110 	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
    111 #define	isa_dmaabort(ic, c)						\
    112 	_isa_dmaabort(&(ic)->ic_dmastate, (c))
    113 #define	isa_dmacount(ic, c)						\
    114 	_isa_dmacount(&(ic)->ic_dmastate, (c))
    115 #define	isa_dmafinished(ic, c)						\
    116 	_isa_dmafinished(&(ic)->ic_dmastate, (c))
    117 #define	isa_dmadone(ic, c)						\
    118 	_isa_dmadone(&(ic)->ic_dmastate, (c))
    119 #define	isa_dmafreeze(ic)						\
    120 	_isa_dmafreeze(&(ic)->ic_dmastate)
    121 #define	isa_dmathaw(ic)							\
    122 	_isa_dmathaw(&(ic)->ic_dmastate)
    123 #define	isa_dmamem_alloc(ic, c, s, ap, f)				\
    124 	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
    125 #define	isa_dmamem_free(ic, c, a, s)					\
    126 	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
    127 #define	isa_dmamem_map(ic, c, a, s, kp, f)				\
    128 	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
    129 #define	isa_dmamem_unmap(ic, c, k, s)					\
    130 	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
    131 #define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
    132 	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
    133 #define isa_drq_alloc(ic, c)						\
    134 	_isa_drq_alloc(&(ic)->ic_dmastate, c)
    135 #define isa_drq_free(ic, c)						\
    136 	_isa_drq_free(&(ic)->ic_dmastate, c)
    137 #define	isa_drq_isfree(ic, c)						\
    138 	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
    139 #define	isa_malloc(ic, c, s, p, f)					\
    140 	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
    141 #define	isa_free(a, p)							\
    142 	_isa_free((a), (p))
    143 #define	isa_mappage(m, o, p)						\
    144 	_isa_mappage((m), (o), (p))
    145 
    146 /*
    147  * alpha-specific ISA functions.
    148  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    149  */
    150 int	isa_display_console(bus_space_tag_t, bus_space_tag_t);
    151 void	isabeep(int, int);
    152 
    153 #ifdef _ALPHA_BUS_DMA_PRIVATE
    154 int	isadma_bounce_dmamap_create(bus_dma_tag_t, bus_size_t, int,
    155 	    bus_size_t, bus_size_t, int, bus_dmamap_t *);
    156 void	isadma_bounce_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
    157 int	isadma_bounce_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
    158 	    bus_size_t, struct proc *, int);
    159 int	isadma_bounce_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
    160 	    struct mbuf *, int);
    161 int	isadma_bounce_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
    162 	    struct uio *, int);
    163 int	isadma_bounce_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
    164 	    bus_dma_segment_t *, int, bus_size_t, int);
    165 void	isadma_bounce_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
    166 void	isadma_bounce_dmamap_sync(bus_dma_tag_t, bus_dmamap_t,
    167 	    bus_addr_t, bus_size_t, int);
    168 
    169 int	isadma_bounce_dmamem_alloc(bus_dma_tag_t, bus_size_t, bus_size_t,
    170 	    bus_size_t, bus_dma_segment_t *, int, int *, int);
    171 #endif /* _ALPHA_BUS_DMA_PRIVATE */
    172