lsi64854var.h revision 145190
1130293Sscottl/* $NetBSD: lsi64854var.h,v 1.4 2001/03/29 02:58:39 petrov Exp $ */ 2130293Sscottl 3130293Sscottl/*- 4130293Sscottl * Copyright (c) 1998 The NetBSD Foundation, Inc. 5130293Sscottl * All rights reserved. 6130293Sscottl * 7130293Sscottl * This code is derived from software contributed to The NetBSD Foundation 8130293Sscottl * by Paul Kranenburg. 9130293Sscottl * 10130293Sscottl * Redistribution and use in source and binary forms, with or without 11130293Sscottl * modification, are permitted provided that the following conditions 12130293Sscottl * are met: 13130293Sscottl * 1. Redistributions of source code must retain the above copyright 14130293Sscottl * notice, this list of conditions and the following disclaimer. 15130293Sscottl * 2. Redistributions in binary form must reproduce the above copyright 16130293Sscottl * notice, this list of conditions and the following disclaimer in the 17130293Sscottl * documentation and/or other materials provided with the distribution. 18130293Sscottl * 3. All advertising materials mentioning features or use of this software 19130293Sscottl * must display the following acknowledgement: 20130293Sscottl * This product includes software developed by the NetBSD 21130293Sscottl * Foundation, Inc. and its contributors. 22130293Sscottl * 4. Neither the name of The NetBSD Foundation nor the names of its 23130293Sscottl * contributors may be used to endorse or promote products derived 24130293Sscottl * from this software without specific prior written permission. 25130293Sscottl * 26130293Sscottl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27130293Sscottl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28130293Sscottl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29130293Sscottl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30130293Sscottl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31130293Sscottl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32130293Sscottl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33130293Sscottl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34130293Sscottl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35130293Sscottl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36130293Sscottl * POSSIBILITY OF SUCH DAMAGE. 37130293Sscottl */ 38130293Sscottl 39130293Sscottl/* $FreeBSD: head/sys/sparc64/sbus/lsi64854var.h 145190 2005-04-17 12:45:20Z marius $ */ 40130293Sscottl 41130293Sscottlstruct lsi64854_softc { 42130293Sscottl device_t sc_dev; 43130293Sscottl const char *dv_name; 44130293Sscottl 45130293Sscottl int sc_rid; 46130293Sscottl struct resource *sc_res; 47130293Sscottl bus_space_handle_t sc_regh; 48130293Sscottl bus_space_tag_t sc_regt; 49130293Sscottl u_int sc_rev; /* revision */ 50130293Sscottl int sc_burst; /* max suported burst size */ 51130293Sscottl 52130293Sscottl int sc_channel; 53130293Sscottl#define L64854_CHANNEL_SCSI 1 54130293Sscottl#define L64854_CHANNEL_ENET 2 55130293Sscottl#define L64854_CHANNEL_PP 3 56130293Sscottl void *sc_client; 57130293Sscottl 58130293Sscottl int sc_active; /* DMA active ? */ 59130293Sscottl bus_dmamap_t sc_dmamap; /* DMA map for bus_dma_* */ 60130293Sscottl 61130293Sscottl bus_dma_tag_t sc_parent_dmat; 62130293Sscottl bus_dma_tag_t sc_buffer_dmat; 63130293Sscottl int sc_datain; 64130293Sscottl size_t sc_dmasize; 65130293Sscottl caddr_t *sc_dmaaddr; 66130293Sscottl size_t *sc_dmalen; 67130293Sscottl 68130293Sscottl void (*reset)(struct lsi64854_softc *);/* reset routine */ 69130293Sscottl int (*setup)(struct lsi64854_softc *, caddr_t *, size_t *, 70130293Sscottl int, size_t *); /* DMA setup */ 71130293Sscottl int (*intr)(void *); /* interrupt handler */ 72130293Sscottl 73130293Sscottl int (*sc_intrchain)(void *); /* next handler in intr chain */ 74130293Sscottl void *sc_intrchainarg; /* arg for next intr handler */ 75130293Sscottl 76130293Sscottl u_int sc_dmactl; 77130293Sscottl}; 78130293Sscottl 79130293Sscottl#define L64854_GCSR(sc) \ 80130293Sscottl (bus_space_read_4((sc)->sc_regt, (sc)->sc_regh, L64854_REG_CSR)) 81130293Sscottl 82130293Sscottl#define L64854_SCSR(sc, csr) \ 83130293Sscottl bus_space_write_4((sc)->sc_regt, (sc)->sc_regh, L64854_REG_CSR, csr) 84130293Sscottl 85130293Sscottl 86130293Sscottl/* 87130293Sscottl * DMA engine interface functions. 88130293Sscottl */ 89130293Sscottl#define DMA_RESET(sc) (((sc)->reset)(sc)) 90130293Sscottl#define DMA_INTR(sc) (((sc)->intr)(sc)) 91130293Sscottl#define DMA_SETUP(sc, a, l, d, s) (((sc)->setup)(sc, a, l, d, s)) 92130293Sscottl 93130293Sscottl#define DMA_ISACTIVE(sc) ((sc)->sc_active) 94130293Sscottl 95130293Sscottl#define DMA_ENINTR(sc) do { \ 96145190Smarius uint32_t csr = L64854_GCSR(sc); \ 97130293Sscottl csr |= L64854_INT_EN; \ 98130293Sscottl L64854_SCSR(sc, csr); \ 99130293Sscottl} while (0) 100130293Sscottl 101130293Sscottl#define DMA_ISINTR(sc) (L64854_GCSR(sc) & (D_INT_PEND|D_ERR_PEND)) 102130293Sscottl 103130293Sscottl#define DMA_GO(sc) do { \ 104145190Smarius uint32_t csr = L64854_GCSR(sc); \ 105130293Sscottl csr |= D_EN_DMA; \ 106130293Sscottl L64854_SCSR(sc, csr); \ 107130293Sscottl sc->sc_active = 1; \ 108130293Sscottl} while (0) 109130293Sscottl 110130293Sscottl 111130293Sscottlvoid lsi64854_attach(struct lsi64854_softc *); 112130293Sscottlint lsi64854_scsi_intr(void *); 113130293Sscottlint lsi64854_enet_intr(void *); 114130293Sscottlint lsi64854_pp_intr(void *); 115