btvmeivar.h revision 1.1 1 1.1 drochner /* $NetBSD: btvmeivar.h,v 1.1 1999/06/30 17:45:39 drochner Exp $ */
2 1.1 drochner
3 1.1 drochner /*
4 1.1 drochner * Copyright (c) 1999
5 1.1 drochner * Matthias Drochner. All rights reserved.
6 1.1 drochner *
7 1.1 drochner * Redistribution and use in source and binary forms, with or without
8 1.1 drochner * modification, are permitted provided that the following conditions
9 1.1 drochner * are met:
10 1.1 drochner * 1. Redistributions of source code must retain the above copyright
11 1.1 drochner * notice, this list of conditions and the following disclaimer.
12 1.1 drochner * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 drochner * notice, this list of conditions and the following disclaimer in the
14 1.1 drochner * documentation and/or other materials provided with the distribution.
15 1.1 drochner * 3. All advertising materials mentioning features or use of this software
16 1.1 drochner * must display the following acknowledgement:
17 1.1 drochner * This product includes software developed for the NetBSD Project
18 1.1 drochner * by Matthias Drochner.
19 1.1 drochner * 4. The name of the author may not be used to endorse or promote products
20 1.1 drochner * derived from this software without specific prior written permission.
21 1.1 drochner *
22 1.1 drochner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 drochner * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 drochner * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 drochner * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 drochner * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 drochner * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 drochner * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 drochner * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 drochner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 drochner * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 drochner *
33 1.1 drochner */
34 1.1 drochner
35 1.1 drochner struct b3_617_vmeintrhand {
36 1.1 drochner TAILQ_ENTRY(b3_617_vmeintrhand) ih_next;
37 1.1 drochner int (*ih_fun) __P((void*));
38 1.1 drochner void *ih_arg;
39 1.1 drochner int ih_level;
40 1.1 drochner int ih_vector;
41 1.1 drochner int ih_prior;
42 1.1 drochner u_long ih_count;
43 1.1 drochner };
44 1.1 drochner
45 1.1 drochner struct b3_617_softc {
46 1.1 drochner struct device sc_dev;
47 1.1 drochner
48 1.1 drochner /* tags passed in from PCI */
49 1.1 drochner pci_chipset_tag_t sc_pc;
50 1.1 drochner bus_space_tag_t csrt, mapt;
51 1.1 drochner bus_space_handle_t csrh, maph;
52 1.1 drochner bus_addr_t vmepbase; /* physical PCI address */
53 1.1 drochner bus_dma_tag_t sc_dmat;
54 1.1 drochner void *sc_ih;
55 1.1 drochner
56 1.1 drochner bus_space_tag_t sc_vmet;
57 1.1 drochner
58 1.1 drochner struct vme_range csrwindow, dmawindow24, dmawindow32;
59 1.1 drochner
60 1.1 drochner /* tags passed to VME devices */
61 1.1 drochner struct vme_chipset_tag sc_vct;
62 1.1 drochner
63 1.1 drochner /* list of VME interrupt handlers */
64 1.1 drochner TAILQ_HEAD(, b3_617_vmeintrhand) intrhdls;
65 1.1 drochner int strayintrs;
66 1.1 drochner
67 1.1 drochner /*
68 1.1 drochner * management of adapter mapping tables
69 1.1 drochner */
70 1.1 drochner /* max fragmentation of scatter tables */
71 1.1 drochner #define NVMEMAP 20
72 1.1 drochner
73 1.1 drochner struct extent *vmeext;
74 1.1 drochner char vmemap[EXTENT_FIXED_STORAGE_SIZE(NVMEMAP)];
75 1.1 drochner };
76 1.1 drochner
77 1.1 drochner #define read_csr_byte(sc, reg) \
78 1.1 drochner bus_space_read_1(sc->csrt, sc->csrh, reg)
79 1.1 drochner #define write_csr_byte(sc, reg, val) \
80 1.1 drochner bus_space_write_1(sc->csrt, sc->csrh, reg, val)
81 1.1 drochner #define read_csr_word(sc, reg) \
82 1.1 drochner bus_space_read_2(sc->csrt, sc->csrh, reg)
83 1.1 drochner #define write_csr_word(sc, reg, val) \
84 1.1 drochner bus_space_write_2(sc->csrt, sc->csrh, reg, val)
85 1.1 drochner
86 1.1 drochner #define write_mapmem(sc, ofs, val) \
87 1.1 drochner bus_space_write_4(sc->mapt, sc->maph, ofs, val)
88 1.1 drochner #define read_mapmem(sc, ofs) \
89 1.1 drochner bus_space_read_4(sc->mapt, sc->maph, ofs)
90 1.1 drochner
91 1.1 drochner #define VME_PAGESIZE 0x1000
92 1.1 drochner #define PCI_PAGESIZE 0x1000
93 1.1 drochner #define DMA_PAGESIZE 0x1000
94 1.1 drochner
95 1.1 drochner /* shared between driver parts */
96 1.1 drochner int b3_617_reset __P((struct b3_617_softc*));
97 1.1 drochner int b3_617_init __P((struct b3_617_softc*));
98 1.1 drochner #ifdef notyet /* for detach */
99 1.1 drochner void b3_617_halt __P((struct b3_617_softc*));
100 1.1 drochner #endif
101 1.1 drochner int b3_617_intr __P((void*));
102 1.1 drochner #if 0
103 1.1 drochner void b3_617_cntlrdma_done __P((struct b3_617_softc*));
104 1.1 drochner #endif
105 1.1 drochner
106 1.1 drochner /* exported via tag structs */
107 1.1 drochner int b3_617_map_vme __P((void *, vme_addr_t, vme_size_t,
108 1.1 drochner vme_am_t, vme_datasize_t, vme_swap_t,
109 1.1 drochner bus_space_tag_t *, bus_space_handle_t *, vme_mapresc_t*));
110 1.1 drochner void b3_617_unmap_vme __P((void *, vme_mapresc_t));
111 1.1 drochner
112 1.1 drochner int b3_617_vme_probe __P((void *, vme_addr_t, vme_size_t, vme_am_t,
113 1.1 drochner vme_datasize_t,
114 1.1 drochner int (*)(void *, bus_space_tag_t, bus_space_handle_t),
115 1.1 drochner void *));
116 1.1 drochner
117 1.1 drochner int b3_617_map_vmeint __P((void *, int, int, vme_intr_handle_t *));
118 1.1 drochner void *b3_617_establish_vmeint __P((void *, vme_intr_handle_t, int,
119 1.1 drochner int (*)(void *), void *));
120 1.1 drochner void b3_617_disestablish_vmeint __P((void *, void *));
121 1.1 drochner
122 1.1 drochner int b3_617_dmamap_create __P((void *, vme_size_t,
123 1.1 drochner vme_am_t, vme_datasize_t, vme_swap_t,
124 1.1 drochner int, vme_size_t, vme_addr_t,
125 1.1 drochner int, bus_dmamap_t *));
126 1.1 drochner void b3_617_dmamap_destroy __P((void *, bus_dmamap_t));
127 1.1 drochner
128 1.1 drochner int b3_617_dmamem_alloc __P((void *, vme_size_t,
129 1.1 drochner vme_am_t, vme_datasize_t, vme_swap_t,
130 1.1 drochner bus_dma_segment_t *, int, int *, int));
131 1.1 drochner void b3_617_dmamem_free __P((void *, bus_dma_segment_t *, int));
132