1
/* Copyright (c) 1996-2004, Adaptec Corporation
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* - Redistributions of source code must retain the above copyright notice, this
8
* list of conditions and the following disclaimer.
9
* - Redistributions in binary form must reproduce the above copyright notice,
10
* this list of conditions and the following disclaimer in the documentation
11
* and/or other materials provided with the distribution.
12
* - Neither the name of the Adaptec Corporation nor the names of its
13
* contributors may be used to endorse or promote products derived from this
14
* software without specific prior written permission.
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
* POSSIBILITY OF SUCH DAMAGE.
33
//***************************************************************************
37
// This file contains EATA specific structure and constant
40
//Author: Doug Anderson
48
//***************************************************************************
51
//Include Files -------------------------------------------------------------
57
# define osdBcopy(src,dest,size) memcpy(dest,src,size)
68
#if defined (_DPT_AIX)
69
#pragma options align=packed
75
//Definitions - Defines & Constants -----------------------------------------
77
// EATA Communcation Methods...........................
82
* Eata Register set definitions. We may need to undef them to remove
83
* errors since these same symbols are repeated in the various drivers.
84
* There are two sets of definitions, in an effort to support driver code
85
* and engine code that had formerly standardized on these.
90
#define HA_DMA_BASE 0x02
91
#define HA_COMMAND 0x07
92
# define CP_READ_CFG_PIO 0xF0 /* Read Configuration Data, PIO */
93
# define CP_EATA_RESET 0xF9 /* Reset SCSI Bus */
94
# define CP_IMMEDIATE 0xFA /* EATA Immediate command */
95
# define CP_DMA_CMD 0xFF /* Send an EATA DMA command */
96
#define HA_STATUS 0x07
97
# define HA_ST_ERROR 0x01
98
# define HA_ST_INDEX 0x02
99
# define HA_ST_CORRCTD 0x04
100
# define HA_ST_DRQ 0x08
101
# define HA_ST_SEEK_COMPLETE 0x10
102
# define HA_ST_WRT_FLT 0x20
103
# define HA_ST_READY 0x40
104
# define HA_ST_BUSY 0x80
105
# define HA_ST_DATA_RDY (HA_ST_SEEK_COMPLETE | HA_ST_READY | HA_ST_DRQ)
106
#define HA_AUX_STATUS 0x08
107
# define HA_AUX_BUSY 0x01
108
# define HA_AUX_INTR 0x02
110
// EATA Registers .....................................
112
// EPR_ = EATA PIO Register Offset
113
#define HBA_COMMAND 0x7 // Write
114
#define HBA_STATUS 0x7 // Read
115
#define HBA_AUX_STATUS 0x8 // Read
116
#define HBA_DATA 0x0 // Read/Write
117
#define HBA_ADDR3 0x5 // Write - CP Address Byte #3
118
#define HBA_ADDR2 0x4 // Write - CP Address Byte #2
119
#define HBA_ADDR1 0x3 // Write - CP Address Byte #1
120
#define HBA_ADDR0 0x2 // Write - CP Address Byte #0
122
// EATA PIO Commands..................................
123
#define EPIO_RD_CONFIG 0xf0 // Read Config.
124
#define EPIO_SEND_CP 0xf2 // Send CP (Command Packet)
125
#define EPIO_RCVE_SP 0xf3 // Recieve SP (Status Packet)
126
#define EPIO_TRUNCATE 0xf4 // Truncate Transfer
128
// EATA DMA Commands..................................
129
#define EDMA_RD_CONFIG 0xfd // Read Config.
130
#define EDMA_SEND_CP 0xff // Send CP (Command Packet)
132
// EATA Commands......................................
133
#define EATA_RESET 0xf9 // Reset
134
#define EDMA_RESET 0xf9 // - Clears controller hung
135
#define EPIO_RESET 0xf9 // - Issues reset to SCSI bus
137
// EATA Status Register...............................
139
// Previous cmd ended in an error
140
#define ESTAT_ERROR 0x01
141
// Controller will have more data soon (To avoid
142
// context switching)
143
#define ESTAT_MORE 0x02
144
// Data read was corrected by ECC algorithm
145
#define ESTAT_CORRECT 0x04
146
// Data Request is active
147
#define ESTAT_DRQ 0x08
149
#define ESTAT_SEEKCOMP 0x10
151
#define ESTAT_FAULT 0x20
153
#define ESTAT_READY 0x40
154
// Controller is busy
155
#define ESTAT_BUSY 0x80
157
// EATA Auxillary Status Register.....................
159
// Controller is busy (Doesn't clear interrupt)
160
#define AUX_BUSY 0x01
161
// A drive interrupt is asserted
165
//Definitions - Structure & Typedef -----------------------------------------
168
// EATA Read Config. Data Structure...................
171
#define RDCFG_EATA_SIG (((long)'E')|(((long)'A')<<8L)|(((long)'T')<<16L)|(((long)'A')<<24L))
174
// Controller supports overlapped cmds
175
#define RDCFG_OVERLAP 0x01
176
// Controller supports SCSI target mode
177
#define RDCFG_TGT_MODE 0x02
178
// Controller supports DMA
179
#define RDCFG_DMA 0x10
180
// The DRQX value is valid
181
#define RDCFG_DRQ_VALID 0x20
182
// ATA device (Head/Drive Register Req'd)
183
#define RDCFG_ATA 0x40
184
// Host Adapter Address Valid
185
#define RDCFG_HBA_ADDR 0x80
188
// Controller interrupt request #
189
#define RDCFG_IRQ_NUM 0x0f
190
// IRQ trigger (0=edge, 1=level)
191
#define RDCFG_IRQ_TRIG 0x10
192
// 0=Primary, 1=Secondary
193
#define RDCFG_PRIORITY 0x20
199
#define RDCFG_DRQ_NUM 0xc0
202
// (1=A secondary EISA controller does not also
203
// respond to ISA address)
204
#define RDCFG_NO_ISA 0x01
205
// 1 = A PCI HBA is configured to decode a fixed EISA address
206
#define RDCFG_FORCE_ADDR 0x02
207
// 1 = A 64KByte scatter-gather table is supported
208
#define RDCFG_SG_64K 0x04
209
// 1 = Unaligned scatter-gather table elements are supported
210
#define RDCFG_SG_UAE 0x08
213
// 1=This is an EISA controller
214
#define RDCFG_EISA_BUS 0x80
215
// 1=This is a PCI controller
216
#define RDCFG_PCI_BUS 0x40
217
// 1=RAIDNUM returned is questionable
218
#define RDCGF_VOODOO_RAIDNUM 0x20
219
// 1=This ia a PCI board with an M1 chip installed
220
#define RDCFG_PCI_M1 0x10
221
// 1=HBA supports AUTO termination on base channel only
222
#define RDCFG_AUTOTRM 0x08
223
// 1=HBA supports SCAM on one or more channels
224
#define RDCFG_SCAM 0x04
227
#define STRUCT_NAME eataRdConfig_S
230
#elif (defined(_DPT_ACTIVE_ALIGNMENT))
231
# define eataRdConfig_size 38
232
typedef unsigned char eataRdConfig_S[eataRdConfig_size];
237
//--------------------
238
// If active alignment...
239
//--------------------
241
#if defined (__cplusplus) && defined (_DPT_ACTIVE_ALIGNMENT)
242
#define eataRdConfig_size 38
243
#define STRUCT_SIZE eataRdConfig_size
249
uCHAR filler[STRUCT_SIZE];
255
// uCHAR getDevType() { return getU1(this,0); }
256
# define eataRdConfig_getDevType(this) ((eataRdConfig_S __FAR__ *)(this))->getDevType()
257
// uCHAR setDevType(uCHAR inChar) { return setU1(this,0,inChar); }
258
# define eataRdConfig_setDevType(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->getDevType(inChar)
259
// uCHAR getPageCode() { return getU1(this,1); }
260
# define eataRdConfig_getPageCode(this) ((eataRdConfig_S __FAR__ *)(this))->getPageCode()
261
// uCHAR setPageCode(uCHAR inChar) { return setU1(this,1,inChar); }
262
# define eataRdConfig_setPageCode(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->getPageCode(inChar)
264
// CR 3033 - Change byte position from 0 to 3 to reflect the correct "length" location
265
uCHAR getLength() { return getU1(this,3); }
266
# define eataRdConfig_getLength(this) ((eataRdConfig_S __FAR__ *)(this))->getLength()
268
// CR 3033 - Change byte position from 0 to 3
269
uCHAR setLength(uCHAR inChar) { return setU1(this,3,inChar); }
270
# define eataRdConfig_setLength(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setLength(inChar)
272
// CR 3033 - Remove swapLength(). Change andU4 to andU1 and byte position
274
// uLONG swapLength() { return osdSwap4((uLONG __FAR__ *)getUP1(this,0)); }
275
// void andLength(uLONG inLong) { andU4(this,0,inLong); }
276
void andLength(uLONG inLong) { andU1(this,3,inLong); }
278
uCHAR __FAR__ * getSignature() { return getUP1(this,4); }
279
# define eataRdConfig_getSignature(this) (*((uLONG __FAR__ *)(this->getSignature())))
281
uCHAR getVersion() { return getU1(this,8); }
282
# define eataRdConfig_getVersion(this) ((eataRdConfig_S __FAR__ *)(this))->getVersion()
283
uCHAR setVersion(uCHAR inChar) { return setU1(this,8,inChar); }
284
# define eataRdConfig_setVersion(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setVersion(inChar)
285
void orVersion(uCHAR inChar) { orU1(this,8,inChar); }
286
void andVersion(uCHAR inChar) { andU1(this,8,inChar); }
288
uCHAR getFlag1() { return getU1(this,9); }
289
# define eataRdConfig_getFlag1(this) ((eataRdConfig_S __FAR__ *)(this))->getFlag1()
290
uCHAR setFlag1(uCHAR inChar) { return setU1(this,9,inChar); }
291
# define eataRdConfig_setFlag1(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setFlag1(inChar)
292
void orFlag1(uCHAR inChar) { orU1(this,9,inChar); }
293
# define eataRdConfig_orFlag1(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->orFlag1(inChar)
294
void andFlag1(uCHAR inChar) { andU1(this,9,inChar); }
295
# define eataRdConfig_andFlag1(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->andFlag1(inChar)
297
uSHORT getPadLength() { return getU2(this,10); }
298
# define eataRdConfig_getPadLength(this) ((eataRdConfig_S __FAR__ *)(this))->getPadLength()
299
uSHORT setPadLength(uSHORT inShort) { return setU2(this,10,inShort); }
300
# define eataRdConfig_setPadLength(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setPadLength(inChar)
301
uSHORT swapPadLength() { return osdSwap2((uSHORT __FAR__ *)getUP1(this,10)); }
303
uCHAR __FAR__ * getScsiIDs() { return getUP1(this,12); }
304
# define eataRdConfig_getScsiIDs(this) ((eataRdConfig_S __FAR__ *)(this))->getScsiIDs()
306
uLONG getCpLength() { return getU4(this,16); }
307
# define eataRdConfig_getCpLength(this) ((eataRdConfig_S __FAR__ *)(this))->getCpLength()
308
uLONG setCpLength(uLONG inLong) { return setU4(this,16,inLong); }
309
# define eataRdConfig_setCpLength(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setCpLength(inChar)
310
uLONG swapCpLength() { return osdSwap4((uLONG __FAR__ *)getUP1(this,16)); }
312
uLONG getSpLength() { return getU4(this,20); }
313
# define eataRdConfig_getSpLength(this) ((eataRdConfig_S __FAR__ *)(this))->getSpLength()
314
uLONG setSpLength(uLONG inLong) { return setU4(this,20,inLong); }
315
# define eataRdConfig_setSpLength(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setSpLength(inChar)
316
uLONG swapSpLength() { return osdSwap4((uLONG __FAR__ *)getUP1(this,20)); }
318
uSHORT getQueueSize() { return getU2(this,24); }
319
# define eataRdConfig_getQueueSize(this) ((eataRdConfig_S __FAR__ *)(this))->getQueueSize()
320
uSHORT setQueueSize(uSHORT inShort) { return setU2(this,24,inShort); }
321
# define eataRdConfig_setQueueSize(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setQueueSize(inChar)
322
uSHORT swapQueueSize() { return osdSwap2((uSHORT __FAR__ *)getUP1(this,24)); }
324
uLONG getSgSize() { return getU4(this,26); }
325
# define eataRdConfig_getSgSize(this) ((eataRdConfig_S __FAR__ *)(this))->getSgSize()
326
uLONG setSgSize(uLONG inLong) { return setU4(this,26,inLong); }
327
# define eataRdConfig_setSgSize(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setSgSize(inChar)
328
uLONG swapSgSize() { return osdSwap4((uLONG __FAR__ *)getUP1(this,26)); }
330
uCHAR getFlag2() { return getU1(this,30); }
331
# define eataRdConfig_getFlag2(this) ((eataRdConfig_S __FAR__ *)(this))->getFlag2()
332
uCHAR setFlag2(uCHAR inChar) { return setU1(this,30,inChar); }
333
# define eataRdConfig_setFlag2(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setFlag2(inChar)
334
void orFlag2(uCHAR inChar) { orU1(this,30,inChar); }
335
# define eataRdConfig_orFlag2(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->orFlag2(inChar)
336
void andFlag2(uCHAR inChar) { andU1(this,30,inChar); }
337
# define eataRdConfig_andFlag2(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->andFlag2(inChar)
339
uCHAR getReserved1() { return getU1(this,31); }
340
uCHAR getIRQ() { return getU1(this,31); }
341
# define eataRdConfig_getIRQ(this) ((eataRdConfig_S __FAR__ *)(this))->getIRQ()
342
uCHAR setReserved1(uCHAR inChar) { return setU1(this,31,inChar); }
343
uCHAR setIRQ(uCHAR inChar) { return setU1(this,31,inChar); }
344
# define eataRdConfig_setIRQ(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setIRQ(inChar)
345
void orReserved1(uCHAR inChar) { orU1(this,31,inChar); }
346
void andReserved1(uCHAR inChar) { andU1(this,31,inChar); }
348
uCHAR getFlag3() { return getU1(this,32); }
349
# define eataRdConfig_getFlag3(this) ((eataRdConfig_S __FAR__ *)(this))->getFlag3()
350
uCHAR setFlag3(uCHAR inChar) { return setU1(this,32,inChar); }
351
# define eataRdConfig_setFlag3(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setFlag3(inChar)
352
void orFlag3(uCHAR inChar) { orU1(this,32,inChar); }
353
# define eataRdConfig_orFlag3(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->orFlag3(inChar)
354
void andFlag3(uCHAR inChar) { andU1(this,32,inChar); }
355
# define eataRdConfig_andFlag3(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->andFlag3(inChar)
357
uCHAR getMaxChanID() { return getU1(this,33); }
358
# define eataRdConfig_getMaxChanID(this) ((eataRdConfig_S __FAR__ *)(this))->getMaxChanID()
359
uCHAR setMaxChanID(uCHAR inChar) { return setU1(this,33,inChar); }
360
# define eataRdConfig_setMaxChanID(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setMaxChanID(inChar)
361
void orMaxChanID(uCHAR inChar) { orU1(this,33,inChar); }
362
# define eataRdConfig_orMaxChanID(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->orMaxChanID(inChar)
363
void andMaxChanID(uCHAR inChar) { andU1(this,33,inChar); }
364
# define eataRdConfig_andMaxChanID(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->andMaxChanID(inChar)
366
uCHAR getMaxLun() { return getU1(this,34); }
367
# define eataRdConfig_getMaxLun(this) ((eataRdConfig_S __FAR__ *)(this))->getMaxLun()
368
uCHAR setMaxLun(uCHAR inChar) { return setU1(this,34,inChar); }
369
# define eataRdConfig_setMaxLun(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setMaxLun(inChar)
370
void orMaxLun(uCHAR inChar) { orU1(this,34,inChar); }
371
void andMaxLun(uCHAR inChar) { andU1(this,34,inChar); }
373
uCHAR getFlag4() { return getU1(this,35); }
374
# define eataRdConfig_getFlag4(this) ((eataRdConfig_S __FAR__ *)(this))->getFlag4()
375
uCHAR setFlag4(uCHAR inChar) { return setU1(this,35,inChar); }
376
# define eataRdConfig_setFlag4(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setFlag4(inChar)
377
void orFlag4(uCHAR inChar) { orU1(this,35,inChar); }
378
# define eataRdConfig_orFlag4(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->orFlag4(inChar)
379
void andFlag4(uCHAR inChar) { andU1(this,35,inChar); }
380
# define eataRdConfig_andFlag4(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->andFlag4(inChar)
382
uCHAR getRaidNum() { return getU1(this,36); }
383
# define eataRdConfig_getRaidNum(this) ((eataRdConfig_S __FAR__ *)(this))->getRaidNum()
384
uCHAR setRaidNum(uCHAR inChar) { return setU1(this,36,inChar); }
385
# define eataRdConfig_setRaidNum(this,inChar) ((eataRdConfig_S __FAR__ *)(this))->setRaidNum(inChar)
386
void orRaidNum(uCHAR inChar) { orU1(this,36,inChar); }
387
void andRaidNum(uCHAR inChar) { andU1(this,36,inChar); }
389
uCHAR getReserved2() { return getU1(this,37); }
390
# define eataRdConfig_getReserved2(this) ((eataRdConfig_S __FAR__ *)(this))->getReserved2()
391
uCHAR setReserved2(uCHAR inChar) { return setU1(this,37,inChar); }
392
void orReserved2(uCHAR inChar) { orU1(this,37,inChar); }
393
void andReserved2(uCHAR inChar) { andU1(this,37,inChar); }
395
//---------------------------
396
// Required Support Functions
397
//---------------------------
399
static uLONG size() { return STRUCT_SIZE; }
400
void clear() { memset(this,0,STRUCT_SIZE); }
401
# define eataRdConfig_clear(this) ((eataRdConfig_S __FAR__ *)(this))->clear()
402
STRUCT_NAME __FAR__ * next() { return ((STRUCT_NAME __FAR__ *)(((uCHAR __FAR__ *)this)+STRUCT_SIZE)); }
403
STRUCT_NAME __FAR__ * prev() { return ((STRUCT_NAME __FAR__ *)(((uCHAR __FAR__ *)this)+STRUCT_SIZE)); }
405
#ifndef _DPT_BIG_ENDIAN
406
// CR 3033 swapLength();
416
#elif (defined(_DPT_ACTIVE_ALIGNMENT))
422
#define eataRdConfig_getDevType(x) getU1(x,0)
423
#define eataRdConfig_getPageCode(x) getU1(x,1)
424
#define eataRdConfig_getLength(x) getU1(x,3)
425
#define eataRdConfig_getSignature(x) (*((unsigned long __FAR__ *)getUP1(x,4)))
426
#define eataRdConfig_getVersion(x) getU1(x,8)
427
#define eataRdConfig_getFlag1(x) getU1(x,9)
428
#define eataRdConfig_orFlag1(x,y) orU1(x,9,y)
429
#define eataRdConfig_andFlag1(x,y) andU1(x,9,y)
430
#define eataRdConfig_setFlag1(x,y) setU1(x,9,y)
431
#define eataRdConfig_getPadLength(x) getU2(x,10)
432
#define eataRdConfig_getScsiIDs(x) getUP1(x,12)
433
#define eataRdConfig_getCpLength(x) getU4(x,16)
434
#define eataRdConfig_setCpLength(x,y) setU4(x,16,y)
435
#define eataRdConfig_getSpLength(x) getU4(x,20)
436
#define eataRdConfig_getQueueSize(x) getU2(x,24)
437
#define eataRdConfig_setQueueSize(x,y) setU2(x,24,y)
438
#define eataRdConfig_getSgSize(x) getU2(x,28)
439
#define eataRdConfig_setSgSize(x,y) setU2(x,28,y)
440
#define eataRdConfig_getFlag2(x) getU1(x,30)
441
#define eataRdConfig_orFlag2(x,y) orU1(x,30,y)
442
#define eataRdConfig_andFlag2(x,y) andU1(x,30,y)
443
#define eataRdConfig_setFlag2(x,y) setU1(x,30,y)
444
#define eataRdConfig_getIRQ(x) getU1(x,31)
445
#define eataRdConfig_setIRQ(x,y) setU1(x,31,y)
446
#define eataRdConfig_getFlag3(x) getU1(x,32)
447
#define eataRdConfig_orFlag3(x,y) orU1(x,32,y)
448
#define eataRdConfig_andFlag3(x,y) andU1(x,32,y)
449
#define eataRdConfig_setFlag3(x,y) setU1(x,32,y)
450
#define eataRdConfig_getMaxChanID(x) getU1(x,33)
451
#define eataRdConfig_orMaxChanID(x,y) orU1(x,33,y)
452
#define eataRdConfig_andMaxChanID(x,y) andU1(x,33,y)
453
#define eataRdConfig_setMaxChanID(x,y) setU1(x,33,y)
454
#define eataRdConfig_getMaxLun(x) getU1(x,34)
455
#define eataRdConfig_setMaxLun(x,y) setU1(x,34,y)
456
#define eataRdConfig_getFlag4(x) getU1(x,35)
457
#define eataRdConfig_orFlag4(x,y) orU1(x,35,y)
458
#define eataRdConfig_andFlag4(x,y) andU1(x,35,y)
459
#define eataRdConfig_setFlag4(x,y) setU1(x,35,y)
460
#define eataRdConfig_getRaidNum(x) getU1(x,36)
461
#define eataRdConfig_setRaidNum(x,y) setU1(x,36,y)
462
#define eataRdConfig_getReserved2(x) getU1(x,37)
464
/*---------------------------
465
* Required Support Functions
466
*---------------------------*/
468
#define eataRdConfig_clear(x) osdBzero(x,eataRdConfig_size)
470
//-----------------------------
471
// Else assume static alignment...
472
//-----------------------------
475
uLONG length; // # bytes following this field
476
# define eataRdConfig_getDevType(this) \
477
((eataRdConfig_S __FAR__ *)this)->length
478
# define eataRdConfig_getPageCode(this) \
479
(((eataRdConfig_S __FAR__ *)this)->length>>8)
480
# define eataRdConfig_getLength(this) \
481
(((eataRdConfig_S __FAR__ *)this)->length>>24)
483
char signature[4]; // EATA signature = ascii "EATA"
484
# define eataRdConfig_getSignature(this) \
485
(*((uLONG __FAR__ *)((eatatRdConfig_S __FAR__ *)this)->signature))
487
uCHAR version; // EATA version level supported
488
// bits 7-4 = version level
490
# define eataRdConfig_getVersion(this) \
491
((eataRdConfig_S __FAR__ *)this)->version
492
# define eataRdConfig_setVersion(this,inChar) \
493
((eataRdConfig_S __FAR__ *)this)->version = (inChar)
495
uCHAR flag1; // Flag byte - see bit definitions above
496
# define eataRdConfig_getFlag1(this) ((eataRdConfig_S __FAR__ *)this)->flag1
497
# define eataRdConfig_setFlag1(this,inChar) \
498
((eataRdConfig_S __FAR__ *)this)->flag1 = (inChar)
499
# define eataRdConfig_orFlag1(this,inChar) \
500
((eataRdConfig_S __FAR__ *)this)->flag1 |= (inChar)
501
# define eataRdConfig_andFlag1(this,inChar) \
502
((eataRdConfig_S __FAR__ *)this)->flag1 &= (inChar)
504
uSHORT padLength; // Extra CP bytes sent (PIO only, DMA = 0)
505
# define eataRdConfig_getPadLength(this) \
506
getU2(&(((eataRdConfig_S __FAR__ *)this)->padLength),0)
507
# define eataRdConfig_setPadLength(this,inShort) \
508
setU2(&(((eataRdConfig_S __FAR__ *)this)->padLength),0,inShort)
510
uCHAR scsiIDs[4]; // HBA's SCSI IDs for various SCSI channels
511
# define eataRdConfig_getScsiIDs(this) \
512
((eataRdConfig_S __FAR__ *)this)->scsiIDs
514
uLONG cpLength; // # valid Command Packet bytes
515
# define eataRdConfig_getCpLength(this) \
516
getU4(&(((eataRdConfig_S __FAR__ *)this)->cpLength),0)
517
# define eataRdConfig_setCpLength(this,inLong) \
518
setU4(&(((eataRdConfig_S __FAR__ *)this)->cpLength),0,inLong)
520
uLONG spLength; // # valid Status Packet bytes
521
# define eataRdConfig_getSpLength(this) \
522
getU4(&(((eataRdConfig_S __FAR__ *)this)->spLength),0)
523
# define eataRdConfig_setSpLength(this,inLong) \
524
setU4(&(((eataRdConfig_S __FAR__ *)this)->spLength),0,inLong)
526
uSHORT queueSize; // Max. # CPs that can be queued
527
# define eataRdConfig_getQueueSize(this) \
528
getU2(&(((eataRdConfig_S __FAR__ *)this)->queueSize),0)
529
# define eataRdConfig_setQueueSize(this,inShort) \
530
setU2(&(((eataRdConfig_S __FAR__ *)this)->queueSize),0,inShort)
532
uLONG sgSize; // Max. # Scatter Gather table entries
534
# define eataRdConfig_getSgSize(this) \
535
getU4(&(((eataRdConfig_S __FAR__ *)this)->sgSize),0)
536
# define eataRdConfig_setSgSize(this,inLong) \
537
setU4(&(((eataRdConfig_S __FAR__ *)this)->sgSize),0,inLong)
539
uCHAR flag2; // Flag byte - see bit definitions above
540
# define eataRdConfig_getFlag2(this) ((eataRdConfig_S __FAR__ *)this)->flag2
541
# define eataRdConfig_setFlag2(this,inChar) \
542
((eataRdConfig_S __FAR__ *)this)->flag2 = (inChar)
543
# define eataRdConfig_orFlag2(this,inChar) \
544
((eataRdConfig_S __FAR__ *)this)->flag2 |= (inChar)
545
# define eataRdConfig_andFlag2(this,inChar) \
546
((eataRdConfig_S __FAR__ *)this)->flag2 &= (inChar)
548
uCHAR reserved1; // Device synchronous mode flags (defunct)
549
// Bit 7 = SCSI ID 7...
550
# define eataRdConfig_getIRQ(this) ((eataRdConfig_S __FAR__ *)this)->reserved1
551
# define eataRdConfig_setIRQ(this,inChar) \
552
((eataRdConfig_S __FAR__ *)this)->reserved1 = (inChar)
554
uCHAR flag3; // Flag byte - see bit definitions above
555
# define eataRdConfig_getFlag3(this) ((eataRdConfig_S __FAR__ *)this)->flag3
556
# define eataRdConfig_setFlag3(this,inChar) \
557
((eataRdConfig_S __FAR__ *)this)->flag3 = (inChar)
558
# define eataRdConfig_orFlag3(this,inChar) \
559
((eataRdConfig_S __FAR__ *)this)->flag3 |= (inChar)
560
# define eataRdConfig_andFlag3(this,inChar) \
561
((eataRdConfig_S __FAR__ *)this)->flag3 &= (inChar)
563
uCHAR maxChanID; // Maximum SCSI channel/ID supported
564
// (Max. channel = upper 3 bits)
565
# define eataRdConfig_getMaxChanID(this) \
566
((eataRdConfig_S __FAR__ *)this)->maxChanID
567
# define eataRdConfig_setMaxChanID(this,inChar) \
568
((eataRdConfig_S __FAR__ *)this)->maxChanID = (inChar)
569
# define eataRdConfig_orMaxChanID(this,inChar) \
570
((eataRdConfig_S __FAR__ *)this)->maxChanID |= (inChar)
571
# define eataRdConfig_andMaxChanID(this,inChar) \
572
((eataRdConfig_S __FAR__ *)this)->maxChanID &= (inChar)
574
uCHAR maxLUN; // Maximum SCSI LUN supported
575
# define eataRdConfig_getMaxLun(this) ((eataRdConfig_S __FAR__ *)this)->maxLUN
576
# define eataRdConfig_setMaxLun(this,inChar) \
577
((eataRdConfig_S __FAR__ *)this)->maxLUN = (inChar)
579
uCHAR flag4; // Flag byte - see bit definitions above
580
# define eataRdConfig_getFlag4(this) ((eataRdConfig_S __FAR__ *)this)->flag4
581
# define eataRdConfig_setFlag4(this,inChar) \
582
((eataRdConfig_S __FAR__ *)this)->flag4 = (inChar)
583
# define eataRdConfig_orFlag4(this,inChar) \
584
((eataRdConfig_S __FAR__ *)this)->flag4 |= (inChar)
585
# define eataRdConfig_andFlag4(this,inChar) \
586
((eataRdConfig_S __FAR__ *)this)->flag4 &= (inChar)
588
uCHAR raidNum; // This HBA's unique RAID number
589
# define eataRdConfig_getRaidNum(this) \
590
((eataRdConfig_S __FAR__ *)this)->raidNum
591
# define eataRdConfig_setRaidNum(this,inChar) \
592
((eataRdConfig_S __FAR__ *)this)->raidNum = (inChar)
595
# define eataRdConfig_getReserved2(this) \
596
((eataRdConfig_S __FAR__ *)this)->reserved2
597
# define eataRdConfig_setReserved2(this,inChar) \
598
((eataRdConfig_S __FAR__ *)this)->reserved2 = (inChar)
600
# define eataRdConfig_size sizeof(eataRdConfig_S)
601
# define eataRdConfig_clear(this) osdBzero(this,eataRdConfig_size)
606
#elif (!defined(_DPT_ACTIVE_ALIGNMENT))
612
// EATA CP (Command Packet) Structure.............
615
// Issue SCSI bus reset
616
#define CP_SCSI_RESET 0x01
617
// Controller should re-initialize
619
// DMA only - Target should automatically transfer
620
// request sense data
621
#define CP_REQ_SENSE 0x04
622
// DMA only - Data address is used for Scatter Gather
623
#define CP_SG_ADDR 0x08
624
// PIO only - Quick mode (CP uses PIO, Data uses DMA)
625
#define CP_QUICK 0x10
626
// The controller should interpret the cmd directly
627
#define CP_INTERPRET 0x20
628
// Data Output (Write, Host to Target)
629
#define CP_DATA_OUT 0x40
630
// Data Input (Read, Target to Host)
631
#define CP_DATA_IN 0x80
634
#define CP_DISCONNECT 0x80
635
#define CP_IDENTIFY 0x40
637
#define STRUCT_NAME eataCP_S
638
// #if (defined(__cplusplus))
639
// struct STRUCT_NAME {
640
// #elif (defined(_DPT_ACTIVE_ALIGNMENT))
641
# define eataCP_size 44
642
// typedef unsigned char eataCP_S[eataCP_size];
647
//--------------------
648
// If active alignment...
649
//--------------------
651
#if 0 && defined (__cplusplus) && defined (_DPT_ACTIVE_ALIGNMENT)
652
#define STRUCT_SIZE 44
658
uCHAR filler[STRUCT_SIZE];
664
uCHAR getFlags() { return getU1(this,0); }
665
# define eataCP_getFlags(this) ((eataCP_S __FAR__ *)(this))->getFlags()
666
uCHAR setFlags(uCHAR inChar) { return setU1(this,0,inChar); }
667
# define eataCP_setFlags(this,inChar) ((eataCP_S __FAR__ *)(this))->setFlags(inChar)
668
uCHAR orFlags(uCHAR inChar) { return orU1(this,0,inChar); }
669
# define eataCP_orFlags(this,inChar) ((eataCP_S __FAR__ *)(this))->orFlags(inChar)
670
uCHAR andFlags(uCHAR inChar) { return andU1(this,0,inChar); }
671
# define eataCP_andFlags(this,inChar) ((eataCP_S __FAR__ *)(this))->andFlags(inChar)
673
uCHAR getReqSenseLen() { return getU1(this,1); }
674
# define eataCP_getReqSenseLen(this) ((eataCP_S __FAR__ *)(this))->getReqSenseLen()
675
uCHAR setReqSenseLen(uCHAR inChar) { return setU1(this,1,inChar); }
676
# define eataCP_setReqSenseLen(this,inChar) ((eataCP_S __FAR__ *)(this))->setReqSenseLen(inChar)
678
uCHAR getExtendedId() { return getU1(this,2); }
679
# define eataCP_getExtendedId(this) ((eataCP_S __FAR__ *)(this))->getExtendedId()
680
uCHAR setExtendedId(uCHAR inChar) { return setU1(this,2,inChar); }
681
# define eataCP_setExtendedId(this,inChar) ((eataCP_S __FAR__ *)(this))->setExtendedId(inChar)
683
uCHAR getNestedFW() { return getU1(this,5); }
684
# define eataCP_getNestedFW(this) ((eataCP_S __FAR__ *)(this))->getNestedFW()
685
uCHAR setNestedFW(uCHAR inChar) { return setU1(this,5,inChar); }
686
# define eataCP_setNestedFW(this,inChar) ((eataCP_S __FAR__ *)(this))->setNestedFW(inChar)
687
uCHAR orNestedFW(uCHAR inChar) { return orU1(this,5,inChar); }
688
# define eataCP_orNestedFW(this,inChar) ((eataCP_S __FAR__ *)(this))->orNestedFW(inChar)
689
uCHAR andNestedFW(uCHAR inChar) { return andU1(this,5,inChar); }
690
# define eataCP_andNestedFW(this,inChar) ((eataCP_S __FAR__ *)(this))->andNestedFW(inChar)
692
uCHAR getPhysical() { return getU1(this,6); }
693
# define eataCP_getPhysical(this) ((eataCP_S __FAR__ *)(this))->getPhysical()
694
uCHAR setPhysical(uCHAR inChar) { return setU1(this,6,inChar); }
695
# define eataCP_setPhysical(this,inChar) ((eataCP_S __FAR__ *)(this))->setPhysical(inChar)
696
uCHAR orPhysical(uCHAR inChar) { return orU1(this,6,inChar); }
697
# define eataCP_orPhysical(this,inChar) ((eataCP_S __FAR__ *)(this))->orPhysical(inChar)
698
uCHAR andPhysical(uCHAR inChar) { return andU1(this,6,inChar); }
699
# define eataCP_andPhysical(this,inChar) ((eataCP_S __FAR__ *)(this))->andPhysical(inChar)
701
uCHAR getDevAddr() { return getU1(this,7); }
702
# define eataCP_getDevAddr(this) ((eataCP_S __FAR__ *)(this))->getDevAddr()
703
uCHAR setDevAddr(uCHAR inChar) { return setU1(this,7,inChar); }
704
# define eataCP_setDevAddr(this,inChar) ((eataCP_S __FAR__ *)(this))->setDevAddr(inChar)
705
uCHAR orDevAddr(uCHAR inChar) { return orU1(this,7,inChar); }
706
# define eataCP_orDevAddr(this,inChar) ((eataCP_S __FAR__ *)(this))->orDevAddr(inChar)
707
uCHAR andDevAddr(uCHAR inChar) { return andU1(this,7,inChar); }
708
# define eataCP_andDevAddr(this,inChar) ((eataCP_S __FAR__ *)(this))->andDevAddr(inChar)
710
uCHAR getMessage() { return getU1(this,8); }
711
# define eataCP_getMessage(this) ((eataCP_S __FAR__ *)(this))->getMessage()
712
uCHAR setMessage(uCHAR inChar) { return setU1(this,8,inChar); }
713
# define eataCP_setMessage(this,inChar) ((eataCP_S __FAR__ *)(this))->setMessage(inChar)
714
uCHAR orMessage(uCHAR inChar) { return orU1(this,8,inChar); }
715
# define eataCP_orMessage(this,inChar) ((eataCP_S __FAR__ *)(this))->orMessage(inChar)
716
uCHAR andMessage(uCHAR inChar) { return andU1(this,8,inChar); }
717
# define eataCP_andMessage(this,inChar) ((eataCP_S __FAR__ *)(this))->andMessage(inChar)
719
uCHAR __FAR__ * getCDB() { return getUP1(this,12); }
720
# define eataCP_getCDB(this) ((eataCP_S __FAR__ *)(this))->getCDB()
722
uLONG getDataLength() { return getU4(this,24); }
723
# define eataCP_getDataLength(this) ((eataCP_S __FAR__ *)(this))->getDataLength()
724
uLONG setDataLength(uLONG inLong) { return setU4(this,24,inLong); }
725
# define eataCP_setDataLength(this,inLong) ((eataCP_S __FAR__ *)(this))->setDataLength(inLong)
726
uLONG __FAR__ * getDataLengthPtr() { return getUP4(this,24); }
727
# define eataCP_getDataLengthPtr(this) ((eataCP_S __FAR__ *)(this))->getDataLengthPtr()
729
uLONG getVCPaddr() { return *((uLONG __FAR__ *)getUP1(this,28)); }
730
# define eataCP_getVCPaddr(this) ((eataCP_S __FAR__ *)(this))->getVCPaddr()
731
uLONG setVCPaddr(uLONG inLong) { return *((uLONG __FAR__ *)getUP1(this,28)) = inLong; }
732
# define eataCP_setVCPaddr(this,inLong) ((eataCP_S __FAR__ *)(this))->setVCPaddr(inLong)
734
uLONG getDataAddr() { return getU4(this,32); }
735
# define eataCP_getDataAddr(this) osdVirt(this->getDataAddr())
736
uLONG setDataAddr(uLONG inLong) { return setU4(this,32,inLong); }
737
# define eataCP_setDataAddr(this,inLong) ((eataCP_S __FAR__ *)(this))->setDataAddr(osdPhys(inLong))
738
uLONG __FAR__ * getDataAddrPtr() { return getUP4(this,32); }
739
# define eataCP_getDataAddrPtr(this) ((eataCP_S __FAR__ *)(this))->getDataAddrPtr()
741
uLONG getSpAddr() { return getU4(this,36); }
742
# define eataCP_getSpAddr(this) osdVirt(this->getSpAddr())
743
uLONG setSpAddr(uLONG inLong) { return setU4(this,36,inLong); }
744
# define eataCP_setSpAddr(this,inLong) ((eataCP_S __FAR__ *)(this))->setSpAddr(osdPhys(inLong))
745
uLONG __FAR__ * getSpAddrPtr() { return getUP4(this,36); }
746
# define eataCP_getSpAddrPtr(this) ((eataCP_S __FAR__ *)(this))->getSpAddrPtr()
748
uLONG getReqSenseAddr() { return getU4(this,40); }
749
# define eataCP_getReqSenseAddr(this) osdVirt(this->getReqSenseAddr())
750
uLONG setReqSenseAddr(uLONG inLong) { return setU4(this,40,inLong); }
751
# define eataCP_setReqSenseAddr(this,inLong) ((eataCP_S __FAR__ *)(this))->setReqSenseAddr(osdPhys(inLong))
752
uLONG __FAR__ * getReqSenseAddrPtr() { return getUP4(this,40); }
753
# define eataCP_getReqSenseAddrPtr(this) ((eataCP_S __FAR__ *)(this))->getReqSenseAddrPtr()
755
//---------------------------
756
// Required Support Functions
757
//---------------------------
759
static uLONG size() { return STRUCT_SIZE; }
760
void clear() { memset(this,0,STRUCT_SIZE); }
761
# define eataRdConfig_clear(this) ((eataCP_S __FAR__ *)(this))->clear()
762
STRUCT_NAME __FAR__ * next() { return ((STRUCT_NAME __FAR__ *)(((uCHAR __FAR__ *)this)+STRUCT_SIZE)); }
763
STRUCT_NAME __FAR__ * prev() { return ((STRUCT_NAME __FAR__ *)(((uCHAR __FAR__ *)this)+STRUCT_SIZE)); }
765
#ifndef _DPT_BIG_ENDIAN
770
// #elif (defined(_DPT_ACTIVE_ALIGNMENT))
777
#define eataCP_getFlags(x) getU1(x,0)
778
#define eataCP_setFlags(x,y) setU1(x,0,y)
779
#define eataCP_orFlags(x,y) orU1(x,0,y)
780
#define eataCP_andFlags(x,y) andU1(x,0,y)
782
#define eataCP_getReqSenseLen(x) getU1(x,1)
783
#define eataCP_setReqSenseLen(x,y) setU1(x,1,y)
785
#define eataCP_getExtendedId(x) getU1(x,2)
786
#define eataCP_setExtendedId(x,y) setU1(x,2,y)
788
#define eataCP_getNestedFW(x) getU1(x,5)
789
#define eataCP_setNestedFW(x,y) setU1(x,5,y)
790
#define eataCP_orNestedFW(x,y) orU1(x,5,y)
791
#define eataCP_andNestedFW(x,y) andU1(x,5,y)
793
#define eataCP_getPhysical(x) getU1(x,6)
794
#define eataCP_setPhysical(x,y) setU1(x,6,y)
795
#define eataCP_orPhysical(x,y) orU1(x,6,y)
796
#define eataCP_andPhysical(x,y) andU1(x,6,y)
798
#define eataCP_getDevAddr(x) getU1(x,7)
799
#define eataCP_setDevAddr(x,y) setU1(x,7,y)
800
#define eataCP_orDevAddr(x,y) orU1(x,7,y)
801
#define eataCP_andDevAddr(x,y) andU1(x,7,y)
803
#define eataCP_getMessage(x) getU1(x,8)
804
#define eataCP_setMessage(x,y) setU1(x,8,y)
805
#define eataCP_orMessage(x,y) orU1(x,8,y)
806
#define eataCP_andMessage(x,y) andU1(x,8,y)
808
#define eataCP_getCDB(x) getUP1(x,12)
810
#if (!defined(eataCP_getDataLength))
811
# define eataCP_getDataLength(x) getU4(x,24)
813
#if (!defined(eataCP_setDataLength))
814
# define eataCP_setDataLength(x,y) setU4(x,24,(unsigned long)(y))
816
#define eataCP_getDataLengthPtr(x) getUP4(x,24)
817
#if (!defined(eataCP_getSgLength))
818
# define eataCP_getSgLength(x) eataCP_getDataLength(x)
820
#if (!defined(eataCP_setSgLength))
821
# define eataCP_setSgLength(x,y) eataCP_setDataLength(x,y)
823
#define eataCP_getSgLengthPtr(x) eataCP_getDataLengthPtr(x)
825
#define eataCP_getVCPaddr(x) (*((unsigned long __FAR__ *)getUP1(x,28)))
826
#define eataCP_setVCPaddr(x,y) (*((unsigned long __FAR__ *)getUP1(x,28)) \
827
= (unsigned long)(y))
829
#if (!defined(eataCP_getDataAddr))
830
# if (defined(osdVirt))
831
# define eataCP_getDataAddr(x) osdVirt(getU4(x,32))
833
# define eataCP_getDataAddr(x) getU4(x,32)
836
#if (!defined(eataCP_setDataAddr))
837
# if (defined(osdPhys))
838
# define eataCP_setDataAddr(x,y) setU4(x,32,osdPhys((unsigned long)(y)))
840
# define eataCP_setDataAddr(x,y) setU4(x,32,(unsigned long)(y))
843
#if (!defined(eataCP_setDataAddrPtr))
844
# define eataCP_getDataAddrPtr(x) getUP4(x,32)
846
#if (!defined(eataCP_getSgAddr))
847
# if ((defined(osdPhys) && defined(osdVirt)) || (!defined(osdPhys) && !defined(osdVirt)))
848
# define eataCP_getSgAddr(x) ((eataSG_S __FAR__ *)eataCP_getDataAddr(x))
851
#if (!defined(eataCP_setSgAddr))
852
# define eataCP_setSgAddr(x,y) eataCP_setDataAddr(x,y)
854
#define eataCP_getSgAddrPtr(x) eataCP_getDataAddrPtr(x)
856
#if (!defined(eataCP_getSpAddr))
857
# if (defined(osdVirt))
858
# define eataCP_getSpAddr(x) (eataSP_S __FAR__ *)osdVirt(getU4(x,36))
860
# define eataCP_getSpAddr(x) (eataSP_S __FAR__ *)getU4(x,36)
863
#if (!defined(eataCP_setSpAddr))
864
# if (defined(osdPhys))
865
# define eataCP_setSpAddr(x,y) setU4(x,36,osdPhys((unsigned long)(y)))
867
# define eataCP_setSpAddr(x,y) setU4(x,36,(unsigned long)(y))
870
#define eataCP_getSpAddrPtr(x) getUP4(x,36)
872
#if (!defined(eataCP_getReqSenseAddr))
873
# if (defined(osdVirt))
874
# define eataCP_getReqSenseAddr(x) ((sdRequestSense_S __FAR__ *)osdVirt(getU4(x,40)))
876
# define eataCP_getReqSenseAddr(x) ((sdRequestSense_S __FAR__ *)getU4(x,40))
879
#if (!defined(eataCP_setReqSenseAddr))
880
# if (defined(osdPhys))
881
# define eataCP_setReqSenseAddr(x,y) setU4(x,40,osdPhys((unsigned long)(y)))
883
# define eataCP_setReqSenseAddr(x,y) setU4(x,40,(unsigned long)(y))
886
#define eataCP_getReqSenseAddrPtr(x) getUP4(x,40)
888
#define eataCP_clear(x) osdBzero(x,eataCP_size)
891
//-----------------------------
892
// Else assume static alignment...
893
//-----------------------------
897
uCHAR flags; // Flag byte - see bit definition above
898
// # define eataCP_getFlags(this) ((eataCP_S __FAR__ *)this)->flags
899
// # define eataCP_setFlags(this,inChar) \
900
// ((eataCP_S __FAR__ *)this)->flags = (inChar)
901
// # define eataCP_orFlags(this,inChar) \
902
// ((eataCP_S __FAR__ *)this)->flags |= (inChar)
903
// # define eataCP_andFlags(this,inChar) \
904
// ((eataCP_S __FAR__ *)this)->flags &= (inChar)
906
uCHAR reqSenseLen; // # bytes requested by controller in
907
// response to a check status (reqSense=1).
908
// # define eataCP_getReqSenseLen(this) ((eataCP_S __FAR__ *)this)->reqSenseLen
909
// # define eataCP_setReqSenseLen(this,inChar) \
910
// ((eataCP_S __FAR__ *)this)->reqSenseLen = (inChar)
912
uCHAR extendedId; // Extended ID word (for SCSI IDs > 31)
913
uCHAR unUsed[2]; // Unused
914
uCHAR nestedFW; // Bit 0 = The SCSI cmd should be sent
915
// to a FW drive that may be a component
917
// # define eataCP_getNestedFW(this) ((eataCP_S __FAR__ *)this)->nestedFW
918
// # define eataCP_setNestedFW(this,inChar) \
919
// ((eataCP_S __FAR__ *)this)->nestedFW = (inChar)
920
// # define eataCP_orNestedFW(this,inChar) \
921
// ((eataCP_S __FAR__ *)this)->nestedFW |= (inChar)
922
// # define eataCP_andNestedFW(this,inChar) \
923
// ((eataCP_S __FAR__ *)this)->nestedFW &= (inChar)
925
uCHAR physical; // Bit 0 = The SCSI cmd should be sent
926
// directly to the target physical unit.
927
// (Bypasses all RAID, mirroring...)
928
// # define eataCP_getPhysical(this) ((eataCP_S __FAR__ *)this)->physical
929
// # define eataCP_setPhysical(this,inChar) \
930
// ((eataCP_S __FAR__ *)this)->physical = (inChar)
931
// # define eataCP_orPhysical(this,inChar) \
932
// ((eataCP_S __FAR__ *)this)->physical |= (inChar)
933
// # define eataCP_andPhysical(this,inChar) \
934
// ((eataCP_S __FAR__ *)this)->physical &= (inChar)
936
uCHAR devAddr; // SCSI channel=bits 7-4, SCSI ID=bits 3-0
937
// # define eataCP_getDevAddr(this) ((eataCP_S __FAR__ *)this)->devAddr
938
// # define eataCP_setDevAddr(this,inChar) \
939
// ((eataCP_S __FAR__ *)this)->devAddr = (inChar)
940
// # define eataCP_orDevAddr(this,inChar) \
941
// ((eataCP_S __FAR__ *)this)->devAddr |= (inChar)
942
// # define eataCP_andDevAddr(this,inChar) \
943
// ((eataCP_S __FAR__ *)this)->devAddr &= (inChar)
945
uCHAR message[4]; // SCSI message bytes to be transfered to
946
// the target device (0=NOP)
947
// # define eataCP_getMessage(this) ((eataCP_S __FAR__ *)this)->message
948
// # define eataCP_setMessage(this,inChar) \
949
// ((eataCP_S __FAR__ *)this)->message = (inChar)
950
// # define eataCP_orMessage(this,inChar) \
951
// ((eataCP_S __FAR__ *)this)->message |= (inChar)
952
// # define eataCP_andMessage(this,inChar) \
953
// ((eataCP_S __FAR__ *)this)->message &= (inChar)
955
uCHAR scsiCDB[12]; // SCSI CDB (Command Description Block)
956
// # define eataCP_getCDB(this) ((eataCP_S __FAR__ *)this)->scsiCDB
958
uLONG dataLength; // If,
959
// SG=0, Max. # bytes transfered.
960
// SG=1, Total scatter gather packet
962
// # define eataCP_getDataLength(this) \
963
// getU4(&(((eataCP_S __FAR__ *)this)->dataLength),0)
964
// # define eataCP_setDataLength(this,inLong) \
965
// setU4(&(((eataCP_S __FAR__ *)this)->dataLength),0,inLong)
966
// # define eataCP_setDataLengthPtr(this) \
967
// &(((eataCP_S __FAR__ *)this)->DataLength)
970
uSHORT vCPsegment; // Real Mode segment of virtual CP address
971
uSHORT vCPoffset; // Real Mode offset of virtual CP address
973
uLONG vCPaddr; // Virtual CP Address (returned in SP)
974
// # define eataCP_getVCPaddr(this) ((eataCP_S __FAR__ *)this)->vCPaddr
975
// # define eataCP_setVCPaddr(this,inLong) \
976
// ((eataCP_S __FAR__ *)this)->vCPaddr = (inLong)
979
// Note: dataAddr, SPaddr, & reqSenseAddr = Physical Addresses
980
uLONG dataAddr; // If,
981
// SG=0, Address of data to be read
983
// SG=1, Address of scatter gather table
984
// # define eataCP_getDataAddr(this) \
985
// osdVirt(getU4(&(((eataCP_S __FAR__ *)this)->dataAddr),0))
986
// # define eataCP_setDataAddr(this,inLong) \
987
// setU4(&(((eataCP_S __FAR__ *)this)->dataAddr),0,osdPhys(inLong))
988
// # define eataCP_setDataAddrPtr(this) \
989
// &(((eataCP_S __FAR__ *)this)->dataAddr)
991
uLONG spAddr; // Address of the SP (Status Packet)
992
// The SP EOC bit should be cleared before
993
// issuing a send CP.
994
// # define eataCP_getSpAddr(this) \
995
// osdVirt(getU4(&(((eataCP_S __FAR__ *)this)->spAddr),0))
996
// # define eataCP_setSpAddr(this,inLong) \
997
// setU4(&(((eataCP_S __FAR__ *)this)->spAddr),0,osdPhys(inLong))
998
// # define eataCP_setSpAddrPtr(this) \
999
// &(((eataCP_S __FAR__ *)this)->spAddr)
1001
uLONG reqSenseAddr; // The address of request sense data
1002
// (check req. sense if CP error)
1003
// # define eataCP_getResSenseAddr(this) \
1004
// osdVirt(getU4(&(((eataCP_S __FAR__ *)this)->reqSenseAddr),0))
1005
// # define eataCP_setResSenseAddr(this,inLong) \
1006
// setU4(&(((eataCP_S __FAR__ *)this)->reqSenseAddr),0,osdPhys(inLong))
1007
// # define eataCP_setResSenseAddrPtr(this) \
1008
// &(((eataCP_S __FAR__ *)this)->reqSenseAddr)
1011
// #ifdef __cplusplus
1013
// #elif (!defined(_DPT_ACTIVE_ALIGNMENT))
1020
#define eataCP_getBus(x) (eataCP_getDevAddr(x)>>5)
1021
#define eataCP_setBus(x,y) (eataCP_andDevAddr(x,31), \
1022
eataCP_orDevAddr(x,(y)<<5))
1023
#define eataCP_getTarget(x) (eataCP_getDevAddr(x)&31)
1024
#define eataCP_setTarget(x,y) (eataCP_andDevAddr(x,225), \
1025
eataCP_orDevAddr(x,(y)&31))
1027
#define eataCP_getLun(x) (eataCP_getMessage(x)&7)
1028
#define eataCP_setLun(x,y) (eataCP_andMessage(x,248), \
1029
eataCP_orMessage(x,(y)&7))
1031
#if (!defined(eataCP_getSgLength))
1032
# define eataCP_getSgLength(x) eataCP_getDataLength(x)
1034
#if (!defined(eataCP_getSgLengthPtr))
1035
# define eataCP_getSgLengthPtr(x) eataCP_getDataLengthPtr(x)
1038
#if (!defined(eataCP_getSgAddr))
1039
# if ((defined(osdPhys) && defined(osdVirt)) || (!defined(osdPhys) && !defined(osdVirt)))
1040
# define eataCP_getSgAddr(x) ((eataSG_S __FAR__ *)eataCP_getDataAddr(x))
1043
#if (!defined(eataCP_setSgAddr))
1044
# define eataCP_setSgAddr(x,y) eataCP_setDataAddr(x,y)
1046
#define eataCP_getSgAddrPtr(x) eataCP_getDataAddrPtr(x)
1050
// EATA SP (Status Packet) Structure..................
1053
// Controller status mask - see Status's above
1054
#define SP_STATUS 0x7f
1058
// Controller status values
1059
#define HERR_NO_ERROR 0x00
1060
#define HERR_SEL_TIMEOUT 0x01
1061
#define HERR_CMD_TIMEOUT 0x02
1062
#define HERR_SCSI_RESET 0x03
1063
#define HERR_HBA_POST 0x04
1064
#define HERR_BUS_PHASE 0x05
1065
#define HERR_BUS_FREE 0x06
1066
#define HERR_BUS_PARITY 0x07
1067
#define HERR_BUS_HUNG 0x08
1068
#define HERR_MSG_REJECT 0x09
1069
#define HERR_BUS_RESET_STUCK 0x0a
1070
#define HERR_AUTO_SENSE 0x0b
1071
#define HERR_RAM_PARITY 0x0c
1072
#define HERR_ABORT_NA 0x0d /* CP aborted - NOT on Bus */
1073
#define HERR_ABORTED 0x0e /* CP aborted - WAS on Bus */
1074
#define HERR_RESET_NA 0x0f /* CP was reset - NOT on Bus */
1075
#define HERR_RESET 0x10 /* CP was reset - WAS on Bus */
1076
#define HERR_ECC 0x11 /* HBA Memory ECC Error */
1077
#define HERR_PCI_PARITY 0x12 /* PCI Parity Error */
1078
#define HERR_PCI_MASTER 0x13 /* PCI Master Abort */
1079
#define HERR_PCI_TARGET 0x14 /* PCI Target Abort */
1080
#define HERR_PCI_SIGNAL_TARGET 0x15 /* PCI Signalled Target Abort */
1082
// SCSI status values
1083
#define SERR_GOOD 0x00
1084
#define SERR_CHECK_CONDITION 0x02
1085
#define SERR_CONDITION_MET 0x04
1086
#define SERR_BUSY 0x08
1087
#define SERR_INTERMEDIATE 0x10
1088
#define SERR_INTM_CM 0x14
1089
#define SERR_RESV_CONFLICT 0x18
1090
#define SERR_CMD_TERMINATED 0x22
1091
#define SERR_QUEUE_FULL 0x28
1095
uCHAR ctlrStatus; // Flags byte - see bit definitions above
1096
uCHAR scsiStatus; // SCSI status (equals 0 if endCmd=0)
1097
uCHAR unUsed1; // Unused (should=0)
1098
uCHAR unUsed2; // Unused (should=0)
1099
uLONG residueLen; // # bytes not transfered
1100
#ifdef _DPT_REALMODE
1101
uSHORT vCPsegment; // Real Mode segment of virtual CP address
1102
uSHORT vCPoffset; // Real Mode offset of virtual CP address
1104
uLONG vCPaddr; // Virtual CP Address
1106
uCHAR message[12]; // Indicate the Nexus responding to a
1110
#define eataSP_size 24
1111
// typedef unsigned char eataSP_S[eataSP_size];
1113
#if (!defined(eataSP_getCtlrStatus))
1114
# define eataSP_getCtlrStatus(x) getU1(x,0)
1116
#if (!defined(eataSP_setCtlrStatus))
1117
# define eataSP_setCtlrStatus(x,y) setU1(x,0,y)
1119
#if (!defined(eataSP_orCtlrStatus))
1120
# define eataSP_orCtlrStatus(x,y) orU1(x,0,y)
1122
#if (!defined(eataSP_andCtlrStatus))
1123
# define eataSP_andCtlrStatus(x,y) andU1(x,0,y)
1126
#if (!defined(eataSP_getScsiStatus))
1127
# define eataSP_getScsiStatus(x) getU1(x,1)
1129
#if (!defined(eataSP_setScsiStatus))
1130
# define eataSP_setScsiStatus(x,y) setU1(x,1,y)
1133
#if (!defined(eataSP_getResidue))
1134
# define eataSP_getResidue(x) getU4(x,4)
1136
#if (!defined(eataSP_setResidue))
1137
# define eataSP_setResidue(x,y) setU4(x,4,(unsigned long)(y))
1139
#define eataSP_getResiduePtr(x) getUP4(x,4)
1141
#if (!defined(eataSP_getVCPaddr))
1142
# define eataSP_getVCPaddr(x) (*((unsigned long __FAR__ *)getUP1(x,8)))
1144
#if (!defined(eataSP_setVCPaddr))
1145
# define eataSP_setVCPaddr(x,y) ((*((unsigned long __FAR__ *)getUP1(x,8))) = y)
1148
#if (!defined(eataSP_getMessage))
1149
# define eataSP_getMessage(x) getUP1(x,12)
1152
#if (!defined(eataSP_clear))
1153
# define eataSP_clear(x) osdBzero(x,eataSP_size)
1156
// EATA SG (Scatter Gather) Structure..................
1164
uCHAR __FAR__ * addr_P;
1168
#define eataSG_size 8
1169
// typedef unsigned char eataSG_S[eataSG_size];
1171
#if (!defined(eataSG_getAddr))
1172
# if (defined(osdVirt))
1173
# define eataSG_getAddr(x) osdVirt(getU4(x,0))
1175
# define eataSG_getAddr(x) getU4(x,0)
1178
#if (!defined(eataSG_setAddr))
1179
# if (defined(osdPhys))
1180
# define eataSG_setAddr(x,y) setU4(x,0,osdPhys((unsigned long)(y)))
1182
# define eataSG_setAddr(x,y) setU4(x,0,(unsigned long)(y))
1185
#define eataSG_getAddrPtr(x) getUP4(x,0)
1187
#define eataSG_getLength(x) getU4(x,4)
1188
#define eataSG_setLength(x,y) setU4(x,4,(unsigned long)(y))
1189
#define eataSG_getLengthPtr(x) getUP4(x,4)
1192
* Log Sense page that provides a list of the LSUs installed into the
1193
* specified HBA. This log page is an interpreted 0x36.
1196
#define eataLSU_size 512
1197
typedef unsigned char eataLSU_S[eataLSU_size];
1199
#define eataLSU_getPageCode(x) getU1(x,0)
1200
#define eataLSU_getReserved1(x) getU1(x,1)
1201
#define eataLSU_getPageLength(x) getU2(x,2)
1202
#define eataLSU_getParmCode(x) getU2(x,4)
1203
#define eataLSU_getReserved2(x) getU1(x,6)
1204
#define eataLSU_getSize(x) getU1(x,7)
1205
#define eataLSU_getEataDevAddr(x) ((eataLSUList_S __FAR__ *)getUP1(x,8))
1208
* The LSU data list contained at eataLSU_getEataDevAddr
1210
#define eataLSUList_size 2
1211
typedef unsigned char eataLSUList_S[eataLSUList_size];
1213
#define eataLSUList_getBus(x) (getU1(x,0) & 7)
1214
#define eataLSUList_getHba(x) (getU1(x,0) >> 3)
1215
#define eataLSUList_getLun(x) (getU1(x,1) & 15)
1216
#define eataLSUList_getTarget(x) (getU1(x,1) >> 4)
1219
* A Mode Sense(10) page 0x2A gets you ...
1221
#define PHYS_CHANGE 0x80
1223
#define eataPhysDesc_size 250
1224
typedef unsigned char eataPhysDesc_S[eataPhysDesc_size];
1226
/* The Mode Page header */
1227
#define eataPhysDesc_getDataLength(x) getU2(x,0)
1228
#define eataPhysDesc_setDataLength(x,y) setU2(x,0,y)
1229
#define eataPhysDesc_getMediumType(x) getU1(x,2)
1230
#define eataPhysDesc_getDevice(x) getU1(x,3)
1231
#define eataPhysDesc_getReserved1(x) getU2(x,4)
1232
#define eataPhysDesc_getBlockLength(x) getU2(x,6)
1233
/* The actual Mode Page */
1234
#define eataPhysDesc_getModePage(x) getU1(x,8)
1235
#define eataPhysDesc_getLength(x) getU1(x,9)
1236
/* A status array, [targets][Bus] [16][15] */
1237
#define eataPhysDesc_getStatus(x) getUP1(x,10)
1240
* Then, a Mode sense(10) page 0x3B gets you ...
1243
#define LAP_CMD_ADD 0x80
1244
#define LAP_CMD_DELETE 0x81
1245
#define LAP_CMD_MODIFY 0x82
1246
#define LAP_CMD_REPLACE 0x83
1247
#define LAP_CMD_ABORT 0x84
1248
#define LAP_CMD_BUILD 0x88
1249
#define LAP_CMD_REBUILD 0x89
1250
#define LAP_CMD_VERIFY 0x8a
1251
#define LAP_CMD_VERIFY_FIX 0x8b
1252
#define LAP_CMD_VERIFY_ABORT 0x8c
1254
#define eataLSUDesc_size 512
1255
typedef unsigned char eataLSUDesc_S[eataLSUDesc_size];
1257
/* The Mode Page header */
1258
#define eataLSUDesc_getDataLength(x) getU2(x,0)
1259
#define eataLSUDesc_setDataLength(x,y) setU2(x,0,y)
1260
#define eataLSUDesc_getMediumType(x) getU1(x,2)
1261
#define eataLSUDesc_getDevice(x) getU1(x,3)
1262
#define eataLSUDesc_getReserved1(x) getU2(x,4)
1263
#define eataLSUDesc_getBlockLength(x) getU2(x,6)
1264
/* The actual Mode Page */
1265
#define eataLSUDesc_getModePage(x) getU1(x,8)
1266
#define eataLSUDesc_getLength(x) getU1(x,9)
1267
#define eataLSUDesc_getActionStatus(x) getU1(x,10)
1268
#define eataLSUDesc_setActionStatus(x,y) setU1(x,10,y)
1269
#define eataLSUDesc_getRAIDLevel(x) getU1(x,11)
1270
#define eataLSUDesc_getLsuType(x) getU1(x,12)
1271
#define eataLSUDesc_getLsuBytesPerBlock(x) getU4(x,13)
1272
#define eataLSUDesc_getCompBytesPerBlock(x) getU2(x,17)
1273
#define eataLSUDesc_getLsuCapacity(x) getU4(x,19)
1274
#define eataLSUDesc_getStartOffset(x) getU4(x,23) /* Verify Error Block */
1275
#define eataLSUDesc_getReserved2(x) getUP1(x,27)
1276
#define eataLSUDesc_getLsuStripeSize(x) getU1(x,31)
1277
#define eataLSUDesc_getCopyDir(x) getU1(x,32)
1278
#define eataLSUDesc_getFlags(x) getU1(x,33)
1279
#define eataLSUDesc_getReconBlock(x) getU4(x,34)
1280
#define eataLSUDesc_getReconFrequency(x) getU1(x,38)
1281
#define eataLSUDesc_getReconAmount(x) getU2(x,39)
1282
#define eataLSUDesc_getLunNumber(x) getU1(x,41)
1283
#define eataLSUDesc_getHbaIndex(x) getU1(x,42)
1284
#define eataLSUDesc_getSpinDown(x) getU1(x,43)
1285
#define eataLSUDesc_getCompList(x) ((eataLSUCompList_S*)(getUP1(x,44)))
1287
* And the component list looks like:
1290
#define eataLSUCompList_size 6
1291
typedef unsigned char eataLSUCompList_S[eataLSUCompList_size];
1293
#define eataLSUCompList_getBus(x) eataLSUList_getBus(x)
1294
#define eataLSUCompList_getHba(x) eataLSUList_getHba(x)
1295
#define eataLSUCompList_getLun(x) eataLSUList_getLun(x)
1296
#define eataLSUCompList_getTarget(x) eataLSUList_getTarget(x)
1297
#define eataLSUCompList_getStripe(x) getU4(x,2)
1300
#if defined (_DPT_AIX)
1301
#pragma options align=reset
1302
#elif defined (UNPACK_FOUR)