Home | History | Annotate | Line # | Download | only in xscale
iopaaureg.h revision 1.2
      1  1.2  thorpej /*	$NetBSD: iopaaureg.h,v 1.2 2002/08/02 06:52:17 thorpej Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*
      4  1.1  thorpej  * Copyright (c) 2002 Wasabi Systems, Inc.
      5  1.1  thorpej  * All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8  1.1  thorpej  *
      9  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     10  1.1  thorpej  * modification, are permitted provided that the following conditions
     11  1.1  thorpej  * are met:
     12  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     13  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     14  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     17  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     18  1.1  thorpej  *    must display the following acknowledgement:
     19  1.1  thorpej  *	This product includes software developed for the NetBSD Project by
     20  1.1  thorpej  *	Wasabi Systems, Inc.
     21  1.1  thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22  1.1  thorpej  *    or promote products derived from this software without specific prior
     23  1.1  thorpej  *    written permission.
     24  1.1  thorpej  *
     25  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26  1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29  1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1  thorpej  */
     37  1.1  thorpej 
     38  1.1  thorpej #ifndef _XSCALE_IOPAAUREG_H_
     39  1.1  thorpej #define	_XSCALE_IOPAAUREG_H_
     40  1.1  thorpej 
     41  1.1  thorpej /*
     42  1.1  thorpej  * The AAU can transfer a maximum of 16MB.
     43  1.1  thorpej  *
     44  1.1  thorpej  * XXX The DMA maps are > 32K if we allow the maximum number
     45  1.1  thorpej  * XXX of DMA segments (16MB / 4K + 1) -- fix this bus_dma
     46  1.1  thorpej  * XXX problem.
     47  1.1  thorpej  */
     48  1.1  thorpej #define	AAU_MAX_XFER	(16U * 1024 * 1024)
     49  1.1  thorpej #if 0
     50  1.1  thorpej #define	AAU_MAX_SEGS	((AAU_MAX_XFER / PAGE_SIZE) + 1)
     51  1.1  thorpej #else
     52  1.1  thorpej #define	AAU_MAX_SEGS	1024
     53  1.1  thorpej #endif
     54  1.1  thorpej 
     55  1.1  thorpej /*
     56  1.1  thorpej  * AAU I/O descriptor for operations with various numbers of inputs.
     57  1.1  thorpej  * Note that all descriptors must be 8-word (32-byte) aligned.
     58  1.1  thorpej  */
     59  1.1  thorpej struct aau_desc_4 {
     60  1.1  thorpej 	struct aau_desc_4 *d_next;	/* pointer to next (va) */
     61  1.1  thorpej 	uint32_t d_pa;			/* our physical address */
     62  1.1  thorpej 
     63  1.1  thorpej 	/* Hardware portion -- must be 32-byte aligned. */
     64  1.1  thorpej 	uint32_t	d_nda;		/* next descriptor address */
     65  1.2  thorpej 	uint32_t	d_sar[4];	/* source address */
     66  1.1  thorpej 	uint32_t	d_dar;		/* destination address */
     67  1.1  thorpej 	uint32_t	d_bc;		/* byte count */
     68  1.1  thorpej 	uint32_t	d_dc;		/* descriptor control */
     69  1.1  thorpej } __attribute__((__packed__));
     70  1.1  thorpej 
     71  1.1  thorpej #define	SYNC_DESC_4_OFFSET	offsetof(struct aau_desc_4, d_nda)
     72  1.1  thorpej #define	SYNC_DESC_4_SIZE	(sizeof(struct aau_desc_4) - SYNC_DESC_4_OFFSET)
     73  1.1  thorpej #define	SYNC_DESC_4(d)							\
     74  1.1  thorpej 	cpu_dcache_wbinv_range(((vaddr_t)(d)) + SYNC_DESC_4_OFFSET,	\
     75  1.1  thorpej 	    SYNC_DESC_4_SIZE)
     76  1.1  thorpej 
     77  1.1  thorpej /* Descriptor control */
     78  1.1  thorpej #define	AAU_DC_IE		(1U << 0)	/* interrupt enable */
     79  1.1  thorpej #define	AAU_DC_B1_CC(x)		((x) << 1)	/* block command/control */
     80  1.1  thorpej #define	AAU_DC_B2_CC(x)		((x) << 4)
     81  1.1  thorpej #define	AAU_DC_B3_CC(x)		((x) << 7)
     82  1.1  thorpej #define	AAU_DC_B4_CC(x)		((x) << 10)
     83  1.1  thorpej #define	AAU_DC_B5_CC(x)		((x) << 13)
     84  1.1  thorpej #define	AAU_DC_B6_CC(x)		((x) << 16)
     85  1.1  thorpej #define	AAU_DC_B7_CC(x)		((x) << 19)
     86  1.1  thorpej #define	AAU_DC_B8_CC(x)		((x) << 22)
     87  1.1  thorpej #define	AAU_DC_SBCI_5_8		(1U << 25)	/* SAR5-SAR8 valid */
     88  1.1  thorpej #define	AAU_DC_SBCI_5_16	(2U << 25)	/* SAR5-SAR16 valid */
     89  1.1  thorpej #define	AAU_DC_SBCI_5_32	(3U << 25)	/* SAR5-SAR32 valid */
     90  1.1  thorpej #define	AAU_DC_TC		(1U << 28)	/* transfer complete */
     91  1.1  thorpej #define	AAU_DC_PERR		(1U << 29)	/* parity check error */
     92  1.1  thorpej #define	AAU_DC_PENB		(1U << 30)	/* parity check enable */
     93  1.1  thorpej #define	AAU_DC_DWE		(1U << 31)	/* destination write enable */
     94  1.1  thorpej 
     95  1.1  thorpej #define	AAU_DC_CC_NULL		0		/* null command */
     96  1.1  thorpej #define	AAU_DC_CC_XOR		1U		/* XOR command */
     97  1.1  thorpej #define	AAU_DC_CC_FILL		2U		/* fill command */
     98  1.1  thorpej #define	AAU_DC_CC_DIRECT_FILL	7U		/* direct fill (copy) */
     99  1.1  thorpej 
    100  1.1  thorpej /* Hardware registers */
    101  1.1  thorpej #define	AAU_ACR		0x00		/* accelerator control */
    102  1.1  thorpej #define	AAU_ASR		0x04		/* accelerator status */
    103  1.1  thorpej #define	AAU_ADAR	0x08		/* descriptor address */
    104  1.1  thorpej #define	AAU_ANDAR	0x0c		/* next descriptor address */
    105  1.1  thorpej #define	AAU_DAR		0x20		/* destination address */
    106  1.1  thorpej #define	AAU_ABCR	0x24		/* byte count */
    107  1.1  thorpej #define	AAU_ADCR	0x28		/* descriptor control */
    108  1.1  thorpej /* i80321 only */
    109  1.1  thorpej #define	AAU_EDCR0	0x3c		/* extended descriptor control 0 */
    110  1.1  thorpej #define	AAU_EDCR1	0x60		/* extended descriptor control 1 */
    111  1.1  thorpej #define	AAU_EDCR2	0x84		/* extended descriptor control 2 */
    112  1.1  thorpej 
    113  1.1  thorpej #define	AAU_ACR_AAE	(1U << 0)	/* accelerator enable */
    114  1.1  thorpej #define	AAU_ACR_CR	(1U << 1)	/* chain resume */
    115  1.1  thorpej #define	AAU_ACR_512	(1U << 2)	/* 512-byte buffer enable */
    116  1.1  thorpej 
    117  1.1  thorpej #define	AAU_ASR_MA	(1U << 5)	/* master abort */
    118  1.1  thorpej #define	AAU_ASR_ECIF	(1U << 8)	/* end of chain interrupt */
    119  1.1  thorpej #define	AAU_ASR_ETIF	(1U << 9)	/* end of transfer interrupt */
    120  1.1  thorpej #define	AAU_ASR_AAF	(1U << 10)	/* acellerator active */
    121  1.1  thorpej 
    122  1.1  thorpej #define	AAU_ABCR_MASK	0x00ffffff	/* 24-bit count */
    123  1.1  thorpej 
    124  1.1  thorpej #endif /* _XSCALE_IOPAAUREG_H_ */
    125