Skip to content

Commit 212d7e1

Browse files
author
Chris Patterson
committed
add initial xenvusb KMDF bus driver for upstream xenbus
Lifted some common code from upstream Xen Project's Windows PV drivers, in addition to build scripts & structure. Signed-off-by: Chris Patterson <[email protected]>
0 parents  commit 212d7e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+12518
-0
lines changed

BUILD.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Building the Xen VUSB Package
2+
===========================
3+
4+
First you'll need a device driver build environment for Windows 10.
5+
This means:
6+
7+
* Visual Studio 2015 (Any SKU, including Express or Community)
8+
* Windows Driver Kit 10
9+
10+
Install Visual Studio first (you only need install MFC for C++) and then
11+
the WDK. Set an environment variable called VS to the base of the Visual
12+
Studio Installation (e.g. C:\Program Files\Microsoft Visual Studio 14.0) and
13+
a variable called KIT to the base of the WDK
14+
(e.g. C:\Program Files\Windows Kits\10). Also set an environment variable
15+
called SYMBOL\_SERVER to point at a location where driver symbols can be
16+
stored. This can be local directory e.g. C:\Symbols.
17+
18+
You will also need to acquire the DIFx re-distributable package from one
19+
of the older WDKs (as it appears not to be present in WDK10), so that the
20+
driver build can copy dpinst.exe into the output.
21+
Set the environment variable DPINST_REDIST to the base dpinst directory
22+
- the directory under which the x86 and x64 sub-directories containing
23+
dpinst.exe can be found
24+
(e.g. C:\Program Files (x86)\Windows Kits\8.1\Redist\DIFx\dpinst\EngMui)
25+
26+
Next you'll need a 3.x version of python (which you can get from
27+
http://www.python.org). Make sure python.exe is somewhere on your default
28+
path.
29+
30+
Now fire up a Command Prompt and navigate to the base of your git repository.
31+
At the prompt type:
32+
33+
build.py checked
34+
35+
This will create a debug build of the driver. To create a non-debug build
36+
type:
37+
38+
build.py free
39+
40+
Note that Static Driver Verifier is run by default as part of the build
41+
process. This can be very time consuming. If you don't want to run the
42+
verifier then you can add the 'nosdv' keyword to the end of your command
43+
e.g.:
44+
45+
build.py free nosdv

INSTALL.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Installing XenVusb Bus Driver
2+
=================
3+
4+
It's important to note that the build scripts generate a driver which is
5+
*test signed*. This means that when the driver is installed on a 64-bit
6+
version of Windows you must enabled testsigning mode otherwise your system
7+
will fail signature verification checked on the next reboot.
8+
If you wish to install the test certificate on the target system then copy
9+
xenvusb.pfx (which you'll find in he proj subdirectory) onto your system and
10+
use certmgr to install it. (It is not password protected).
11+
12+
xenvusb.sys binds to one of three devices which may be created by XenBus:
13+
14+
1. XENBUS\\VEN_XP000&DEV_VUSB&REV_00000001
15+
2. XENBUS\\VEN_XP0001&DEV_VUSB&REV_00000001
16+
3. XENBUS\\VEN_XP0002&DEV_VUSB&REV_00000001
17+
18+
The particular device present in your VM will be determined by the binding
19+
of the XenBus driver. The DeviceID of the PCI device to which it is bound is
20+
echoed in the VEN_ substring of the devices it creates. Hence only one of the
21+
above three variants will be present.
22+
23+
To install the driver on your target system, copy the contents of the xenvusb
24+
subdirectory onto the system, then navigate into the copy, to either the x86
25+
or x64 subdirectory (whichever is appropriate), and execute the copy of
26+
dpinst.exe you find there with Administrator privilege.

INTERFACES.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Interface Versions and PDO Revisions
2+
====================================
3+
4+
It is important that introduction of a new API, introduction of a new
5+
version of an existing API or retirement of an old version of an API is
6+
managed carefully to avoid incompatibilities between clients and
7+
providers. The general API versioning policy is described below:
8+
9+
Each distinct set of API versions exported by a bus driver maps to a PDO
10+
revision. The DeviceID of each PDO created will specify the latest
11+
revision supported and all others will be contained within the
12+
HardwareIDs and CompatibleIDs. When a new version of an API is added,
13+
a new PDO revision must be added. When a version of an API is removed
14+
then ALL revisions that API version maps to must be removed. The mapping
15+
of interface versions to PDO revisions is specified in the header file
16+
include/revision.h in the bus driver source repository.
17+
18+
Whe introducing a new version of an interface in a bus driver it is good
19+
practice to continue to support the previous version so it is not
20+
necessary to simultaneously introduce a new PDO revision and retire a
21+
previous one that child drivers may still be binding to.
22+
Child drivers should, of course, always be built to use the latest
23+
interface versions (which can be copied from the include directory in the
24+
source repository of the bus driver providing them) but it may take
25+
some time to make the necessary changes and deploy new builds of child
26+
drivers and so some overlap is desirable.
27+
28+
To try to avoid installation of a version of a bus driver that is
29+
incompatible with child drivers installed on a system. There is a check
30+
in the pre-install phase in the co-intaller which compares the
31+
MatchingDeviceId values for each child driver against the table in
32+
include/revision.h in the bus driver source to make sure that the
33+
matching revision number is present.

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) Citrix Systems Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms,
5+
with or without modification, are permitted provided
6+
that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above
9+
copyright notice, this list of conditions and the
10+
following disclaimer.
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the
13+
following disclaimer in the documentation and/or other
14+
materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
17+
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29+
SUCH DAMAGE.
30+

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
XenVusb - The Xen Paravitual Network Class Driver for Windows
2+
============================================================
3+
4+
The XenVusb package consists of a single device driver:
5+
6+
* xenvusb.sys is a bus driver which attaches to a virtual device created
7+
by XenBus and creates a child device for each VUSB device for XENUSBDEVICE
8+
to attach to.
9+
10+
Quick Start Guide
11+
=================
12+
13+
Building the driver
14+
-------------------
15+
16+
See BUILD.md
17+
18+
Installing the driver
19+
---------------------
20+
21+
See INSTALL.md
22+
23+
Driver Interfaces
24+
=================
25+
26+
See INTERFACES.md
27+
28+
Miscellaneous
29+
=============
30+
31+
For convenience the source repository includes some other scripts:
32+
33+
kdfiles.py
34+
----------
35+
36+
This generates two files called kdfiles32.txt and kdfiles64.txt which can
37+
be used as map files for the .kdfiles WinDBG command.
38+
39+
sdv.py
40+
------
41+
42+
This runs Static Driver Verifier on the source.
43+
44+
clean.py
45+
--------
46+
47+
This removes any files not checked into the repository and not covered by
48+
the .gitignore file.
49+
50+
get_xen_headers.py
51+
------------------
52+
53+
This will import any necessary headers from a given tag of that Xen
54+
repository at git://xenbits.xen.org/xen.git.

0 commit comments

Comments
 (0)