How to do software simulation of PCI Device

Hi All
Can we simulate a PCI Device partially using PCI Bus Filter driver?
That is by faking the enumeration of a PCI Device and creating PDO for that
in the filter driver.
And then handling the request for the PDO that we created.

Regards
Santosh K

You can enumerate whatever you want in terms of HW IDs, you do not need to be a bus filter on PCI to do that. Enumerating a device with assigned HW resources is not really possible. If you get over that hurdle, are you going to try to use driver that is unaware that there is a simulated device on top of your PDO? If so, you will have no way of trapping reads/writes to mapped memory nor a way for the OS to really know what interrupt you are connecting.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of santosh katvate
Sent: Saturday, September 13, 2008 9:18 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to do software simulation of PCI Device

Hi All
Can we simulate a PCI Device partially using PCI Bus Filter driver?
That is by faking the enumeration of a PCI Device and creating PDO for that in the filter driver.
And then handling the request for the PDO that we created.

Regards
Santosh K
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Doran

Actual aim of this was to test the PCI Device driver with some kind of
simulator, Since the actual physical hardware will take time to build. By
the time hardware arrives i want to make sure that everything in the device
driver works fine.
Are there other ways of doing this?

Regards
Santosh

On Sun, Sep 14, 2008 at 12:51 AM, Doron Holan wrote:

> You can enumerate whatever you want in terms of HW IDs, you do not need
> to be a bus filter on PCI to do that. Enumerating a device with assigned HW
> resources is not really possible. If you get over that hurdle, are you
> going to try to use driver that is unaware that there is a simulated device
> on top of your PDO? If so, you will have no way of trapping reads/writes to
> mapped memory nor a way for the OS to really know what interrupt you are
> connecting.
>
> d
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *santosh katvate
> Sent: Saturday, September 13, 2008 9:18 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to do software simulation of PCI Device
>
> Hi All
>
> Can we simulate a PCI Device partially using PCI Bus Filter driver?
>
> That is by faking the enumeration of a PCI Device and creating PDO for that
> in the filter driver.
>
> And then handling the request for the PDO that we created.
>
> Regards
>
> Santosh K
>

Depending on what you’re actually intending on doing, you might be able to use a PCI exerciser/analyzer to get started, but not
likely to do everything that ‘simulation’ could imply. I’ve used Agilent’s E2920 (PCI) and E2960 (PCI & PCI-e), but I used them for
very non-standard purposes, so I don’t really know the details for your purposes, but you might want to take a look, though I would
imagine that they will not really fill the bill for what I’m guessing you want, and they are not by a long shot cheap.

Good luck,

mm

santosh katvate wrote:

Hi Doran

Actual aim of this was to test the PCI Device driver with some kind of
simulator, Since the actual physical hardware will take time to build.
By the time hardware arrives i want to make sure that everything in the
device driver works fine.
Are there other ways of doing this?

Regards
Santosh

On Sun, Sep 14, 2008 at 12:51 AM, Doron Holan > mailto:xxxxx> wrote:
>
> You can enumerate whatever you want in terms of HW IDs, you do not
> need to be a bus filter on PCI to do that. Enumerating a device
> with assigned HW resources is not really possible. If you get over
> that hurdle, are you going to try to use driver that is unaware that
> there is a simulated device on top of your PDO? If so, you will
> have no way of trapping reads/writes to mapped memory nor a way for
> the OS to really know what interrupt you are connecting.
>
> d
>
> From: xxxxx@lists.osr.com
> mailto:xxxxx
> [mailto:xxxxx@lists.osr.com
> mailto:xxxxx] *On Behalf Of *santosh
> katvate
> Sent: Saturday, September 13, 2008 9:18 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to do software simulation of PCI Device
>
> Hi All
>
> Can we simulate a PCI Device partially using PCI Bus Filter driver?
>
> That is by faking the enumeration of a PCI Device and creating PDO
> for that in the filter driver.
>
> And then handling the request for the PDO that we created.
>
> Regards
>
> Santosh K
></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

I did something like this years ago under NT4. The driver was written in
C++. I had an interface class that the driver used to talk to the hardware.
The real hardware class was derived from this interface class. There was
also a simulator clas that derived from the interface class. The simulator
class defined a device that the simulator user application used. The result
was the actuall simulator was a user mode application that talked to the
driver which then through the interface class talked to the main driver code
and to the real user mode application. This particular driver had a lot of
processing code in it so this approach made a lot of sense. It also allowed
the real user applications to test without having the hardware.

Bill Wandel


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of santosh katvate
Sent: Sunday, September 14, 2008 10:03 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to do software simulation of PCI Device

Hi Doran

Actual aim of this was to test the PCI Device driver with some kind of
simulator, Since the actual physical hardware will take time to build. By
the time hardware arrives i want to make sure that everything in the device
driver works fine.
Are there other ways of doing this?

Regards
Santosh

On Sun, Sep 14, 2008 at 12:51 AM, Doron Holan
wrote:

You can enumerate whatever you want in terms of HW IDs, you do not need to
be a bus filter on PCI to do that. Enumerating a device with assigned HW
resources is not really possible. If you get over that hurdle, are you
going to try to use driver that is unaware that there is a simulated device
on top of your PDO? If so, you will have no way of trapping reads/writes to
mapped memory nor a way for the OS to really know what interrupt you are
connecting.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of santosh katvate
Sent: Saturday, September 13, 2008 9:18 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to do software simulation of PCI Device

Hi All

Can we simulate a PCI Device partially using PCI Bus Filter driver?

That is by faking the enumeration of a PCI Device and creating PDO for that
in the filter driver.

And then handling the request for the PDO that we created.

Regards

Santosh K

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

santosh katvate wrote:

Actual aim of this was to test the PCI Device driver with some kind of
simulator, Since the actual physical hardware will take time to build.
By the time hardware arrives i want to make sure that everything in
the device driver works fine.
Are there other ways of doing this?

Sure. I’ve done this myself.

The key is to define your own macros to access the device, and use them
religiously. So, instead of just writing to registers with
WRITE_REGISTER_ULONG( xx, yy );
or the even worse:
*xx = yy;
Instead, use something like this:
MY_WRITE_REGISTER_ULONG( xx, yy );

Now, you can write custom macros that invoke your simulator. When the
hardware is ready, then you can do
#define MY_WRITE_REGISTER_ULONG(a,b) WRITE_REGISTER_ULONG(a,b)


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks Doran, Martin, Bill, Tim for providing me valuable insight.

On Mon, Sep 15, 2008 at 10:56 PM, Tim Roberts wrote:

> santosh katvate wrote:
> >
> > Actual aim of this was to test the PCI Device driver with some kind of
> > simulator, Since the actual physical hardware will take time to build.
> > By the time hardware arrives i want to make sure that everything in
> > the device driver works fine.
> > Are there other ways of doing this?
>
> Sure. I’ve done this myself.
>
> The key is to define your own macros to access the device, and use them
> religiously. So, instead of just writing to registers with
> WRITE_REGISTER_ULONG( xx, yy );
> or the even worse:
> *xx = yy;
> Instead, use something like this:
> MY_WRITE_REGISTER_ULONG( xx, yy );
>
> Now, you can write custom macros that invoke your simulator. When the
> hardware is ready, then you can do
> #define MY_WRITE_REGISTER_ULONG(a,b) WRITE_REGISTER_ULONG(a,b)
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
> Life is Small and Lots of Things to Learn
Lets Share the Knowledge