win-pvdrivers

view xenvbd/xenvbd.h @ 74:06b4321b7068

Created a common AllocagePages routine in xen_windows.h
Updated xennet and xenvbd to use it.
Updated xennet's method of getting the virtual address from the Mdl
author James Harper <james.harper@bendigoit.com.au>
date Thu Dec 20 21:37:20 2007 +1100 (2007-12-20)
parents 94d0f2823b42
children b7863ede7a37
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 #define __DRIVER_NAME "XenVbd"
17 #include <xen_windows.h>
18 #include <memory.h>
19 #include <grant_table.h>
20 #include <event_channel.h>
21 #include <hvm/params.h>
22 #include <hvm/hvm_op.h>
23 #include <xen_public.h>
24 #include <evtchn_public.h>
25 #include <xenbus_public.h>
26 #include <gnttbl_public.h>
27 #include <io/ring.h>
28 #include <io/blkif.h>
30 #define XENVBD_POOL_TAG (ULONG) 'XVBD'
32 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
33 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
35 typedef struct {
36 blkif_request_t req;
37 PSCSI_REQUEST_BLOCK Srb;
38 PMDL Mdl;
39 VOID *Buf;
40 } blkif_shadow_t;
42 //#include "scsidata.h"
45 #define SCSI_BUSES 4
46 #define SCSI_TARGETS_PER_BUS 16
48 typedef enum {
49 XENVBD_DEVICETYPE_UNKNOWN,
50 XENVBD_DEVICETYPE_DISK,
51 XENVBD_DEVICETYPE_CDROM,
52 XENVBD_DEVICETYPE_CONTROLLER // Not yet used
53 } XENVBD_DEVICETYPE;
55 struct
56 {
57 int Present;
58 BOOLEAN PendingInterrupt;
59 PVOID DeviceData; // how can we create a forward definition for this???
60 evtchn_port_t EventChannel;
61 //blkif_sring_t *SharedRing;
62 blkif_shadow_t *shadow;
63 uint64_t shadow_free;
64 ULONG RingBufPFN;
65 int BackendState;
66 int FrontendState;
67 char Path[128];
68 int DeviceIndex;
69 char BackendPath[128];
70 blkif_front_ring_t Ring;
71 XENVBD_DEVICETYPE DeviceType;
72 DISK_GEOMETRY Geometry;
73 ULONG BytesPerSector;
74 ULONGLONG TotalSectors;
75 } typedef XENVBD_TARGET_DATA, *PXENVBD_TARGET_DATA;
77 struct
78 {
79 XENVBD_TARGET_DATA TargetData[SCSI_TARGETS_PER_BUS];
80 } typedef XENVBD_BUS_DATA, *PXENVBD_BUS_DATA;
82 struct
83 {
84 PXENPCI_XEN_DEVICE_DATA XenDeviceData;
85 XENVBD_BUS_DATA BusData[SCSI_BUSES];
87 KSPIN_LOCK Lock;
89 int BusChangePending;
91 int EnumeratedDevices;
92 KEVENT WaitDevicesEvent;
94 } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;
96 #endif