07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

155 * "is this a new device" checks in their queuecommand routine,<br />

156 * thereby making the hot path a bit quicker.<br />

157 *<br />

158 * Return values: 0 on success, non-0 on failure<br />

159 *<br />

160 * Deallocation: If we didn't find any devices at this ID, you will<br />

161 * get an immediate call to slave_destroy(). If we find something<br />

162 * here then you will get a call to slave_configure(), then the<br />

163 * device will be used for however long it is kept around, then when<br />

164 * the device is removed from the system (or * possibly at reboot<br />

165 * time), you will then get a call to slave_destroy(). This is<br />

166 * assuming you implement slave_configure and slave_destroy.<br />

167 * However, if you allocate memory and hang it <strong>of</strong>f the device struct,<br />

168 * then you must implement the slave_destroy() routine at a minimum<br />

169 * in order to avoid leaking memory<br />

170 * each time a device is tore down.<br />

171 *<br />

172 * Status: OPTIONAL<br />

173 */<br />

174 int (* slave_alloc)(struct scsi_device *);<br />

175<br />

176 /*<br />

177 * Once the device has responded to an INQUIRY and we know the<br />

178 * device is online, we call into the low level driver with the<br />

179 * struct scsi_device *. If the low level device driver implements<br />

180 * this function, it *must* perform the task <strong>of</strong> setting the queue<br />

181 * depth on the device. All other tasks are optional and depend<br />

182 * on what the driver supports and various implementation details.<br />

183 *<br />

184 * Things currently recommended to be handled at this time include:<br />

185 *<br />

186 * 1. Setting the device queue depth. Proper setting <strong>of</strong> this is<br />

187 * described in the comments for scsi_adjust_queue_depth.<br />

188 * 2. Determining if the device supports the various synchronous<br />

189 * negotiation protocols. The device struct will already have<br />

190 * responded to INQUIRY and the results <strong>of</strong> the standard items<br />

191 * will have been shoved into the various device flag bits, eg.<br />

192 * device->sdtr will be true if the device supports SDTR messages.<br />

193 * 3. Allocating command structs that the device will need.<br />

194 * 4. Setting the default timeout on this device (if needed).<br />

195 * 5. Anything else the low level driver might want to do on a device<br />

196 * specific setup basis...<br />

98<br />

197 * 6. Return 0 on success, non-0 on error. The device will be marked

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!