wdcreg.h revision 1.7 1 1.7 cgd /* $NetBSD: wdcreg.h,v 1.7 1994/10/27 04:18:30 cgd 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.1 cgd #define wd_data 0x0 /* data register (R/W - 16 bits) */
45 1.1 cgd #define wd_error 0x1 /* error register (R) */
46 1.1 cgd #define wd_precomp wd_error /* write precompensation (W) */
47 1.1 cgd #define wd_seccnt 0x2 /* sector count (R/W) */
48 1.1 cgd #define wd_sector 0x3 /* first sector number (R/W) */
49 1.1 cgd #define wd_cyl_lo 0x4 /* cylinder address, low byte (R/W) */
50 1.1 cgd #define wd_cyl_hi 0x5 /* cylinder address, high byte (R/W)*/
51 1.1 cgd #define wd_sdh 0x6 /* sector size/drive/head (R/W)*/
52 1.1 cgd #define wd_command 0x7 /* command register (W) */
53 1.1 cgd #define wd_status wd_command /* immediate status (R) */
54 1.1 cgd
55 1.1 cgd #define wd_altsts 0x206 /*alternate fixed disk status(via 1015) (R)*/
56 1.1 cgd #define wd_ctlr 0x206 /*fixed disk controller control(via 1015) (W)*/
57 1.1 cgd #define WDCTL_4BIT 0x8 /* use four head bits (wd1003) */
58 1.1 cgd #define WDCTL_RST 0x4 /* reset the controller */
59 1.1 cgd #define WDCTL_IDS 0x2 /* disable controller interrupts */
60 1.1 cgd #define wd_digin 0x207 /* disk controller input(via 1015) (R)*/
61 1.1 cgd
62 1.1 cgd /*
63 1.1 cgd * Status Bits.
64 1.1 cgd */
65 1.1 cgd #define WDCS_BUSY 0x80 /* Controller busy bit. */
66 1.1 cgd #define WDCS_READY 0x40 /* Selected drive is ready */
67 1.1 cgd #define WDCS_WRTFLT 0x20 /* Write fault */
68 1.1 cgd #define WDCS_SEEKCMPLT 0x10 /* Seek complete */
69 1.1 cgd #define WDCS_DRQ 0x08 /* Data request bit. */
70 1.1 cgd #define WDCS_ECCCOR 0x04 /* ECC correction made in data */
71 1.1 cgd #define WDCS_INDEX 0x02 /* Index pulse from selected drive */
72 1.1 cgd #define WDCS_ERR 0x01 /* Error detect bit. */
73 1.1 cgd
74 1.6 mycroft #define WDCS_BITS "\020\010busy\007rdy\006wrtflt\005seekdone\004drq\003ecc_cor\002index\001err"
75 1.1 cgd
76 1.1 cgd #define WDERR_BITS "\020\010badblk\007uncorr\006id_crc\005no_id\003abort\002tr000\001no_dam"
77 1.1 cgd
78 1.1 cgd /*
79 1.1 cgd * Commands for Disk Controller.
80 1.1 cgd */
81 1.1 cgd #define WDCC_RESTORE 0x10 /* disk restore code -- resets cntlr */
82 1.1 cgd
83 1.1 cgd #define WDCC_READ 0x20 /* disk read code */
84 1.1 cgd #define WDCC_WRITE 0x30 /* disk write code */
85 1.1 cgd #define WDCC__LONG 0x02 /* modifier -- access ecc bytes */
86 1.1 cgd #define WDCC__NORETRY 0x01 /* modifier -- no retrys */
87 1.1 cgd
88 1.1 cgd #define WDCC_FORMAT 0x50 /* disk format code */
89 1.1 cgd #define WDCC_DIAGNOSE 0x90 /* controller diagnostic */
90 1.1 cgd #define WDCC_IDC 0x91 /* initialize drive command */
91 1.1 cgd
92 1.1 cgd #define WDCC_EXTDCMD 0xE0 /* send extended command */
93 1.1 cgd #define WDCC_READP 0xEC /* read parameters from controller */
94 1.1 cgd #define WDCC_CACHEC 0xEF /* cache control */
95 1.1 cgd
96 1.1 cgd #define WD_STEP 0 /* winchester- default 35us step */
97 1.1 cgd
98 1.1 cgd #define WDSD_IBM 0xa0 /* forced to 512 byte sector, ecc */
99 1.1 cgd
100 1.1 cgd
101 1.1 cgd #ifdef KERNEL
102 1.1 cgd /*
103 1.1 cgd * read parameters command returns this:
104 1.1 cgd */
105 1.1 cgd struct wdparams {
106 1.1 cgd /* drive info */
107 1.1 cgd short wdp_config; /* general configuration */
108 1.1 cgd short wdp_fixedcyl; /* number of non-removable cylinders */
109 1.1 cgd short wdp_removcyl; /* number of removable cylinders */
110 1.1 cgd short wdp_heads; /* number of heads */
111 1.1 cgd short wdp_unfbytespertrk; /* number of unformatted bytes/track */
112 1.1 cgd short wdp_unfbytes; /* number of unformatted bytes/sector */
113 1.1 cgd short wdp_sectors; /* number of sectors */
114 1.1 cgd short wdp_minisg; /* minimum bytes in inter-sector gap*/
115 1.1 cgd short wdp_minplo; /* minimum bytes in postamble */
116 1.1 cgd short wdp_vendstat; /* number of words of vendor status */
117 1.1 cgd /* controller info */
118 1.1 cgd char wdp_cnsn[20]; /* controller serial number */
119 1.1 cgd short wdp_cntype; /* controller type */
120 1.1 cgd #define WDTYPE_SINGLEPORTSECTOR 1 /* single port, single sector buffer */
121 1.1 cgd #define WDTYPE_DUALPORTMULTI 2 /* dual port, multiple sector buffer */
122 1.1 cgd #define WDTYPE_DUALPORTMULTICACHE 3 /* above plus track cache */
123 1.1 cgd short wdp_cnsbsz; /* sector buffer size, in sectors */
124 1.1 cgd short wdp_necc; /* ecc bytes appended */
125 1.1 cgd char wdp_rev[8]; /* firmware revision */
126 1.1 cgd char wdp_model[40]; /* model name */
127 1.1 cgd short wdp_nsecperint; /* sectors per interrupt */
128 1.1 cgd short wdp_usedmovsd; /* can use double word read/write? */
129 1.1 cgd };
130 1.1 cgd #endif KERNEL
131