FreeBSD/Linux Kernel Cross Reference
sys/i386ps2/hdreg.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1989 Carnegie Mellon University
4 * Copyright (c) 1991 IBM Corporation
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation,
12 * and that the name IBM not be used in advertising or publicity
13 * pertaining to distribution of the software without specific, written
14 * prior permission.
15 *
16 * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31 /*
32 * HISTORY
33 * $Log: hdreg.h,v $
34 * Revision 2.4 93/11/17 16:53:19 dbg
35 * Removed local definition of 'HZ'. Removed non-MACH_KERNEL code.
36 * [93/09/21 dbg]
37 *
38 * Revision 2.3 93/03/11 14:09:25 danner
39 * u_long -> u_int
40 * [93/03/09 danner]
41 *
42 * Revision 2.2 93/02/04 08:00:04 danner
43 * Integrate PS2 code from IBM.
44 * [93/01/18 prithvi]
45 *
46 * Revision 1.2 90/08/16 16:04:24 relyea
47 * fix problems which blew GCC out of the water.
48 *
49 * Revision 1.1 90/08/07 10:28:01 chuckr
50 * Initial revision
51 *
52 * Revision 1.1 90/02/23 00:27:23 devrcs
53 * Updated for osc.5 build.
54 * [90/02/20 16:05:16 kevins]
55 *
56 * Revision 1.5 89/09/09 15:22:00 rvb
57 * hd.h -> hdreg.h; hd.h is now use for configuration.
58 * [89/09/09 rvb]
59 *
60 * Revision 1.4 89/07/17 10:40:31 rvb
61 * Olivetti Changes to X79 upto 5/9/89:
62 * [89/07/11 rvb]
63 *
64 * Revision 1.3 89/02/26 12:36:47 gm0w
65 * Changes for cleanup.
66 *
67 */
68
69 /*
70 * INTEL CORPORATION PROPRIETARY INFORMATION
71 *
72 * This software is supplied under the terms of a license
73 * agreement or nondisclosure agreement with Intel Corpo-
74 * ration and may not be copied or disclosed except in
75 * accordance with the terms of that agreement.
76 * Copyright 1988 Intel Corporation.
77 */
78
79 #include <platforms.h>
80
81 #define BOOTRECORDSIGNATURE (0x55aa & 0x00ff)
82 #define FIXED_DISK_REG 0x3f6
83 #define MORETHAN8HEADS 0x008
84 #define EIGHTHEADSORLESS 0x000
85 #define FIXEDBITS 0x0a0
86
87 #define PORT_DATA 0x1f0
88 #define PORT_ERROR 0x1f1
89 #define PORT_PRECOMP 0x1f1
90 #define PORT_NSECTOR 0x1f2
91 #define PORT_SECTOR 0x1f3
92 #define PORT_CYLINDERLOWBYTE 0x1f4
93 #define PORT_CYLINDERHIBYTE 0x1f5
94 #define PORT_DRIVE_HEADREGISTER 0x1f6
95 #define PORT_STATUS 0x1f7
96 #define PORT_COMMAND 0x1f7
97
98 #define STAT_BUSY 0x080
99 #define STAT_READY 0x040
100 #define STAT_WRITEFAULT 0x020
101 #define STAT_SEEKDONE 0x010
102 #define STAT_DATAREQUEST 0x008
103 #define STAT_ECC 0x004
104 #define STAT_INDEX 0x002
105 #define STAT_ERROR 0x001
106
107 #define CMD_RESTORE 0x010
108 #define CMD_SEEK 0x070
109 #define CMD_READ 0x020
110 #define CMD_WRITE 0x030
111 #define CMD_FORMAT 0x050
112 #define CMD_READVERIFY 0x040
113 #define CMD_DIAGNOSE 0x090
114 #define CMD_SETPARAMETERS 0x091
115
116 #define ERROR_BBD 0x80
117 #define ERROR_ECC 0x40
118
119 #define MAX_RETRIES 5
120 #define MAX_ALTBUFS 4
121
122 #define PATIENCE 3000000 /* how long to wait for controller */
123 #define PARTITION(z) (minor(z) & 0x0f)
124 #define UNIT(z) ( (minor(z) >> 4) & 0x01)
125 #define GOINGUP 1
126 #define GOINGDOWN 0
127
128 #define PDLOCATION 29
129 #define GETALTTBL ( ('H' <<8) | 1)
130 #define FMTBAD ( ('H' <<8) | 2)
131 #define BAD_BLK 0x80 /* needed for V_VERIFY */
132
133 #define NDRIVES 2
134 #define NLIDS 2 /* number of LIDS allocated to abios disks */
135 #define SECSIZE 512
136 #define u_char unsigned char
137 #define u_int unsigned int
138
139 #define GDDEBUG_MISC BIT16
140 #define GDDEBUG_START BIT17
141 #define GDDEBUG_MINCNT BIT18
142
143 #ifndef B_VERIFY
144 #define B_VERIFY 0x02000000 /* JD_XXX needed by hd */
145 #endif
146 #ifndef B_FORMAT
147 #define B_FORMAT 0x04000000
148 #endif
149
150 #define STRAT_NORMAL 0x01
151 #define STRAT_URGENT 0xff
152
153 #define PAGESIZ 4096
154 #define BOOT_OFFSET 256 /* 256 blocks or 128k of boot code. */
155
156 /* The following macro returns the proper pmap for a virtual address.
157 */
158 #define get_pmap(bp) (kernel_pmap) /* no b_proc to use! */
159
160 /* The following macro returns a page aligned address given the address of a
161 * buffer.
162 */
163 #define ADDR(A) (caddr_t)((((long)(A)) + (I386_PGBYTES - 1)) \
164 & ~ (I386_PGBYTES - 1))
165 /* The following macro returns the virtual address in a given buf struct.
166 */
167 #define paddr(X) (paddr_t)(X->b_un.b_addr)
168 #define b_cylin b_resid
169
170 #ifndef NULL
171 #define NULL 0
172 #endif
173
174 #ifndef HZ
175 #define HZ hz
176 #endif
177
178 #define retry_count retries
179
180 typedef struct {
181 unsigned short ncylinders;
182 unsigned short nheads;
183 unsigned short precomp;
184 unsigned short landzone;
185 unsigned short nsecpertrack;
186 unsigned short flags; /* flags from abios */
187 unsigned short retries; /* suggested number of retries */
188 unsigned char lid; /* Logical ID */
189 unsigned char unit; /* unit on LID */
190 unsigned long nblocks;
191 unsigned long altinfo_loc;
192 unsigned long max_transfer; /* maximum number of blocks to transfer */
193 } hdisk_t;
194
195 typedef struct {
196 caddr_t phys_addr;
197 unsigned long count;
198 } saveaddr_t;
199
200 /* hh holds the state of the one and only (stupid board) current
201 block I/O request
202 */
203
204 struct hh {
205 int un_aligned;
206 u_char curdrive;
207 u_char busy;
208 u_char retries; /* # of times cmd has been tried */
209 u_char num_units;
210 u_short status;
211 u_char restoring;
212 u_char format_request;
213 #ifndef PS2
214 u_char interleave_tab[SECSIZE];
215 #endif
216 u_int format_track;
217 u_char absolute_sector;
218 u_int single_mode;
219 u_int block_is_bad;
220 daddr_t physblock;
221 u_int substituteblock;
222 u_int substitutetrack;
223 paddr_t rw_addr;
224 paddr_t vert_addr;
225 u_int phys_addr;
226 u_int cylinder;
227 u_int head;
228 u_int sector;
229 u_int blockcount;
230 u_int numblocks;
231 u_int blocktotal;
232 u_int start_of_unix[NDRIVES];
233 int sleep;
234 };
235
236 /* the boot record partition table is documented in IBM AT Tech. Ref p. 9-6 */
237 struct boot_record {
238 u_char boot_ind; /* if it == 0x80, this partition is active */
239 u_char head; /* driver does not look at this field */
240 u_char sector; /* driver does not look at this field */
241 u_char cylinder; /* driver does not look at this field */
242
243 u_char sys_type; /* Indicates the system type. */
244 u_char end_head; /* driver does not look at this field */
245 u_char end_sector; /* driver does not look at this field */
246 u_char end_cylinder; /* driver does not look at this field */
247
248 u_int rel_sect; /* where unix starts if boot_ind == 0x80 */
249 u_int num_sects; /* driver does not look at this field */
250 };
251
Cache object: deb8b33a6f2cbcd4d634b1e94cc8534c
|