/*
* Copyright (c) 2001 Wayne Knowles
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Wayne Knowles
*
* 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.
*/
int wdsc_dmasetup(struct wd33c93_softc *, void ** ,size_t *, int, size_t *);
int wdsc_dmago(struct wd33c93_softc *);
void wdsc_dmastop(struct wd33c93_softc *);
void wdsc_reset(struct wd33c93_softc *);
int wdsc_dmaintr(void *);
int wdsc_scsiintr(void *);
/*
* Match for SCSI devices on the onboard and GIO32 adapter WD33C93 chips
*/
int
wdsc_match(device_t parent, cfdata_t cf, void *aux)
{
struct hpc_attach_args *haa = aux;
if (strcmp(haa->ha_name, cf->cf_name) == 0) {
vaddr_t reset, asr, reg;
/*
* Prime the hardware for a DMA transfer
*
* Requires splbio() interrupts to be disabled by the caller
*/
int
wdsc_dmasetup(struct wd33c93_softc *sc, void **addr, size_t *len, int datain,
size_t *dmasize)
{
struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
struct hpc_dma_softc *dsc = &wsc->sc_hpcdma;
int count, err;
void *vaddr;
/* Build list of physical addresses for this transfer */
if ((err = bus_dmamap_load(wsc->sc_dmat, wsc->sc_dmamap,
vaddr, count, NULL /* kernel address */,
BUS_DMA_NOWAIT)) != 0)
panic("%s: bus_dmamap_load err=%d",
device_xname(sc->sc_dev), err);
/*
* Prime the hardware for the next DMA transfer
*/
int
wdsc_dmago(struct wd33c93_softc *sc)
{
struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
struct hpc_dma_softc *dsc = &wsc->sc_hpcdma;