win-pvdrivers

view xenvbd/xenvbd.h @ 314:a55d72ac422f

updates to the whole xenconfig thing to allow xennet to dynamically config. Almost there.
Created some bat files to do the signing.
author James Harper <james.harper@bendigoit.com.au>
date Tue Jun 17 10:35:26 2008 +1000 (2008-06-17)
parents 60372bd2582d
children 0488ef11be09
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2007 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #if !defined(_XENVBD_H_)
21 #define _XENVBD_H_
23 #include <ntifs.h>
24 #include <ntddk.h>
25 #include <wdm.h>
26 #include <initguid.h>
27 #include <ntdddisk.h>
28 #include <srb.h>
30 #define NTSTRSAFE_LIB
31 #include <ntstrsafe.h>
33 #define __DRIVER_NAME "XenVbd"
35 #include <xen_windows.h>
36 #include <memory.h>
37 #include <grant_table.h>
38 #include <event_channel.h>
39 #include <hvm/params.h>
40 #include <hvm/hvm_op.h>
41 #include <xen_public.h>
42 #include <io/ring.h>
43 #include <io/blkif.h>
45 #define XENVBD_POOL_TAG (ULONG) 'XVBD'
47 #define UNALIGNED_DOUBLE_BUFFER_SIZE (PAGE_SIZE * 1)
48 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
49 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
50 #define BLK_OTHER_RING_SIZE __RING_SIZE((blkif_other_sring_t *)0, PAGE_SIZE)
52 #if defined(__x86_64__)
53 #pragma pack(push, 4)
54 #endif
55 struct blkif_other_request {
56 uint8_t operation;
57 uint8_t nr_segments;
58 blkif_vdev_t handle;
59 uint64_t id;
60 blkif_sector_t sector_number;
61 struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
62 };
63 struct blkif_other_response {
64 uint64_t id;
65 uint8_t operation;
66 int16_t status;
67 };
68 #if defined(__x86_64__)
69 #pragma pack(pop)
70 #endif
72 typedef struct blkif_other_request blkif_other_request_t;
73 typedef struct blkif_other_response blkif_other_response_t;
74 DEFINE_RING_TYPES(blkif_other, struct blkif_other_request, struct blkif_other_response);
76 typedef struct {
77 blkif_request_t req;
78 PSCSI_REQUEST_BLOCK srb;
79 ULONG offset;
80 ULONG length;
81 } blkif_shadow_t;
83 #define SHADOW_ENTRIES 16
84 #define MAX_GRANT_ENTRIES 512
86 typedef enum {
87 XENVBD_DEVICETYPE_UNKNOWN,
88 XENVBD_DEVICETYPE_DISK,
89 XENVBD_DEVICETYPE_CDROM,
90 XENVBD_DEVICETYPE_CONTROLLER // Not yet used
91 } XENVBD_DEVICETYPE;
93 struct
94 {
95 blkif_shadow_t shadows[SHADOW_ENTRIES];
96 USHORT shadow_free_list[SHADOW_ENTRIES];
97 USHORT shadow_free;
98 USHORT shadow_min_free;
100 grant_ref_t grant_free_list[MAX_GRANT_ENTRIES];
101 USHORT grant_free;
102 USHORT grant_entries;
104 evtchn_port_t event_channel;
105 union {
106 blkif_front_ring_t ring;
107 blkif_other_front_ring_t other_ring;
108 };
109 int ring_detect_state;
110 BOOLEAN use_other;
111 UCHAR last_sense_key;
112 UCHAR last_additional_sense_code;
113 blkif_response_t tmp_rep;
114 XENVBD_DEVICETYPE device_type;
115 DISK_GEOMETRY Geometry;
116 ULONG bytes_per_sector;
117 ULONGLONG total_sectors;
118 XENPCI_VECTORS vectors;
119 PSCSI_REQUEST_BLOCK pending_srb;
120 BOOLEAN split_request_in_progress;
122 ULONGLONG interrupts;
123 ULONGLONG aligned_requests;
124 ULONGLONG aligned_bytes;
125 ULONGLONG unaligned_requests;
126 ULONGLONG unaligned_bytes;
127 ULONGLONG no_free_grant_requests;
128 } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;
130 VOID
131 XenVbd_FillInitCallbacks(PHW_INITIALIZATION_DATA HwInitializationData);
133 #endif