FreeBSD/Linux Kernel Cross Reference
sys/sqtsec/sec.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 Sequent Computer Systems
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 *
13 * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
14 * THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
15 * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /*
30 * HISTORY
31 * $Log: sec.h,v $
32 * Revision 2.4 93/03/10 11:30:56 danner
33 * u_long -> u_int
34 * [93/03/10 danner]
35 *
36 * Revision 2.3 91/07/31 18:07:40 dbg
37 * Changed copyright.
38 * [91/07/31 dbg]
39 *
40 * Revision 2.2 91/05/08 13:07:21 dbg
41 * Added volatile declarations.
42 * [90/11/13 dbg]
43 *
44 * Adapted for pure Mach kernel.
45 * [90/10/04 dbg]
46 *
47 */
48
49 /*
50 * $Header: sec.h,v 2.4 93/03/10 11:30:56 danner Exp $
51 */
52
53 /*
54 * Revision 1.1 89/07/05 13:20:15 kak
55 * Initial revision
56 *
57 * Revision 2.12 88/03/11 18:01:43 davest
58 * added MAX_SCED_ADDR_MEM -highest addressable memory SCED can access
59 *
60 */
61
62 #ifndef _SQTSEC_SEC_H_
63 #define _SQTSEC_SEC_H_
64
65 #include <sys/types.h>
66
67 /*
68 * sec.h
69 *
70 * This file contains the definitions of the interfaces
71 * to the SCSI/Ether (SEC) firmware.
72 *
73 *
74 * Below are the device numbers that the firmware expects for the
75 * unit channel id when a message such as STARTIO is sent. The SCSI
76 * devices have a range from 0x20 (32) to 0x5f (95) with each target
77 * adapter having a maximum of 8 logical units.
78 *
79 * adapter# lun sed_chan#
80 * 0 0-7 0x20-0x27
81 * 1 0-7 0x28-0x2f
82 * 2 0-7 0x30-0x37
83 * 3 0-7 0x38-0x3f
84 * 4 0-7 0x40-0x47
85 * 5 0-7 0x48-0x4f
86 * 6 0-7 0x50-0x57
87 * host(7) 0-7 0x58-0x5f
88 *
89 * The host adapter number by default is adapter number 7 but should
90 * there be more than one SEC on a single scsi bus then the adapter
91 * number should be changed as the board won't work if there are more
92 * than one adapter with the same bus number.
93 */
94
95 #define SDEV_SCSIBOARD 0 /* The SEC itself..... */
96 #define SDEV_ETHERREAD 1 /* ether input channel */
97 #define SDEV_ETHERWRITE 2 /* ether output channel */
98 #define SDEV_CONSOLE0IN 3 /* console port channel input */
99 #define SDEV_CONSOLE0OUT 4 /* console port channel output */
100 #define SDEV_CONSOLE1IN 5 /* diag port channel input */
101 #define SDEV_CONSOLE1OUT 6 /* diag port channel output */
102 #define SDEV_TOD 7 /* time of day clock channel */
103 #define SDEV_MEM 8 /* memory channel */
104 #define SDEV_WATCHDOG 9 /* watch dog timer channel */
105
106 #ifdef KERNEL_PROFILING
107 #define SDEV_PROFILER 10 /* SEC profiler channel */
108 #define SDEV_NUM_NONSCSI 11 /* last non-scsi device */
109 #else
110 #define SDEV_NUM_NONSCSI 10 /* last non-scsi device */
111 #endif KERNEL_PROFILING
112
113 #define SDEV_SCSISTART 0x20 /* scsi unit number start (32) */
114 #define SDEV_SCSIEND 0x5f /* scsi unit number end (95) */
115 #define SDEV_NUM_DEVICES 96
116
117 /*
118 * Indirect address table.
119 */
120
121 #ifdef ns32000
122 /*
123 * Must handle case where CLBYTES > 4095 which is a h/w limit
124 * on the size of an xfer count. buf_iatsz() also handles this.
125 */
126
127 #if (CLBYTES>4095)
128 #define IATBYTES 2048
129 #define IATSIZE 4
130 #else
131 #define IATSIZE CLSIZE
132 #define IATBYTES CLBYTES
133 #endif
134 #endif ns32000
135
136 #ifdef i386
137 /*
138 * Ideally, IATBYTES == CLBYTES. However, IATBYTES must be < 4096, since
139 * 4095 is a hardware limit on the size of an xfer count. buf_iatsz()
140 * also handles this. Thus take power of two below this (2048).
141 */
142 #define IATBYTES 2048
143 #endif i386
144
145 #define SEC_IAT_FLAG 0x80000000 /* indirect bit for iat ptr */
146 #define SEC_IATIFY(addr) ((struct sec_iat *)(((int)(addr)) | SEC_IAT_FLAG))
147 #define IATVARIANCE 1 /* raw - for tail garbage */
148
149 struct sec_iat {
150 u_char *iat_data; /* pointer to data */
151 int iat_count; /* number of bytes to put there */
152 };
153
154
155 /*
156 * Maximum amount of physical memory the SCED can address. All transfers
157 * must be to physical addresses below this address.
158 */
159
160 #define MAX_SCED_ADDR_MEM (128 * 1024 * 1024) /* 128Meg */
161
162 /*
163 * device program for all devices except ether read and clocks
164 */
165
166 #define SCSI_CMD_SIZE 16 /* Max no. of bytes in a scsi command */
167
168 struct sec_dev_prog {
169 u_char dp_status1; /* byte 1 of status */
170 u_char dp_status2; /* byte 2 of status */
171 short dp_reserved;
172 int dp_count; /* number of bytes transferred */
173 union {
174 u_char *dp_data; /* ptr to data */
175 struct sec_iat *dp_iat; /* ptr to indirect address table */
176 } dp_un;
177 struct sec_dev_prog *dp_next; /* ptr to next dev program if linked */
178 int dp_data_len; /* total number of bytes to transfer */
179 int dp_cmd_len; /* real size of next field */
180 u_char dp_cmd[SCSI_CMD_SIZE]; /* SCSI Device command */
181 };
182
183 /*
184 * channel instruction block
185 */
186 struct sec_cib {
187 int cib_inst; /* instruction */
188 volatile
189 int *cib_status; /* ptr to status or other structs */
190 };
191
192 /* Error Flags */
193 #define SEC_ERR_NONE 0
194 #define SEC_ERR_INVALID_INS 1
195 #define SEC_ERR_INVALID_DEV 2
196 #define SEC_ERR_NO_MORE_IO 3
197 #define SEC_ERR_NO_SENSE 4
198 #define SEC_ERR_COUNT_TOO_BIG 128
199 #define SEC_ERR_BAD_MODE 129
200
201 /*
202 * Instructions SCSI/Ether controller.
203 */
204 #define SINST_INSDONE 0x80000000 /* instruction complete bit */
205 #define SINST_INIT 0 /* Initialize instruction */
206 #define SINST_SETMODE 1 /* set modes instruction */
207 #define SINST_STARTIO 2 /* start io instruction */
208 #define SINST_GETMODE 3 /* get modes instruction */
209 #define SINST_FLUSHQUEUE 4 /* flush queue instruction */
210 #define SINST_RESTARTCURRENTIO 5 /* restart current inst */
211 #define SINST_RESTARTIO 6 /* restart instruction */
212 #define SINST_REQUESTSENSE 7 /* request sense inst */
213 #define SINST_STOPIO 8 /* stop io instruction */
214 #define SINST_RETTODIAG 9 /* return to diagnostics inst */
215 #define SINST_DIAG_REQ 10 /* special diagnostics request */
216
217 #define SCSI_ETHER_WRITE 0xA /* SCSI first byte for write */
218 #define SCSI_ETHER_STATION 0x0 /* SCSI 2nd byte for station */
219 #define SCSI_ETHER_MULTICAST 0x1 /* SCSI 2nd byte for multicast */
220
221 /*
222 * device program queue
223 */
224
225 #define SEC_POWERUP_QUEUE_SIZE 3 /* Queue size at power-up */
226
227 struct sec_progq {
228 u_int pq_head; /* head of list */
229 u_int pq_tail; /* tail of list */
230 union {
231 struct sec_dev_prog *pq_progs[SEC_POWERUP_QUEUE_SIZE];
232 struct sec_edev_prog {
233 int edp_iat_count; /* no. of iat's */
234 struct sec_iat *edp_iat; /* ptr to iat's */
235 } *pq_eprogs[SEC_POWERUP_QUEUE_SIZE];
236 } pq_un;
237 };
238
239 /*
240 * ether read output queue
241 */
242 struct sec_eprogq {
243 u_int epq_head; /* head of list */
244 u_int epq_tail; /* tail of list */
245 struct sec_ether_status {
246 u_char es_status1; /* byte 1 of status */
247 u_char es_status2; /* byte 2 of status */
248 short es_reserved;
249 int es_count; /* number of bytes received */
250 u_char *es_data; /* pointer to the first byte received */
251 } epq_status[SEC_POWERUP_QUEUE_SIZE]; /* ether status blocks */
252 };
253
254 /*
255 * SCSI Queues at power-up.
256 * The address of this is passed by power-up code to the kernel
257 * for auto-config of the SCSI/Ether controller.
258 */
259 struct sec_powerup {
260 struct sec_cib pu_cib; /* all devices */
261 struct sec_progq pu_requestq; /* all devices but ether read */
262 struct sec_progq pu_doneq; /* all devices but ether read */
263 struct sec_progq pu_erequestq; /* for ether read */
264 struct sec_eprogq pu_edoneq; /* for ether read */
265 };
266
267 /*
268 * init channel instruction data structure (ptr to it is passed in cib status
269 * pointer)
270 */
271 struct sec_init_chan_data {
272 volatile
273 int sic_status; /* status of INIT instruction */
274 struct sec_cib *sic_cib; /* pointer to cibs (1/device) */
275 struct sec_chan_descr {
276 struct sec_progq *scd_requestq; /* pointer to input queue */
277 struct sec_progq *scd_doneq; /* pointer to output queue */
278 u_char scd_bin; /* bin to interrupt Unix on */
279 u_char scd_vector; /* interrupt vector to return */
280 u_char scd_destslic; /* Interrupt destination */
281 } sic_chans[SDEV_NUM_DEVICES]; /* channel descriptors (1/device) */
282 };
283
284 /*
285 * Diagnostic request.
286 * A pointer to this is passed in the cib_status
287 * when the cib_inst is SINST_DIAG_REQ.
288 *
289 * For SDR_CACHE_OFF and SDR_CACHE_ON, sdr_slic is the SLIC id
290 * of the thing that needs its cache turned on or off. This is
291 * done with the processor held (via its PROC_CTL register),
292 * if it is a processor.
293 *
294 * SDR_MEM_CHANGED has no arguments.
295 *
296 * SDR_WRSUBSLAVE writes the SLIC sub-slave register at SLIC
297 * address sdr_slic, slave register sdr_s_slave and subslave
298 * address sdr_s_subslave with the data in sdr_s_data.
299 * This is intended primarily for use with SGS processor
300 * boards, so it forces a bus PAUSE, then holds the
301 * processor (and its neighbor) before doing the wrSubslave().
302 * The VLSI wanted to assume these settings were static...
303 */
304 struct sec_diag_req {
305 volatile
306 int sdr_status; /* status from this cmd */
307 u_char sdr_cmd; /* command for SCED to execute */
308 u_char sdr_slic; /* SLIC target operand for some cmds */
309 u_char sdr_compad[2]; /* common data pad */
310 union sdr_un { /* command-specific fields: */
311 struct sdru_slave {
312 u_char sdrus_slave; /* SLIC slave address */
313 u_char sdrus_subslave; /* SLIC sub-slave addr (opt) */
314 u_char sdrus_data; /* SLIC data for write */
315 } sdru_slave; /* slave command for SCED to execute */
316 u_int sdru_pad[10]; /* lots of padding for cmd-specifics */
317 } sdr_un;
318 };
319
320 /*
321 * Values for sdr_cmd.
322 */
323 #define SDR_CACHE_OFF 0x00 /* turn cache off for someone */
324 #define SDR_CACHE_ON 0x01 /* turn cache on for someone */
325 #define SDR_MEM_CHANGED 0x02 /* notice that memory config changed */
326 #define SDR_WRSUBSLAVE 0x03 /* write a SLIC sub-slave register */
327
328 /*
329 * Make union entries easy to get to.
330 */
331 #define sdr_s_slave sdr_un.sdru_slave.sdrus_slave
332 #define sdr_s_subslave sdr_un.sdru_slave.sdrus_subslave
333 #define sdr_s_data sdr_un.sdru_slave.sdrus_data
334 #define sdr_pad sdr_un.sdru_pad
335
336
337 #ifdef KERNEL_PROFILING
338
339 struct pc_mode {
340 unsigned int pm_pc;
341 unsigned int pm_mode; /* usermode != 0, kernel mode = 0 */
342 };
343
344 /*
345 * profiling get and set mode structure
346 * used for communication with the profiler pseudo device on a SCED
347 */
348 struct kp_modes {
349 int kpm_interval; /* SCED timer interrupt interval in ms */
350 int kpm_reload; /* SCED sends NMI every reload timer intrs */
351 unsigned long kpm_sced_nmis;/* Number of nmi's sent by fw */
352 int kpm_state; /* state of profiling */
353 int kpm_binshift; /* Log2(Size in bytes of a bin) */
354 int kpm_bins; /* Number of bins used in profiling */
355 int kpm_engines; /* Number of engines to profile */
356 unsigned kpm_b_text; /* addr of 1st text symbol */
357 struct pc_mode *kpm_pc; /* addr of pc/psr pairs for processors */
358 /* addr in main mem: passed in from driver */
359 unsigned long *kpm_cntrs;/* address of the profiling cntrs */
360 /* addr in main mem: passed in from driver */
361 };
362 #endif KERNEL_PROFILING
363
364
365 /*
366 * structure for set modes command. Ptr to this goes in channel status ptr
367 */
368 struct sec_smode {
369 volatile
370 int sm_status; /* status from this cmd */
371 union {
372 struct sec_cons_modes {
373 short cm_baud; /* baud rate */
374 short cm_flags; /* flags for stop bits, dtr etc */
375 } sm_cons;
376 struct sec_ether_smodes {
377 u_char esm_addr[6]; /* ether address */
378 short esm_size; /* constant iat chunk size */
379 short esm_flags; /* receive mode flag */
380 } sm_ether;
381 struct sec_scsi_smodes {
382 short ssm_timeout; /* bus timeout */
383 short ssm_flags; /* used Single ended or diff connect */
384 } sm_scsi;
385 struct sec_tod_modes {
386 int tod_freq; /* interrupt frequency */
387 int tod_newtime; /* new time for TOD clock */
388 } sm_tod;
389 int sm_wdt_mode; /* wd timer mode */
390 struct sec_board_modes {
391 struct sec_powerup *sec_powerup;
392 short sec_dopoll;
393 short sec_errlight; /* error light */
394 struct reboot *sec_reboot; /* see cfg.h */
395 } sm_board;
396 struct sec_mem {
397 char *mm_buffer; /* address of log buffer */
398 char *mm_nextchar; /* next free char in buffer */
399 short mm_size; /* buffer size */
400 short mm_nchar; /* number valid chars in buf */
401 } sm_mem;
402 #ifdef KERNEL_PROFILING
403 struct kp_modes sm_kp;
404 #endif KERNEL_PROFILING
405 } sm_un;
406 };
407
408 /* Console Flags */
409 #define SCONS_STOP1 0x0000
410 #define SCONS_STOP1P5 0x0001
411 #define SCONS_STOP2 0x0002
412 #define SCONS_ALL_STOP 0x0003
413
414 #define SCONS_DATA8 0x0000
415 #define SCONS_DATA7 0x0004
416 #define SCONS_ALL_DATA 0x0004
417
418 #define SCONS_NO_PARITY 0x0000
419 #define SCONS_EVEN_PARITY 0x0008
420 #define SCONS_ODD_PARITY 0x0010
421 #define SCONS_ALL_PARITY 0x0018
422
423 #define SCONS_SEND_CARRIER 0x0000
424 #define SCONS_IGN_CARRIER 0x0020
425
426 #define SCONS_SET_DTR 0x0000
427 #define SCONS_CLEAR_DTR 0x0040
428
429 #define SCONS_SEND_BREAK 0x0000
430 #define SCONS_DIAG_BREAK 0x0080
431 #define SCONS_IGNORE_BREAK 0x0100
432 #define SCONS_ALL_BREAK 0x0180
433
434 #define SCONS_DHMODE 0x0000
435 #define SCONS_DZMODE 0x0200
436
437 #define SCONS_CARRIER_SET 0x0000
438 #define SCONS_CARRIER_CLEAR 0x0400
439
440 #define SCONS_SET_RTS 0x0000
441 #define SCONS_CLEAR_RTS 0x0800
442
443 #define SCONS_CLEAR_BREAK 0x0000
444 #define SCONS_SET_BREAK 0x1000
445
446 #define SCONS_CRT_ERASE 0x8000
447
448 #define SCONS_SETABLE (SCONS_ALL_STOP | SCONS_ALL_DATA \
449 | SCONS_ALL_PARITY | SCONS_IGN_CARRIER | SCONS_CLEAR_DTR \
450 | SCONS_CLEAR_RTS | SCONS_SET_BREAK)
451
452 #define SCONS_PRESERVE (SCONS_ALL_BREAK | SCONS_CRT_ERASE)
453
454 #define SCONS_TRANSIENT (0xFFFF & ~(SCONS_PRESERVE | SCONS_SETABLE))
455
456 /* Console info error bits */
457 #define SCONS_TIMEOUT 0x1
458 #define SCONS_BREAK_DET 0x2
459 #define SCONS_CARR_DET 0x4
460 #define SCONS_OVRFLOW 0x8
461 #define SCONS_FLUSHED 0x10
462 #define SCONS_PARITY_ERR 0x20
463 #define SCONS_FRAME_ERR 0x40
464
465 /* Ether mode flags */
466 #define SETHER_DISABLE 0
467 #define SETHER_PROMISCUOUS 1
468 #define SETHER_S_AND_B 2
469 #define SETHER_MULTICAST 3
470 #define SETHER_LOOPBACK 4
471
472 /* Front panel error light */
473 #define SERR_LIGHT_ON 1
474 #define SERR_LIGHT_SAME 0
475 #define SERR_LIGHT_OFF -1
476
477 /* value of the cib_status pointer upon SINST_RETTODIAG command */
478 #define SRD_BREAK (int *)0 /* returning from BREAK, halts */
479 #define SRD_POWERUP (int *)1 /* use powerup defaults */
480 #define SRD_REBOOT (int *)2 /* use setmode data */
481
482 /*
483 * structure for get modes command. Ptr to this goes in channel status ptr
484 */
485 struct sec_gmode {
486 volatile
487 int gm_status; /* status from this instruction */
488 volatile
489 union {
490 struct sec_cons_modes gm_cons; /* console data */
491 struct sec_ether_gmodes {
492 struct sec_ether_smodes egm_sm; /* same as set modes */
493 int egm_rx_ovfl; /* number of dma overflows */
494 int egm_rx_crc; /* number of crc errors */
495 int egm_rx_dribbles; /* number of dribbles */
496 int egm_rx_short; /* number of short packets */
497 int egm_rx_good; /* number of good packets */
498 int egm_tx_unfl; /* number of dma underflows */
499 int egm_tx_coll; /* number of collisions */
500 int egm_tx_16x_coll; /* number of 16x collisions */
501 int egm_tx_good; /* number of good packets sent */
502 } gm_ether;
503 struct sec_wdt_gmodes {
504 int gwdt_time; /* time between expirations */
505 int gwdt_expired; /* number of times light has expired */
506 } gm_wdt;
507 struct sec_tod_modes gm_tod; /* time of day data */
508 struct sec_scsi_gmodes {
509 struct sec_scsi_smodes sgm_sm; /* same as scsi set mode */
510 int sgm_bus_parity; /* number of bus parity errors seen */
511 } gm_scsi;
512 struct sec_board_modes gm_board; /* same as board set mode */
513 struct sec_mem gm_mem;
514 #ifdef KERNEL_PROFILING
515 struct kp_modes gm_kp;
516 #endif KERNEL_PROFILING
517 } gm_un;
518 };
519
520 /*
521 * request sense structure. ptr goes in channel status ptr.
522 */
523 struct sec_req_sense {
524 volatile
525 int rs_status;
526 struct sec_dev_prog rs_dev_prog; /* device program to run for sense command */
527 };
528
529 /* SCSI Sense Info */
530 #define SSENSE_NOSENSE 0
531 #define SSENSE_RECOVERABLE 1
532 #define SSENSE_NOT_READY 2
533 #define SSENSE_MEDIA_ERR 3
534 #define SSENSE_HARD_ERR 4
535 #define SSENSE_ILL_REQ 5
536 #define SSENSE_UNIT_ATN 6
537 #define SSENSE_DATA_PROT 7
538 #define SSENSE_BLANK_CHK 8
539 #define SSENSE_ABORT 0xb
540 #define SSENSE_EQUAL 0xc
541 #define SSENSE_VOL_OVER 0xd
542 #define SSENSE_CHECK 2
543 #define SSENSE_INTSTAT 16
544 #define SSENSE_MOREINFO 0x80
545 #define SSENSE_HOST_ERR 1
546 #define SSENSE_NOTREADY 1
547
548 /*
549 * SCSI bus device probe routine responses
550 */
551
552 #define SECP_NOTFOUND 0x1 /* no good unit here */
553 #define SECP_NOTARGET 0x2 /* no good target here */
554 #define SECP_FOUND 0x4 /* multi-unit target found */
555 #define SECP_ONELUN 0x8 /* single-unit target found */
556
557 #endif /* _SQTSEC_SEC_H_ */
Cache object: 1e0a88ff52f4ef6867a679ef0af80333
|