win-pvdrivers

view xenscsi/xenscsi.h @ 266:b88529df8b60

More wdm updates
author James Harper <james.harper@bendigoit.com.au>
date Wed May 07 10:47:03 2008 +1000 (2008-05-07)
parents 8609c27c4893
children 874c3640830e
line source
1 #if !defined(_XENSCSI_H_)
2 #define _XENSCSI_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 "XenSCSI"
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 <io/ring.h>
25 #include <io/vscsiif.h>
27 typedef struct vscsiif_request vscsiif_request_t;
28 typedef struct vscsiif_response vscsiif_response_t;
30 #define XENSCSI_POOL_TAG (ULONG) 'XSCS'
32 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
33 #define VSCSIIF_RING_SIZE __RING_SIZE((vscsiif_sring_t *)0, PAGE_SIZE)
35 typedef struct {
36 vscsiif_request_t req;
37 PSCSI_REQUEST_BLOCK Srb;
38 PMDL Mdl;
39 VOID *Buf;
40 } vscsiif_shadow_t;
42 //#include "scsidata.h"
44 #define SCSI_BUSES 4
45 #define SCSI_TARGETS_PER_BUS 16
47 struct
48 {
49 int Present;
50 BOOLEAN PendingInterrupt;
51 PVOID DeviceData; // how can we create a forward definition for this???
52 evtchn_port_t EventChannel;
53 vscsiif_shadow_t *shadow;
54 uint16_t shadow_free;
55 ULONG RingBufPFN;
56 int BackendState;
57 int FrontendState;
58 char Path[128];
59 int DeviceIndex;
60 char BackendPath[128];
61 vscsiif_front_ring_t Ring;
62 int ring_detect_state;
63 int host;
64 int channel;
65 int id;
66 int lun;
67 } typedef XENSCSI_TARGET_DATA, *PXENSCSI_TARGET_DATA;
69 struct
70 {
71 XENSCSI_TARGET_DATA TargetData[SCSI_TARGETS_PER_BUS];
72 } typedef XENSCSI_BUS_DATA, *PXENSCSI_BUS_DATA;
74 struct
75 {
76 PXENPCI_XEN_DEVICE_DATA XenDeviceData;
77 XENSCSI_BUS_DATA BusData[SCSI_BUSES];
79 KSPIN_LOCK Lock;
81 int BusChangePending;
83 LONG EnumeratedDevices;
84 int TotalInitialDevices;
85 } typedef XENSCSI_DEVICE_DATA, *PXENSCSI_DEVICE_DATA;
87 enum dma_data_direction {
88 DMA_BIDIRECTIONAL = 0,
89 DMA_TO_DEVICE = 1,
90 DMA_FROM_DEVICE = 2,
91 DMA_NONE = 3,
92 };
94 #endif