win-pvdrivers

view xenpci/xenpci_device_interface.c @ 1001:c21dd04d3ae6

Less noise for xennet6
author James Harper <james.harper@bendigoit.com.au>
date Fri Dec 14 21:26:22 2012 +1100 (2012-12-14)
parents 1bae3638ab55
children
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2009 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 #include "xenpci.h"
22 VOID
23 XenPci_EvtDeviceFileCreate(WDFDEVICE device, WDFREQUEST request, WDFFILEOBJECT file_object)
24 {
25 NTSTATUS status;
26 PXENPCI_DEVICE_INTERFACE_DATA xpdid = GetXpdid(file_object);
27 WDF_IO_QUEUE_CONFIG queue_config;
29 FUNCTION_ENTER();
31 xpdid->type = DEVICE_INTERFACE_TYPE_XENBUS; //TODO: determine the actual type
33 KeInitializeSpinLock(&xpdid->lock);
34 WDF_IO_QUEUE_CONFIG_INIT(&queue_config, WdfIoQueueDispatchSequential);
35 status = XenBus_DeviceFileInit(device, &queue_config, file_object); /* this completes the queue init */
36 if (!NT_SUCCESS(status)) {
37 WdfRequestComplete(request, STATUS_UNSUCCESSFUL);
38 }
39 status = WdfIoQueueCreate(device, &queue_config, WDF_NO_OBJECT_ATTRIBUTES, &xpdid->io_queue);
40 if (!NT_SUCCESS(status)) {
41 KdPrint(("Error creating queue 0x%x\n", status));
42 WdfRequestComplete(request, STATUS_UNSUCCESSFUL);
43 }
45 WdfRequestComplete(request, STATUS_SUCCESS);
47 FUNCTION_EXIT();
48 }
50 VOID
51 XenPci_EvtFileCleanup(WDFFILEOBJECT file_object)
52 {
53 PXENPCI_DEVICE_INTERFACE_DATA xpdid = GetXpdid(file_object);
55 FUNCTION_ENTER();
56 xpdid->EvtFileCleanup(file_object);
57 FUNCTION_EXIT();
58 }
60 VOID
61 XenPci_EvtFileClose(WDFFILEOBJECT file_object)
62 {
64 PXENPCI_DEVICE_INTERFACE_DATA xpdid = GetXpdid(file_object);
66 FUNCTION_ENTER();
67 xpdid->EvtFileClose(file_object);
68 FUNCTION_EXIT();
69 }
71 VOID
72 XenPci_EvtIoDefault(WDFQUEUE queue, WDFREQUEST request)
73 {
74 WDFFILEOBJECT file_object = WdfRequestGetFileObject(request);
75 PXENPCI_DEVICE_INTERFACE_DATA xpdid = GetXpdid(file_object);
77 UNREFERENCED_PARAMETER(queue);
79 FUNCTION_ENTER();
80 WdfRequestForwardToIoQueue(request, xpdid->io_queue);
81 FUNCTION_EXIT();
82 }