win-pvdrivers

view xenvbd_scsiport/xenvbd.h @ 1087:494bfa9c34c4

Apply same fix from xenvbd_storport to fix problem with crash dump
author James Harper <james.harper@bendigoit.com.au>
date Tue Dec 24 15:43:21 2013 +1100 (2013-12-24)
parents fe3af8f4d54b
children 27bd2a5a4704
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2013 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 <ntddk.h>
24 //#include <wdm.h>
25 #include <initguid.h>
26 #define NTSTRSAFE_LIB
27 #include <ntstrsafe.h>
29 #if (NTDDI_VERSION < NTDDI_WINXP) /* srb.h causes warnings under 2K for some reason */
30 #pragma warning(disable:4201) /* nameless struct/union */
31 #pragma warning(disable:4214) /* bit field types other than int */
32 #endif
34 #include <srb.h>
35 #include <scsi.h>
36 #include <ntddscsi.h>
37 #include <ntdddisk.h>
38 #include <stdlib.h>
40 #define __DRIVER_NAME "XenVbd"
42 #include <xen_windows.h>
43 #include <xen_public.h>
44 #include <io/protocols.h>
45 #include <memory.h>
46 #include <event_channel.h>
47 #include <hvm/params.h>
48 #include <hvm/hvm_op.h>
49 #include <io/ring.h>
50 #include <io/blkif.h>
51 #include <io/xenbus.h>
53 #include "..\xenvbd_common\common.h"
55 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
56 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
58 #define SHADOW_ID_ID_MASK 0x03FF /* maximum of 1024 requests - currently use a maximum of 64 though */
59 #define SHADOW_ID_DUMP_FLAG 0x8000 /* indicates the request was generated by dump mode */
61 /* if this is ever increased to more than 1 then we need a way of tracking it properly */
62 #define DUMP_MODE_UNALIGNED_PAGES 1 /* only for unaligned buffer use */
64 #include "common.h"
66 struct {
67 PXENVBD_DEVICE_DATA xvdd;
68 ULONG outstanding;
69 PVOID hypercall_stubs;
70 PSCSI_REQUEST_BLOCK stop_srb;
71 /* this is the size of the buffer to allocate at the end of DeviceExtenstion. It includes an extra PAGE_SIZE-1 bytes to assure that we can always align to PAGE_SIZE */
72 #define UNALIGNED_BUFFER_DATA_SIZE ((BLKIF_MAX_SEGMENTS_PER_REQUEST + 1) * PAGE_SIZE - 1)
73 #define UNALIGNED_BUFFER_DATA_SIZE_DUMP_MODE ((DUMP_MODE_UNALIGNED_PAGES + 1) * PAGE_SIZE - 1)
74 /* this has to be right at the end of DeviceExtension */
75 /* can't allocate too much data in dump mode so size DeviceExtensionSize accordingly */
76 UCHAR aligned_buffer_data[1];
77 } typedef XENVBD_SCSIPORT_DATA, *PXENVBD_SCSIPORT_DATA;
79 #endif