|
|
1.1 root 1: /* Copyright (c) 1994 NeXT Computer, Inc. All rights reserved.
2: *
3: * AMD_SCSI.h - top-level API for AMD 53C974/79C974 PCI SCSI driver.
4: *
5: * HISTORY
6: * 21 Oct 94 Doug Mitchell at NeXT
7: * Created.
8: */
9:
10: #import <driverkit/i386/directDevice.h>
11: #import <kernserv/queue.h>
12: #import <driverkit/IODirectDevice.h>
13: #import <driverkit/i386/IOPCIDirectDevice.h>
14: #import <driverkit/i386/driverTypes.h>
15: #import <driverkit/IOSCSIController.h>
16: #import <driverkit/IOPower.h>
17: #import "AMD_Types.h"
18:
19: @interface AMD_SCSI : IOSCSIController <IOPower>
20: {
21: IOEISAPortAddress ioBase; // base IO port addr
22: port_t interruptPortKern;
23:
24: /*
25: * Commands are passed from exported methods to the I/O thread
26: * via commandQ, which is protected by commandLock.
27: *
28: * Commands which are disconnected but not complete are kept
29: * in disconnectQ.
30: *
31: * Commands which have been dequeued from commandQ by the
32: * I/O thread but which have not been started because a
33: * command is currently active on the bus are kept in pendingQ.
34: *
35: * The currently active command, if any, is kept in activeCmd.
36: * Only commandBufs with op == CO_Execute are ever placed in
37: * activeCmd.
38: */
39: queue_head_t disconnectQ;
40: queue_head_t commandQ;
41: id commandLock; // NXLock; protects commandQ
42: queue_head_t pendingQ;
43: commandBuf *activeCmd; // connected command (if any). NULL
44: // implies we're disconnected.
45:
46: /*
47: * Option flags, accessible via instance table or setIntValues
48: * (DEBUG only).
49: */
50: unsigned autoSenseEnable:1,
51: cmdQueueEnable:1,
52: syncModeEnable:1,
53: fastModeEnable:1,
54: extendTiming:1,
55: ioThreadRunning:1,
56: pad:26;
57: unsigned scsiClockRate; // in MHz
58:
59: /*
60: * Array of active I/Os counters, one counter per lun per target.
61: * If command queueing is disabled, the max value of each counter
62: * is 1. ActiveCount is the sum of all elements in activeArray.
63: */
64: unsigned char activeArray[SCSI_NTARGETS][SCSI_NLUNS];
65: unsigned activeCount;
66:
67: /*
68: * Hardware related variables used (mostly) in AMD_Chip.m.
69: */
70: unsigned char saveStatus; // saved status on interrupt
71: unsigned char saveSeqStep; // saved seqstep
72: unsigned char saveIntrStatus; // saved interrupt status
73: unsigned char hostId; // our SCSI ID
74: scState_t scState; // SCS_DISCONNECTED, etc.
75: unsigned char reselTarget; // target attempting to reselect
76: unsigned char reselLun; // lun "" ""
77:
78: /*
79: * commandBuf->queueTag for next I/O. This is never zero; for
80: * metjhod calls involving a T/L/Q nexus, a queue tag of zero
81: * indicates a nontagges command.
82: */
83: unsigned char nextQueueTag;
84:
85: /*
86: * Per-target information.
87: */
88: perTargetData perTarget[SCSI_NTARGETS];
89:
90: /*
91: * Message in/out state machine variables.
92: * Outbound messages are placed in currMsgOut[] after asserting ATN;
93: * when we see phase == PHASE_MSGOUT, these are sent to FIFO.
94: * Inbound messages are placed in currMsgIn[] and are processed
95: * when we leave phase == PHASE_MSGIN.
96: */
97: unsigned char currMsgOut[AMD_MSG_SIZE];
98: unsigned currMsgOutCnt;
99: unsigned char currMsgIn[AMD_MSG_SIZE];
100: unsigned currMsgInCnt;
101: msgOutState_t msgOutState; // MOS_WAITING, etc.
102:
103: SDTR_State_t SDTR_State;
104:
105: unsigned reselPending:1,
106: pad2:31;
107:
108: #ifdef DEBUG
109: /*
110: * Shadows of write-only registers.
111: */
112: unsigned char syncOffsetShadow;
113: unsigned char syncPeriodShadow;
114: #endif DEBUG
115: /*
116: * Statistics support.
117: */
118: unsigned maxQueueLen;
119: unsigned queueLenTotal;
120: unsigned totalCommands;
121:
122: vm_address_t *mdl; // well aligned working ptr
123: vm_address_t *mdlFree; // ptr we have to IOFree()
124: unsigned mdlPhys; // physical address of mdl
125:
126: /*
127: * host bus info.
128: */
129: BusType busType; // only BT_PCI for now
130: BOOL levelIRQ;
131: unsigned char busNumber; // FIXME - do we need these?
132: unsigned char deviceNumber;
133: unsigned char functionNumber;
134:
135: }
136:
137: + (BOOL)probe:deviceDescription;
138: - free;
139: - (sc_status_t) executeRequest : (IOSCSIRequest *)scsiReq
140: buffer : (void *)buffer
141: client : (vm_task_t)client;
142: - (sc_status_t)resetSCSIBus;
143: - (void)resetStats;
144: - (unsigned)numQueueSamples;
145: - (unsigned)sumQueueLengths;
146: - (unsigned) maxQueueLength;
147: - (void)interruptOccurred;
148: - (void)timeoutOccurred;
149:
150: #if AMD_ENABLE_GET_SET
151:
152: - (IOReturn)setIntValues : (unsigned *)parameterArray
153: forParameter : (IOParameterName)parameterName
154: count : (unsigned)count;
155: - (IOReturn)getIntValues : (unsigned *)parameterArray
156: forParameter : (IOParameterName)parameterName
157: count : (unsigned *)count; // in/out
158: /*
159: * setIntValues parameters.
160: */
161: #define AMD_AUTOSENSE "AutoSense"
162: #define AMD_CMD_QUEUE "CmdQueue"
163: #define AMD_SYNC "Sync"
164: #define AMD_FAST_SCSI "FastSCSI"
165: #define AMD_RESET_TARGETS "ResetTargets"
166:
167: #endif AMD_ENABLE_GET_SET
168:
169: @end
170:
171:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.