win-pvdrivers

changeset 485:0c0efefd40f4

Removed xenconfig - resource faking and setup now occurs in xenpci
author James Harper <james.harper@bendigoit.com.au>
date Sun Dec 07 11:51:12 2008 +1100 (2008-12-07)
parents 8f8c9edeac01
children efb43e8b47ec
files dirs installer.nsi xenconfig/makefile.inc xenconfig/sources xenconfig/xenconfig.c xenconfig/xenconfig.h xenpci/xenpci_pdo.c
line diff
     1.1 --- a/dirs	Sat Dec 06 16:23:28 2008 +1100
     1.2 +++ b/dirs	Sun Dec 07 11:51:12 2008 +1100
     1.3 @@ -1,1 +1,1 @@
     1.4 -DIRS=xenpci xenhide xenvbd xennet xenscsi xenstub xenconfig copyconfig shutdownmon
     1.5 \ No newline at end of file
     1.6 +DIRS=xenpci xenhide xenvbd xennet xenscsi xenstub copyconfig shutdownmon
     1.7 \ No newline at end of file
     2.1 --- a/installer.nsi	Sat Dec 06 16:23:28 2008 +1100
     2.2 +++ b/installer.nsi	Sun Dec 07 11:51:12 2008 +1100
     2.3 @@ -72,7 +72,6 @@ Section "Windows 2000" win2k
     2.4    File .\target\win2k\i386\xenvbd.sys
     2.5    File .\target\win2k\i386\xenscsi.sys
     2.6    File .\target\win2k\i386\xenstub.sys
     2.7 -  File .\target\win2k\i386\xenconfig.sys
     2.8  SectionEnd
     2.9  
    2.10  Section "Windows XP" winxp
    2.11 @@ -92,7 +91,6 @@ Section "Windows XP" winxp
    2.12    File .\target\winxp\i386\xenvbd.sys
    2.13    File .\target\winxp\i386\xenscsi.sys
    2.14    File .\target\winxp\i386\xenstub.sys
    2.15 -  File .\target\winxp\i386\xenconfig.sys
    2.16  SectionEnd
    2.17  
    2.18  Section "Windows 2003 x32" win2k3x32
    2.19 @@ -112,7 +110,6 @@ Section "Windows 2003 x32" win2k3x32
    2.20    File .\target\winnet\i386\xenvbd.sys
    2.21    File .\target\winnet\i386\xenscsi.sys
    2.22    File .\target\winnet\i386\xenstub.sys
    2.23 -  File .\target\winnet\i386\xenconfig.sys
    2.24  SectionEnd
    2.25  
    2.26  Section "Windows 2003 x64" win2k3x64
    2.27 @@ -132,7 +129,6 @@ Section "Windows 2003 x64" win2k3x64
    2.28    File .\target\winnet\amd64\xenvbd.sys
    2.29    File .\target\winnet\amd64\xenscsi.sys
    2.30    File .\target\winnet\amd64\xenstub.sys
    2.31 -  File .\target\winnet\amd64\xenconfig.sys
    2.32  SectionEnd
    2.33  
    2.34  Section "Windows 2008 x32" win2k8x32
    2.35 @@ -152,7 +148,6 @@ Section "Windows 2008 x32" win2k8x32
    2.36    File .\target\winlh\i386\xenvbd.sys
    2.37    File .\target\winlh\i386\xenscsi.sys
    2.38    File .\target\winlh\i386\xenstub.sys
    2.39 -  File .\target\winlh\i386\xenconfig.sys
    2.40  SectionEnd
    2.41  
    2.42  Section "Windows 2008 x64" win2k8x64
    2.43 @@ -172,7 +167,6 @@ Section "Windows 2008 x64" win2k8x64
    2.44    File .\target\winlh\amd64\xenvbd.sys
    2.45    File .\target\winlh\amd64\xenscsi.sys
    2.46    File .\target\winlh\amd64\xenstub.sys
    2.47 -  File .\target\winlh\amd64\xenconfig.sys
    2.48  SectionEnd
    2.49  
    2.50  Section /o "Install Cert" installcert
     3.1 --- a/xenconfig/sources	Sat Dec 06 16:23:28 2008 +1100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,5 +0,0 @@
     3.4 -!INCLUDE ..\common.inc
     3.5 -TARGETNAME=xenconfig
     3.6 -TARGETTYPE=DRIVER
     3.7 -INF_NAME=$(TARGETNAME)
     3.8 -SOURCES=xenconfig.c
     4.1 --- a/xenconfig/xenconfig.c	Sat Dec 06 16:23:28 2008 +1100
     4.2 +++ b/xenconfig/xenconfig.c	Sun Dec 07 11:51:12 2008 +1100
     4.3 @@ -391,6 +391,7 @@ XenConfig_Pnp(PDEVICE_OBJECT device_obje
     4.4    stack = IoGetCurrentIrpStackLocation(irp);
     4.5  
     4.6    switch (stack->MinorFunction) {
     4.7 +#if 0
     4.8    case IRP_MN_START_DEVICE:
     4.9      return XenConfig_Pnp_StartDevice(device_object, irp);
    4.10    case IRP_MN_QUERY_CAPABILITIES:
    4.11 @@ -401,6 +402,7 @@ XenConfig_Pnp(PDEVICE_OBJECT device_obje
    4.12      IoCompleteRequest(irp, IO_NO_INCREMENT);
    4.13  //    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    4.14      return status;
    4.15 +#endif
    4.16    default:
    4.17      IoSkipCurrentIrpStackLocation(irp);
    4.18      status = IoCallDriver(xcdd->lower_do, irp);
     5.1 --- a/xenconfig/xenconfig.h	Sat Dec 06 16:23:28 2008 +1100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,45 +0,0 @@
     5.4 -/*
     5.5 -PV Drivers for Windows Xen HVM Domains
     5.6 -Copyright (C) 2007 James Harper
     5.7 -
     5.8 -This program is free software; you can redistribute it and/or
     5.9 -modify it under the terms of the GNU General Public License
    5.10 -as published by the Free Software Foundation; either version 2
    5.11 -of the License, or (at your option) any later version.
    5.12 -
    5.13 -This program is distributed in the hope that it will be useful,
    5.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.16 -GNU General Public License for more details.
    5.17 -
    5.18 -You should have received a copy of the GNU General Public License
    5.19 -along with this program; if not, write to the Free Software
    5.20 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    5.21 -*/
    5.22 -
    5.23 -#if !defined(_XENCONFIG_H_)
    5.24 -#define _XENCONFIG_H_
    5.25 -
    5.26 -#include <ntddk.h>
    5.27 -#include <wdm.h>
    5.28 -#include <initguid.h>
    5.29 -#include <wdmguid.h>
    5.30 -#include <errno.h>
    5.31 -#define NTSTRSAFE_LIB
    5.32 -#include <ntstrsafe.h>
    5.33 -#define __DRIVER_NAME "XenConfig"
    5.34 -#include <xen_windows.h>
    5.35 -#include <xen_public.h>
    5.36 -
    5.37 -#define XENCONFIG_POOL_TAG (ULONG) 'XenC'
    5.38 -
    5.39 -typedef struct
    5.40 -{
    5.41 -  PDEVICE_OBJECT filter_do;
    5.42 -  PDEVICE_OBJECT pdo;
    5.43 -  PDEVICE_OBJECT lower_do;
    5.44 -
    5.45 -  PMDL config_mdl;
    5.46 -} XENCONFIG_DEVICE_DATA, *PXENCONFIG_DEVICE_DATA;
    5.47 -
    5.48 -#endif
     6.1 --- a/xenpci/xenpci_pdo.c	Sat Dec 06 16:23:28 2008 +1100
     6.2 +++ b/xenpci/xenpci_pdo.c	Sun Dec 07 11:51:12 2008 +1100
     6.3 @@ -947,6 +947,179 @@ XenPci_DumpPdoConfig(PDEVICE_OBJECT devi
     6.4    KdPrint((__DRIVER_NAME "     irq_vector = %x\n", xppdd->irq_vector));
     6.5  }
     6.6  
     6.7 +static PMDL
     6.8 +XenConfig_MakeConfigPage(PDEVICE_OBJECT device_object)
     6.9 +{
    6.10 +  NTSTATUS status;
    6.11 +
    6.12 +  //PXENCONFIG_DEVICE_DATA xcdd = (PXENCONFIG_DEVICE_DATA)device_object->DeviceExtension;
    6.13 +  //PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
    6.14 +  //PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
    6.15 +
    6.16 +  HANDLE hwkey_handle, xenkey_handle, confkey_handle;
    6.17 +  ULONG length;
    6.18 +  PKEY_BASIC_INFORMATION key_info;
    6.19 +  PKEY_VALUE_PARTIAL_INFORMATION type_info;
    6.20 +  PKEY_VALUE_PARTIAL_INFORMATION value_info;
    6.21 +  UNICODE_STRING xenkey_name, confkey_name;
    6.22 +  UNICODE_STRING type_name, value_name;
    6.23 +  UNICODE_STRING tmp_unicode_string;
    6.24 +  //UNICODE_STRING typekey_value, valuekey_value;
    6.25 +  //UNICODE_STRING value_value;
    6.26 +  OBJECT_ATTRIBUTES oa;
    6.27 +  ULONG info_length = 1000;
    6.28 +  PMDL mdl;
    6.29 +  UCHAR type;
    6.30 +  ANSI_STRING setting;
    6.31 +  ANSI_STRING value;
    6.32 +  PUCHAR ptr;
    6.33 +  int i;
    6.34 +
    6.35 +  mdl = AllocateUncachedPage();
    6.36 +  ptr = MmGetMdlVirtualAddress(mdl);
    6.37 +
    6.38 +  status = IoOpenDeviceRegistryKey(device_object, PLUGPLAY_REGKEY_DEVICE, KEY_READ, &hwkey_handle);
    6.39 +
    6.40 +  if (!NT_SUCCESS(status))
    6.41 +  {
    6.42 +    KdPrint((__DRIVER_NAME "    cannot get hardware key\n"));
    6.43 +    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL);          
    6.44 +    return mdl;
    6.45 +  }
    6.46 +  RtlInitUnicodeString(&xenkey_name, L"XenConfig");
    6.47 +  InitializeObjectAttributes(&oa, &xenkey_name, 0, hwkey_handle, NULL);
    6.48 +  status = ZwOpenKey(&xenkey_handle, KEY_READ, &oa);
    6.49 +  if (!NT_SUCCESS(status))
    6.50 +  {
    6.51 +    // close key_handle
    6.52 +    KdPrint((__DRIVER_NAME "    cannot get XenConfig key\n"));
    6.53 +    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL);          
    6.54 +    return mdl;
    6.55 +  }
    6.56 +  // XenConfig key exists, so we go ahead and make fake memory resources
    6.57 +  RtlInitUnicodeString(&type_name, L"type");
    6.58 +  RtlInitUnicodeString(&value_name, L"value");
    6.59 +  key_info = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    6.60 +  type_info = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    6.61 +  value_info = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    6.62 +  //value.Buffer = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    6.63 +  //value.MaximumLength = info_length;
    6.64 +  setting.Buffer = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    6.65 +  setting.MaximumLength = (USHORT)info_length;
    6.66 +  
    6.67 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RUN, NULL, NULL);
    6.68 +  for (i = 0; ZwEnumerateKey(xenkey_handle, i, KeyBasicInformation, key_info, info_length, &length) == STATUS_SUCCESS; i++)
    6.69 +  {
    6.70 +    confkey_name.Length = (USHORT)key_info->NameLength;
    6.71 +    confkey_name.MaximumLength = (USHORT)key_info->NameLength;
    6.72 +    confkey_name.Buffer = key_info->Name;
    6.73 +    RtlUnicodeStringToAnsiString(&setting, &confkey_name, FALSE);
    6.74 +    setting.Buffer[setting.Length] = 0;
    6.75 +    KdPrint((__DRIVER_NAME "     config key name = '%wZ'\n", &confkey_name));
    6.76 +    InitializeObjectAttributes(&oa, &confkey_name, 0, xenkey_handle, NULL);
    6.77 +    status = ZwOpenKey(&confkey_handle, KEY_READ, &oa);
    6.78 +    if (!NT_SUCCESS(status))
    6.79 +    {
    6.80 +      KdPrint((__DRIVER_NAME "    cannot get handle for XenConfig\\%wZ\n", &confkey_name));
    6.81 +      continue;
    6.82 +    }
    6.83 +    
    6.84 +    status = ZwQueryValueKey(confkey_handle, &type_name, KeyValuePartialInformation, type_info, info_length, &length);
    6.85 +    // make sure type is dword
    6.86 +    type = (UCHAR)*(ULONG *)type_info->Data;
    6.87 +    status = ZwQueryValueKey(confkey_handle, &value_name, KeyValuePartialInformation, value_info, info_length, &length);
    6.88 +    if (!NT_SUCCESS(status))
    6.89 +    {
    6.90 +      ADD_XEN_INIT_REQ(&ptr, type, setting.Buffer, NULL);
    6.91 +    }
    6.92 +    else
    6.93 +    {
    6.94 +      switch(value_info->Type)
    6.95 +      {
    6.96 +      case REG_DWORD:
    6.97 +        ADD_XEN_INIT_REQ(&ptr, type, setting.Buffer, UlongToPtr(*(PULONG)value_info->Data));
    6.98 +        break;
    6.99 +        
   6.100 +      case REG_SZ:
   6.101 +        tmp_unicode_string.Length = (USHORT)value_info->DataLength;
   6.102 +        tmp_unicode_string.MaximumLength = (USHORT)value_info->DataLength;
   6.103 +        tmp_unicode_string.Buffer = (PWCHAR)value_info->Data;
   6.104 +        RtlUnicodeStringToAnsiString(&value, &tmp_unicode_string, FALSE);
   6.105 +        value.Buffer[value.Length] = 0;
   6.106 +        ADD_XEN_INIT_REQ(&ptr, type, setting.Buffer, value.Buffer);
   6.107 +        break;
   6.108 +      
   6.109 +      default:
   6.110 +        // report error here
   6.111 +        break;
   6.112 +      }
   6.113 +    }
   6.114 +  }
   6.115 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL);          
   6.116 +
   6.117 +  ExFreePoolWithTag(key_info, XENPCI_POOL_TAG);
   6.118 +
   6.119 +  return mdl;
   6.120 +}
   6.121 +#if 0
   6.122 +static NTSTATUS
   6.123 +XenConfig_Pnp_StartDevice(PDEVICE_OBJECT device_object, PIRP irp)
   6.124 +{
   6.125 +  PIO_STACK_LOCATION stack;
   6.126 +  PMDL mdl;
   6.127 +  PCM_RESOURCE_LIST old_crl, new_crl;
   6.128 +  PCM_PARTIAL_RESOURCE_LIST prl;
   6.129 +  PCM_PARTIAL_RESOURCE_DESCRIPTOR prd;
   6.130 +  ULONG old_length, new_length;
   6.131 +
   6.132 +  UNREFERENCED_PARAMETER(device_object);
   6.133 +
   6.134 +  FUNCTION_ENTER();
   6.135 +
   6.136 +  stack = IoGetCurrentIrpStackLocation(irp);
   6.137 +
   6.138 +  if ((mdl = XenConfig_MakeConfigPage(device_object)) != NULL)
   6.139 +  {
   6.140 +    old_crl = stack->Parameters.StartDevice.AllocatedResourcesTranslated;
   6.141 +    old_length = FIELD_OFFSET(CM_RESOURCE_LIST, List) + 
   6.142 +      FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList) +
   6.143 +      FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
   6.144 +      sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * old_crl->List[0].PartialResourceList.Count;
   6.145 +    new_length = old_length + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 1;
   6.146 +    new_crl = ExAllocatePoolWithTag(PagedPool, new_length, XENPCI_POOL_TAG);
   6.147 +    memcpy(new_crl, old_crl, old_length);
   6.148 +    prl = &new_crl->List[0].PartialResourceList;
   6.149 +    prd = &prl->PartialDescriptors[prl->Count++];
   6.150 +    prd->Type = CmResourceTypeMemory;
   6.151 +    prd->ShareDisposition = CmResourceShareDeviceExclusive;
   6.152 +    prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
   6.153 +    KdPrint((__DRIVER_NAME "     PFN[0] = %p\n", MmGetMdlPfnArray(mdl)[0]));
   6.154 +    prd->u.Memory.Start.QuadPart = ((ULONGLONG)MmGetMdlPfnArray(mdl)[0]) << PAGE_SHIFT;
   6.155 +    prd->u.Memory.Length = PAGE_SIZE;
   6.156 +    KdPrint((__DRIVER_NAME "     Start = %08x:%08x, Length = %d\n", prd->u.Memory.Start.HighPart, prd->u.Memory.Start.LowPart, prd->u.Memory.Length));
   6.157 +    stack->Parameters.StartDevice.AllocatedResourcesTranslated = new_crl;
   6.158 +
   6.159 +    old_crl = stack->Parameters.StartDevice.AllocatedResources;
   6.160 +    new_crl = ExAllocatePoolWithTag(PagedPool, new_length, XENPCI_POOL_TAG);
   6.161 +    memcpy(new_crl, old_crl, old_length);
   6.162 +    prl = &new_crl->List[0].PartialResourceList;
   6.163 +    prd = &prl->PartialDescriptors[prl->Count++];
   6.164 +    prd->Type = CmResourceTypeMemory;
   6.165 +    prd->ShareDisposition = CmResourceShareDeviceExclusive;
   6.166 +    prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
   6.167 +    prd->u.Memory.Start.QuadPart = (ULONGLONG)MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
   6.168 +    prd->u.Memory.Length = PAGE_SIZE;
   6.169 +    stack->Parameters.StartDevice.AllocatedResources = new_crl;
   6.170 +
   6.171 +    // free the original resource lists???
   6.172 +  }
   6.173 +
   6.174 +  FUNCTION_EXIT();
   6.175 +  
   6.176 +  return STATUS_PENDING;
   6.177 +}
   6.178 +#endif
   6.179 +
   6.180  static NTSTATUS
   6.181  XenPci_Pnp_StartDevice(PDEVICE_OBJECT device_object, PIRP irp)
   6.182  {
   6.183 @@ -958,6 +1131,7 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   6.184    PCM_PARTIAL_RESOURCE_DESCRIPTOR prd;
   6.185    ULONG i;
   6.186    char path[128];
   6.187 +  PMDL mdl;
   6.188   
   6.189    FUNCTION_ENTER();
   6.190  
   6.191 @@ -971,6 +1145,8 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   6.192      return status;
   6.193    }
   6.194  
   6.195 +  mdl = XenConfig_MakeConfigPage(device_object);
   6.196 +  
   6.197    prl = &stack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
   6.198    for (i = 0; i < prl->Count; i++)
   6.199    {
   6.200 @@ -984,6 +1160,13 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   6.201        xppdd->irq_number = prd->u.Interrupt.Vector;
   6.202        //xppdd->irq_level = (KIRQL)prd->u.Interrupt.Level;
   6.203        break;
   6.204 +    case CmResourceTypeMemory:
   6.205 +      if (prd->u.Memory.Length == 0)
   6.206 +      {
   6.207 +        prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
   6.208 +        prd->u.Memory.Length = MmGetMdlByteCount(mdl);
   6.209 +      }
   6.210 +      break;
   6.211      }
   6.212    }
   6.213  
   6.214 @@ -1001,26 +1184,30 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   6.215        xppdd->irq_level = (KIRQL)prd->u.Interrupt.Level;
   6.216        break;
   6.217      case CmResourceTypeMemory:
   6.218 -      if (prd->u.Memory.Start.QuadPart)
   6.219 +      if (prd->u.Memory.Length == 0)
   6.220        {
   6.221 -        KdPrint((__DRIVER_NAME "     CmResourceTypeMemory\n"));
   6.222 -        KdPrint((__DRIVER_NAME "     Start = %08x, Length = %d\n", prd->u.Memory.Start.LowPart, prd->u.Memory.Length));
   6.223 -        xppdd->config_page_phys = prd->u.Memory.Start;
   6.224 -        xppdd->config_page_length = prd->u.Memory.Length;
   6.225 -        xppdd->requested_resources_start = xppdd->requested_resources_ptr = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
   6.226 -        xppdd->assigned_resources_start = xppdd->assigned_resources_ptr = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
   6.227 -        
   6.228 -        status = XenPci_XenConfigDevice(xppdd);
   6.229 -        if (!NT_SUCCESS(status))
   6.230 -        {
   6.231 -          RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
   6.232 -          XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackEndStateHandler, xppdd);
   6.233 -          FUNCTION_ERROR_EXIT();
   6.234 -          return status;
   6.235 -        }
   6.236 +        prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
   6.237 +        prd->u.Memory.Length = MmGetMdlByteCount(mdl);
   6.238        }
   6.239 +      KdPrint((__DRIVER_NAME "     CmResourceTypeMemory\n"));
   6.240 +      KdPrint((__DRIVER_NAME "     Start = %08x, Length = %d\n", prd->u.Memory.Start.LowPart, prd->u.Memory.Length));
   6.241 +      xppdd->config_page_phys = prd->u.Memory.Start;
   6.242 +      xppdd->config_page_length = prd->u.Memory.Length;
   6.243 +      xppdd->requested_resources_start = xppdd->requested_resources_ptr = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
   6.244 +      xppdd->assigned_resources_start = xppdd->assigned_resources_ptr = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
   6.245 +      
   6.246 +      status = XenPci_XenConfigDevice(xppdd);
   6.247 +      if (!NT_SUCCESS(status))
   6.248 +      {
   6.249 +        RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
   6.250 +        XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackEndStateHandler, xppdd);
   6.251 +        FUNCTION_ERROR_EXIT();
   6.252 +        return status;
   6.253 +      }
   6.254 +      break;
   6.255      }
   6.256    }
   6.257 +
   6.258    SET_PNP_STATE(&xppdd->common, Started);
   6.259    
   6.260    FUNCTION_EXIT();
   6.261 @@ -1074,7 +1261,7 @@ XenPci_QueryResourceRequirements(PDEVICE
   6.262  
   6.263    length = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List) +
   6.264      FIELD_OFFSET(IO_RESOURCE_LIST, Descriptors) +
   6.265 -    sizeof(IO_RESOURCE_DESCRIPTOR) * 1;
   6.266 +    sizeof(IO_RESOURCE_DESCRIPTOR) * 2;
   6.267    irrl = ExAllocatePoolWithTag(NonPagedPool,
   6.268      length,
   6.269      XENPCI_POOL_TAG);
   6.270 @@ -1095,6 +1282,16 @@ XenPci_QueryResourceRequirements(PDEVICE
   6.271    ird->Flags = (xpdd->irq_mode == Latched)?CM_RESOURCE_INTERRUPT_LATCHED:CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
   6.272    ird->u.Interrupt.MinimumVector = xpdd->irq_number;
   6.273    ird->u.Interrupt.MaximumVector = xpdd->irq_number;
   6.274 +
   6.275 +  ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
   6.276 +  ird->Option = 0;
   6.277 +  ird->Type = CmResourceTypeMemory;
   6.278 +  ird->ShareDisposition = CmResourceShareShared;
   6.279 +  ird->Flags = CM_RESOURCE_MEMORY_READ_WRITE | CM_RESOURCE_MEMORY_CACHEABLE;
   6.280 +  ird->u.Memory.MinimumAddress = xpdd->platform_mmio_addr;
   6.281 +  ird->u.Memory.MaximumAddress = xpdd->platform_mmio_addr;
   6.282 +  ird->u.Memory.Length = 0;
   6.283 +  ird->u.Memory.Alignment = PAGE_SIZE;
   6.284    
   6.285    irp->IoStatus.Information = (ULONG_PTR)irrl;
   6.286    return STATUS_SUCCESS;