2005-12-11 15:16:03 +03:00
|
|
|
/* $NetBSD: lsi64854var.h,v 1.8 2005/12/11 12:21:27 christos Exp $ */
|
1998-08-30 01:42:03 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Kranenburg.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct lsi64854_softc {
|
|
|
|
struct device sc_dev; /* base device */
|
|
|
|
bus_space_tag_t sc_bustag; /* bus tags */
|
|
|
|
bus_dma_tag_t sc_dmatag;
|
|
|
|
|
|
|
|
bus_space_handle_t sc_regs; /* the registers */
|
|
|
|
u_int sc_rev; /* revision */
|
|
|
|
int sc_burst; /* max suported burst size */
|
|
|
|
|
|
|
|
int sc_channel;
|
|
|
|
#define L64854_CHANNEL_SCSI 1
|
|
|
|
#define L64854_CHANNEL_ENET 2
|
|
|
|
#define L64854_CHANNEL_PP 3
|
|
|
|
void *sc_client;
|
|
|
|
|
|
|
|
int sc_active; /* DMA active ? */
|
|
|
|
bus_dmamap_t sc_dmamap; /* DMA map for bus_dma_* */
|
|
|
|
caddr_t sc_dvmaaddr; /* DVMA cookie */
|
|
|
|
size_t sc_dmasize;
|
|
|
|
caddr_t *sc_dmaaddr;
|
|
|
|
size_t *sc_dmalen;
|
|
|
|
|
2005-02-04 05:10:35 +03:00
|
|
|
void (*reset)(struct lsi64854_softc *);/* reset routine */
|
|
|
|
int (*setup)(struct lsi64854_softc *, caddr_t *, size_t *,
|
|
|
|
int, size_t *); /* DMA setup */
|
|
|
|
int (*intr)(void *); /* interrupt handler */
|
1998-08-30 01:42:03 +04:00
|
|
|
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*sc_intrchain)(void *); /* next handler in intr chain */
|
1998-08-30 01:42:03 +04:00
|
|
|
void *sc_intrchainarg; /* arg for next intr handler */
|
|
|
|
|
2001-03-29 06:58:38 +04:00
|
|
|
u_int sc_dmactl;
|
1998-08-30 01:42:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define L64854_GCSR(sc) \
|
1998-08-31 15:13:10 +04:00
|
|
|
(bus_space_read_4((sc)->sc_bustag, (sc)->sc_regs, L64854_REG_CSR))
|
1998-08-30 01:42:03 +04:00
|
|
|
|
|
|
|
#define L64854_SCSR(sc, csr) \
|
1998-08-31 15:13:10 +04:00
|
|
|
bus_space_write_4((sc)->sc_bustag, (sc)->sc_regs, L64854_REG_CSR, csr)
|
1998-08-30 01:42:03 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DMA engine interface functions.
|
|
|
|
*/
|
|
|
|
#define DMA_RESET(sc) (((sc)->reset)(sc))
|
|
|
|
#define DMA_INTR(sc) (((sc)->intr)(sc))
|
|
|
|
#define DMA_SETUP(sc, a, l, d, s) (((sc)->setup)(sc, a, l, d, s))
|
|
|
|
|
|
|
|
#define DMA_ISACTIVE(sc) ((sc)->sc_active)
|
|
|
|
|
|
|
|
#define DMA_ENINTR(sc) do { \
|
2005-05-31 04:46:05 +04:00
|
|
|
u_int32_t _csr = L64854_GCSR(sc); \
|
|
|
|
_csr |= L64854_INT_EN; \
|
|
|
|
L64854_SCSR(sc, _csr); \
|
|
|
|
} while (/*CONSTCOND*/0)
|
1998-08-30 01:42:03 +04:00
|
|
|
|
|
|
|
#define DMA_ISINTR(sc) (L64854_GCSR(sc) & (D_INT_PEND|D_ERR_PEND))
|
|
|
|
|
|
|
|
#define DMA_GO(sc) do { \
|
2005-05-31 04:46:05 +04:00
|
|
|
u_int32_t _csr = L64854_GCSR(sc); \
|
|
|
|
_csr |= D_EN_DMA; \
|
|
|
|
L64854_SCSR(sc, _csr); \
|
1998-08-30 01:42:03 +04:00
|
|
|
sc->sc_active = 1; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
2005-02-04 05:10:35 +03:00
|
|
|
void lsi64854_attach(struct lsi64854_softc *);
|
|
|
|
int lsi64854_scsi_intr(void *);
|
|
|
|
int lsi64854_enet_intr(void *);
|
|
|
|
int lsi64854_pp_intr(void *);
|