1*a0403cdeSmsaitoh /* $NetBSD: hpcdma.h,v 1.12 2019/12/27 09:41:49 msaitoh Exp $ */ 20ac0d0d4Swdk 30ac0d0d4Swdk /* 40ac0d0d4Swdk * Copyright (c) 2001 Wayne Knowles 50ac0d0d4Swdk * All rights reserved. 60ac0d0d4Swdk * 70ac0d0d4Swdk * This code is derived from software contributed to The NetBSD Foundation 80ac0d0d4Swdk * by Wayne Knowles 90ac0d0d4Swdk * 100ac0d0d4Swdk * Redistribution and use in source and binary forms, with or without 110ac0d0d4Swdk * modification, are permitted provided that the following conditions 120ac0d0d4Swdk * are met: 130ac0d0d4Swdk * 1. Redistributions of source code must retain the above copyright 140ac0d0d4Swdk * notice, this list of conditions and the following disclaimer. 150ac0d0d4Swdk * 2. Redistributions in binary form must reproduce the above copyright 160ac0d0d4Swdk * notice, this list of conditions and the following disclaimer in the 170ac0d0d4Swdk * documentation and/or other materials provided with the distribution. 185d1469bdSmartin * 3. All advertising materials mentioning features or use of this software 195d1469bdSmartin * must display the following acknowledgement: 205d1469bdSmartin * This product includes software developed by the NetBSD 215d1469bdSmartin * Foundation, Inc. and its contributors. 225d1469bdSmartin * 4. Neither the name of The NetBSD Foundation nor the names of its 235d1469bdSmartin * contributors may be used to endorse or promote products derived 245d1469bdSmartin * from this software without specific prior written permission. 250ac0d0d4Swdk * 260ac0d0d4Swdk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 270ac0d0d4Swdk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 280ac0d0d4Swdk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 290ac0d0d4Swdk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 300ac0d0d4Swdk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 310ac0d0d4Swdk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 320ac0d0d4Swdk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 330ac0d0d4Swdk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 340ac0d0d4Swdk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 350ac0d0d4Swdk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 360ac0d0d4Swdk * POSSIBILITY OF SUCH DAMAGE. 370ac0d0d4Swdk */ 380ac0d0d4Swdk 39de81761cSwdk #ifndef _SGIMIPS_HPC_DMA_H 40de81761cSwdk #define _SGIMIPS_HPC_DMA_H 410ac0d0d4Swdk 42cf10107dSdyoung #include <sys/bus.h> 430ac0d0d4Swdk 440ac0d0d4Swdk struct hpc_dma_softc { 450ac0d0d4Swdk bus_space_tag_t sc_bst; 460ac0d0d4Swdk bus_space_handle_t sc_bsh; 470ac0d0d4Swdk bus_dma_tag_t sc_dmat; 480ac0d0d4Swdk 49f016e292Stsutsui uint32_t sc_flags; 50de81761cSwdk #define HPCDMA_READ 0x20 /* direction of transfer */ 51de81761cSwdk #define HPCDMA_LOADED 0x40 /* bus_dmamap loaded */ 52de81761cSwdk #define HPCDMA_ACTIVE 0x80 /* DMA engine is busy */ 53f016e292Stsutsui uint32_t sc_dmacmd; 540ac0d0d4Swdk int sc_ndesc; 550ac0d0d4Swdk bus_dmamap_t sc_dmamap; 560ac0d0d4Swdk struct hpc_dma_desc *sc_desc_kva; /* Virtual address */ 572f9d0dfcStsutsui bus_addr_t sc_desc_pa; /* DMA address */ 58*a0403cdeSmsaitoh ssize_t sc_dlen; /* # of bytes transferred */ 59af4ac18eSsekiya struct hpc_values *hpc; /* constants for HPC1/3 */ 600ac0d0d4Swdk }; 610ac0d0d4Swdk 620ac0d0d4Swdk 630ac0d0d4Swdk void hpcdma_init(struct hpc_attach_args *, struct hpc_dma_softc *, int); 640ac0d0d4Swdk void hpcdma_sglist_create(struct hpc_dma_softc *, bus_dmamap_t); 65f016e292Stsutsui void hpcdma_cntl(struct hpc_dma_softc *, uint32_t); 668edf2c6dSthorpej void hpcdma_reset(struct hpc_dma_softc *); 670ac0d0d4Swdk void hpcdma_flush(struct hpc_dma_softc *); 680ac0d0d4Swdk 69de81761cSwdk #endif /* _SGIMIPS_HPC_DMA_H */ 70