win-pvdrivers

view xenscsi/xenscsi.h @ 993:61fea9275419

Added tag 0.11.0.369 for changeset 58899e6ed48f
author James Harper <james.harper@bendigoit.com.au>
date Fri Sep 21 23:34:14 2012 +1000 (2012-09-21)
parents 150118f124a1
children
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 <initguid.h>
8 #include <ntdddisk.h>
9 //#include <srb.h>
11 #define NTSTRSAFE_LIB
12 #include <ntstrsafe.h>
14 #define __DRIVER_NAME "XenSCSI"
16 #include <xen_windows.h>
17 #include <memory.h>
18 #include <grant_table.h>
19 #include <event_channel.h>
20 #include <hvm/params.h>
21 #include <hvm/hvm_op.h>
22 #include <xen_public.h>
23 #include <io/ring.h>
24 #include <io/vscsiif.h>
26 //#include <io/blkif.h>
27 //#include <storport.h>
28 #include <scsi.h>
29 //#include <ntddscsi.h>
30 //#include <ntdddisk.h>
31 #include <stdlib.h>
32 #include <io/xenbus.h>
33 #include <io/protocols.h>
36 typedef struct vscsiif_request vscsiif_request_t;
37 typedef struct vscsiif_response vscsiif_response_t;
39 #define XENSCSI_POOL_TAG (ULONG) 'XSCS'
41 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
42 #define VSCSIIF_RING_SIZE __RING_SIZE((vscsiif_sring_t *)0, PAGE_SIZE)
44 typedef struct {
45 vscsiif_request_t req;
46 PSCSI_REQUEST_BLOCK Srb;
47 } vscsiif_shadow_t;
49 #define SHADOW_ENTRIES 32
50 #define MAX_GRANT_ENTRIES 512
52 #define SCSI_DEV_NODEV ((ULONG)-1)
54 typedef struct {
55 LIST_ENTRY entry;
56 ULONG dev_no; // SCSI_DEV_NODEV == end
57 ULONG state;
58 BOOLEAN validated;
59 UCHAR host;
60 UCHAR channel;
61 UCHAR id;
62 UCHAR lun;
63 } scsi_dev_t;
65 #if 0
66 #define SCSI_STATE_ENUM_PENDING 0
67 #define SCSI_STATE_ENUM_IN_PROGRESS 1
68 #define SCSI_STATE_ENUM_COMPLETE 2
70 #define XENSCSI_MAX_ENUM_TIME 5
71 #endif
73 #define SHARED_PAUSED_SCSIPORT_UNPAUSED 0
74 #define SHARED_PAUSED_PASSIVE_PAUSED 1
75 #define SHARED_PAUSED_SCSIPORT_PAUSED 2
76 #define SHARED_PAUSED_PASSIVE_UNPAUSED 3
78 struct
79 {
80 vscsiif_shadow_t shadows[SHADOW_ENTRIES];
81 USHORT shadow_free_list[SHADOW_ENTRIES];
82 USHORT shadow_free;
84 grant_ref_t grant_free_list[MAX_GRANT_ENTRIES];
85 USHORT grant_free;
86 USHORT grant_entries;
88 evtchn_port_t event_channel;
90 vscsiif_front_ring_t ring;
92 XENPCI_VECTORS vectors;
94 LIST_ENTRY dev_list_head;
96 //BOOLEAN pause_req;
97 //BOOLEAN pause_ack;
98 volatile LONG shared_paused;
99 ULONG scsiport_paused; /* scsiport code has acknowledged pause */
100 ULONG bus_changes[8];
101 } typedef XENSCSI_DEVICE_DATA, *PXENSCSI_DEVICE_DATA;
103 struct {
104 UCHAR sense_len;
105 UCHAR sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
106 } typedef XENSCSI_LU_DATA, *PXENSCSI_LU_DATA;
108 enum dma_data_direction {
109 DMA_BIDIRECTIONAL = 0,
110 DMA_TO_DEVICE = 1,
111 DMA_FROM_DEVICE = 2,
112 DMA_NONE = 3,
113 };
115 VOID
116 XenScsi_FillInitCallbacks(PHW_INITIALIZATION_DATA HwInitializationData);
118 #endif