|
|
1.1 root 1: /* Copyright (c) 1994 NeXT Computer, Inc. All rights reserved.
2: *
3: * AMD_ChipPrivate.h - private structs and #defines for AMD_Chip category.
4: *
5: * HISTORY
6: * 1 Nov 94 Doug Mitchell at NeXT
7: * Created.
8: */
9:
10: /*
11: * opcode groups
12: */
13: #define SCSI_OPGROUP(opcode) ((opcode) & 0xe0)
14:
15: #define OPGROUP_0 0x00 /* six byte commands */
16: #define OPGROUP_1 0x20 /* ten byte commands */
17: #define OPGROUP_2 0x40 /* ten byte commands */
18: #define OPGROUP_5 0xa0 /* twelve byte commands */
19: #define OPGROUP_6 0xc0 /* six byte, vendor unique commands */
20: #define OPGROUP_7 0xe0 /* ten byte, vendor unique commands */
21:
22: /*
23: * scsi bus phases
24: */
25: #define PHASE_DATAOUT 0x0
26: #define PHASE_DATAIN 0x1
27: #define PHASE_COMMAND 0x2
28: #define PHASE_STATUS 0x3
29: #define PHASE_MSGOUT 0x6
30: #define PHASE_MSGIN 0x7
31:
32: /*
33: * message codes
34: */
35: #define MSG_CMDCMPLT 0x00 /* to host: command complete */
36: #define MSG_EXTENDED 0x01 /* both ways: extended message */
37: #define MSG_SAVEPTRS 0x02 /* to host: save data pointers */
38: #define MSG_RESTOREPTRS 0x03 /* to host: restore pointers */
39: #define MSG_DISCONNECT 0x04 /* to host: disconnect */
40: #define MSG_IDETERR 0x05 /* to disk: initiator detected error */
41: #define MSG_ABORT 0x06 /* to disk: abort op, go to bus free */
42: #define MSG_MSGREJECT 0x07 /* both ways: last msg unimplemented */
43: #define MSG_NOP 0x08 /* to disk: no-op message */
44: #define MSG_MSGPARERR 0x09 /* to disk: parity error last
45: message */
46: #define MSG_LNKCMDCMPLT 0x0a /* to host: linked command complete */
47: #define MSG_LNKCMDCMPLTFLAG 0x0b /* to host: flagged linked cmd cmplt */
48: #define MSG_DEVICERESET 0x0c /* to disk: reset and go to bus free */
49: #define MSG_SIMPLE_QUEUE_TAG 0x20 /* both ways: simple queue tag */
50: #define MSG_HEAD_QUEUE_TAG 0x21 /* to disk: head of queue tag */
51: #define MSG_ORDERED_QUEUE_TAG 0x22 /* to disk: ordered queue tag */
52: #define MSG_IDENTIFYMASK 0x80 /* both ways: thread identification */
53: #define MSG_ID_DISCONN 0x40 /* can disconnect/reconnect */
54: #define MSG_ID_LUNMASK 0x07 /* target LUN */
55:
56: /*
57: * Extended message codes
58: */
59: #define MSG_SDTR 0x01 /* sync data transfer request */
60: #define MSG_SDTR_LENGTH 5 /* total SDTR message length */
61:
62: /*
63: * Delay, in ms, after SCSI reset.
64: */
65: #define AMD_SCSI_RESET_DELAY 10000
66:
67: /*
68: * Private methods, used only by AMD_Chip module.
69: */
70:
71: @interface AMD_SCSI(ChipPrivate)
72:
73: /*
74: * Determine what kind of SCSI interrupt is pending, if any.
75: */
76:
77: typedef enum {
78: SINT_NONE, /* no interrupt */
79: SINT_DEVICE, /* 53C974 */
80: SINT_DMA, /* DMA (not currently used) */
81: SINT_OTHER /* ?? */
82: } sintPending_t;
83:
84: - (sintPending_t)scsiInterruptPending;
85:
86:
87: /*
88: * Methods invoked upon interrupt. One per legal scState.
89: */
90: - (void)fsmDisconnected;
91: - (void)fsmSelecting;
92: - (void)fsmInitiator;
93: - (void)fsmCompleting;
94: - (void)fsmDMAing;
95: - (void)fsmAcceptingMsg;
96: - (void)fsmSendingMsg;
97: - (void)fsmSelecting;
98: - (void)fsmGettingMsg;
99: - (void)fsmSelecting;
100: - (void)fsmSendingCmd;
101:
102: /*
103: * This is is called after an interrupt leaves us as SCS_INITIATOR.
104: */
105: - (void)fsmPhaseChange;
106:
107: - (void)messageOut : (unsigned char)msg;
108:
109: /*
110: * Load syncPeriod, syncOffset for activeCmd per perTarget values.
111: */
112: - (void)targetContext : (unsigned)target;
113:
114: /*
115: * Parse and validate 5-byte SDTR message. If valid, save in perTarget
116: * and in hardware. Returns YES if valid, else NO.
117: *
118: * Specified message buffer could be from either currMsgIn[] or
119: * currMsgOut[].
120: */
121: - (BOOL)parseSDTR : (unsigned char *)sdtrMessage;
122:
123: /*
124: * Cons up an SDTR message appropriate for both our hardware and a possible
125: * target-generated SDTR message. If inboundMsg is NULL, we just use
126: * the parameters we want.
127: */
128: - (void)createSDTR : (unsigned char *)outboundMsg // required
129: inboundMsg : (unsigned char *)inboundMsg;
130:
131: /*
132: * Disable specified mode for activeCmd's target.
133: */
134:
135: typedef enum {
136: AM_CmdQueue,
137: AM_Sync,
138: } AMD_Mode;
139:
140: - (void)disableMode : (AMD_Mode)mode;
141:
142: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.