|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /**
26: * Copyright (c) 1994-1996 NeXT Software, Inc. All rights reserved.
27: * Copyright 1997 Apple Computer Inc. All Rights Reserved.
28: * @author Martin Minow mailto:[email protected]
29: * @revision 1997.02.13 Initial conversion from AMDPCSCSIDriver sources.
30: *
31: * Private structures and definitions for Apple 53C96 SCSI driver.
32: * Apple96SCSI is closely based on Doug Mitchell's AMD 53C974/79C974 driver.
33: *
34: * Edit History
35: * 1997.02.13 MM Initial conversion from AMDPCSCSIDriver sources.
36: */
37:
38: #import "Apple96SCSI.h"
39:
40: @interface Apple96_SCSI(Private)
41:
42: /*
43: * Send a command to the controller thread, and wait for its completion.
44: * Only invoked by publicly exported methods in SCSIController.m.
45: */
46: - (IOReturn) executeCmdBuf
47: : (CommandBuffer *) cmdBuf;
48:
49: /*
50: * Abort all active and disconnected commands with specified status. No
51: * hardware action. Used by threadResetBus and during processing
52: * of a kCommandAbortRequest command.
53: */
54: - (void) abortAllCommands : (sc_status_t) status;
55:
56: /*
57: * I/O thread version of resetSCSIBus and executeRequest.
58: */
59: - (void) threadResetBus
60: : (const char *) reason;
61:
62:
63: - (void) threadExecuteRequest
64: : (CommandBuffer *) cmdBuf;
65:
66: /*
67: * Methods called by other modules in this driver.
68: */
69:
70: /*
71: * Called when a transaction associated with cmdBuf is complete. Notify
72: * waiting thread. If cmdBuf->scsiReq exists (i.e., this is not a reset
73: * or an abort), scsiReq->driverStatus must be valid. If cmdBuf is activeCmd,
74: * caller must remove from activeCmd.
75: *
76: * If the request status is SR_IOST_INVALID (the initial value), it will
77: * be set to finalStatus.
78: */
79: - (void) ioComplete
80: : (CommandBuffer *) cmdBuf
81: finalStatus : (sc_status_t) finalStatus;
82:
83: /**
84: * A target reported a full queue. Push this command back on the pending
85: * queue and try it again, later. (Return SR_IOST_GOOD if successful,
86: * SR_IOST_BADST on failure.
87: */
88: - (sc_status_t) pushbackFullTargetQueue
89: : (CommandBuffer *) cmdBuf;
90:
91: /**
92: * A command couldn't be issued (because a target is trying to reselect
93: * us or we lost arbitration for some other reason). Push this request
94: * onto the front of the pending request queue.
95: */
96: - (void) pushbackCurrentRequest
97: : (CommandBuffer *) cmdBuf;
98:
99: /**
100: * A command can't be continued. Perhaps there is no target.
101: */
102: // - (void) killCurrentRequest;
103:
104: /*
105: * I/O associated with activeCmd has disconnected. Place it on disconnectQ
106: * and enable another transaction.
107: */
108: - (void) disconnect;
109:
110: /*
111: * The current target,lun is trying to reselect. If we have a CommandBuffer
112: * for this TL nexus and it is not tagged, remove it, make it the current
113: * gActiveCommand, and return IO_R_SUCCESS. If the first disconnected
114: * command is tagged, we need to read the queue tag message, return
115: * IO_R_INTERNAL to signal this (it is not an error). If there is no
116: * disconnected command, return IO_R_HW to initiate error recovery.
117: */
118: - (IOReturn) reselectNexusWithoutTag;
119:
120: /*
121: * The current target, lun, and specified queueTag is trying to reselect.
122: * If we have a CommandBuffer for this TLQ nexus on disconnectQ, remove it,
123: * make it the current activeCmd, and return IO_R_SUCCESS. Else return IO_R_HW.
124: */
125: - (IOReturn) reselectNexusWithTag
126: : (unsigned char) queueTag;
127:
128: /*
129: * Determine if gActiveArray[][], maxQueue[][], cmdQueueEnable, and a
130: * command's target and lun show that it's OK to start processing cmdBuf.
131: * Returns YES if the command can be started.
132: */
133: - (Boolean) commandCanBeStarted
134: : (CommandBuffer *) cmdBuf;
135:
136: /*
137: * The bus has gone free. Start up commands in pendingQ, if any.
138: */
139: - (void) busFree;
140:
141: /**
142: * Choose the next request that can be started.
143: */
144: - (CommandBuffer *) selectNextRequest;
145:
146: /*
147: * Abort activeCmd (if any) and any disconnected I/Os (if any) and reset
148: * the bus due to gross hardware failure.
149: * If activeCmd is valid, its scsiReq->driverStatus will be set to 'status'.
150: */
151: - (void) killActiveCommandAndResetBus
152: : (sc_status_t) status
153: reason : (const char *) reason;
154:
155: - (void) killActiveCommand
156: : (sc_status_t) status;
157: /*
158: * Called by chip level to indicate that a command has gone out to the
159: * hardware.
160: */
161: - (void) activateCommand
162: : (CommandBuffer *) cmdBuf;
163:
164: /*
165: * Remove the current command from "active" status. Update activeArray,
166: * activeCount, and unschedule pending timer.
167: */
168: - (void) deactivateCmd;
169:
170: /**
171: * Kill everything in the indicated queue. Called after bus reset.
172: */
173: - (void) killQueue : (queue_head_t *) queuePtr
174: finalStatus : (sc_status_t) scsiStatus;
175:
176:
177: @end
178:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.