Home | History | Annotate | Line # | Download | only in pci
pciidereg.h revision 1.7
      1  1.7     fvdl /*	$NetBSD: pciidereg.h,v 1.7 2003/11/27 23:02:40 fvdl Exp $	*/
      2  1.1      cgd 
      3  1.1      cgd /*
      4  1.1      cgd  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
      5  1.1      cgd  *
      6  1.1      cgd  * Redistribution and use in source and binary forms, with or without
      7  1.1      cgd  * modification, are permitted provided that the following conditions
      8  1.1      cgd  * are met:
      9  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     10  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     11  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     13  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     14  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     15  1.1      cgd  *    must display the following acknowledgement:
     16  1.1      cgd  *      This product includes software developed by Christopher G. Demetriou
     17  1.1      cgd  *	for the NetBSD Project.
     18  1.1      cgd  * 4. The name of the author may not be used to endorse or promote products
     19  1.1      cgd  *    derived from this software without specific prior written permission
     20  1.1      cgd  *
     21  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1      cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1      cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1      cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1      cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1      cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1      cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1      cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1      cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1      cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1      cgd  */
     32  1.1      cgd 
     33  1.1      cgd /*
     34  1.1      cgd  * PCI IDE controller register definitions.
     35  1.1      cgd  *
     36  1.1      cgd  * Author: Christopher G. Demetriou, March 2, 1998.
     37  1.1      cgd  *
     38  1.2      cgd  * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" and
     39  1.2      cgd  * "Programming Interface for Bus Master IDE Controller, Revision 1.0
     40  1.2      cgd  * 5/16/94" from the PCI SIG.
     41  1.1      cgd  */
     42  1.1      cgd 
     43  1.1      cgd /*
     44  1.1      cgd  * Number of channels per chip.  MUST NOT CHANGE (macros in pciide.c and
     45  1.1      cgd  * this file depend on its value).
     46  1.1      cgd  */
     47  1.1      cgd #define	PCIIDE_NUM_CHANNELS		2
     48  1.1      cgd 
     49  1.1      cgd /*
     50  1.2      cgd  * PCI base address register locations (some are per-channel).
     51  1.1      cgd  */
     52  1.1      cgd #define	PCIIDE_REG_CMD_BASE(chan)	(0x10 + (8 * (chan)))
     53  1.1      cgd #define	PCIIDE_REG_CTL_BASE(chan)	(0x14 + (8 * (chan)))
     54  1.2      cgd #define	PCIIDE_REG_BUS_MASTER_DMA	0x20
     55  1.1      cgd 
     56  1.1      cgd /*
     57  1.2      cgd  * Bits in the PCI Programming Interface register (some are per-channel).
     58  1.4   bouyer  * Bits 6-4 are defined as read-only in PCI 2.1 specification.
     59  1.4   bouyer  * Microsoft proposed to use these bits for independant channels
     60  1.4   bouyer  * enable/disable. This feature is enabled based on the value of bit 6.
     61  1.1      cgd  */
     62  1.4   bouyer #define PCIIDE_CHANSTATUS_EN		0x40
     63  1.4   bouyer #define PCIIDE_CHAN_EN(chan)		(0x20 >> (chan))
     64  1.1      cgd #define	PCIIDE_INTERFACE_PCI(chan)	(0x01 << (2 * (chan)))
     65  1.1      cgd #define	PCIIDE_INTERFACE_SETTABLE(chan)	(0x02 << (2 * (chan)))
     66  1.2      cgd #define	PCIIDE_INTERFACE_BUS_MASTER_DMA	0x80
     67  1.1      cgd 
     68  1.1      cgd /*
     69  1.2      cgd  * Compatibility address/IRQ definitions (some are per-channel).
     70  1.1      cgd  */
     71  1.1      cgd #define	PCIIDE_COMPAT_CMD_BASE(chan)	((chan) == 0 ? 0x1f0 : 0x170)
     72  1.1      cgd #define	PCIIDE_COMPAT_CMD_SIZE		8
     73  1.1      cgd #define	PCIIDE_COMPAT_CTL_BASE(chan)	((chan) == 0 ? 0x3f6 : 0x376)
     74  1.1      cgd #define	PCIIDE_COMPAT_CTL_SIZE		1
     75  1.1      cgd #define	PCIIDE_COMPAT_IRQ(chan)		((chan) == 0 ? 14 : 15)
     76  1.5    soren 
     77  1.5    soren #define PCIIDE_CHANNEL_NAME(chan)	((chan) == 0 ? "primary" : "secondary")
     78  1.3   bouyer 
     79  1.3   bouyer /*
     80  1.3   bouyer  * definitions for IDE DMA
     81  1.3   bouyer  * XXX maybe this should go elsewhere
     82  1.3   bouyer  */
     83  1.3   bouyer 
     84  1.3   bouyer /* secondary channel registers offset */
     85  1.3   bouyer #define IDEDMA_SCH_OFFSET 0x08
     86  1.7     fvdl #define IDEDMA_NREGS 8
     87  1.3   bouyer 
     88  1.3   bouyer /* Bus master command register */
     89  1.3   bouyer #define IDEDMA_CMD 0x00
     90  1.3   bouyer #define IDEDMA_CMD_WRITE 0x08
     91  1.3   bouyer #define IDEDMA_CMD_START 0x01
     92  1.3   bouyer 
     93  1.3   bouyer /* Bus master status register */
     94  1.3   bouyer #define IDEDMA_CTL 0x02
     95  1.3   bouyer #define IDEDMA_CTL_DRV_DMA(d)	(0x20 << (d))
     96  1.3   bouyer #define IDEDMA_CTL_INTR		0x04
     97  1.3   bouyer #define IDEDMA_CTL_ERR		0x02
     98  1.3   bouyer #define IDEDMA_CTL_ACT		0x01
     99  1.3   bouyer 
    100  1.3   bouyer /* Bus master table pointer register */
    101  1.3   bouyer #define IDEDMA_TBL 0x04
    102  1.3   bouyer #define IDEDMA_TBL_MASK 0xfffffffc
    103  1.3   bouyer #define IDEDMA_TBL_ALIGN 0x00010000
    104  1.3   bouyer 
    105  1.3   bouyer /* bus master table descriptor */
    106  1.3   bouyer struct idedma_table {
    107  1.3   bouyer 	u_int32_t base_addr; /* physical base addr of memory region */
    108  1.3   bouyer 	u_int32_t byte_count; /* memory region length */
    109  1.3   bouyer #define IDEDMA_BYTE_COUNT_MASK 0x0000FFFF
    110  1.3   bouyer #define IDEDMA_BYTE_COUNT_EOT  0x80000000
    111  1.3   bouyer };
    112  1.3   bouyer 
    113  1.3   bouyer #define IDEDMA_BYTE_COUNT_MAX 0x00010000 /* Max I/O per table */
    114  1.3   bouyer #define IDEDMA_BYTE_COUNT_ALIGN 0x00010000
    115  1.3   bouyer 
    116  1.3   bouyer /* Number of idedma table needed */
    117  1.6  thorpej #define NIDEDMA_TABLES (MAXPHYS/PAGE_SIZE + 1)
    118