win-pvdrivers

annotate xenvbd_scsiport/xenvbd.c @ 1032:306c10cdcba1

Added online resize. Untested under storport yet (>= Vista)
author James Harper <james.harper@bendigoit.com.au>
date Sun Mar 03 12:19:31 2013 +1100 (2013-03-03)
parents 0f40ce5cb467
children 9f476ac2fbe1
rev   line source
james@1005 1 /*
james@1005 2 PV Drivers for Windows Xen HVM Domains
james@1005 3 Copyright (C) 2007 James Harper
james@1005 4
james@1005 5 This program is free software; you can redistribute it and/or
james@1005 6 modify it under the terms of the GNU General Public License
james@1005 7 as published by the Free Software Foundation; either version 2
james@1005 8 of the License, or (at your option) any later version.
james@1005 9
james@1005 10 This program is distributed in the hope that it will be useful,
james@1005 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
james@1005 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
james@1005 13 GNU General Public License for more details.
james@1005 14
james@1005 15 You should have received a copy of the GNU General Public License
james@1005 16 along with this program; if not, write to the Free Software
james@1005 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
james@1005 18 */
james@1005 19
james@1005 20 #define INITGUID
james@1005 21
james@1005 22 #include "xenvbd.h"
james@1005 23
james@1005 24 #pragma warning(disable: 4127)
james@1005 25
james@1005 26 /* Not really necessary but keeps PREfast happy */
james@1005 27 DRIVER_INITIALIZE DriverEntry;
james@1005 28 static IO_WORKITEM_ROUTINE XenVbd_DisconnectWorkItem;
james@1005 29
james@1005 30 static VOID XenVbd_ProcessSrbList(PXENVBD_DEVICE_DATA xvdd);
james@1005 31 static BOOLEAN XenVbd_ResetBus(PXENVBD_DEVICE_DATA xvdd, ULONG PathId);
james@1005 32 static VOID XenVbd_CompleteDisconnect(PXENVBD_DEVICE_DATA xvdd);
james@1005 33
james@1005 34 static BOOLEAN dump_mode = FALSE;
james@1005 35 #define DUMP_MODE_ERROR_LIMIT 64
james@1005 36 static ULONG dump_mode_errors = 0;
james@1005 37
james@1005 38 #define StorPortAcquireSpinLock(...) {}
james@1005 39 #define StorPortReleaseSpinLock(...) {}
james@1005 40
james@1014 41 static ULONG
james@1014 42 SxxxPortGetSystemAddress(PVOID device_extension, PSCSI_REQUEST_BLOCK srb, PVOID *system_address) {
james@1014 43 UNREFERENCED_PARAMETER(device_extension);
james@1014 44 *system_address = (PUCHAR)srb->DataBuffer;
james@1014 45 return STATUS_SUCCESS;
james@1014 46 }
james@1014 47
james@1025 48 static PHYSICAL_ADDRESS
james@1025 49 SxxxPortGetPhysicalAddress(PVOID device_extension, PSCSI_REQUEST_BLOCK srb, PVOID virtual_address, ULONG *length) {
james@1025 50 UNREFERENCED_PARAMETER(device_extension);
james@1025 51 UNREFERENCED_PARAMETER(srb);
james@1025 52 UNREFERENCED_PARAMETER(length);
james@1025 53 return MmGetPhysicalAddress(virtual_address);
james@1025 54 }
james@1025 55
james@1008 56 #define SxxxPortNotification(NotificationType, DeviceExtension, ...) XenVbd_Notification##NotificationType(DeviceExtension, __VA_ARGS__)
james@1008 57
james@1014 58 static VOID
james@1008 59 XenVbd_NotificationRequestComplete(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb) {
james@1008 60 PXENVBD_SCSIPORT_DATA xvsd = (PXENVBD_SCSIPORT_DATA)xvdd->xvsd;
james@1008 61 srb_list_entry_t *srb_entry = srb->SrbExtension;
james@1008 62 if (srb_entry->outstanding_requests != 0) {
james@1008 63 FUNCTION_MSG("srb outstanding_requests = %d\n", srb_entry->outstanding_requests);
james@1008 64 }
james@1008 65 xvsd->outstanding--;
james@1008 66 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1008 67 }
james@1008 68
james@1008 69 VOID
james@1008 70 XenVbd_NotificationNextLuRequest(PXENVBD_DEVICE_DATA xvdd, UCHAR PathId, UCHAR TargetId, UCHAR Lun) {
james@1008 71 ScsiPortNotification(NextLuRequest, xvdd->xvsd, PathId, TargetId, Lun);
james@1005 72 }
james@1005 73
james@1032 74 VOID
james@1032 75 XenVbd_NotificationBusChangeDetected(PXENVBD_DEVICE_DATA xvdd, UCHAR PathId) {
james@1032 76 ScsiPortNotification(BusChangeDetected, xvdd->xvsd, PathId);
james@1032 77 }
james@1032 78
james@1005 79 #include "..\xenvbd_common\common_miniport.h"
james@1005 80
james@1008 81
james@1005 82 /* called in non-dump mode */
james@1005 83 static ULONG
james@1008 84 XenVbd_HwScsiFindAdapter(PVOID DeviceExtension, PVOID HwContext, PVOID BusInformation, PCHAR ArgumentString, PPORT_CONFIGURATION_INFORMATION ConfigInfo, PBOOLEAN Again) {
james@1005 85 PXENVBD_SCSIPORT_DATA xvsd = (PXENVBD_SCSIPORT_DATA)DeviceExtension;
james@1005 86 PXENVBD_DEVICE_DATA xvdd;
james@1005 87 PACCESS_RANGE access_range;
james@1005 88
james@1005 89 UNREFERENCED_PARAMETER(HwContext);
james@1005 90 UNREFERENCED_PARAMETER(BusInformation);
james@1005 91 UNREFERENCED_PARAMETER(ArgumentString);
james@1005 92
james@1005 93 FUNCTION_ENTER();
james@1027 94 FUNCTION_MSG("IRQL = %d\n", KeGetCurrentIrql());
james@1027 95 FUNCTION_MSG("xvsd = %p\n", xvsd);
james@1005 96
james@1005 97 if (ConfigInfo->NumberOfAccessRanges != 1) {
james@1005 98 FUNCTION_MSG("NumberOfAccessRanges wrong\n");
james@1005 99 FUNCTION_EXIT();
james@1005 100 return SP_RETURN_BAD_CONFIG;
james@1005 101 }
james@1005 102 if (XnGetVersion() != 1) {
james@1005 103 FUNCTION_MSG("Wrong XnGetVersion\n");
james@1005 104 FUNCTION_EXIT();
james@1005 105 return SP_RETURN_BAD_CONFIG;
james@1005 106 }
james@1027 107 RtlZeroMemory(xvsd, FIELD_OFFSET(XENVBD_SCSIPORT_DATA, aligned_buffer_data));
james@1005 108
james@1005 109 access_range = &((*(ConfigInfo->AccessRanges))[0]);
james@1027 110
james@1027 111 if (!dump_mode) {
james@1027 112 xvdd = (PXENVBD_DEVICE_DATA)(ULONG_PTR)access_range->RangeStart.QuadPart;
james@1027 113 xvsd->xvdd = xvdd;
james@1027 114 xvdd->xvsd = xvsd;
james@1027 115 xvdd->aligned_buffer = (PVOID)((ULONG_PTR)((PUCHAR)xvsd->aligned_buffer_data + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
james@1027 116 } else {
james@1027 117 /* make a copy of xvdd and use that copy */
james@1027 118 xvdd = (PXENVBD_DEVICE_DATA)xvsd->aligned_buffer_data;
james@1027 119 memcpy(xvdd, (PVOID)(ULONG_PTR)access_range->RangeStart.QuadPart, sizeof(XENVBD_DEVICE_DATA));
james@1027 120 /* make sure original xvdd is set to DISCONNECTED or resume will not work */
james@1027 121 ((PXENVBD_DEVICE_DATA)(ULONG_PTR)access_range->RangeStart.QuadPart)->device_state = DEVICE_STATE_DISCONNECTED;
james@1027 122 xvsd->xvdd = xvdd;
james@1027 123 xvdd->xvsd = xvsd;
james@1027 124 xvdd->aligned_buffer = (PVOID)((ULONG_PTR)((PUCHAR)xvsd->aligned_buffer_data + sizeof(XENVBD_DEVICE_DATA) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
james@1027 125 if (xvsd->xvdd->device_state != DEVICE_STATE_ACTIVE) {
james@1027 126 /* if we are not connected to the ring when we start dump mode then there is nothing we can do */
james@1027 127 FUNCTION_MSG("Cannot connect backend in dump mode - state = %d\n", xvsd->xvdd->device_state);
james@1027 128 return SP_RETURN_ERROR;
james@1027 129 }
james@1027 130 }
james@1027 131 FUNCTION_MSG("aligned_buffer_data = %p\n", xvsd->aligned_buffer_data);
james@1027 132 FUNCTION_MSG("aligned_buffer = %p\n", xvdd->aligned_buffer);
james@1005 133
james@1005 134 InitializeListHead(&xvdd->srb_list);
james@1005 135 xvdd->aligned_buffer_in_use = FALSE;
james@1005 136 /* align the buffer to PAGE_SIZE */
james@1005 137
james@1005 138 ConfigInfo->MaximumTransferLength = 4 * 1024 * 1024; //BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE;
james@1005 139 ConfigInfo->NumberOfPhysicalBreaks = ConfigInfo->MaximumTransferLength >> PAGE_SHIFT; //BLKIF_MAX_SEGMENTS_PER_REQUEST - 1;
james@1005 140 FUNCTION_MSG("ConfigInfo->MaximumTransferLength = %d\n", ConfigInfo->MaximumTransferLength);
james@1005 141 FUNCTION_MSG("ConfigInfo->NumberOfPhysicalBreaks = %d\n", ConfigInfo->NumberOfPhysicalBreaks);
james@1005 142 if (!dump_mode) {
james@1005 143 xvdd->aligned_buffer_size = BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE;
james@1005 144 } else {
james@1005 145 xvdd->aligned_buffer_size = DUMP_MODE_UNALIGNED_PAGES * PAGE_SIZE;
james@1005 146 }
james@1005 147
james@1005 148 FUNCTION_MSG("MultipleRequestPerLu = %d\n", ConfigInfo->MultipleRequestPerLu);
james@1005 149 FUNCTION_MSG("TaggedQueuing = %d\n", ConfigInfo->TaggedQueuing);
james@1005 150 FUNCTION_MSG("AutoRequestSense = %d\n", ConfigInfo->AutoRequestSense );
james@1005 151 ConfigInfo->ScatterGather = TRUE;
james@1005 152 ConfigInfo->Master = TRUE;
james@1005 153 ConfigInfo->CachesData = FALSE;
james@1005 154 ConfigInfo->MapBuffers = TRUE;
james@1005 155 ConfigInfo->AlignmentMask = 0;
james@1005 156 ConfigInfo->NumberOfBuses = 1;
james@1005 157 ConfigInfo->InitiatorBusId[0] = 1;
james@1005 158 ConfigInfo->MaximumNumberOfLogicalUnits = 1;
james@1005 159 ConfigInfo->MaximumNumberOfTargets = 2;
james@1005 160 if (ConfigInfo->Dma64BitAddresses == SCSI_DMA64_SYSTEM_SUPPORTED) {
james@1005 161 ConfigInfo->Dma64BitAddresses = SCSI_DMA64_MINIPORT_SUPPORTED;
james@1005 162 FUNCTION_MSG("Dma64BitAddresses supported\n");
james@1005 163 } else {
james@1005 164 FUNCTION_MSG("Dma64BitAddresses not supported\n");
james@1005 165 }
james@1005 166 *Again = FALSE;
james@1005 167
james@1005 168 FUNCTION_EXIT();
james@1005 169
james@1005 170 return SP_RETURN_FOUND;
james@1005 171 }
james@1005 172
james@1005 173 /* Called at PASSIVE_LEVEL for non-dump mode */
james@1005 174 static BOOLEAN
james@1008 175 XenVbd_HwScsiInitialize(PVOID DeviceExtension) {
james@1005 176 PXENVBD_SCSIPORT_DATA xvsd = (PXENVBD_SCSIPORT_DATA)DeviceExtension;
james@1005 177 PXENVBD_DEVICE_DATA xvdd = (PXENVBD_DEVICE_DATA)xvsd->xvdd;
james@1005 178 ULONG i;
james@1005 179
james@1005 180 FUNCTION_ENTER();
james@1027 181 FUNCTION_MSG("IRQL = %d\n", KeGetCurrentIrql());
james@1027 182 FUNCTION_MSG("dump_mode = %d\n", dump_mode);
james@1005 183
james@1005 184 xvdd->shadow_free = 0;
james@1005 185 memset(xvdd->shadows, 0, sizeof(blkif_shadow_t) * SHADOW_ENTRIES);
james@1005 186 for (i = 0; i < SHADOW_ENTRIES; i++) {
james@1005 187 xvdd->shadows[i].req.id = i;
james@1005 188 /* make sure leftover real requests's are never confused with dump mode requests */
james@1005 189 if (dump_mode)
james@1005 190 xvdd->shadows[i].req.id |= SHADOW_ID_DUMP_FLAG;
james@1005 191 put_shadow_on_freelist(xvdd, &xvdd->shadows[i]);
james@1005 192 }
james@1005 193
james@1005 194 if (!dump_mode) {
james@1005 195 /* nothing */
james@1005 196 } else {
james@1005 197 xvdd->grant_tag = (ULONG)'DUMP';
james@1005 198 }
james@1005 199
james@1005 200 FUNCTION_EXIT();
james@1005 201
james@1005 202 return TRUE;
james@1005 203 }
james@1005 204
james@1005 205 /* this is only used during hiber and dump */
james@1005 206 static BOOLEAN
james@1005 207 XenVbd_HwScsiInterrupt(PVOID DeviceExtension)
james@1005 208 {
james@1005 209 PXENVBD_SCSIPORT_DATA xvsd = DeviceExtension;
james@1005 210 XenVbd_HandleEvent(xvsd->xvdd);
james@1008 211 //SxxxPortNotification(NextLuRequest, xvdd, 0, 0, 0);
james@1005 212 return TRUE;
james@1005 213 }
james@1005 214
james@1005 215 static BOOLEAN
james@1005 216 XenVbd_HwScsiResetBus(PVOID DeviceExtension, ULONG PathId)
james@1005 217 {
james@1005 218 PXENVBD_SCSIPORT_DATA xvsd = DeviceExtension;
james@1005 219 return XenVbd_ResetBus(xvsd->xvdd, PathId);
james@1005 220 }
james@1005 221
james@1005 222 static VOID
james@1005 223 XenVbd_CompleteDisconnect(PXENVBD_DEVICE_DATA xvdd) {
james@1005 224 PXENVBD_SCSIPORT_DATA xvsd = (PXENVBD_SCSIPORT_DATA)xvdd->xvsd;
james@1005 225 PSCSI_REQUEST_BLOCK srb;
james@1005 226
james@1005 227 if (xvsd->stop_srb) {
james@1005 228 srb = xvsd->stop_srb;
james@1005 229 xvsd->stop_srb = NULL;
james@1005 230 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1005 231 }
james@1005 232 }
james@1005 233
james@1005 234 static BOOLEAN
james@1008 235 XenVbd_HwScsiStartIo(PVOID DeviceExtension, PSCSI_REQUEST_BLOCK srb) {
james@1005 236 PXENVBD_SCSIPORT_DATA xvsd = DeviceExtension;
james@1005 237 PXENVBD_DEVICE_DATA xvdd = (PXENVBD_DEVICE_DATA)xvsd->xvdd;
james@1005 238 PSRB_IO_CONTROL sic;
james@1005 239
james@1008 240 if ((LONG)xvsd->outstanding < 0) {
james@1008 241 FUNCTION_MSG("HwScsiStartIo outstanding = %d\n", xvsd->outstanding);
james@1008 242 }
james@1005 243 if (srb->PathId != 0 || srb->TargetId != 0 || srb->Lun != 0) {
james@1005 244 FUNCTION_MSG("HwScsiStartIo (Out of bounds - PathId = %d, TargetId = %d, Lun = %d)\n", srb->PathId, srb->TargetId, srb->Lun);
james@1005 245 srb->SrbStatus = SRB_STATUS_NO_DEVICE;
james@1005 246 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1005 247 } else if (srb->Function == SRB_FUNCTION_IO_CONTROL && memcmp(((PSRB_IO_CONTROL)srb->DataBuffer)->Signature, XENVBD_CONTROL_SIG, 8) == 0) {
james@1005 248 sic = srb->DataBuffer;
james@1005 249 switch(sic->ControlCode) {
james@1005 250 case XENVBD_CONTROL_EVENT:
james@1005 251 srb->SrbStatus = SRB_STATUS_SUCCESS;
james@1005 252 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1008 253 break;
james@1005 254 case XENVBD_CONTROL_STOP:
james@1005 255 if (xvdd->shadow_free == SHADOW_ENTRIES) {
james@1005 256 srb->SrbStatus = SRB_STATUS_SUCCESS;
james@1005 257 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1008 258 FUNCTION_MSG("CONTROL_STOP done\n");
james@1005 259 } else {
james@1005 260 xvsd->stop_srb = srb;
james@1008 261 FUNCTION_MSG("CONTROL_STOP pended\n");
james@1005 262 }
james@1005 263 break;
james@1005 264 case XENVBD_CONTROL_START:
james@1008 265 // we might need to reload a few things here...
james@1008 266 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1005 267 break;
james@1005 268 default:
james@1005 269 FUNCTION_MSG("XENVBD_CONTROL_%d\n", sic->ControlCode);
james@1008 270 srb->SrbStatus = SRB_STATUS_ERROR;
james@1005 271 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1005 272 break;
james@1005 273 }
james@1005 274 } else if (xvdd->device_state == DEVICE_STATE_INACTIVE) {
james@1005 275 FUNCTION_MSG("HwScsiStartIo Inactive Device (in StartIo)\n");
james@1005 276 srb->SrbStatus = SRB_STATUS_NO_DEVICE;
james@1005 277 ScsiPortNotification(RequestComplete, xvsd, srb);
james@1005 278 } else {
james@1005 279 xvsd->outstanding++;
james@1005 280 XenVbd_PutSrbOnList(xvdd, srb);
james@1005 281 }
james@1014 282 /* HandleEvent also puts queued SRB's on the ring */
james@1014 283 XenVbd_HandleEvent(xvdd);
james@1008 284 /* need 2 spare slots - 1 for EVENT and 1 for STOP/START */
james@1005 285 if (xvsd->outstanding < 30) {
james@1008 286 ScsiPortNotification(NextLuRequest, xvsd, 0, 0, 0);
james@1005 287 } else {
james@1005 288 ScsiPortNotification(NextRequest, xvsd);
james@1005 289 }
james@1005 290 return TRUE;
james@1005 291 }
james@1005 292
james@1005 293 static SCSI_ADAPTER_CONTROL_STATUS
james@1027 294 XenVbd_HwScsiAdapterControl(PVOID DeviceExtension, SCSI_ADAPTER_CONTROL_TYPE ControlType, PVOID Parameters) {
james@1005 295 PXENVBD_SCSIPORT_DATA xvsd = DeviceExtension;
james@1005 296 PXENVBD_DEVICE_DATA xvdd = (PXENVBD_DEVICE_DATA)xvsd->xvdd;
james@1005 297 SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
james@1005 298 PSCSI_SUPPORTED_CONTROL_TYPE_LIST SupportedControlTypeList;
james@1005 299
james@1005 300 FUNCTION_ENTER();
james@1027 301 FUNCTION_MSG("IRQL = %d\n", KeGetCurrentIrql());
james@1027 302 FUNCTION_MSG("xvsd = %p\n", xvsd);
james@1005 303
james@1027 304 switch (ControlType) {
james@1005 305 case ScsiQuerySupportedControlTypes:
james@1005 306 SupportedControlTypeList = (PSCSI_SUPPORTED_CONTROL_TYPE_LIST)Parameters;
james@1027 307 FUNCTION_MSG("ScsiQuerySupportedControlTypes (Max = %d)\n", SupportedControlTypeList->MaxControlType);
james@1005 308 SupportedControlTypeList->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;
james@1005 309 SupportedControlTypeList->SupportedTypeList[ScsiStopAdapter] = TRUE;
james@1005 310 SupportedControlTypeList->SupportedTypeList[ScsiRestartAdapter] = TRUE;
james@1005 311 break;
james@1005 312 case ScsiStopAdapter:
james@1027 313 FUNCTION_MSG("ScsiStopAdapter\n");
james@1005 314 if (xvdd->device_state == DEVICE_STATE_INACTIVE) {
james@1027 315 FUNCTION_MSG("inactive - nothing to do\n");
james@1005 316 break;
james@1005 317 }
james@1027 318 XN_ASSERT(IsListEmpty(&xvdd->srb_list));
james@1027 319 XN_ASSERT(xvdd->shadow_free == SHADOW_ENTRIES);
james@1005 320 break;
james@1005 321 case ScsiRestartAdapter:
james@1027 322 FUNCTION_MSG("ScsiRestartAdapter\n");
james@1008 323 if (xvdd->device_state == DEVICE_STATE_INACTIVE) {
james@1027 324 FUNCTION_MSG("inactive - nothing to do\n");
james@1005 325 break;
james@1005 326 }
james@1005 327 /* increase the tag every time we stop/start to track where the gref's came from */
james@1005 328 xvdd->grant_tag++;
james@1005 329 break;
james@1005 330 case ScsiSetBootConfig:
james@1027 331 FUNCTION_MSG("ScsiSetBootConfig\n");
james@1005 332 break;
james@1005 333 case ScsiSetRunningConfig:
james@1027 334 FUNCTION_MSG("ScsiSetRunningConfig\n");
james@1005 335 break;
james@1005 336 default:
james@1027 337 FUNCTION_MSG("UNKNOWN\n");
james@1005 338 break;
james@1005 339 }
james@1005 340
james@1005 341 FUNCTION_EXIT();
james@1005 342
james@1005 343 return Status;
james@1005 344 }
james@1005 345
james@1005 346 NTSTATUS
james@1005 347 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
james@1005 348 ULONG status;
james@1005 349 HW_INITIALIZATION_DATA HwInitializationData;
james@1005 350
james@1005 351 /* RegistryPath == NULL when we are invoked as a crash dump driver */
james@1005 352 if (!RegistryPath) {
james@1005 353 dump_mode = TRUE;
james@1027 354 XnPrintDump();
james@1005 355 }
james@1005 356
james@1005 357 FUNCTION_ENTER();
james@1027 358 FUNCTION_MSG("IRQL = %d\n", KeGetCurrentIrql());
james@1027 359 FUNCTION_MSG("DriverObject = %p, RegistryPath = %p\n", DriverObject, RegistryPath);
james@1005 360
james@1005 361 RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA));
james@1005 362 HwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);
james@1005 363 HwInitializationData.AdapterInterfaceType = PNPBus; /* not Internal */
james@1005 364 HwInitializationData.SrbExtensionSize = sizeof(srb_list_entry_t);
james@1005 365 HwInitializationData.NumberOfAccessRanges = 1;
james@1005 366 HwInitializationData.MapBuffers = TRUE;
james@1005 367 HwInitializationData.NeedPhysicalAddresses = FALSE;
james@1005 368 HwInitializationData.TaggedQueuing = TRUE;
james@1005 369 HwInitializationData.AutoRequestSense = TRUE;
james@1005 370 HwInitializationData.MultipleRequestPerLu = TRUE;
james@1005 371 HwInitializationData.ReceiveEvent = FALSE;
james@1005 372 HwInitializationData.HwInitialize = XenVbd_HwScsiInitialize;
james@1005 373 HwInitializationData.HwStartIo = XenVbd_HwScsiStartIo;
james@1005 374 HwInitializationData.HwFindAdapter = XenVbd_HwScsiFindAdapter;
james@1005 375 HwInitializationData.HwResetBus = XenVbd_HwScsiResetBus;
james@1005 376 HwInitializationData.HwAdapterControl = XenVbd_HwScsiAdapterControl;
james@1005 377 if (!dump_mode) {
james@1005 378 HwInitializationData.DeviceExtensionSize = FIELD_OFFSET(XENVBD_SCSIPORT_DATA, aligned_buffer_data) + UNALIGNED_BUFFER_DATA_SIZE;
james@1005 379 } else {
james@1005 380 HwInitializationData.HwInterrupt = XenVbd_HwScsiInterrupt;
james@1027 381 HwInitializationData.DeviceExtensionSize = FIELD_OFFSET(XENVBD_SCSIPORT_DATA, aligned_buffer_data) + sizeof(XENVBD_DEVICE_DATA) + UNALIGNED_BUFFER_DATA_SIZE_DUMP_MODE;
james@1005 382 }
james@1005 383 status = ScsiPortInitialize(DriverObject, RegistryPath, &HwInitializationData, NULL);
james@1005 384
james@1005 385 if(!NT_SUCCESS(status)) {
james@1005 386 FUNCTION_MSG("ScsiPortInitialize failed with status 0x%08x\n", status);
james@1005 387 }
james@1005 388
james@1005 389 FUNCTION_EXIT();
james@1005 390
james@1005 391 return status;
james@1005 392 }