160107Sobrien/* $NetBSD: sivar.h,v 1.12 2023/01/23 22:16:44 andvar Exp $ */ 216877Ssos 316877Ssos/*- 416877Ssos * Copyright (c) 1996 The NetBSD Foundation, Inc. 516877Ssos * All rights reserved. 616877Ssos * 716877Ssos * This code is derived from software contributed to The NetBSD Foundation 816877Ssos * by Adam Glass, David Jones, and Gordon W. Ross. 916877Ssos * 1016877Ssos * Redistribution and use in source and binary forms, with or without 1116877Ssos * modification, are permitted provided that the following conditions 1216877Ssos * are met: 1316877Ssos * 1. Redistributions of source code must retain the above copyright 1416877Ssos * notice, this list of conditions and the following disclaimer. 1516877Ssos * 2. Redistributions in binary form must reproduce the above copyright 1616877Ssos * notice, this list of conditions and the following disclaimer in the 1716877Ssos * documentation and/or other materials provided with the distribution. 1816877Ssos * 19117271Sache * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2016877Ssos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2116877Ssos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2216877Ssos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2316877Ssos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2416877Ssos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2516877Ssos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2616877Ssos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2716877Ssos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2816877Ssos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2916877Ssos * POSSIBILITY OF SUCH DAMAGE. 3016877Ssos */ 3116877Ssos 3216877Ssos/* 3316877Ssos * This file defines the interface between si.c and 3416877Ssos * the bus-specific files: si_obio.c, si_vme.c 3516877Ssos */ 3616877Ssos 3716877Ssos/* 3816877Ssos * Transfers smaller than this are done using PIO 3916877Ssos * (on assumption they're not worth DMA overhead) 4016877Ssos */ 4116877Ssos#define MIN_DMA_LEN 128 4216877Ssos 4316877Ssos/* 4416877Ssos * Transfers larger than 65535 bytes need to be split-up. 4516877Ssos * (Some of the FIFO logic has only 16 bits counters.) 4616877Ssos * Make the size an integer multiple of the page size 4716877Ssos * to avoid buf/cluster remap problems. (paranoid?) 4816877Ssos */ 4916877Ssos#define MAX_DMA_LEN 0xE000 5016877Ssos 5116877Ssos/* 5216877Ssos * This structure is used to keep track of mapped DMA requests. 5316877Ssos */ 5416877Ssosstruct si_dma_handle { 5516877Ssos int dh_flags; 5616877Ssos#define SIDH_BUSY 1 /* This DH is in use */ 5716877Ssos#define SIDH_OUT 2 /* DMA does data out (write) */ 5816877Ssos vaddr_t dh_dmaaddr; /* VA of buffer in DVMA space */ 5938140Syokota vsize_t dh_dmalen; /* Length of KVA mapping. */ 6016877Ssos}; 6116877Ssos 6216877Ssos/* 6332822Syokota * The first structure member has to be the ncr5380_softc 6416877Ssos * so we can just cast to go back and fourth between them. 6516877Ssos */ 6616877Ssosstruct si_softc { 6716877Ssos struct ncr5380_softc ncr_sc; 6816877Ssos bus_space_tag_t sc_bst; 6916877Ssos bus_space_handle_t sc_bsh; 7016877Ssos volatile struct si_regs *sc_regs; 7116877Ssos bus_dma_tag_t sc_dmat; 7216877Ssos bus_dmamap_t sc_dmap; 7316877Ssos int sc_adapter_type; 7416877Ssos int sc_adapter_iv_am; /* int. vec + address modifier */ 7516877Ssos int sc_options; /* options for this instance */ 7616877Ssos int sc_reqlen; /* requested transfer length */ 7716877Ssos struct si_dma_handle *sc_dma; 7816877Ssos /* DMA command block for the OBIO controller. */ 7916877Ssos void *sc_dmacmd; 8016877Ssos}; 8116877Ssos 8216877Ssos/* Options for disconnect/reselect, DMA, and interrupts. */ 8316877Ssos#define SI_NO_DISCONNECT 0xff 8416877Ssos#define SI_NO_PARITY_CHK 0xff00 8516877Ssos#define SI_FORCE_POLLING 0x10000 8616877Ssos#define SI_DISABLE_DMA 0x20000 8716877Ssos/* The options are taken from the config file (PR#1929) */ 8816877Ssos 8916877Ssosextern int si_debug; 9016877Ssos 9116877Ssosvoid si_attach(struct si_softc *); 9216877Ssosint si_intr(void *); 9316877Ssos 9416877Ssosvoid si_dma_alloc(struct ncr5380_softc *); 9518194Ssosvoid si_dma_free(struct ncr5380_softc *); 9616877Ssosvoid si_dma_poll(struct ncr5380_softc *); 9716877Ssos