win-pvdrivers

changeset 305:b4f7d75fbe24 wdm

Trying to make the devices appear more pci-like, pushing config into the inf files.
Fixed a bug which was causing crashes when multiple unaligned requests were issued concurrently
author James Harper <james.harper@bendigoit.com.au>
date Wed Jun 11 20:18:33 2008 +1000 (2008-06-11)
parents ad900d2d7507
children 6b85686a16c0
files common.inc common/include/public/memory.h xenpci/xenpci.h xenpci/xenpci_pdo.c xenvbd/scsiport.c xenvbd/xenvbd.c xenvbd/xenvbd.inx
line diff
     1.1 --- a/common.inc	Sun Jun 08 23:13:49 2008 +1000
     1.2 +++ b/common.inc	Wed Jun 11 20:18:33 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.8.0
     1.5 +VERSION=0.9.8.5
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/common/include/public/memory.h	Sun Jun 08 23:13:49 2008 +1000
     2.2 +++ b/common/include/public/memory.h	Wed Jun 11 20:18:33 2008 +1000
     2.3 @@ -1,281 +1,281 @@
     2.4 -/******************************************************************************
     2.5 - * memory.h
     2.6 - * 
     2.7 - * Memory reservation and information.
     2.8 - * 
     2.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.10 - * of this software and associated documentation files (the "Software"), to
    2.11 - * deal in the Software without restriction, including without limitation the
    2.12 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    2.13 - * sell copies of the Software, and to permit persons to whom the Software is
    2.14 - * furnished to do so, subject to the following conditions:
    2.15 - *
    2.16 - * The above copyright notice and this permission notice shall be included in
    2.17 - * all copies or substantial portions of the Software.
    2.18 - *
    2.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.24 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    2.25 - * DEALINGS IN THE SOFTWARE.
    2.26 - *
    2.27 - * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
    2.28 - */
    2.29 -
    2.30 -#ifndef __XEN_PUBLIC_MEMORY_H__
    2.31 -#define __XEN_PUBLIC_MEMORY_H__
    2.32 -
    2.33 -/*
    2.34 - * Increase or decrease the specified domain's memory reservation. Returns the
    2.35 - * number of extents successfully allocated or freed.
    2.36 - * arg == addr of struct xen_memory_reservation.
    2.37 - */
    2.38 -#define XENMEM_increase_reservation 0
    2.39 -#define XENMEM_decrease_reservation 1
    2.40 -#define XENMEM_populate_physmap     6
    2.41 -struct xen_memory_reservation {
    2.42 -
    2.43 -    /*
    2.44 -     * XENMEM_increase_reservation:
    2.45 -     *   OUT: MFN (*not* GMFN) bases of extents that were allocated
    2.46 -     * XENMEM_decrease_reservation:
    2.47 -     *   IN:  GMFN bases of extents to free
    2.48 -     * XENMEM_populate_physmap:
    2.49 -     *   IN:  GPFN bases of extents to populate with memory
    2.50 -     *   OUT: GMFN bases of extents that were allocated
    2.51 -     *   (NB. This command also updates the mach_to_phys translation table)
    2.52 -     */
    2.53 -    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
    2.54 -
    2.55 -    /* Number of extents, and size/alignment of each (2^extent_order pages). */
    2.56 -    xen_ulong_t    nr_extents;
    2.57 -    unsigned int   extent_order;
    2.58 -
    2.59 -    /*
    2.60 -     * Maximum # bits addressable by the user of the allocated region (e.g., 
    2.61 -     * I/O devices often have a 32-bit limitation even in 64-bit systems). If 
    2.62 -     * zero then the user has no addressing restriction.
    2.63 -     * This field is not used by XENMEM_decrease_reservation.
    2.64 -     */
    2.65 -    unsigned int   address_bits;
    2.66 -
    2.67 -    /*
    2.68 -     * Domain whose reservation is being changed.
    2.69 -     * Unprivileged domains can specify only DOMID_SELF.
    2.70 -     */
    2.71 -    domid_t        domid;
    2.72 -};
    2.73 -typedef struct xen_memory_reservation xen_memory_reservation_t;
    2.74 -DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
    2.75 -
    2.76 -/*
    2.77 - * An atomic exchange of memory pages. If return code is zero then
    2.78 - * @out.extent_list provides GMFNs of the newly-allocated memory.
    2.79 - * Returns zero on complete success, otherwise a negative error code.
    2.80 - * On complete success then always @nr_exchanged == @in.nr_extents.
    2.81 - * On partial success @nr_exchanged indicates how much work was done.
    2.82 - */
    2.83 -#define XENMEM_exchange             11
    2.84 -struct xen_memory_exchange {
    2.85 -    /*
    2.86 -     * [IN] Details of memory extents to be exchanged (GMFN bases).
    2.87 -     * Note that @in.address_bits is ignored and unused.
    2.88 -     */
    2.89 -    struct xen_memory_reservation in;
    2.90 -
    2.91 -    /*
    2.92 -     * [IN/OUT] Details of new memory extents.
    2.93 -     * We require that:
    2.94 -     *  1. @in.domid == @out.domid
    2.95 -     *  2. @in.nr_extents  << @in.extent_order == 
    2.96 -     *     @out.nr_extents << @out.extent_order
    2.97 -     *  3. @in.extent_start and @out.extent_start lists must not overlap
    2.98 -     *  4. @out.extent_start lists GPFN bases to be populated
    2.99 -     *  5. @out.extent_start is overwritten with allocated GMFN bases
   2.100 -     */
   2.101 -    struct xen_memory_reservation out;
   2.102 -
   2.103 -    /*
   2.104 -     * [OUT] Number of input extents that were successfully exchanged:
   2.105 -     *  1. The first @nr_exchanged input extents were successfully
   2.106 -     *     deallocated.
   2.107 -     *  2. The corresponding first entries in the output extent list correctly
   2.108 -     *     indicate the GMFNs that were successfully exchanged.
   2.109 -     *  3. All other input and output extents are untouched.
   2.110 -     *  4. If not all input exents are exchanged then the return code of this
   2.111 -     *     command will be non-zero.
   2.112 -     *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
   2.113 -     */
   2.114 -    xen_ulong_t nr_exchanged;
   2.115 -};
   2.116 -typedef struct xen_memory_exchange xen_memory_exchange_t;
   2.117 -DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
   2.118 -
   2.119 -/*
   2.120 - * Returns the maximum machine frame number of mapped RAM in this system.
   2.121 - * This command always succeeds (it never returns an error code).
   2.122 - * arg == NULL.
   2.123 - */
   2.124 -#define XENMEM_maximum_ram_page     2
   2.125 -
   2.126 -/*
   2.127 - * Returns the current or maximum memory reservation, in pages, of the
   2.128 - * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
   2.129 - * arg == addr of domid_t.
   2.130 - */
   2.131 -#define XENMEM_current_reservation  3
   2.132 -#define XENMEM_maximum_reservation  4
   2.133 -
   2.134 -/*
   2.135 - * Returns the maximum GPFN in use by the guest, or -ve errcode on failure.
   2.136 - */
   2.137 -#define XENMEM_maximum_gpfn         14
   2.138 -
   2.139 -/*
   2.140 - * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
   2.141 - * mapping table. Architectures which do not have a m2p table do not implement
   2.142 - * this command.
   2.143 - * arg == addr of xen_machphys_mfn_list_t.
   2.144 - */
   2.145 -#define XENMEM_machphys_mfn_list    5
   2.146 -struct xen_machphys_mfn_list {
   2.147 -    /*
   2.148 -     * Size of the 'extent_start' array. Fewer entries will be filled if the
   2.149 -     * machphys table is smaller than max_extents * 2MB.
   2.150 -     */
   2.151 -    unsigned int max_extents;
   2.152 -
   2.153 -    /*
   2.154 -     * Pointer to buffer to fill with list of extent starts. If there are
   2.155 -     * any large discontiguities in the machine address space, 2MB gaps in
   2.156 -     * the machphys table will be represented by an MFN base of zero.
   2.157 -     */
   2.158 -    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
   2.159 -
   2.160 -    /*
   2.161 -     * Number of extents written to the above array. This will be smaller
   2.162 -     * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
   2.163 -     */
   2.164 -    unsigned int nr_extents;
   2.165 -};
   2.166 -typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
   2.167 -DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
   2.168 -
   2.169 -/*
   2.170 - * Returns the location in virtual address space of the machine_to_phys
   2.171 - * mapping table. Architectures which do not have a m2p table, or which do not
   2.172 - * map it by default into guest address space, do not implement this command.
   2.173 - * arg == addr of xen_machphys_mapping_t.
   2.174 - */
   2.175 -#define XENMEM_machphys_mapping     12
   2.176 -struct xen_machphys_mapping {
   2.177 -    xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
   2.178 -    xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
   2.179 -};
   2.180 -typedef struct xen_machphys_mapping xen_machphys_mapping_t;
   2.181 -DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
   2.182 -
   2.183 -/*
   2.184 - * Sets the GPFN at which a particular page appears in the specified guest's
   2.185 - * pseudophysical address space.
   2.186 - * arg == addr of xen_add_to_physmap_t.
   2.187 - */
   2.188 -#define XENMEM_add_to_physmap      7
   2.189 -struct xen_add_to_physmap {
   2.190 -    /* Which domain to change the mapping for. */
   2.191 -    domid_t domid;
   2.192 -
   2.193 -    /* Source mapping space. */
   2.194 -#define XENMAPSPACE_shared_info 0 /* shared info page */
   2.195 -#define XENMAPSPACE_grant_table 1 /* grant table page */
   2.196 -    unsigned int space;
   2.197 -
   2.198 -    /* Index into source mapping space. */
   2.199 -    xen_ulong_t idx;
   2.200 -
   2.201 -    /* GPFN where the source mapping page should appear. */
   2.202 -    xen_pfn_t     gpfn;
   2.203 -};
   2.204 -typedef struct xen_add_to_physmap xen_add_to_physmap_t;
   2.205 -DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
   2.206 -
   2.207 -/*
   2.208 - * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
   2.209 - * code on failure. This call only works for auto-translated guests.
   2.210 - */
   2.211 -#define XENMEM_translate_gpfn_list  8
   2.212 -struct xen_translate_gpfn_list {
   2.213 -    /* Which domain to translate for? */
   2.214 -    domid_t domid;
   2.215 -
   2.216 -    /* Length of list. */
   2.217 -    xen_ulong_t nr_gpfns;
   2.218 -
   2.219 -    /* List of GPFNs to translate. */
   2.220 -    XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
   2.221 -
   2.222 -    /*
   2.223 -     * Output list to contain MFN translations. May be the same as the input
   2.224 -     * list (in which case each input GPFN is overwritten with the output MFN).
   2.225 -     */
   2.226 -    XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
   2.227 -};
   2.228 -typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
   2.229 -DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
   2.230 -
   2.231 -/*
   2.232 - * Returns the pseudo-physical memory map as it was when the domain
   2.233 - * was started (specified by XENMEM_set_memory_map).
   2.234 - * arg == addr of xen_memory_map_t.
   2.235 - */
   2.236 -#define XENMEM_memory_map           9
   2.237 -struct xen_memory_map {
   2.238 -    /*
   2.239 -     * On call the number of entries which can be stored in buffer. On
   2.240 -     * return the number of entries which have been stored in
   2.241 -     * buffer.
   2.242 -     */
   2.243 -    unsigned int nr_entries;
   2.244 -
   2.245 -    /*
   2.246 -     * Entries in the buffer are in the same format as returned by the
   2.247 -     * BIOS INT 0x15 EAX=0xE820 call.
   2.248 -     */
   2.249 -    XEN_GUEST_HANDLE(void) buffer;
   2.250 -};
   2.251 -typedef struct xen_memory_map xen_memory_map_t;
   2.252 -DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
   2.253 -
   2.254 -/*
   2.255 - * Returns the real physical memory map. Passes the same structure as
   2.256 - * XENMEM_memory_map.
   2.257 - * arg == addr of xen_memory_map_t.
   2.258 - */
   2.259 -#define XENMEM_machine_memory_map   10
   2.260 -
   2.261 -/*
   2.262 - * Set the pseudo-physical memory map of a domain, as returned by
   2.263 - * XENMEM_memory_map.
   2.264 - * arg == addr of xen_foreign_memory_map_t.
   2.265 - */
   2.266 -#define XENMEM_set_memory_map       13
   2.267 -struct xen_foreign_memory_map {
   2.268 -    domid_t domid;
   2.269 -    struct xen_memory_map map;
   2.270 -};
   2.271 -typedef struct xen_foreign_memory_map xen_foreign_memory_map_t;
   2.272 -DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
   2.273 -
   2.274 -#endif /* __XEN_PUBLIC_MEMORY_H__ */
   2.275 -
   2.276 -/*
   2.277 - * Local variables:
   2.278 - * mode: C
   2.279 - * c-set-style: "BSD"
   2.280 - * c-basic-offset: 4
   2.281 - * tab-width: 4
   2.282 - * indent-tabs-mode: nil
   2.283 - * End:
   2.284 - */
   2.285 +/******************************************************************************
   2.286 + * memory.h
   2.287 + * 
   2.288 + * Memory reservation and information.
   2.289 + * 
   2.290 + * Permission is hereby granted, free of charge, to any person obtaining a copy
   2.291 + * of this software and associated documentation files (the "Software"), to
   2.292 + * deal in the Software without restriction, including without limitation the
   2.293 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   2.294 + * sell copies of the Software, and to permit persons to whom the Software is
   2.295 + * furnished to do so, subject to the following conditions:
   2.296 + *
   2.297 + * The above copyright notice and this permission notice shall be included in
   2.298 + * all copies or substantial portions of the Software.
   2.299 + *
   2.300 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   2.301 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   2.302 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   2.303 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   2.304 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   2.305 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   2.306 + * DEALINGS IN THE SOFTWARE.
   2.307 + *
   2.308 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
   2.309 + */
   2.310 +
   2.311 +#ifndef __XEN_PUBLIC_MEMORY_H__
   2.312 +#define __XEN_PUBLIC_MEMORY_H__
   2.313 +
   2.314 +/*
   2.315 + * Increase or decrease the specified domain's memory reservation. Returns the
   2.316 + * number of extents successfully allocated or freed.
   2.317 + * arg == addr of struct xen_memory_reservation.
   2.318 + */
   2.319 +#define XENMEM_increase_reservation 0
   2.320 +#define XENMEM_decrease_reservation 1
   2.321 +#define XENMEM_populate_physmap     6
   2.322 +struct xen_memory_reservation {
   2.323 +
   2.324 +    /*
   2.325 +     * XENMEM_increase_reservation:
   2.326 +     *   OUT: MFN (*not* GMFN) bases of extents that were allocated
   2.327 +     * XENMEM_decrease_reservation:
   2.328 +     *   IN:  GMFN bases of extents to free
   2.329 +     * XENMEM_populate_physmap:
   2.330 +     *   IN:  GPFN bases of extents to populate with memory
   2.331 +     *   OUT: GMFN bases of extents that were allocated
   2.332 +     *   (NB. This command also updates the mach_to_phys translation table)
   2.333 +     */
   2.334 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
   2.335 +
   2.336 +    /* Number of extents, and size/alignment of each (2^extent_order pages). */
   2.337 +    xen_ulong_t    nr_extents;
   2.338 +    unsigned int   extent_order;
   2.339 +
   2.340 +    /*
   2.341 +     * Maximum # bits addressable by the user of the allocated region (e.g., 
   2.342 +     * I/O devices often have a 32-bit limitation even in 64-bit systems). If 
   2.343 +     * zero then the user has no addressing restriction.
   2.344 +     * This field is not used by XENMEM_decrease_reservation.
   2.345 +     */
   2.346 +    unsigned int   address_bits;
   2.347 +
   2.348 +    /*
   2.349 +     * Domain whose reservation is being changed.
   2.350 +     * Unprivileged domains can specify only DOMID_SELF.
   2.351 +     */
   2.352 +    domid_t        domid;
   2.353 +};
   2.354 +typedef struct xen_memory_reservation xen_memory_reservation_t;
   2.355 +DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
   2.356 +
   2.357 +/*
   2.358 + * An atomic exchange of memory pages. If return code is zero then
   2.359 + * @out.extent_list provides GMFNs of the newly-allocated memory.
   2.360 + * Returns zero on complete success, otherwise a negative error code.
   2.361 + * On complete success then always @nr_exchanged == @in.nr_extents.
   2.362 + * On partial success @nr_exchanged indicates how much work was done.
   2.363 + */
   2.364 +#define XENMEM_exchange             11
   2.365 +struct xen_memory_exchange {
   2.366 +    /*
   2.367 +     * [IN] Details of memory extents to be exchanged (GMFN bases).
   2.368 +     * Note that @in.address_bits is ignored and unused.
   2.369 +     */
   2.370 +    struct xen_memory_reservation in;
   2.371 +
   2.372 +    /*
   2.373 +     * [IN/OUT] Details of new memory extents.
   2.374 +     * We require that:
   2.375 +     *  1. @in.domid == @out.domid
   2.376 +     *  2. @in.nr_extents  << @in.extent_order == 
   2.377 +     *     @out.nr_extents << @out.extent_order
   2.378 +     *  3. @in.extent_start and @out.extent_start lists must not overlap
   2.379 +     *  4. @out.extent_start lists GPFN bases to be populated
   2.380 +     *  5. @out.extent_start is overwritten with allocated GMFN bases
   2.381 +     */
   2.382 +    struct xen_memory_reservation out;
   2.383 +
   2.384 +    /*
   2.385 +     * [OUT] Number of input extents that were successfully exchanged:
   2.386 +     *  1. The first @nr_exchanged input extents were successfully
   2.387 +     *     deallocated.
   2.388 +     *  2. The corresponding first entries in the output extent list correctly
   2.389 +     *     indicate the GMFNs that were successfully exchanged.
   2.390 +     *  3. All other input and output extents are untouched.
   2.391 +     *  4. If not all input exents are exchanged then the return code of this
   2.392 +     *     command will be non-zero.
   2.393 +     *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
   2.394 +     */
   2.395 +    xen_ulong_t nr_exchanged;
   2.396 +};
   2.397 +typedef struct xen_memory_exchange xen_memory_exchange_t;
   2.398 +DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
   2.399 +
   2.400 +/*
   2.401 + * Returns the maximum machine frame number of mapped RAM in this system.
   2.402 + * This command always succeeds (it never returns an error code).
   2.403 + * arg == NULL.
   2.404 + */
   2.405 +#define XENMEM_maximum_ram_page     2
   2.406 +
   2.407 +/*
   2.408 + * Returns the current or maximum memory reservation, in pages, of the
   2.409 + * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
   2.410 + * arg == addr of domid_t.
   2.411 + */
   2.412 +#define XENMEM_current_reservation  3
   2.413 +#define XENMEM_maximum_reservation  4
   2.414 +
   2.415 +/*
   2.416 + * Returns the maximum GPFN in use by the guest, or -ve errcode on failure.
   2.417 + */
   2.418 +#define XENMEM_maximum_gpfn         14
   2.419 +
   2.420 +/*
   2.421 + * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
   2.422 + * mapping table. Architectures which do not have a m2p table do not implement
   2.423 + * this command.
   2.424 + * arg == addr of xen_machphys_mfn_list_t.
   2.425 + */
   2.426 +#define XENMEM_machphys_mfn_list    5
   2.427 +struct xen_machphys_mfn_list {
   2.428 +    /*
   2.429 +     * Size of the 'extent_start' array. Fewer entries will be filled if the
   2.430 +     * machphys table is smaller than max_extents * 2MB.
   2.431 +     */
   2.432 +    unsigned int max_extents;
   2.433 +
   2.434 +    /*
   2.435 +     * Pointer to buffer to fill with list of extent starts. If there are
   2.436 +     * any large discontiguities in the machine address space, 2MB gaps in
   2.437 +     * the machphys table will be represented by an MFN base of zero.
   2.438 +     */
   2.439 +    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
   2.440 +
   2.441 +    /*
   2.442 +     * Number of extents written to the above array. This will be smaller
   2.443 +     * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
   2.444 +     */
   2.445 +    unsigned int nr_extents;
   2.446 +};
   2.447 +typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
   2.448 +DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
   2.449 +
   2.450 +/*
   2.451 + * Returns the location in virtual address space of the machine_to_phys
   2.452 + * mapping table. Architectures which do not have a m2p table, or which do not
   2.453 + * map it by default into guest address space, do not implement this command.
   2.454 + * arg == addr of xen_machphys_mapping_t.
   2.455 + */
   2.456 +#define XENMEM_machphys_mapping     12
   2.457 +struct xen_machphys_mapping {
   2.458 +    xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
   2.459 +    xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
   2.460 +};
   2.461 +typedef struct xen_machphys_mapping xen_machphys_mapping_t;
   2.462 +DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
   2.463 +
   2.464 +/*
   2.465 + * Sets the GPFN at which a particular page appears in the specified guest's
   2.466 + * pseudophysical address space.
   2.467 + * arg == addr of xen_add_to_physmap_t.
   2.468 + */
   2.469 +#define XENMEM_add_to_physmap      7
   2.470 +struct xen_add_to_physmap {
   2.471 +    /* Which domain to change the mapping for. */
   2.472 +    domid_t domid;
   2.473 +
   2.474 +    /* Source mapping space. */
   2.475 +#define XENMAPSPACE_shared_info 0 /* shared info page */
   2.476 +#define XENMAPSPACE_grant_table 1 /* grant table page */
   2.477 +    unsigned int space;
   2.478 +
   2.479 +    /* Index into source mapping space. */
   2.480 +    xen_ulong_t idx;
   2.481 +
   2.482 +    /* GPFN where the source mapping page should appear. */
   2.483 +    xen_pfn_t     gpfn;
   2.484 +};
   2.485 +typedef struct xen_add_to_physmap xen_add_to_physmap_t;
   2.486 +DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
   2.487 +
   2.488 +/*
   2.489 + * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
   2.490 + * code on failure. This call only works for auto-translated guests.
   2.491 + */
   2.492 +#define XENMEM_translate_gpfn_list  8
   2.493 +struct xen_translate_gpfn_list {
   2.494 +    /* Which domain to translate for? */
   2.495 +    domid_t domid;
   2.496 +
   2.497 +    /* Length of list. */
   2.498 +    xen_ulong_t nr_gpfns;
   2.499 +
   2.500 +    /* List of GPFNs to translate. */
   2.501 +    XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
   2.502 +
   2.503 +    /*
   2.504 +     * Output list to contain MFN translations. May be the same as the input
   2.505 +     * list (in which case each input GPFN is overwritten with the output MFN).
   2.506 +     */
   2.507 +    XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
   2.508 +};
   2.509 +typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
   2.510 +DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
   2.511 +
   2.512 +/*
   2.513 + * Returns the pseudo-physical memory map as it was when the domain
   2.514 + * was started (specified by XENMEM_set_memory_map).
   2.515 + * arg == addr of xen_memory_map_t.
   2.516 + */
   2.517 +#define XENMEM_memory_map           9
   2.518 +struct xen_memory_map {
   2.519 +    /*
   2.520 +     * On call the number of entries which can be stored in buffer. On
   2.521 +     * return the number of entries which have been stored in
   2.522 +     * buffer.
   2.523 +     */
   2.524 +    unsigned int nr_entries;
   2.525 +
   2.526 +    /*
   2.527 +     * Entries in the buffer are in the same format as returned by the
   2.528 +     * BIOS INT 0x15 EAX=0xE820 call.
   2.529 +     */
   2.530 +    XEN_GUEST_HANDLE(void) buffer;
   2.531 +};
   2.532 +typedef struct xen_memory_map xen_memory_map_t;
   2.533 +DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
   2.534 +
   2.535 +/*
   2.536 + * Returns the real physical memory map. Passes the same structure as
   2.537 + * XENMEM_memory_map.
   2.538 + * arg == addr of xen_memory_map_t.
   2.539 + */
   2.540 +#define XENMEM_machine_memory_map   10
   2.541 +
   2.542 +/*
   2.543 + * Set the pseudo-physical memory map of a domain, as returned by
   2.544 + * XENMEM_memory_map.
   2.545 + * arg == addr of xen_foreign_memory_map_t.
   2.546 + */
   2.547 +#define XENMEM_set_memory_map       13
   2.548 +struct xen_foreign_memory_map {
   2.549 +    domid_t domid;
   2.550 +    struct xen_memory_map map;
   2.551 +};
   2.552 +typedef struct xen_foreign_memory_map xen_foreign_memory_map_t;
   2.553 +DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
   2.554 +
   2.555 +#endif /* __XEN_PUBLIC_MEMORY_H__ */
   2.556 +
   2.557 +/*
   2.558 + * Local variables:
   2.559 + * mode: C
   2.560 + * c-set-style: "BSD"
   2.561 + * c-basic-offset: 4
   2.562 + * tab-width: 4
   2.563 + * indent-tabs-mode: nil
   2.564 + * End:
   2.565 + */
   2.566 \ No newline at end of file
     3.1 --- a/xenpci/xenpci.h	Sun Jun 08 23:13:49 2008 +1000
     3.2 +++ b/xenpci/xenpci.h	Wed Jun 11 20:18:33 2008 +1000
     3.3 @@ -237,6 +237,7 @@ typedef struct {
     3.4    grant_ref_t grant_refs[MAX_RESOURCES];
     3.5    PMDL mdls[MAX_RESOURCES];
     3.6    evtchn_port_t event_channels[MAX_RESOURCES];
     3.7 +  PMDL config_mdl;
     3.8  } XENPCI_PDO_DEVICE_DATA, *PXENPCI_PDO_DEVICE_DATA;
     3.9  
    3.10  typedef struct
     4.1 --- a/xenpci/xenpci_pdo.c	Sun Jun 08 23:13:49 2008 +1000
     4.2 +++ b/xenpci/xenpci_pdo.c	Wed Jun 11 20:18:33 2008 +1000
     4.3 @@ -375,6 +375,110 @@ XenPci_ShutdownDevice(PVOID Context)
     4.4    return STATUS_SUCCESS;
     4.5  }
     4.6  
     4.7 +// this may work in future versions of xen...
     4.8 +#if 0
     4.9 +static NTSTATUS
    4.10 +XenPci_Remap_Page(PXENPCI_DEVICE_DATA xpdd, PFN_NUMBER src, PFN_NUMBER dst)
    4.11 +{
    4.12 +  xen_memory_exchange_t xme;
    4.13 +  //xen_pfn_t *pfns;
    4.14 +  int ret;
    4.15 +  
    4.16 +  xme.in.domid = DOMID_SELF;
    4.17 +  set_xen_guest_handle(xme.in.extent_start, src);
    4.18 +  xme.in.nr_extents = 1;
    4.19 +  xme.in.extent_order = 0;
    4.20 +  xme.in.address_bits = 64;
    4.21 +
    4.22 +  xme.out.domid = DOMID_SELF;
    4.23 +  set_xen_guest_handle(xme.out.extent_start, dst);
    4.24 +  xme.out.nr_extents = 1;
    4.25 +  xme.out.extent_order = 0;
    4.26 +  xme.out.address_bits = 64;
    4.27 +  
    4.28 +  xme.nr_exchanged = 0;
    4.29 +  
    4.30 +  ret = HYPERVISOR_memory_op(xpdd, XENMEM_exchange, &xme);
    4.31 +  KdPrint((__DRIVER_NAME " hypervisor memory op ret = %d\n", ret));  
    4.32 +}
    4.33 +#endif
    4.34 +
    4.35 +    
    4.36 +static PMDL
    4.37 +XenPci_MakeConfigPage(PDEVICE_OBJECT device_object)
    4.38 +{
    4.39 +#if 0
    4.40 +  NTSTATUS status;
    4.41 +  PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
    4.42 +  HANDLE hwkey_handle, xenkey_handle, confkey_handle;
    4.43 +  ULONG length;
    4.44 +  PKEY_BASIC_INFORMATION key_info;
    4.45 +  PKEY_VALUE_FULL_INFORMATION value_info;
    4.46 +  UNICODE_STRING xenkey_name, confkey_name;
    4.47 +  UNICODE_STRING value_name;
    4.48 +  PWCHAR value_value;
    4.49 +  //UNICODE_STRING typekey_value, valuekey_value;
    4.50 +  //UNICODE_STRING value_value;
    4.51 +  OBJECT_ATTRIBUTES oa;
    4.52 +  ULONG info_length = 1000;
    4.53 +  PMDL mdl;
    4.54 +  UCHAR type;
    4.55 +  int i, j;
    4.56 +
    4.57 +  status = IoOpenDeviceRegistryKey(device_object, PLUGPLAY_REGKEY_DEVICE, KEY_READ, &hwkey_handle);
    4.58 +
    4.59 +  if (!NT_SUCCESS(status))
    4.60 +  {
    4.61 +    KdPrint((__DRIVER_NAME "    cannot get hardware key\n"));
    4.62 +    return NULL;
    4.63 +  }
    4.64 +  RtlInitUnicodeString(&xenkey_name, L"XenConfig");
    4.65 +  InitializeObjectAttributes(&oa, &xenkey_name, 0, hwkey_handle, NULL);
    4.66 +  status = ZwOpenKey(&xenkey_handle, KEY_READ, &oa);
    4.67 +  if (!NT_SUCCESS(status))
    4.68 +  {
    4.69 +    // close key_handle
    4.70 +    KdPrint((__DRIVER_NAME "    cannot get XenConfig key\n"));
    4.71 +    return NULL;
    4.72 +  }
    4.73 +  // XenConfig key exists, so we go ahead and make fake memory resources
    4.74 +  mdl = AllocateUncachedPage();
    4.75 +  //RtlInitUnicodeString(&typekey_name, "type");
    4.76 +  //RtlInitUnicodeString(&valuekey_name, "value");
    4.77 +  key_info = value_info = ExAllocatePoolWithTag(PagedPool, info_length, XENPCI_POOL_TAG);
    4.78 +  for (i = 0; ZwEnumerateKey(xenkey_handle, i, KeyBasicInformation, key_info, info_length, &length) == STATUS_SUCCESS; i++)
    4.79 +  {
    4.80 +    confkey_name.Length = (USHORT)key_info->NameLength;
    4.81 +    confkey_name.MaximumLength = (USHORT)key_info->NameLength;
    4.82 +    confkey_name.Buffer = key_info->Name;
    4.83 +    KdPrint((__DRIVER_NAME "     config key name = '%wZ'\n", &confkey_name));
    4.84 +    InitializeObjectAttributes(&oa, &confkey_name, 0, xenkey_handle, NULL);
    4.85 +    status = ZwOpenKey(&confkey_handle, KEY_READ, &oa);
    4.86 +    if (!NT_SUCCESS(status))
    4.87 +    {
    4.88 +      KdPrint((__DRIVER_NAME "    cannot get handle for XenConfig\\%wZ\n", &confkey_name));
    4.89 +      continue;
    4.90 +    }
    4.91 +    for (j = 0; ZwEnumerateValueKey(confkey_handle, j, KeyValueFullInformation, value_info, info_length, &length) == STATUS_SUCCESS; j++)
    4.92 +    {
    4.93 +      value_name.Length = confkey_name.MaximumLength = (USHORT)value_info->NameLength;
    4.94 +      value_name.Buffer = value_info->Name;
    4.95 +      KdPrint((__DRIVER_NAME "      name = '%wZ'\n", &value_name));
    4.96 +      if (value_info->Type != REG_SZ)
    4.97 +      {
    4.98 +        KdPrint((__DRIVER_NAME "      type is not REG_SZ (is %d)\n", value_info->Type));
    4.99 +        continue;
   4.100 +      }
   4.101 +      value_value = (PWCHAR)(((PUCHAR)value_info) + value_info->DataOffset);
   4.102 +      KdPrint((__DRIVER_NAME "      value = '%ws'\n", value_value));
   4.103 +    }
   4.104 +  }
   4.105 +  ExFreePoolWithTag(key_info, XENPCI_POOL_TAG);
   4.106 +#endif
   4.107 +
   4.108 +  return NULL;
   4.109 +}
   4.110 +
   4.111  static NTSTATUS
   4.112  XenPci_Pnp_StartDevice(PDEVICE_OBJECT device_object, PIRP irp)
   4.113  {
   4.114 @@ -395,7 +499,13 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   4.115    XENPCI_VECTORS vectors;
   4.116    ULONG rings = 0;
   4.117    ULONG event_channels = 0;
   4.118 -
   4.119 +  BOOLEAN has_config_page = FALSE;
   4.120 +  PMDL mdl;
   4.121 +  PCM_RESOURCE_LIST old_crl, new_crl;
   4.122 +  PCM_PARTIAL_RESOURCE_LIST prl;
   4.123 +  PCM_PARTIAL_RESOURCE_DESCRIPTOR prd;
   4.124 +  ULONG old_length, new_length;
   4.125 + 
   4.126    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   4.127  
   4.128    DUMP_CURRENT_PNP_STATE(xppdd);
   4.129 @@ -421,6 +531,54 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   4.130    RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
   4.131    XenBus_AddWatch(xpdd, XBT_NIL, path, XenPci_BackEndStateHandler, xppdd);
   4.132  
   4.133 +  has_config_page = FALSE;
   4.134 +  res_list = &stack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList;
   4.135 +  for (i = 0; i < res_list->Count; i++)
   4.136 +  {
   4.137 +    res_descriptor = &res_list->PartialDescriptors[i];
   4.138 +    if (res_descriptor->Type == CmResourceTypeMemory)
   4.139 +    {
   4.140 +      has_config_page = TRUE;
   4.141 +      break;
   4.142 +    }
   4.143 +  }
   4.144 +
   4.145 +  if (!has_config_page && (mdl = XenPci_MakeConfigPage(device_object)) != NULL)
   4.146 +  {
   4.147 +    old_crl = stack->Parameters.StartDevice.AllocatedResourcesTranslated;
   4.148 +    old_length = FIELD_OFFSET(CM_RESOURCE_LIST, List) + 
   4.149 +      FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList) +
   4.150 +      FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
   4.151 +      sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * old_crl->List[0].PartialResourceList.Count;
   4.152 +    new_length = old_length + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 1;
   4.153 +    new_crl = ExAllocatePoolWithTag(PagedPool, new_length, XENPCI_POOL_TAG);
   4.154 +    memcpy(new_crl, old_crl, old_length);
   4.155 +    prl = &new_crl->List[0].PartialResourceList;
   4.156 +    prd = &prl->PartialDescriptors[prl->Count++];
   4.157 +    prd->Type = CmResourceTypeMemory;
   4.158 +    prd->ShareDisposition = CmResourceShareDeviceExclusive;
   4.159 +    prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
   4.160 +    KdPrint((__DRIVER_NAME "     PFN[0] = %p\n", MmGetMdlPfnArray(mdl)[0]));
   4.161 +    prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
   4.162 +    prd->u.Memory.Length = PAGE_SIZE;
   4.163 +    KdPrint((__DRIVER_NAME "     Start = %08x:%08x, Length = %d\n", prd->u.Memory.Start.HighPart, prd->u.Memory.Start.LowPart, prd->u.Memory.Length));
   4.164 +    stack->Parameters.StartDevice.AllocatedResourcesTranslated = new_crl;
   4.165 +
   4.166 +    old_crl = stack->Parameters.StartDevice.AllocatedResources;
   4.167 +    new_crl = ExAllocatePoolWithTag(PagedPool, new_length, XENPCI_POOL_TAG);
   4.168 +    memcpy(new_crl, old_crl, old_length);
   4.169 +    prl = &new_crl->List[0].PartialResourceList;
   4.170 +    prd = &prl->PartialDescriptors[prl->Count++];
   4.171 +    prd->Type = CmResourceTypeMemory;
   4.172 +    prd->ShareDisposition = CmResourceShareDeviceExclusive;
   4.173 +    prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE|CM_RESOURCE_MEMORY_PREFETCHABLE|CM_RESOURCE_MEMORY_CACHEABLE;
   4.174 +    prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
   4.175 +    prd->u.Memory.Length = PAGE_SIZE;
   4.176 +    stack->Parameters.StartDevice.AllocatedResources = new_crl;
   4.177 +    
   4.178 +    // free the original resource lists???
   4.179 +  }
   4.180 +
   4.181    res_list = &stack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
   4.182    for (i = 0; i < res_list->Count; i++)
   4.183    {
   4.184 @@ -438,7 +596,8 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   4.185    for (i = 0; i < res_list->Count; i++)
   4.186    {
   4.187      res_descriptor = &res_list->PartialDescriptors[i];
   4.188 -    switch (res_descriptor->Type) {
   4.189 +    switch (res_descriptor->Type)
   4.190 +    {
   4.191      case CmResourceTypeInterrupt:
   4.192        KdPrint((__DRIVER_NAME "     CmResourceTypeInterrupt\n"));
   4.193        KdPrint((__DRIVER_NAME "     irq_vector = %03x\n", res_descriptor->u.Interrupt.Vector));
   4.194 @@ -606,7 +765,7 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
   4.195  static NTSTATUS
   4.196  XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT device_object, PIRP irp)
   4.197  {
   4.198 -  NTSTATUS status;
   4.199 +  NTSTATUS status = STATUS_SUCCESS;
   4.200    PXENPCI_PDO_DEVICE_DATA xppdd = device_object->DeviceExtension;
   4.201    PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
   4.202    char path[128];
   4.203 @@ -667,17 +826,17 @@ XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT d
   4.204  static NTSTATUS
   4.205  XenPci_QueryResourceRequirements(PDEVICE_OBJECT device_object, PIRP irp)
   4.206  {
   4.207 -  //PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
   4.208 +  PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
   4.209    //PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
   4.210    PIO_RESOURCE_REQUIREMENTS_LIST irrl;
   4.211    PIO_RESOURCE_DESCRIPTOR ird;
   4.212    ULONG length;
   4.213 -  
   4.214 +
   4.215    UNREFERENCED_PARAMETER(device_object);
   4.216 -  
   4.217 +
   4.218    length = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List) +
   4.219      FIELD_OFFSET(IO_RESOURCE_LIST, Descriptors) +
   4.220 -    sizeof(IO_RESOURCE_DESCRIPTOR) * 3;
   4.221 +    sizeof(IO_RESOURCE_DESCRIPTOR) * 2;
   4.222    irrl = ExAllocatePoolWithTag(PagedPool,
   4.223      length,
   4.224      XENPCI_POOL_TAG);
   4.225 @@ -706,6 +865,18 @@ XenPci_QueryResourceRequirements(PDEVICE
   4.226    ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
   4.227    ird->u.Interrupt.MinimumVector = 10;
   4.228    ird->u.Interrupt.MaximumVector = 14;
   4.229 +  
   4.230 +#if 0 
   4.231 +  ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
   4.232 +  ird->Option = 0;  
   4.233 +  ird->Type = CmResourceTypeMemory;
   4.234 +  ird->ShareDisposition = CmResourceShareDeviceExclusive;
   4.235 +  ird->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
   4.236 +  ird->u.Memory.Length = PAGE_SIZE;
   4.237 +  ird->u.Memory.Alignment = PAGE_SIZE;
   4.238 +  ird->u.Memory.MinimumAddress.QuadPart = 0; //MmGetMdlPfnArray(xppdd->config_mdl)[0] << PAGE_SHIFT;
   4.239 +  ird->u.Memory.MaximumAddress.QuadPart = 0xFFFFFFFFFFFFFFFF; //ird->u.Memory.MinimumAddress.QuadPart + PAGE_SIZE - 1;
   4.240 +#endif
   4.241  
   4.242    irp->IoStatus.Information = (ULONG_PTR)irrl;
   4.243    return STATUS_SUCCESS;
     5.1 --- a/xenvbd/scsiport.c	Sun Jun 08 23:13:49 2008 +1000
     5.2 +++ b/xenvbd/scsiport.c	Wed Jun 11 20:18:33 2008 +1000
     5.3 @@ -689,7 +689,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
     5.4              xvdd->pending_srb = NULL;
     5.5              XenVbd_PutSrbOnRing(xvdd, srb, 0);
     5.6            }
     5.7 -          else
     5.8 +          else if (!xvdd->split_request_in_progress)
     5.9              ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
    5.10          }
    5.11        }
     6.1 --- a/xenvbd/xenvbd.c	Sun Jun 08 23:13:49 2008 +1000
     6.2 +++ b/xenvbd/xenvbd.c	Wed Jun 11 20:18:33 2008 +1000
     6.3 @@ -43,6 +43,7 @@ XenVbd_Pnp(PDEVICE_OBJECT device_object,
     6.4    PIO_STACK_LOCATION stack;
     6.5    NTSTATUS status;
     6.6    PCM_RESOURCE_LIST old_crl, new_crl;
     6.7 +  ULONG i;
     6.8    PCM_PARTIAL_RESOURCE_LIST prl;
     6.9    PCM_PARTIAL_RESOURCE_DESCRIPTOR prd;
    6.10    ULONG old_length, new_length;
    6.11 @@ -59,6 +60,26 @@ XenVbd_Pnp(PDEVICE_OBJECT device_object,
    6.12    {
    6.13    case IRP_MN_START_DEVICE:
    6.14      KdPrint((__DRIVER_NAME "     IRP_MN_START_DEVICE - DeviceObject = %p\n", stack->DeviceObject));
    6.15 +#if 0
    6.16 +    crl = stack->Parameters.StartDevice.AllocatedResourcesTranslated;
    6.17 +    prl = &crl->List[0].PartialResourceList;
    6.18 +    for (i = 0; i < prl->Count; i++)
    6.19 +    {
    6.20 +      prd = &prl->PartialDescriptors[i];
    6.21 +      if (prd->Type == CmResourceTypeMemory)
    6.22 +      {
    6.23 +        ptr = MmMapIoSpace(prd->u.Memory.Start, prd->u.Memory.Length, MmNonCached);
    6.24 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "ring-ref", NULL);
    6.25 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_IRQ, "event-channel", NULL);
    6.26 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_FRONT, "device-type", NULL);
    6.27 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "sectors", NULL);
    6.28 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "sector-size", NULL);
    6.29 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_VECTORS, NULL, NULL);
    6.30 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, UlongToPtr(GRANT_ENTRIES), NULL);
    6.31 +        ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL);        
    6.32 +      }
    6.33 +    }
    6.34 +#endif
    6.35      old_crl = stack->Parameters.StartDevice.AllocatedResourcesTranslated;
    6.36      if (old_crl != NULL)
    6.37      {
    6.38 @@ -74,7 +95,7 @@ XenVbd_Pnp(PDEVICE_OBJECT device_object,
    6.39        prd = &prl->PartialDescriptors[prl->Count++];
    6.40        prd->Type = CmResourceTypeMemory;
    6.41        prd->ShareDisposition = CmResourceShareDeviceExclusive;
    6.42 -      prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE|CM_RESOURCE_MEMORY_PREFETCHABLE|CM_RESOURCE_MEMORY_CACHEABLE;
    6.43 +      prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE; //|CM_RESOURCE_MEMORY_PREFETCHABLE; //|CM_RESOURCE_MEMORY_CACHEABLE;
    6.44        KdPrint((__DRIVER_NAME "     PFN[0] = %p\n", MmGetMdlPfnArray(mdl)[0]));
    6.45        prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
    6.46        prd->u.Memory.Length = PAGE_SIZE;
    6.47 @@ -104,10 +125,6 @@ XenVbd_Pnp(PDEVICE_OBJECT device_object,
    6.48        stack->Parameters.StartDevice.AllocatedResources = new_crl;
    6.49        IoCopyCurrentIrpStackLocationToNext(irp);
    6.50      }
    6.51 -    else
    6.52 -    {
    6.53 -      KdPrint((__DRIVER_NAME "     AllocatedResource == NULL\n"));
    6.54 -    }
    6.55      status = XenVbd_Pnp_Original(device_object, irp);
    6.56  
    6.57      break;
     7.1 --- a/xenvbd/xenvbd.inx	Sun Jun 08 23:13:49 2008 +1000
     7.2 +++ b/xenvbd/xenvbd.inx	Wed Jun 11 20:18:33 2008 +1000
     7.3 @@ -37,7 +37,7 @@ StartType      = 0
     7.4  ErrorControl   = 1
     7.5  LoadOrderGroup = System Bus Extender
     7.6  ServiceBinary  = %12%\xenvbd.sys                            
     7.7 -AddReg = XenVbd_Service_AddReg
     7.8 +AddReg = XenVbd_Service_AddReg,XenVbd_XenConfig_AddReg
     7.9  
    7.10  [XenVbd_Service_AddReg]
    7.11  HKR,"Parameters\PnpInterface", "0", 0x00010001, 0x00000001
    7.12 @@ -54,7 +54,17 @@ HKR,,EventMessageFile,0x00020000,"%Syste
    7.13  HKR,,TypesSupported,0x00010001,7
    7.14  
    7.15  [XenVbd_Inst.NT.HW]
    7.16 -AddReg = XenVbd_Inst_HW_AddReg
    7.17 +AddReg = XenVbd_XenConfig_AddReg
    7.18 +
    7.19 +[XenVbd_XenConfig_AddReg]
    7.20 +HKR,"XenConfig\ring-ref", "type", , RING
    7.21 +HKR,"XenConfig\event-channel", "type", , EVENT_CHANNEL_IRQ
    7.22 +HKR,"XenConfig\device-type", "type", , READ_STRING_FRONT
    7.23 +HKR,"XenConfig\sectors", "type", , READ_STRING_FRONT
    7.24 +HKR,"XenConfig\sector-size", "type", , READ_STRING_BACK
    7.25 +HKR,"XenConfig\vectors", "type", , VECTORS
    7.26 +HKR,"XenConfig\vectors", "type", , GRANT_ENTRIES
    7.27 +HKR,"XenConfig\vectors", "value", , 144
    7.28  
    7.29  [SourceDisksFiles]
    7.30  xenvbd.sys=1