ULONG DriverEntry (IN PVOID HAObject, IN PVOID ARG) { HW_INITIALIZATION_DATA InitData; // Adapter init. struct unsigned i; ULONG AdapterCount; ULONG ISAStatus, EISAStatus; // ULONG MCAStatus, LocalStatus; /* Initialize the environment: */ EnvLib_Init(); // Initialize the object for (i=0; i < sizeof(InitData); i++) ((char *)&InitData)[i] = 0; InitData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); // Set pointers to service functions: InitData.HwInitialize = HAInit; InitData.HwStartIo = StartIO; InitData.HwInterrupt = GeneralISR; InitData.HwFindAdapter = FindAdapter; InitData.HwResetBus = ResetBus; InitData.HwAdapterState = AdapterState; // // Set capabilities InitData.MapBuffers = TRUE; // This should be in PORT config info InitData.NeedPhysicalAddresses = FALSE; InitData.TaggedQueuing = FALSE; #if defined(AUTOSENSE) InitData.AutoRequestSense = TRUE; #else InitData.AutoRequestSense = FALSE; #endif InitData.MultipleRequestPerLu = InitData.AutoRequestSense; InitData.ReceiveEvent = FALSE; // Set misc. things: InitData.NumberOfAccessRanges = 1; // Set the size of extensions InitData.DeviceExtensionSize = HAExtentLen; InitData.SpecificLuExtensionSize = DEVExtentLen; InitData.SrbExtensionSize = REQExtentLen; AdapterCount = 0; TRACE(3, ("DriverEntry(): Trying EISA adapters\n")); InitData.AdapterInterfaceType = Eisa; EISAStatus = ScsiPortInitialize(HAObject, ARG, &InitData, (PVOID)&AdapterCount); TRACE(2, ("DriverEntry(): ScsiPortInitialize() returned: %x\n", EISAStatus)); if (EISAStatus != 0) { TRACE(3, ("DriverEntry(): Trying ISA adapters\n")); InitData.AdapterInterfaceType = Isa; ISAStatus = ScsiPortInitialize(HAObject, ARG, &InitData, (PVOID)&AdapterCount); TRACE(2, ("DriverEntry(): ScsiPortInitialize() returned: %x\n", ISAStatus)); } return min(ISAStatus, EISAStatus); }
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { ULONG Status; HW_INITIALIZATION_DATA HwInitializationData; PVOID driver_extension; PUCHAR ptr; FUNCTION_ENTER(); KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql())); IoAllocateDriverObjectExtension(DriverObject, UlongToPtr(XEN_INIT_DRIVER_EXTENSION_MAGIC), PAGE_SIZE, &driver_extension); ptr = driver_extension; ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "ring-ref", NULL, NULL); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_IRQ, "event-channel", NULL, NULL); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, UlongToPtr((ULONG)'SCSI'), UlongToPtr(144), NULL); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT, NULL, NULL, NULL); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitialised); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected); __ADD_XEN_INIT_UCHAR(&ptr, 20); __ADD_XEN_INIT_UCHAR(&ptr, 0); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT, NULL, NULL, NULL); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected); __ADD_XEN_INIT_UCHAR(&ptr, 20); __ADD_XEN_INIT_UCHAR(&ptr, 0); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_SHUTDOWN, NULL, NULL, NULL); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosing); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosing); __ADD_XEN_INIT_UCHAR(&ptr, 50); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosed); __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosed); __ADD_XEN_INIT_UCHAR(&ptr, 50); //__ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitWait); //ialising); //__ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitWait); //__ADD_XEN_INIT_UCHAR(&ptr, 50); __ADD_XEN_INIT_UCHAR(&ptr, 0); ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL, NULL); /* RegistryPath == NULL when we are invoked as a crash dump driver */ if (!RegistryPath) { dump_mode = TRUE; } RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA)); HwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); HwInitializationData.AdapterInterfaceType = PNPBus; HwInitializationData.DeviceExtensionSize = sizeof(XENSCSI_DEVICE_DATA); HwInitializationData.SpecificLuExtensionSize = sizeof(XENSCSI_LU_DATA); HwInitializationData.SrbExtensionSize = 0; HwInitializationData.NumberOfAccessRanges = 1; HwInitializationData.MapBuffers = TRUE; HwInitializationData.NeedPhysicalAddresses = FALSE; HwInitializationData.TaggedQueuing = TRUE; HwInitializationData.AutoRequestSense = TRUE; HwInitializationData.MultipleRequestPerLu = TRUE; HwInitializationData.HwInitialize = XenScsi_HwScsiInitialize; HwInitializationData.HwStartIo = XenScsi_HwScsiStartIo; HwInitializationData.HwInterrupt = XenScsi_HwScsiInterrupt; HwInitializationData.HwFindAdapter = XenScsi_HwScsiFindAdapter; HwInitializationData.HwResetBus = XenScsi_HwScsiResetBus; HwInitializationData.HwAdapterControl = XenScsi_HwScsiAdapterControl; Status = ScsiPortInitialize(DriverObject, RegistryPath, &HwInitializationData, NULL); if(!NT_SUCCESS(Status)) { KdPrint((__DRIVER_NAME " ScsiPortInitialize failed with status 0x%08x\n", Status)); } FUNCTION_EXIT(); return Status; }
ULONG DriverEntry( IN PVOID DriverObject, IN PVOID RegistryPath ) { HW_INITIALIZATION_DATA hwInitData; ULONG initResult; #ifndef USE_STORPORT UCHAR venId[4] = {'1', 'A', 'F', '4'}; UCHAR devId[4] = {'1', '0', '0', '1'}; #endif InitializeDebugPrints((PDRIVER_OBJECT)DriverObject, (PUNICODE_STRING)RegistryPath); RhelDbgPrint(TRACE_LEVEL_ERROR, ("Viostor driver started...built on %s %s\n", __DATE__, __TIME__)); IsCrashDumpMode = FALSE; if (RegistryPath == NULL) { RhelDbgPrint(TRACE_LEVEL_INFORMATION, ("DriverEntry: Crash dump mode\n")); IsCrashDumpMode = TRUE; } memset(&hwInitData, 0, sizeof(HW_INITIALIZATION_DATA)); hwInitData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); hwInitData.HwFindAdapter = VirtIoFindAdapter; hwInitData.HwInitialize = VirtIoHwInitialize; hwInitData.HwStartIo = VirtIoStartIo; hwInitData.HwInterrupt = VirtIoInterrupt; hwInitData.HwResetBus = VirtIoResetBus; hwInitData.HwAdapterControl = VirtIoAdapterControl; #ifdef USE_STORPORT hwInitData.HwBuildIo = VirtIoBuildIo; #endif hwInitData.NeedPhysicalAddresses = TRUE; hwInitData.TaggedQueuing = TRUE; hwInitData.AutoRequestSense = TRUE; hwInitData.MultipleRequestPerLu = TRUE; hwInitData.DeviceExtensionSize = sizeof(ADAPTER_EXTENSION); hwInitData.SrbExtensionSize = sizeof(RHEL_SRB_EXTENSION); hwInitData.AdapterInterfaceType = PCIBus; #ifndef USE_STORPORT hwInitData.VendorIdLength = 4; hwInitData.VendorId = venId; hwInitData.DeviceIdLength = 4; hwInitData.DeviceId = devId; #endif hwInitData.NumberOfAccessRanges = 1; #ifdef USE_STORPORT hwInitData.MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS; #else hwInitData.MapBuffers = TRUE; #endif initResult = ScsiPortInitialize(DriverObject, RegistryPath, &hwInitData, NULL); RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("Initialize returned 0x%x\n", initResult)); return initResult; }
ULONG DriverEntry ( IN PVOID DriverObject, IN PVOID Argument2 ) /*++ Routine Description: Installable driver initialization entry point for system. Arguments: Driver Object Argument2 - Not used. Return Value: Status from ScsiPortInitialize() --*/ { HW_INITIALIZATION_DATA hwInitializationData; ULONG AdapterCount = 0; ULONG i; DebugPrint((1,"\n\nSCSI WD7000EX MiniPort Driver\n")); // // Zero out structure. // for (i=0; i<sizeof(HW_INITIALIZATION_DATA); i++) { ((PUCHAR)&hwInitializationData)[i] = 0; } // // Set size of hwInitializationData. // hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); // // Set entry points. // hwInitializationData.HwInitialize = Wd7000ExInitialize; hwInitializationData.HwFindAdapter = Wd7000ExFindAdapter; hwInitializationData.HwStartIo = Wd7000ExStartIo; hwInitializationData.HwInterrupt = Wd7000ExInterrupt; hwInitializationData.HwResetBus = Wd7000ExResetBus; hwInitializationData.HwAdapterState = Wd7000ExAdapterState; // // Set number of access ranges and bus type. // hwInitializationData.NumberOfAccessRanges = 1; hwInitializationData.AdapterInterfaceType = Eisa; // // Indicate no buffer mapping but will need physical addresses. // hwInitializationData.NeedPhysicalAddresses = TRUE; // // Specify size of extensions. // hwInitializationData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION); // // Ask for SRB extensions for CCBs. // hwInitializationData.SrbExtensionSize = sizeof(CCB); return ScsiPortInitialize(DriverObject, Argument2, &hwInitializationData, &AdapterCount); } // end DriverEntry()