win-pvdrivers

view xenscsi/xenscsi.h @ 783:644e5ddb1b47

Handle SCSI INQUIRY command better in xenvbd
author James Harper <james.harper@bendigoit.com.au>
date Mon Feb 15 20:53:57 2010 +1100 (2010-02-15)
parents a6e3f76419c3
children 150118f124a1
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 #define SCSI_STATE_ENUM_PENDING 0
66 #define SCSI_STATE_ENUM_IN_PROGRESS 1
67 #define SCSI_STATE_ENUM_COMPLETE 2
69 #define XENSCSI_MAX_ENUM_TIME 5
71 struct
72 {
73 vscsiif_shadow_t shadows[SHADOW_ENTRIES];
74 USHORT shadow_free_list[SHADOW_ENTRIES];
75 USHORT shadow_free;
77 grant_ref_t grant_free_list[MAX_GRANT_ENTRIES];
78 USHORT grant_free;
79 USHORT grant_entries;
81 evtchn_port_t event_channel;
83 vscsiif_front_ring_t ring;
85 XENPCI_VECTORS vectors;
87 LIST_ENTRY dev_list_head;
89 //STOR_DPC dpc;
91 BOOLEAN pause_req;
92 BOOLEAN pause_ack;
93 } typedef XENSCSI_DEVICE_DATA, *PXENSCSI_DEVICE_DATA;
95 struct {
96 UCHAR sense_len;
97 UCHAR sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
98 } typedef XENSCSI_LU_DATA, *PXENSCSI_LU_DATA;
100 enum dma_data_direction {
101 DMA_BIDIRECTIONAL = 0,
102 DMA_TO_DEVICE = 1,
103 DMA_FROM_DEVICE = 2,
104 DMA_NONE = 3,
105 };
107 VOID
108 XenScsi_FillInitCallbacks(PHW_INITIALIZATION_DATA HwInitializationData);
110 #endif