]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/scsi/drvSymbios8xx/Sym8xxInterface.h
xnu-201.5.tar.gz
[apple/xnu.git] / iokit / Drivers / scsi / drvSymbios8xx / Sym8xxInterface.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /* Sym8xxInterface.h created by russb2 on Sat 30-May-1998 */
24
25 /*
26 * This file contains shared data structures between the script and the driver
27 *
28 */
29
30 #define MAX_SCSI_TARGETS 16
31 #define MAX_SCSI_LUNS 8
32 #define MAX_SCSI_TAG 256
33 #define MIN_SCSI_TAG 128
34
35 #define kHostAdapterSCSIId 7
36
37 #define MAX_SCHED_MAILBOXES 256
38 #define kMailBoxEmpty 0
39 #define kMailBoxCancel 1
40
41 #define kSCSITimerIntervalMS 250
42 #define kReqSenseTimeoutMS 3000
43 #define kAbortTimeoutMS 3000
44 #define kResetQuiesceDelayMS 3000
45 #define kAbortScriptTimeoutMS 50
46
47 /*
48 * NEXUS DATA Structure
49 *
50 * The Nexus structure contains per-request information for the script/driver
51 * to execute a SCSI request.
52 */
53
54 typedef struct SGEntry
55 {
56 UInt32 length;
57 UInt32 physAddr;
58 } SGEntry;
59
60 /*
61 * Note: There are (3) SG List entries reserved for use by the driver,
62 * i.e SG Entries 0-1 and the last entry in the list.
63 */
64 #define MAX_SGLIST_ENTRIES (64+3)
65
66 /*
67 * This part of the Nexus structure contains the script engine clock registers to
68 * be used for this request. This information is also contained in the per-target
69 * table (AdapterInterface->targetClocks).
70 */
71 typedef struct NexusParms
72 {
73 UInt8 reserved_1;
74 UInt8 sxferReg;
75 UInt8 target;
76 UInt8 scntl3Reg;
77 } NexusParms;
78
79 /*
80 * Pointers in the Nexus to our CDB/MsgOut data are in this format.
81 */
82 typedef struct NexusData
83 {
84 UInt32 length;
85 UInt32 ppData;
86 } NexusData;
87
88 typedef struct Nexus Nexus;
89 struct Nexus
90 {
91 NexusParms targetParms;
92
93 SGEntry *ppSGList;
94
95 NexusData msg;
96 NexusData cdb;
97
98 UInt32 currentDataPtr;
99 UInt32 savedDataPtr;
100
101 UInt8 tag;
102 UInt8 dataXferCalled;
103 UInt8 wideResidCount;
104 UInt8 reserved_1[1];
105
106 /*
107 * Data buffers for nexus
108 */
109 UInt8 cdbData[16];
110 UInt8 msgData[16];
111 UInt32 sgNextIndex;
112 SGEntry sgListData[MAX_SGLIST_ENTRIES];
113
114 };
115
116 /*
117 * Abort Bdr Mailbox
118 *
119 * The mailbox is used to send an Abort or Bus Device Reset to a device
120 * This mailbox is 4 bytes long, and all the necessary information are
121 * contained in this mailbox (No nexus Data associated)
122 */
123 typedef struct IOAbortBdrMailBox
124 {
125 UInt8 identify; /* Identify msg (0xC0) if Abort A0 */
126 UInt8 tag; /* Tag Message or Zero A1 */
127 UInt8 scsi_id; /* SCSI id of the target of the request A2 */
128 UInt8 message; /* Abort(0x06) or Bdr(0x0C) or AbortTag (0x0D) A3 */
129 } IOAbortBdrMailBox;
130
131 /*
132 * IODone mailbox
133 *
134 * This mailbox is used to signal the completion of an I/O to the driver.
135 */
136
137 typedef struct IODoneMailBox
138 {
139 UInt8 nexus; /* Nexus of the completed I/O */
140 UInt8 status; /* Status of the completed I/O */
141 UInt8 zero;
142 UInt8 semaphore; /* If set, these contents are valid */
143 } IODoneMailBox;
144
145 /*
146 * Adapter Interface
147 *
148 * This structure contains the shared data between the script and
149 * the driver. The script's local variable table is updated to point to the
150 * physical addresses of the data in this control block.
151 */
152
153 typedef struct TargetClocks
154 {
155 UInt8 reserved_1;
156 UInt8 sxferReg;
157 UInt8 reserved_2;
158 UInt8 scntl3Reg;
159 } TargetClocks;
160
161 typedef struct AdapterInterface
162 {
163 Nexus **nexusPtrsVirt;
164 Nexus **nexusPtrsPhys;
165
166 Nexus *nexusArrayPhys[MAX_SCSI_TAG]; /* Active SRBs or -1 */
167 Nexus *schedMailBox[MAX_SCHED_MAILBOXES]; /* New SRBs */
168 TargetClocks targetClocks[MAX_SCSI_TARGETS];
169
170 UInt32 xferSWideInst[4];
171
172 } AdapterInterface;
173
174 #define SCRIPT_VAR(x) ( *(UInt32 *)(chipRamAddr+(x)) )