/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2008 Nathan Whitehorn4* All rights reserved5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef _POWERPC_POWERMAC_DBDMAVAR_H_29#define _POWERPC_POWERMAC_DBDMAVAR_H_3031struct dbdma_command {32uint8_t cmd:4; /* DBDMA command */3334uint8_t _resd1:1;35uint8_t key:3; /* Stream number, or 6 for KEY_SYSTEM */36uint8_t _resd2:2;3738/* Interrupt, branch, and wait flags */39uint8_t intr:2;40uint8_t branch:2;41uint8_t wait:2;4243uint16_t reqCount; /* Bytes to transfer */4445uint32_t address; /* 32-bit system physical address */46uint32_t cmdDep; /* Branch address or quad word to load/store */4748uint16_t xferStatus; /* Contents of channel status after completion */49uint16_t resCount; /* Number of residual bytes outstanding */50};5152struct dbdma_channel {53struct resource *sc_regs;54u_int sc_off;5556struct dbdma_command *sc_slots;57int sc_nslots;58bus_addr_t sc_slots_pa;5960bus_dma_tag_t sc_dmatag;61bus_dmamap_t sc_dmamap;62uint32_t sc_saved_regs[5];63};6465/*66DBDMA registers are found at 0x8000 + n*0x100 in the macio register space,67and are laid out as follows within each block:6869Address: Description: Length (bytes):700x000 Channel Control 4710x004 Channel Status 4720x00C Command Phys Addr 4730x010 Interrupt Select 4740x014 Branch Select 4750x018 Wait Select 476*/7778#define CHAN_CONTROL_REG 0x0079#define CHAN_STATUS_REG 0x0480#define CHAN_CMDPTR_HI 0x0881#define CHAN_CMDPTR 0x0C82#define CHAN_INTR_SELECT 0x1083#define CHAN_BRANCH_SELECT 0x1484#define CHAN_WAIT_SELECT 0x188586/* Channel control is the write channel to channel status, the upper 16 bits87are a mask of which bytes to change */8889#define DBDMA_REG_MASK_SHIFT 169091/* Status bits 0-7 are device dependent status bits */9293/*94The Interrupt/Branch/Wait Select triggers the corresponding condition bits95in the event that (select.mask & device dependent status) == select.value9697They are defined a follows:98Byte 1: Reserved99Byte 2: Mask100Byte 3: Reserved101Byte 4: Value102*/103104#endif /* _POWERPC_POWERMAC_DBDMAVAR_H_ */105106107