Home | History | Annotate | Line # | Download | only in pci
pciide_pdc202xx_reg.h revision 1.1
      1  1.1  bouyer /*	$NetBSD: pciide_pdc202xx_reg.h,v 1.1 1999/08/29 17:20:10 bouyer Exp $ */
      2  1.1  bouyer 
      3  1.1  bouyer /*
      4  1.1  bouyer  * Copyright (c) 1999 Manuel Bouyer.
      5  1.1  bouyer  *
      6  1.1  bouyer  * Redistribution and use in source and binary forms, with or without
      7  1.1  bouyer  * modification, are permitted provided that the following conditions
      8  1.1  bouyer  * are met:
      9  1.1  bouyer  * 1. Redistributions of source code must retain the above copyright
     10  1.1  bouyer  *    notice, this list of conditions and the following disclaimer.
     11  1.1  bouyer  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  bouyer  *    notice, this list of conditions and the following disclaimer in the
     13  1.1  bouyer  *    documentation and/or other materials provided with the distribution.
     14  1.1  bouyer  * 3. All advertising materials mentioning features or use of this software
     15  1.1  bouyer  *    must display the following acknowledgement:
     16  1.1  bouyer  *	This product includes software developed by the University of
     17  1.1  bouyer  *	California, Berkeley and its contributors.
     18  1.1  bouyer  * 4. Neither the name of the University nor the names of its contributors
     19  1.1  bouyer  *    may be used to endorse or promote products derived from this software
     20  1.1  bouyer  *    without specific prior written permission.
     21  1.1  bouyer  *
     22  1.1  bouyer  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  bouyer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  bouyer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  bouyer  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  bouyer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  bouyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  bouyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  bouyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  bouyer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  bouyer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  bouyer  * SUCH DAMAGE.
     33  1.1  bouyer  *
     34  1.1  bouyer  */
     35  1.1  bouyer 
     36  1.1  bouyer /*
     37  1.1  bouyer  * Registers definitions for PROMISE PDC20246 PCI IDE controller.
     38  1.1  bouyer  * Unfortunably the HW docs available don't provide much informations
     39  1.1  bouyer  * Most of the values set in registers comes from the FreeBSD and linux
     40  1.1  bouyer  * drivers, and from experiments with the BIOS of a Promise Ultra/33 board.
     41  1.1  bouyer  */
     42  1.1  bouyer 
     43  1.1  bouyer /* controller initial state */
     44  1.1  bouyer #define PDC2xx_STATE		0x50
     45  1.1  bouyer #define PDC2xx_STATE_SHIPID		0x8000
     46  1.1  bouyer #define PDC2xx_STATE_IOCHRDY		0x0400
     47  1.1  bouyer #define PDC2xx_STATE_LBA(channel)	(0x0100 << (channel))
     48  1.1  bouyer #define PDC2xx_STATE_NATIVE		0x0080
     49  1.1  bouyer #define PDC2xx_STATE_ISAIRQ		0x0008
     50  1.1  bouyer #define PDC2xx_STATE_EN(channel)	(0x0002 << (channel))
     51  1.1  bouyer #define PDC2xx_STATE_IDERAID		0x0001
     52  1.1  bouyer 
     53  1.1  bouyer /* per-drive timings */
     54  1.1  bouyer #define PDC2xx_TIM(channel, drive) (0x60 + 4 * (drive) + 8 * (channel))
     55  1.1  bouyer #define PDC2xx_TIM_SET_PA(r, x)	(((r) & 0xfffffff0) | ((x) & 0xf))
     56  1.1  bouyer #define PDC2xx_TIM_SET_PB(r, x)	(((r) & 0xffffe0ff) | (((x) & 0x1f) << 8))
     57  1.1  bouyer #define PDC2xx_TIM_SET_MB(r, x)	(((r) & 0xffff1fff) | (((x) & 0x7) << 13))
     58  1.1  bouyer #define PDC2xx_TIM_SET_MC(r, x)	(((r) & 0xfff0ffff) | (((x) & 0xf) << 16))
     59  1.1  bouyer #define PDC2xx_TIM_PRE		0x00000010
     60  1.1  bouyer #define PDC2xx_TIM_IORDY	0x00000020
     61  1.1  bouyer #define PDC2xx_TIM_ERRDY	0x00000040
     62  1.1  bouyer #define PDC2xx_TIM_SYNC		0x00000080
     63  1.1  bouyer #define PDC2xx_TIM_DMAW		0x00100000
     64  1.1  bouyer #define PDC2xx_TIM_DMAR		0x00200000
     65  1.1  bouyer #define PDC2xx_TIM_IORDYp	0x00400000
     66  1.1  bouyer #define PDC2xx_TIM_DMARQp	0x00800000
     67  1.1  bouyer 
     68  1.1  bouyer /* The following are extentions of the DMA registers */
     69  1.1  bouyer 
     70  1.1  bouyer /* primary mode (1 byte) */
     71  1.1  bouyer #define PDC2xx_PM	0x1a
     72  1.1  bouyer /* secondary mode (1 byte) */
     73  1.1  bouyer #define PDC2xx_SM	0x1b
     74  1.1  bouyer /* System control register (4 bytes) */
     75  1.1  bouyer #define PDC2xx_SCR	0x1c
     76  1.1  bouyer #define PDC2xx_SCR_SET_GEN(r,x) (((r) & 0xfffffff0) | ((x) & 0xf))
     77  1.1  bouyer #define PDC2xx_SCR_EMPTY(channel) (0x00000100 << (4 * channel))
     78  1.1  bouyer #define PDC2xx_SCR_FULL(channel) (0x00000200 << (4 * channel))
     79  1.1  bouyer #define PDC2xx_SCR_INT(channel) (0x00000400 << (4 * channel))
     80  1.1  bouyer #define PDC2xx_SCR_ERR(channel) (0x00000800 << (4 * channel))
     81  1.1  bouyer #define PDC2xx_SCR_SET_I2C(r,x) (((r) & 0xfff0ffff) | (((x) & 0xf) << 16))
     82  1.1  bouyer #define PDC2xx_SCR_SET_POLL(r,x) (((r) & 0xff0fffff) | (((x) & 0xf) << 20))
     83  1.1  bouyer #define PDC2xx_SCR_DMA		0x01000000
     84  1.1  bouyer #define PDC2xx_SCR_IORDY	0x02000000
     85  1.1  bouyer #define PDC2xx_SCR_G2FD		0x04000000
     86  1.1  bouyer #define PDC2xx_SCR_FLOAT	0x08000000
     87  1.1  bouyer #define PDC2xx_SCR_RSET		0x10000000
     88  1.1  bouyer #define PDC2xx_SCR_TST		0x20000000
     89  1.1  bouyer 
     90  1.1  bouyer /*
     91  1.1  bouyer  * The timings provided here results from things gathered from the FreeBSD
     92  1.1  bouyer  * driver and experimentations with the BIOS of a promise board.
     93  1.1  bouyer  * Unfortunably I didn't have enouth HW to test all the modes.
     94  1.1  bouyer  * They may be suboptimal.
     95  1.1  bouyer  */
     96  1.1  bouyer 
     97  1.1  bouyer static int8_t pdc2xx_pa[] = {0x4, 0x4, 0x4, 0x7, 0x3};
     98  1.1  bouyer static int8_t pdc2xx_pb[] = {0x13, 0x13, 0x13, 0xf, 0x7};
     99  1.1  bouyer static int8_t pdc2xx_dma_mb[] = {0x7, 0x3, 0x3};
    100  1.1  bouyer static int8_t pdc2xx_dma_mc[] = {0xf, 0x4, 0x3};
    101  1.1  bouyer static int8_t pdc2xx_udma_mb[] = {0x3, 0x2, 0x1, 0x2, 0x1};
    102  1.1  bouyer static int8_t pdc2xx_udma_mc[] = {0x1, 0x1, 0x1, 0x1, 0x1};
    103