Home | History | Annotate | Line # | Download | only in ic
wdcreg.h revision 1.9
      1  1.9  mycroft /*	$NetBSD: wdcreg.h,v 1.9 1994/11/22 05:34:54 mycroft Exp $	*/
      2  1.7      cgd 
      3  1.1      cgd /*-
      4  1.1      cgd  * Copyright (c) 1991 The Regents of the University of California.
      5  1.1      cgd  * All rights reserved.
      6  1.1      cgd  *
      7  1.1      cgd  * This code is derived from software contributed to Berkeley by
      8  1.1      cgd  * William Jolitz.
      9  1.1      cgd  *
     10  1.1      cgd  * Redistribution and use in source and binary forms, with or without
     11  1.1      cgd  * modification, are permitted provided that the following conditions
     12  1.1      cgd  * are met:
     13  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     14  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     15  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     17  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     18  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     19  1.1      cgd  *    must display the following acknowledgement:
     20  1.1      cgd  *	This product includes software developed by the University of
     21  1.1      cgd  *	California, Berkeley and its contributors.
     22  1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     23  1.1      cgd  *    may be used to endorse or promote products derived from this software
     24  1.1      cgd  *    without specific prior written permission.
     25  1.1      cgd  *
     26  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.1      cgd  * SUCH DAMAGE.
     37  1.1      cgd  *
     38  1.7      cgd  *	@(#)wdreg.h	7.1 (Berkeley) 5/9/91
     39  1.1      cgd  */
     40  1.1      cgd 
     41  1.1      cgd /*
     42  1.1      cgd  * Disk Controller register definitions.
     43  1.1      cgd  */
     44  1.9  mycroft #define	wd_data		0x000	/* data register (R/W - 16 bits) */
     45  1.9  mycroft #define wd_error	0x001	/* error register (R) */
     46  1.9  mycroft #define	wd_precomp	0x001	/* write precompensation (W) */
     47  1.9  mycroft #define	wd_features	0x001	/* features (W) */
     48  1.9  mycroft #define	wd_seccnt	0x002	/* sector count (R/W) */
     49  1.9  mycroft #define	wd_sector	0x003	/* first sector number (R/W) */
     50  1.9  mycroft #define	wd_cyl_lo	0x004	/* cylinder address, low byte (R/W) */
     51  1.9  mycroft #define	wd_cyl_hi	0x005	/* cylinder address, high byte (R/W) */
     52  1.9  mycroft #define	wd_sdh		0x006	/* sector size/drive/head (R/W) */
     53  1.9  mycroft #define	wd_command	0x007	/* command register (W)	*/
     54  1.9  mycroft #define	wd_status	0x007	/* immediate status (R)	*/
     55  1.9  mycroft 
     56  1.9  mycroft #define	wd_altsts	0x206	/* alternate fixed disk status (via 1015) (R) */
     57  1.9  mycroft #define	wd_ctlr		0x206	/* fixed disk controller control (via 1015) (W) */
     58  1.9  mycroft #define  WDCTL_4BIT	 0x08	/* use four head bits (wd1003) */
     59  1.9  mycroft #define  WDCTL_RST	 0x04	/* reset the controller */
     60  1.9  mycroft #define  WDCTL_IDS	 0x02	/* disable controller interrupts */
     61  1.9  mycroft #define	wd_digin	0x207	/* disk controller input (via 1015) (R) */
     62  1.1      cgd 
     63  1.1      cgd /*
     64  1.9  mycroft  * Status bits.
     65  1.1      cgd  */
     66  1.9  mycroft #define	WDCS_BSY	0x80	/* busy */
     67  1.9  mycroft #define	WDCS_DRDY	0x40	/* drive ready */
     68  1.9  mycroft #define	WDCS_DWF	0x20	/* drive write fault */
     69  1.9  mycroft #define	WDCS_DSC	0x10	/* drive seek complete */
     70  1.9  mycroft #define	WDCS_DRQ	0x08	/* data request */
     71  1.9  mycroft #define	WDCS_CORR	0x04	/* corrected data */
     72  1.9  mycroft #define	WDCS_IDX	0x02	/* index */
     73  1.9  mycroft #define	WDCS_ERR	0x01	/* error */
     74  1.9  mycroft #define WDCS_BITS	"\020\010bsy\007drdy\006dwf\005dsc\004drq\003corr\002idx\001err"
     75  1.1      cgd 
     76  1.9  mycroft /*
     77  1.9  mycroft  * Error bits.
     78  1.9  mycroft  */
     79  1.9  mycroft #define	WDCE_BBK	0x80	/* bad block detected */
     80  1.9  mycroft #define	WDCE_UNC	0x40	/* uncorrectable data error */
     81  1.9  mycroft #define	WDCE_MC		0x20	/* media changed */
     82  1.9  mycroft #define	WDCE_IDNF	0x10	/* id not found */
     83  1.9  mycroft #define	WDCE_ABRT	0x08	/* aborted command */
     84  1.9  mycroft #define	WDCE_MCR	0x04	/* media change requested */
     85  1.9  mycroft #define	WDCE_TK0NF	0x02	/* track 0 not found */
     86  1.9  mycroft #define	WDCE_AMNF	0x01	/* address mark not found */
     87  1.9  mycroft #define WDERR_BITS	"\020\010bbk\007unc\006mc\005idnf\004mcr\003abrt\002tk0nf\001amnf"
     88  1.1      cgd 
     89  1.1      cgd /*
     90  1.1      cgd  * Commands for Disk Controller.
     91  1.1      cgd  */
     92  1.9  mycroft #define	WDCC_RECAL	0x10	/* disk restore code -- resets cntlr */
     93  1.9  mycroft 
     94  1.9  mycroft #define	WDCC_READ	0x20	/* disk read code */
     95  1.9  mycroft #define	WDCC_WRITE	0x30	/* disk write code */
     96  1.9  mycroft #define	 WDCC__LONG	 0x02	 /* modifier -- access ecc bytes */
     97  1.9  mycroft #define	 WDCC__NORETRY	 0x01	 /* modifier -- no retrys */
     98  1.9  mycroft 
     99  1.9  mycroft #define	WDCC_FORMAT	0x50	/* disk format code */
    100  1.9  mycroft #define	WDCC_DIAGNOSE	0x90	/* controller diagnostic */
    101  1.9  mycroft #define	WDCC_IDP	0x91	/* initialize drive parameters */
    102  1.9  mycroft 
    103  1.9  mycroft #define	WDCC_READMULTI	0xc4	/* read multiple */
    104  1.9  mycroft #define	WDCC_WRITEMULTI	0xc5	/* write multiple */
    105  1.9  mycroft #define	WDCC_SETMULTI	0xc6	/* set multiple mode */
    106  1.9  mycroft 
    107  1.9  mycroft #define	WDCC_READDMA	0xc8	/* read with DMA */
    108  1.9  mycroft #define	WDCC_WRITEDMA	0xca	/* write with DMA */
    109  1.9  mycroft 
    110  1.9  mycroft #define	WDCC_ACKMC	0xdb	/* acknowledge media change */
    111  1.9  mycroft #define	WDCC_LOCK	0xde	/* lock drawer */
    112  1.9  mycroft #define	WDCC_UNLOCK	0xdf	/* unlock drawer */
    113  1.1      cgd 
    114  1.9  mycroft #define	WDCC_IDENTIFY	0xec	/* read parameters from controller */
    115  1.9  mycroft #define	WDCC_CACHEC	0xef	/* cache control */
    116  1.1      cgd 
    117  1.9  mycroft #define	WDSD_IBM	0xa0	/* forced to 512 byte sector, ecc */
    118  1.1      cgd 
    119  1.1      cgd 
    120  1.1      cgd #ifdef KERNEL
    121  1.1      cgd /*
    122  1.1      cgd  * read parameters command returns this:
    123  1.1      cgd  */
    124  1.1      cgd struct wdparams {
    125  1.1      cgd 	/* drive info */
    126  1.1      cgd 	short	wdp_config;		/* general configuration */
    127  1.9  mycroft #define	WD_CFG_REMOVABLE	0x0080
    128  1.9  mycroft #define	WD_CFG_FIXED		0x0040
    129  1.9  mycroft 	short	wdp_cylinders;		/* number of non-removable cylinders */
    130  1.9  mycroft 	char	__reserved1[2];
    131  1.1      cgd 	short	wdp_heads;		/* number of heads */
    132  1.1      cgd 	short	wdp_unfbytespertrk;	/* number of unformatted bytes/track */
    133  1.9  mycroft 	short	wdp_unfbytespersec;	/* number of unformatted bytes/sector */
    134  1.1      cgd 	short	wdp_sectors;		/* number of sectors */
    135  1.9  mycroft 	char	wdp_vendor1[6];
    136  1.1      cgd 	/* controller info */
    137  1.9  mycroft 	char	wdp_serial[20];		/* serial number */
    138  1.9  mycroft 	short	wdp_buftype;		/* buffer type */
    139  1.9  mycroft #define	WD_BUF_SINGLEPORTSECTOR	1	 /* single port, single sector buffer */
    140  1.9  mycroft #define	WD_BUF_DUALPORTMULTI	2	 /* dual port, multiple sector buffer */
    141  1.9  mycroft #define	WD_BUF_DUALPORTMULTICACHE 3	 /* above plus track cache */
    142  1.9  mycroft 	short	wdp_bufsize;		/* buffer size, in 512-byte units */
    143  1.9  mycroft 	short	wdp_eccbytes;		/* ecc bytes appended */
    144  1.9  mycroft 	char	wdp_revision[8];	/* firmware revision */
    145  1.1      cgd 	char	wdp_model[40];		/* model name */
    146  1.9  mycroft 	char	wdp_maxmulti;		/* maximum sectors per interrupt */
    147  1.9  mycroft 	char	wdp_vendor2[1];
    148  1.1      cgd 	short	wdp_usedmovsd;		/* can use double word read/write? */
    149  1.9  mycroft 	char	wdp_vendor3[1];
    150  1.9  mycroft 	char	wdp_capabilities;	/* capability flags */
    151  1.9  mycroft #define	WD_CAP_LBA	0x02
    152  1.9  mycroft #define	WD_CAP_DMA	0x01
    153  1.9  mycroft 	char	__reserved2[2];
    154  1.9  mycroft 	char	wdp_vendor4[1];
    155  1.9  mycroft 	char	wdp_piotiming;		/* PIO timing mode */
    156  1.9  mycroft 	char	wdp_vendor5[1];
    157  1.9  mycroft 	char	wdp_dmatiming;		/* DMA timing mode */
    158  1.1      cgd };
    159  1.1      cgd #endif KERNEL
    160