Home | History | Annotate | Line # | Download | only in pci
btvmeivar.h revision 1.5
      1  1.5       chs /* $NetBSD: btvmeivar.h,v 1.5 2012/10/27 17:18:28 chs 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  *
     16  1.1  drochner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  drochner  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  drochner  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  drochner  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  drochner  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  1.1  drochner  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  1.1  drochner  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  1.1  drochner  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  1.1  drochner  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  1.1  drochner  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  1.1  drochner  *
     27  1.1  drochner  */
     28  1.1  drochner 
     29  1.1  drochner struct b3_617_vmeintrhand {
     30  1.1  drochner 	TAILQ_ENTRY(b3_617_vmeintrhand) ih_next;
     31  1.3     perry 	int (*ih_fun)(void*);
     32  1.1  drochner 	void *ih_arg;
     33  1.1  drochner 	int ih_level;
     34  1.1  drochner 	int ih_vector;
     35  1.1  drochner 	int ih_prior;
     36  1.1  drochner 	u_long ih_count;
     37  1.1  drochner };
     38  1.1  drochner 
     39  1.1  drochner struct b3_617_softc {
     40  1.5       chs 	device_t sc_dev;
     41  1.1  drochner 
     42  1.1  drochner 	/* tags passed in from PCI */
     43  1.1  drochner 	pci_chipset_tag_t sc_pc;
     44  1.1  drochner 	bus_space_tag_t csrt, mapt;
     45  1.1  drochner 	bus_space_handle_t csrh, maph;
     46  1.1  drochner 	bus_addr_t vmepbase; /* physical PCI address */
     47  1.1  drochner 	bus_dma_tag_t sc_dmat;
     48  1.1  drochner 	void *sc_ih;
     49  1.1  drochner 
     50  1.1  drochner 	bus_space_tag_t sc_vmet;
     51  1.1  drochner 
     52  1.1  drochner 	struct vme_range csrwindow, dmawindow24, dmawindow32;
     53  1.1  drochner 
     54  1.1  drochner 	/* tags passed to VME devices */
     55  1.1  drochner 	struct vme_chipset_tag sc_vct;
     56  1.1  drochner 
     57  1.1  drochner 	/* list of VME interrupt handlers */
     58  1.1  drochner 	TAILQ_HEAD(, b3_617_vmeintrhand) intrhdls;
     59  1.1  drochner 	int strayintrs;
     60  1.1  drochner 
     61  1.1  drochner 	/*
     62  1.1  drochner 	 * management of adapter mapping tables
     63  1.1  drochner 	 */
     64  1.1  drochner 	/* max fragmentation of scatter tables */
     65  1.1  drochner #define NVMEMAP 20
     66  1.1  drochner 
     67  1.1  drochner 	struct extent *vmeext;
     68  1.1  drochner 	char vmemap[EXTENT_FIXED_STORAGE_SIZE(NVMEMAP)];
     69  1.1  drochner };
     70  1.1  drochner 
     71  1.1  drochner #define read_csr_byte(sc, reg) \
     72  1.1  drochner   bus_space_read_1(sc->csrt, sc->csrh, reg)
     73  1.1  drochner #define write_csr_byte(sc, reg, val) \
     74  1.1  drochner   bus_space_write_1(sc->csrt, sc->csrh, reg, val)
     75  1.1  drochner #define read_csr_word(sc, reg) \
     76  1.1  drochner   bus_space_read_2(sc->csrt, sc->csrh, reg)
     77  1.1  drochner #define write_csr_word(sc, reg, val) \
     78  1.1  drochner   bus_space_write_2(sc->csrt, sc->csrh, reg, val)
     79  1.1  drochner 
     80  1.1  drochner #define write_mapmem(sc, ofs, val) \
     81  1.1  drochner   bus_space_write_4(sc->mapt, sc->maph, ofs, val)
     82  1.1  drochner #define read_mapmem(sc, ofs) \
     83  1.1  drochner   bus_space_read_4(sc->mapt, sc->maph, ofs)
     84  1.1  drochner 
     85  1.1  drochner #define VME_PAGESIZE 0x1000
     86  1.1  drochner #define PCI_PAGESIZE 0x1000
     87  1.1  drochner #define DMA_PAGESIZE 0x1000
     88  1.1  drochner 
     89  1.1  drochner /* shared between driver parts */
     90  1.3     perry int b3_617_reset(struct b3_617_softc*);
     91  1.3     perry int b3_617_init(struct b3_617_softc*);
     92  1.1  drochner #ifdef notyet /* for detach */
     93  1.3     perry void b3_617_halt(struct b3_617_softc*);
     94  1.1  drochner #endif
     95  1.3     perry int b3_617_intr(void*);
     96  1.1  drochner #if 0
     97  1.3     perry void b3_617_cntlrdma_done(struct b3_617_softc*);
     98  1.1  drochner #endif
     99  1.1  drochner 
    100  1.1  drochner /* exported via tag structs */
    101  1.3     perry int b3_617_map_vme(void *, vme_addr_t, vme_size_t,
    102  1.1  drochner 			vme_am_t, vme_datasize_t, vme_swap_t,
    103  1.3     perry 			bus_space_tag_t *, bus_space_handle_t *,
    104  1.3     perry 			vme_mapresc_t*);
    105  1.3     perry void b3_617_unmap_vme(void *, vme_mapresc_t);
    106  1.1  drochner 
    107  1.3     perry int b3_617_vme_probe(void *, vme_addr_t, vme_size_t, vme_am_t,
    108  1.1  drochner 			  vme_datasize_t,
    109  1.1  drochner 			  int (*)(void *, bus_space_tag_t, bus_space_handle_t),
    110  1.3     perry 			  void *);
    111  1.1  drochner 
    112  1.3     perry int b3_617_map_vmeint(void *, int, int, vme_intr_handle_t *);
    113  1.3     perry void *b3_617_establish_vmeint(void *, vme_intr_handle_t, int,
    114  1.3     perry 				   int (*)(void *), void *);
    115  1.3     perry void b3_617_disestablish_vmeint(void *, void *);
    116  1.1  drochner 
    117  1.3     perry int b3_617_dmamap_create(void *, vme_size_t,
    118  1.1  drochner 			      vme_am_t, vme_datasize_t, vme_swap_t,
    119  1.1  drochner 			      int, vme_size_t, vme_addr_t,
    120  1.3     perry 			      int, bus_dmamap_t *);
    121  1.3     perry void b3_617_dmamap_destroy(void *, bus_dmamap_t);
    122  1.1  drochner 
    123  1.3     perry int b3_617_dmamem_alloc(void *, vme_size_t,
    124  1.1  drochner 			     vme_am_t, vme_datasize_t, vme_swap_t,
    125  1.3     perry 			     bus_dma_segment_t *, int, int *, int);
    126  1.3     perry void b3_617_dmamem_free(void *, bus_dma_segment_t *, int);
    127