Bill
Tue Sep 02 10:58:09 CDT 2003
A bus driver is indeed the best solution here, and in fact, if your separate
sub-units' resources are specified by separate PCI BARs you might be able to
use mf.sys and not have to write this bus driver yourself (I believe this
only works on XP and later though). Otherwise, you are pretty well stuck
with writing your own bus driver. See mf.sys in the DDK help for more
information.
Some issues to be aware of if you write your own bus driver:
1.) According to a post on NTDEV sometime back by Jake Oshins (HAL guy at
MS), you cannot share interrupts with child devices you create with this bus
driver. In other words, you can't hand the PCI resources that the bus
driver receives to the child devices and expect them to work properly,
especially interrupts. IoConnectInterrupt is reported by Jake, not to
receive enough information to properly understand what PnP device actually
owns the interrupt. I used this technique with a PCI40 device (similar
setup to yours) with no problems whatsoever, but this is reported not to be
stable everywhere. So, the parent of the bus driver should control all
resources and provide an interface for the child devices to use through the
PDOs. See QueryBusInformation in the DDK and in the toaster sample.
2.) Because of #1, it is impossible for your bus to support certain
miniport models. For example, your child devices could not be NDIS, SCSI,
or video devices as these devices don't have access to IRPs and thus can't
communicate with the PDO to share resources with the parent. IF you add a
WDM filter driver above the child devices you could use this filter to
communicate with the PDO and then hand the resources to the child devices.
You likely won't care about this, but thought I would mention it just in
case. I believe this is a moot point if you use mf.sys.
--
Bill McKenzie
Compuware Corporation
Watch your IRPs/IRBs/URBs/SRBs/NDIS pkts with our free WDMSniffer tool:
http://frontline.compuware.com/nashua/patches/utility.htm
"Don Burn" <burn@acm.org> wrote in message
news:vl6esr67llpc63@corp.supernews.com...
> Yes you want to write a bus driver, the toaster bus code is a good
starting
> point. You need to have a bus driver so that PNP and Power know about
your
> devices, just creating additional devices does not identify them to these
> subsystems.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> "Maurice zmau" <zmau@netvision.net.il> wrote in message
> news:a4a129d6.0308312352.1d2bdcc2@posting.google.com...
> > Hi all,
> >
> > I have a PCI card, which has a few differenrt sub units (Comunication
> > ports, D2A, A2D, etc.). From the PCI BUS point of view, it is one
> > device with one function.
> >
> > I want to create different device for each sub unit (4 typeA, 2 TypeB,
> > 1 D2A, etc.).
> >
> > I already have an NT 4.0 device driver, which woks fine. Each sub unit
> > has it's own device. In Driver entry we create multiple devices.
> >
> > The questions are : What is the best way to approach this under WDM ?
> > If I create multiple devices in AddDevice, will it cause any trouble ?
> > Does win-2000 expexts ONLY one device to be created in AddDevice
> > routine ?
> > For example : will win-2000 send power management to each of these
> > devices or only to one of them ?
> > Someone told me that I should write a BUS driver (toaster example). Is
> > that true ? Any code examples ?
> >
> >
> > Thanks
> > Maurice
>
>