win-pvdrivers

view xenvbd/xenvbd.c @ 318:0488ef11be09

final changes for 0.9.10
author James Harper <james.harper@bendigoit.com.au>
date Tue Jun 17 20:51:52 2008 +1000 (2008-06-17)
parents 60372bd2582d
children 9ac05494063f
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 "xenvbd.h"
21 #include <io/blkif.h>
22 #include <scsi.h>
23 #include <ntddscsi.h>
24 #include <ntdddisk.h>
25 #include <stdlib.h>
26 #include <xen_public.h>
27 #include <io/xenbus.h>
28 #include <io/protocols.h>
30 #pragma warning(disable: 4127)
32 DRIVER_INITIALIZE DriverEntry;
34 #ifdef ALLOC_PRAGMA
35 #pragma alloc_text (INIT, DriverEntry)
36 #endif
38 NTSTATUS
39 DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
40 {
41 ULONG status;
42 HW_INITIALIZATION_DATA HwInitializationData;
44 KdPrint((__DRIVER_NAME " --> "__FUNCTION__ "\n"));
45 KdPrint((__DRIVER_NAME " IRQL = %d\n", KeGetCurrentIrql()));
47 RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA));
49 HwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);
50 HwInitializationData.AdapterInterfaceType = Internal;
51 HwInitializationData.DeviceExtensionSize = sizeof(XENVBD_DEVICE_DATA);
52 HwInitializationData.SpecificLuExtensionSize = 0;
53 /* SrbExtension is not always aligned to a page boundary, so we add PAGE_SIZE-1 to it to make sure we have at least UNALIGNED_DOUBLE_BUFFER_SIZE bytes of page aligned memory */
54 HwInitializationData.SrbExtensionSize = UNALIGNED_DOUBLE_BUFFER_SIZE + PAGE_SIZE - 1;
55 HwInitializationData.NumberOfAccessRanges = 1;
56 HwInitializationData.MapBuffers = TRUE;
57 HwInitializationData.NeedPhysicalAddresses = FALSE;
58 HwInitializationData.TaggedQueuing = FALSE;
59 HwInitializationData.AutoRequestSense = TRUE;
60 HwInitializationData.MultipleRequestPerLu = TRUE;
61 HwInitializationData.ReceiveEvent = FALSE;
62 HwInitializationData.VendorIdLength = 0;
63 HwInitializationData.VendorId = NULL;
64 HwInitializationData.DeviceIdLength = 0;
65 HwInitializationData.DeviceId = NULL;
67 XenVbd_FillInitCallbacks(&HwInitializationData);
69 status = ScsiPortInitialize(DriverObject, RegistryPath, &HwInitializationData, NULL);
71 if(!NT_SUCCESS(status))
72 {
73 KdPrint((__DRIVER_NAME " ScsiPortInitialize failed with status 0x%08x\n", status));
74 }
76 KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
78 return status;
79 }