win-pvdrivers

view xenscsi/scsiport.c @ 283:3c65d6c6453f

Fixed a sense problem with xenscsi. scsi passthrough now working properly.
author James Harper <james.harper@bendigoit.com.au>
date Tue May 27 22:46:06 2008 +1000 (2008-05-27)
parents
children a55d72ac422f
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2007 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #include "xenscsi.h"
21 #include <scsi.h>
22 #include <ntddscsi.h>
23 #include <ntdddisk.h>
24 #include <stdlib.h>
25 #include <xen_public.h>
26 #include <io/xenbus.h>
27 #include <io/protocols.h>
29 #pragma warning(disable: 4127)
31 static vscsiif_shadow_t *
32 get_shadow_from_freelist(PXENSCSI_DEVICE_DATA xsdd)
33 {
34 if (xsdd->shadow_free == 0)
35 {
36 KdPrint((__DRIVER_NAME " No more shadow entries\n"));
37 return NULL;
38 }
39 xsdd->shadow_free--;
40 return &xsdd->shadows[xsdd->shadow_free_list[xsdd->shadow_free]];
41 }
43 static VOID
44 put_shadow_on_freelist(PXENSCSI_DEVICE_DATA xsdd, vscsiif_shadow_t *shadow)
45 {
46 xsdd->shadow_free_list[xsdd->shadow_free] = (USHORT)shadow->req.rqid;
47 shadow->Srb = NULL;
48 xsdd->shadow_free++;
49 }
51 static grant_ref_t
52 get_grant_from_freelist(PXENSCSI_DEVICE_DATA xsdd)
53 {
54 if (xsdd->grant_free == 0)
55 {
56 KdPrint((__DRIVER_NAME " No more grant refs\n"));
57 return (grant_ref_t)0x0FFFFFFF;
58 }
59 xsdd->grant_free--;
60 return xsdd->grant_free_list[xsdd->grant_free];
61 }
63 static VOID
64 put_grant_on_freelist(PXENSCSI_DEVICE_DATA xsdd, grant_ref_t grant)
65 {
66 xsdd->grant_free_list[xsdd->grant_free] = grant;
67 xsdd->grant_free++;
68 }
70 static BOOLEAN
71 XenScsi_HwScsiInterrupt(PVOID DeviceExtension)
72 {
73 PXENSCSI_DEVICE_DATA xsdd = (PXENSCSI_DEVICE_DATA)DeviceExtension;
74 PSCSI_REQUEST_BLOCK Srb;
75 RING_IDX i, rp;
76 int j;
77 vscsiif_response_t *rep;
78 int more_to_do = TRUE;
79 vscsiif_shadow_t *shadow;
80 ULONG remaining;
82 //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
84 while (more_to_do)
85 {
86 rp = xsdd->ring.sring->rsp_prod;
87 KeMemoryBarrier();
88 for (i = xsdd->ring.rsp_cons; i != rp; i++)
89 {
90 rep = RING_GET_RESPONSE(&xsdd->ring, i);
91 shadow = &xsdd->shadows[rep->rqid];
92 KdPrint((__DRIVER_NAME " Operation complete - result = 0x%08x\n", rep->rslt));
93 Srb = shadow->Srb;
94 Srb->ScsiStatus = (UCHAR)rep->rslt;
95 if (rep->sense_len > 0 && Srb->SenseInfoBuffer != NULL)
96 {
97 memcpy(Srb->SenseInfoBuffer, rep->sense_buffer, min(Srb->SenseInfoBufferLength, rep->sense_len));
98 }
99 if (!rep->rslt)
100 {
101 Srb->SrbStatus = SRB_STATUS_SUCCESS;
102 }
103 else
104 {
105 KdPrint((__DRIVER_NAME " Xen Operation returned error (result = 0x%08x)\n", rep->rslt));
106 Srb->SrbStatus = SRB_STATUS_ERROR;
107 if (rep->sense_len > 0 && !(Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) && Srb->SenseInfoBuffer != NULL)
108 {
109 Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
110 }
111 }
112 remaining = Srb->DataTransferLength;
113 for (j = 0; remaining != 0; j++)
114 {
115 xsdd->vectors.GntTbl_EndAccess(xsdd->vectors.context, shadow->req.seg[j].gref, TRUE);
116 put_grant_on_freelist(xsdd, shadow->req.seg[j].gref);
117 shadow->req.seg[j].gref = 0;
118 remaining -= shadow->req.seg[j].length;
119 }
120 put_shadow_on_freelist(xsdd, shadow);
121 ScsiPortNotification(RequestComplete, xsdd, Srb);
122 ScsiPortNotification(NextRequest, xsdd);
123 }
125 xsdd->ring.rsp_cons = i;
126 if (i != xsdd->ring.req_prod_pvt)
127 {
128 RING_FINAL_CHECK_FOR_RESPONSES(&xsdd->ring, more_to_do);
129 }
130 else
131 {
132 xsdd->ring.sring->rsp_event = i + 1;
133 more_to_do = FALSE;
134 }
135 }
137 //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
139 return FALSE; /* we just don't know... */
140 }
142 static VOID
143 XenScsi_ParseBackendDevice(PXENSCSI_DEVICE_DATA xsdd, PCHAR value)
144 {
145 int i = 0;
146 int j = 0;
147 BOOLEAN scanning = TRUE;
149 while (scanning)
150 {
151 if (value[i] == 0)
152 scanning = FALSE;
153 if (value[i] == ':' || value[i] == 0)
154 {
155 value[i] = 0;
156 xsdd->host = xsdd->channel;
157 xsdd->channel = xsdd->id;
158 xsdd->id = xsdd->lun;
159 xsdd->lun = atoi(&value[j]);
160 j = i + 1;
161 }
162 i++;
163 }
164 KdPrint((__DRIVER_NAME " host = %d, channel = %d, id = %d, lun = %d\n",
165 xsdd->host, xsdd->channel, xsdd->id, xsdd->lun));
166 }
168 static ULONG
169 XenScsi_HwScsiFindAdapter(PVOID DeviceExtension, PVOID HwContext, PVOID BusInformation, PCHAR ArgumentString, PPORT_CONFIGURATION_INFORMATION ConfigInfo, PBOOLEAN Again)
170 {
171 ULONG i;
172 // PACCESS_RANGE AccessRange;
173 PXENSCSI_DEVICE_DATA xsdd = (PXENSCSI_DEVICE_DATA)DeviceExtension;
174 // ULONG status;
175 // PXENPCI_XEN_DEVICE_DATA XenDeviceData;
176 PACCESS_RANGE access_range;
177 PUCHAR ptr;
178 USHORT type;
179 PCHAR setting, value;
180 vscsiif_sring_t *sring;
182 UNREFERENCED_PARAMETER(HwContext);
183 UNREFERENCED_PARAMETER(BusInformation);
184 UNREFERENCED_PARAMETER(ArgumentString);
186 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
187 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
189 *Again = FALSE;
191 KdPrint((__DRIVER_NAME " BusInterruptLevel = %d\n", ConfigInfo->BusInterruptLevel));
192 KdPrint((__DRIVER_NAME " BusInterruptVector = %03x\n", ConfigInfo->BusInterruptVector));
194 if (ConfigInfo->NumberOfAccessRanges != 1)
195 {
196 KdPrint((__DRIVER_NAME " NumberOfAccessRanges = %d\n", ConfigInfo->NumberOfAccessRanges));
197 return SP_RETURN_BAD_CONFIG;
198 }
200 access_range = &((*(ConfigInfo->AccessRanges))[0]);
202 KdPrint((__DRIVER_NAME " RangeStart = %08x, RangeLength = %08x\n",
203 access_range->RangeStart.LowPart, access_range->RangeLength));
205 ptr = ScsiPortGetDeviceBase(
206 DeviceExtension,
207 ConfigInfo->AdapterInterfaceType,
208 ConfigInfo->SystemIoBusNumber,
209 access_range->RangeStart,
210 access_range->RangeLength,
211 !access_range->RangeInMemory);
212 //ptr = MmMapIoSpace(access_range->RangeStart, access_range->RangeLength, MmCached);
213 if (ptr == NULL)
214 {
215 KdPrint((__DRIVER_NAME " Unable to map range\n"));
216 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
217 return SP_RETURN_BAD_CONFIG;
218 }
220 sring = NULL;
221 xsdd->event_channel = 0;
222 while((type = GET_XEN_INIT_RSP(&ptr, &setting, &value)) != XEN_INIT_TYPE_END)
223 {
224 switch(type)
225 {
226 case XEN_INIT_TYPE_RING: /* frontend ring */
227 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_RING - %s = %p\n", setting, value));
228 if (strcmp(setting, "ring-ref") == 0)
229 {
230 sring = (vscsiif_sring_t *)value;
231 FRONT_RING_INIT(&xsdd->ring, sring, PAGE_SIZE);
232 }
233 break;
234 case XEN_INIT_TYPE_EVENT_CHANNEL: /* frontend event channel */
235 case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ: /* frontend event channel */
236 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_EVENT_CHANNEL - %s = %d\n", setting, PtrToUlong(value)));
237 if (strcmp(setting, "event-channel") == 0)
238 {
239 xsdd->event_channel = PtrToUlong(value);
240 }
241 break;
242 case XEN_INIT_TYPE_READ_STRING_BACK:
243 case XEN_INIT_TYPE_READ_STRING_FRONT:
244 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
245 if (strcmp(setting, "b-dev") == 0)
246 {
247 XenScsi_ParseBackendDevice(xsdd, value);
248 }
249 break;
250 case XEN_INIT_TYPE_VECTORS:
251 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_VECTORS\n"));
252 if (((PXENPCI_VECTORS)value)->length != sizeof(XENPCI_VECTORS) ||
253 ((PXENPCI_VECTORS)value)->magic != XEN_DATA_MAGIC)
254 {
255 KdPrint((__DRIVER_NAME " vectors mismatch (magic = %08x, length = %d)\n",
256 ((PXENPCI_VECTORS)value)->magic, ((PXENPCI_VECTORS)value)->length));
257 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
258 return SP_RETURN_BAD_CONFIG;
259 }
260 else
261 memcpy(&xsdd->vectors, value, sizeof(XENPCI_VECTORS));
262 break;
263 case XEN_INIT_TYPE_GRANT_ENTRIES:
264 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(setting)));
265 if (PtrToUlong(setting) != GRANT_ENTRIES)
266 {
267 KdPrint((__DRIVER_NAME " grant entries mismatch\n"));
268 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
269 return SP_RETURN_BAD_CONFIG;
270 }
271 else
272 {
273 memcpy(&xsdd->grant_free_list, value, sizeof(ULONG) * PtrToUlong(setting));
274 xsdd->grant_free = GRANT_ENTRIES;
275 }
276 break;
277 default:
278 KdPrint((__DRIVER_NAME " XEN_INIT_TYPE_%d\n", type));
279 break;
280 }
281 }
282 #if 0
283 if (xsdd->device_type == XENSCSI_DEVICETYPE_UNKNOWN
284 || sring == NULL
285 || xsdd->event_channel == 0)
286 {
287 KdPrint((__DRIVER_NAME " Missing settings\n"));
288 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
289 return SP_RETURN_BAD_CONFIG;
290 }
291 #endif
292 ConfigInfo->MaximumTransferLength = VSCSIIF_SG_TABLESIZE * PAGE_SIZE;
293 ConfigInfo->NumberOfPhysicalBreaks = VSCSIIF_SG_TABLESIZE - 1;
294 ConfigInfo->ScatterGather = TRUE;
295 ConfigInfo->AlignmentMask = 0;
296 ConfigInfo->NumberOfBuses = 1;
297 ConfigInfo->InitiatorBusId[0] = 1;
298 ConfigInfo->MaximumNumberOfLogicalUnits = 1;
299 ConfigInfo->MaximumNumberOfTargets = 2;
300 ConfigInfo->BufferAccessScsiPortControlled = TRUE;
301 if (ConfigInfo->Dma64BitAddresses == SCSI_DMA64_SYSTEM_SUPPORTED)
302 {
303 ConfigInfo->Master = TRUE;
304 ConfigInfo->Dma64BitAddresses = SCSI_DMA64_MINIPORT_SUPPORTED;
305 KdPrint((__DRIVER_NAME " Dma64BitAddresses supported\n"));
306 }
307 else
308 {
309 ConfigInfo->Master = FALSE;
310 KdPrint((__DRIVER_NAME " Dma64BitAddresses not supported\n"));
311 }
313 xsdd->shadow_free = 0;
314 memset(xsdd->shadows, 0, sizeof(vscsiif_shadow_t) * SHADOW_ENTRIES);
315 for (i = 0; i < SHADOW_ENTRIES; i++)
316 {
317 xsdd->shadows[i].req.rqid = (USHORT)i;
318 put_shadow_on_freelist(xsdd, &xsdd->shadows[i]);
319 }
321 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
323 return SP_RETURN_FOUND;
324 }
326 static BOOLEAN
327 XenScsi_HwScsiInitialize(PVOID DeviceExtension)
328 {
329 //PXENSCSI_DEVICE_DATA xsdd = (PXENSCSI_DEVICE_DATA)DeviceExtension;
331 UNREFERENCED_PARAMETER(DeviceExtension);
333 KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
334 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
336 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
338 return TRUE;
339 }
341 static VOID
342 XenScsi_PutSrbOnRing(PXENSCSI_DEVICE_DATA xsdd, PSCSI_REQUEST_BLOCK Srb)
343 {
344 PUCHAR ptr;
345 PHYSICAL_ADDRESS physical_address;
346 PFN_NUMBER pfn;
347 //int i;
348 vscsiif_shadow_t *shadow;
349 int remaining;
351 // KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
353 shadow = get_shadow_from_freelist(xsdd);
354 ASSERT(shadow);
355 shadow->Srb = Srb;
356 shadow->req.cmd = VSCSIIF_CMND_SCSI;
357 memset(shadow->req.cmnd, 0, VSCSIIF_MAX_COMMAND_SIZE);
358 memcpy(shadow->req.cmnd, Srb->Cdb, Srb->CdbLength);
359 shadow->req.cmd_len = Srb->CdbLength;
360 shadow->req.id = (USHORT)xsdd->id;
361 shadow->req.lun = (USHORT)xsdd->lun;
362 shadow->req.channel = (USHORT)xsdd->channel;
363 if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_IN) && (Srb->SrbFlags & SRB_FLAGS_DATA_OUT))
364 {
365 KdPrint((__DRIVER_NAME " Cmd = %02x, Length = %d, DMA_BIDIRECTIONAL\n", Srb->Cdb[0], Srb->DataTransferLength));
366 shadow->req.sc_data_direction = DMA_BIDIRECTIONAL;
367 }
368 else if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_IN))
369 {
370 KdPrint((__DRIVER_NAME " Cmd = %02x, Length = %d, DMA_FROM_DEVICE\n", Srb->Cdb[0], Srb->DataTransferLength));
371 shadow->req.sc_data_direction = DMA_FROM_DEVICE;
372 }
373 else if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_OUT))
374 {
375 KdPrint((__DRIVER_NAME " Cmd = %02x, Length = %d, DMA_TO_DEVICE\n", Srb->Cdb[0], Srb->DataTransferLength));
376 shadow->req.sc_data_direction = DMA_TO_DEVICE;
377 }
378 else
379 {
380 KdPrint((__DRIVER_NAME " Cmd = %02x, Length = %d, DMA_NONE\n", Srb->Cdb[0], Srb->DataTransferLength));
381 shadow->req.sc_data_direction = DMA_NONE;
382 }
383 //shadow->req.use_sg = (UINT8)((Srb->DataTransferLength + PAGE_SIZE - 1) >> PAGE_SHIFT);
384 shadow->req.request_bufflen = Srb->DataTransferLength;
386 remaining = Srb->DataTransferLength;
387 shadow->req.seg[0].offset = 0;
388 shadow->req.seg[0].length = 0;
390 ptr = Srb->DataBuffer;
392 for (shadow->req.use_sg = 0; remaining != 0; shadow->req.use_sg++)
393 {
394 physical_address = MmGetPhysicalAddress(ptr);
395 pfn = (ULONG)(physical_address.QuadPart >> PAGE_SHIFT);
396 shadow->req.seg[shadow->req.use_sg].gref = get_grant_from_freelist(xsdd);
397 ASSERT(shadow->req.seg[shadow->req.use_sg].gref);
398 xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, 0, shadow->req.seg[shadow->req.use_sg].gref);
399 shadow->req.seg[shadow->req.use_sg].offset = (USHORT)(physical_address.LowPart & (PAGE_SIZE - 1));
400 shadow->req.seg[shadow->req.use_sg].length = (USHORT)min(PAGE_SIZE - shadow->req.seg[shadow->req.use_sg].offset, remaining);
401 remaining -= shadow->req.seg[shadow->req.use_sg].length;
402 ptr += shadow->req.seg[shadow->req.use_sg].length;
403 //KdPrint((__DRIVER_NAME " Page = %d, Offset = %d, Length = %d, Remaining = %d\n", shadow->req.use_sg, shadow->req.seg[shadow->req.use_sg].offset, shadow->req.seg[shadow->req.use_sg].length, remaining));
404 }
405 *RING_GET_REQUEST(&xsdd->ring, xsdd->ring.req_prod_pvt) = shadow->req;
406 xsdd->ring.req_prod_pvt++;
408 // KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
409 }
411 static BOOLEAN
412 XenScsi_HwScsiStartIo(PVOID DeviceExtension, PSCSI_REQUEST_BLOCK Srb)
413 {
414 PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
415 int notify;
417 //KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
419 // KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
421 if (Srb->PathId != 0 || Srb->TargetId != 0)
422 {
423 Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
424 ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
425 ScsiPortNotification(NextRequest, DeviceExtension, NULL);
426 KdPrint((__DRIVER_NAME " --- HwScsiStartIo (Out of bounds)\n"));
427 return TRUE;
428 }
430 switch (Srb->Function)
431 {
432 case SRB_FUNCTION_EXECUTE_SCSI:
433 XenScsi_PutSrbOnRing(xsdd, Srb);
434 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xsdd->ring, notify);
435 if (notify)
436 xsdd->vectors.EvtChn_Notify(xsdd->vectors.context, xsdd->event_channel);
437 if (!xsdd->shadow_free)
438 ScsiPortNotification(NextRequest, DeviceExtension);
439 break;
440 case SRB_FUNCTION_IO_CONTROL:
441 KdPrint((__DRIVER_NAME " SRB_FUNCTION_IO_CONTROL\n"));
442 Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
443 ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
444 ScsiPortNotification(NextRequest, DeviceExtension, NULL);
445 break;
446 case SRB_FUNCTION_FLUSH:
447 KdPrint((__DRIVER_NAME " SRB_FUNCTION_FLUSH\n"));
448 Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
449 ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
450 ScsiPortNotification(NextRequest, DeviceExtension, NULL);
451 break;
452 default:
453 KdPrint((__DRIVER_NAME " Unhandled Srb->Function = %08X\n", Srb->Function));
454 Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
455 ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
456 ScsiPortNotification(NextRequest, DeviceExtension, NULL);
457 break;
458 }
460 //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
461 return TRUE;
462 }
464 static BOOLEAN
465 XenScsi_HwScsiResetBus(PVOID DeviceExtension, ULONG PathId)
466 {
467 UNREFERENCED_PARAMETER(DeviceExtension);
468 UNREFERENCED_PARAMETER(PathId);
471 KdPrint((__DRIVER_NAME " --> HwScsiResetBus\n"));
472 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
474 KdPrint((__DRIVER_NAME " <-- HwScsiResetBus\n"));
476 return TRUE;
477 }
479 static BOOLEAN
480 XenScsi_HwScsiAdapterState(PVOID DeviceExtension, PVOID Context, BOOLEAN SaveState)
481 {
482 UNREFERENCED_PARAMETER(DeviceExtension);
483 UNREFERENCED_PARAMETER(Context);
484 UNREFERENCED_PARAMETER(SaveState);
486 KdPrint((__DRIVER_NAME " --> HwScsiAdapterState\n"));
487 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
489 KdPrint((__DRIVER_NAME " <-- HwScsiAdapterState\n"));
491 return TRUE;
492 }
494 static SCSI_ADAPTER_CONTROL_STATUS
495 XenScsi_HwScsiAdapterControl(PVOID DeviceExtension, SCSI_ADAPTER_CONTROL_TYPE ControlType, PVOID Parameters)
496 {
497 SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
498 PSCSI_SUPPORTED_CONTROL_TYPE_LIST SupportedControlTypeList;
499 //KIRQL OldIrql;
501 UNREFERENCED_PARAMETER(DeviceExtension);
503 KdPrint((__DRIVER_NAME " --> HwScsiAdapterControl\n"));
504 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
506 switch (ControlType)
507 {
508 case ScsiQuerySupportedControlTypes:
509 SupportedControlTypeList = (PSCSI_SUPPORTED_CONTROL_TYPE_LIST)Parameters;
510 KdPrint((__DRIVER_NAME " ScsiQuerySupportedControlTypes (Max = %d)\n", SupportedControlTypeList->MaxControlType));
511 SupportedControlTypeList->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;
512 SupportedControlTypeList->SupportedTypeList[ScsiStopAdapter] = TRUE;
513 break;
514 case ScsiStopAdapter:
515 KdPrint((__DRIVER_NAME " ScsiStopAdapter\n"));
516 break;
517 case ScsiRestartAdapter:
518 KdPrint((__DRIVER_NAME " ScsiRestartAdapter\n"));
519 break;
520 case ScsiSetBootConfig:
521 KdPrint((__DRIVER_NAME " ScsiSetBootConfig\n"));
522 break;
523 case ScsiSetRunningConfig:
524 KdPrint((__DRIVER_NAME " ScsiSetRunningConfig\n"));
525 break;
526 default:
527 KdPrint((__DRIVER_NAME " UNKNOWN\n"));
528 break;
529 }
531 KdPrint((__DRIVER_NAME " <-- HwScsiAdapterControl\n"));
533 return Status;
534 }
536 VOID
537 XenScsi_FillInitCallbacks(PHW_INITIALIZATION_DATA HwInitializationData)
538 {
539 KdPrint((__DRIVER_NAME " --> "__FUNCTION__ "\n"));
540 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
542 HwInitializationData->HwInitialize = XenScsi_HwScsiInitialize;
543 HwInitializationData->HwStartIo = XenScsi_HwScsiStartIo;
544 HwInitializationData->HwInterrupt = XenScsi_HwScsiInterrupt;
545 HwInitializationData->HwFindAdapter = XenScsi_HwScsiFindAdapter;
546 HwInitializationData->HwResetBus = XenScsi_HwScsiResetBus;
547 HwInitializationData->HwAdapterState = XenScsi_HwScsiAdapterState;
548 HwInitializationData->HwAdapterControl = XenScsi_HwScsiAdapterControl;
550 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
551 }