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