win-pvdrivers

view xenvbd/xenvbd.h @ 42:5dc3e004cf94

xennet: implement tx ring cleanup on xen interrupt
author Andy Grover <andy.grover@oracle.com>
date Wed Dec 05 14:56:01 2007 -0800 (2007-12-05)
parents be8c09632f31
children 94d0f2823b42
line source
1 #if !defined(_XENBUS_H_)
2 #define _XENBUS_H_
4 #include <ntddk.h>
5 #include <wdm.h>
6 #include <wdf.h>
7 #include <initguid.h>
8 #include <ntdddisk.h>
10 #define NTSTRSAFE_LIB
11 #include <ntstrsafe.h>
13 #include <xen_windows.h>
14 #include <memory.h>
15 #include <grant_table.h>
16 #include <event_channel.h>
17 #include <hvm/params.h>
18 #include <hvm/hvm_op.h>
19 #include <evtchn_public.h>
20 #include <xenbus_public.h>
21 #include <io/ring.h>
22 #include <io/blkif.h>
23 #define __DRIVER_NAME "XenVbd"
24 #define XENVBD_POOL_TAG (ULONG) 'XenP'
26 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
27 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
29 typedef struct {
30 blkif_request_t req;
31 //int Id;
32 PIRP Irp;
33 PMDL Mdl;
34 VOID *Buf;
35 //int nr_segments;
36 //unsigned long gref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
37 } blkif_shadow_t;
39 typedef struct {
40 LIST_ENTRY Entry;
41 PIRP Irp;
42 } XenVbd_ListEntry;
44 /*
45 typedef struct _XENVBD_QUEUE_DATA {
46 XENVBD_CHILD_DEVICE_DATA DeviceData;
47 } XENVBD_QUEUE_DATA, *PXENVBD_QUEUE_DATA;
49 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(XENVBD_QUEUE_DATA, GetQueueData)
50 */
52 //typedef unsigned long xenbus_transaction_t;
53 //typedef uint32_t XENSTORE_RING_IDX;
55 extern XEN_IFACE_EVTCHN EvtChnInterface;
56 extern XEN_IFACE_XENBUS XenBusInterface;
58 typedef enum {
59 XENVBD_DEVICETYPE_UNKNOWN,
60 XENVBD_DEVICETYPE_DISK,
61 XENVBD_DEVICETYPE_CDROM
62 } XENVBD_DEVICETYPE;
64 typedef struct _XENVBD_CHILD_DEVICE_DATA {
65 LIST_ENTRY Entry;
66 KSPIN_LOCK Lock;
67 WDFQUEUE IoDefaultQueue;
68 WDFDEVICE Device;
69 char Path[128];
70 char BackendPath[128];
71 ULONG DeviceIndex;
72 evtchn_port_t EventChannel;
73 //blkif_sring_t *SharedRing;
74 ULONG RingBufPFN;
75 int BackendState;
76 int FrontendState;
77 blkif_front_ring_t Ring;
78 blkif_shadow_t *shadow;
79 uint64_t shadow_free;
81 LIST_ENTRY IrpListHead;
82 KSPIN_LOCK IrpListLock;
84 WDFDPC Dpc;
86 ULONG BytesPerSector;
87 ULONGLONG TotalSectors;
88 DISK_GEOMETRY Geometry;
89 XENVBD_DEVICETYPE DeviceType;
91 int IrpAddedToList;
92 int IrpRemovedFromList;
93 int IrpAddedToRing;
94 int IrpAddedToRingAtLastNotify;
95 int IrpAddedToRingAtLastInterrupt;
96 int IrpAddedToRingAtLastDpc;
97 int IrpRemovedFromRing;
98 int IrpCompleted;
100 int FastPathUsed;
101 int SlowPathUsed;
103 } XENVBD_CHILD_DEVICE_DATA, *PXENVBD_CHILD_DEVICE_DATA;
105 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PXENVBD_CHILD_DEVICE_DATA, GetChildDeviceData);
107 typedef struct _XENVBD_DEVICE_IDENTIFICATION_DESCRIPTION
108 {
109 WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header;
110 PXENVBD_CHILD_DEVICE_DATA DeviceData;
111 //ULONG DeviceIndex;
112 //char Path[128];
113 } XENVBD_DEVICE_IDENTIFICATION_DESCRIPTION, *PXENVBD_DEVICE_IDENTIFICATION_DESCRIPTION;
115 #endif