win-pvdrivers

view xenvbd/xenvbd.h @ 73:f74723639713

Corrected merge of dpc patches.
Releasing 0.5.0.0
author James Harper <james.harper@bendigoit.com.au>
date Thu Dec 20 13:07:44 2007 +1100 (2007-12-20)
parents 94d0f2823b42
children 06b4321b7068
line source
1 #if !defined(_XENVBD_H_)
2 #define _XENVBD_H_
4 #include <ntifs.h>
5 #include <ntddk.h>
6 #include <wdm.h>
7 #include <wdf.h>
8 #include <initguid.h>
9 #include <ntdddisk.h>
10 #include <srb.h>
12 #define NTSTRSAFE_LIB
13 #include <ntstrsafe.h>
15 #include <xen_windows.h>
16 #include <memory.h>
17 #include <grant_table.h>
18 #include <event_channel.h>
19 #include <hvm/params.h>
20 #include <hvm/hvm_op.h>
21 #include <xen_public.h>
22 #include <evtchn_public.h>
23 #include <xenbus_public.h>
24 #include <gnttbl_public.h>
25 #include <io/ring.h>
26 #include <io/blkif.h>
27 #define __DRIVER_NAME "XenVbd"
28 #define XENVBD_POOL_TAG (ULONG) 'XVBD'
30 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
31 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
33 typedef struct {
34 blkif_request_t req;
35 PSCSI_REQUEST_BLOCK Srb;
36 PMDL Mdl;
37 VOID *Buf;
38 } blkif_shadow_t;
40 //#include "scsidata.h"
43 #define SCSI_BUSES 4
44 #define SCSI_TARGETS_PER_BUS 16
46 typedef enum {
47 XENVBD_DEVICETYPE_UNKNOWN,
48 XENVBD_DEVICETYPE_DISK,
49 XENVBD_DEVICETYPE_CDROM,
50 XENVBD_DEVICETYPE_CONTROLLER // Not yet used
51 } XENVBD_DEVICETYPE;
53 struct
54 {
55 int Present;
56 BOOLEAN PendingInterrupt;
57 PVOID DeviceData; // how can we create a forward definition for this???
58 evtchn_port_t EventChannel;
59 //blkif_sring_t *SharedRing;
60 blkif_shadow_t *shadow;
61 uint64_t shadow_free;
62 ULONG RingBufPFN;
63 int BackendState;
64 int FrontendState;
65 char Path[128];
66 int DeviceIndex;
67 char BackendPath[128];
68 blkif_front_ring_t Ring;
69 XENVBD_DEVICETYPE DeviceType;
70 DISK_GEOMETRY Geometry;
71 ULONG BytesPerSector;
72 ULONGLONG TotalSectors;
73 } typedef XENVBD_TARGET_DATA, *PXENVBD_TARGET_DATA;
75 struct
76 {
77 XENVBD_TARGET_DATA TargetData[SCSI_TARGETS_PER_BUS];
78 } typedef XENVBD_BUS_DATA, *PXENVBD_BUS_DATA;
80 struct
81 {
82 PXENPCI_XEN_DEVICE_DATA XenDeviceData;
83 XENVBD_BUS_DATA BusData[SCSI_BUSES];
85 KSPIN_LOCK Lock;
87 int BusChangePending;
89 int EnumeratedDevices;
90 KEVENT WaitDevicesEvent;
92 } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;
94 #endif