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

Re: A driver with a few different devices (One PCI CARD) by Don

Don
Mon Sep 01 07:27:39 CDT 2003

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



Re: A driver with a few different devices (One PCI CARD) by Bill

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
>
>



Re: A driver with a few different devices (One PCI CARD) by Maxim

Maxim
Tue Sep 02 13:21:34 CDT 2003

Read the MSDN chapter on MF.SYS. The sample INF files are the ones for Aureal
Vortex (shipped with w2k).

MF can help only if your subdevices have no BAR or start order dependencies. If
several subdevices share a BAR - then writing a custom bus driver is the only
way.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


"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



Re: A driver with a few different devices (One PCI CARD) by Bill

Bill
Fri Sep 05 10:49:08 CDT 2003

Yeah, but if I remember correctly, and I may not, there was some limitation
as to whether a driver could make this call and still pass WHQL. Same with
using the NDIS_WDM switch. That is why I didn't mention them, but probably
good you did.

--
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


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:u3WPVF5cDHA.2176@TK2MSFTNGP09.phx.gbl...
> > 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
>
> NDIS has this access by means of NdisMGetDeviceProperty call. This is how
> NDIS/WDM drivers work.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>



Re: A driver with a few different devices (One PCI CARD) by Bill

Bill
Fri Sep 05 10:55:02 CDT 2003

> If
> several subdevices share a BAR - then writing a custom bus driver is the
only
> way.

That is the Win2K limitation. For XP, mf.sys can handle splitting resources
from a single BAR see "Creating Varying Resource Maps" in the latest DDK
documentation for more information.

--
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


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:bj59vk$1qk2$1@gavrilo.mtu.ru...
> Read the MSDN chapter on MF.SYS. The sample INF files are the ones for
Aureal
> Vortex (shipped with w2k).
>
> MF can help only if your subdevices have no BAR or start order
dependencies. If
> several subdevices share a BAR - then writing a custom bus driver is the
only
> way.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>
> "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
>
>