Hello,

I have to write a mini-port driver which must handle 2 chip
simultaneously. Is it possible? If it is, what's the difference?
If no, do I have to write a filter driver to do this? Thanks.

Andy

Re: Windows: How to support 2 chip in a single driver? by Don

Don
Tue May 24 09:38:40 CDT 2005

All drivers on Windows should support multiple copies of the same device.
If the devices are different, the driver can support them, but you need to
have a mechanism (normally in the hardware) to flag which device it is, then
have conditional code to support the differences when talking to the
hardware where needed.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



<trivalchang@yahoo.com.tw> wrote in message
news:1116944713.633390.189460@g43g2000cwa.googlegroups.com...
> Hello,
>
> I have to write a mini-port driver which must handle 2 chip
> simultaneously. Is it possible? If it is, what's the difference?
> If no, do I have to write a filter driver to do this? Thanks.
>
> Andy
>



Re: Windows: How to support 2 chip in a single driver? by trivalchang

trivalchang
Tue May 24 09:52:19 CDT 2005

Don,

Thanks for reply. If I have to support 2 different PCI chip in a
driver, I have to add the ID information in INF file, am I right?
If so, how many times does DriverEntry get called? Twice?

Andy


Re: Windows: How to support 2 chip in a single driver? by Don

Don
Tue May 24 09:56:08 CDT 2005

Andy,

Driver entry is called once. AddDevice will be called for each device.
If your resource sizes are different, for instance one model has some
extended registers, this is the typical way to detect in AddDevice which
device you are dealing with, otherwise things get a trickier.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



<trivalchang@yahoo.com.tw> wrote in message
news:1116946339.664041.13940@g44g2000cwa.googlegroups.com...
> Don,
>
> Thanks for reply. If I have to support 2 different PCI chip in a
> driver, I have to add the ID information in INF file, am I right?
> If so, how many times does DriverEntry get called? Twice?
>
> Andy
>



Re: Windows: How to support 2 chip in a single driver? by Mark

Mark
Tue May 24 10:22:41 CDT 2005

Don Burn wrote:
> Andy,
>
> Driver entry is called once. AddDevice will be called for each device.
> If your resource sizes are different, for instance one model has some
> extended registers, this is the typical way to detect in AddDevice which
> device you are dealing with, otherwise things get a trickier.
>
>
Actually you should ask PnP for the pnp id of the device in add device
to distinguish which of your devices this device instance represents.
You do not have any resources to look at in add device. Use
IoGetDeviceProperty and DevicePropertyHardwareID.

Re: Windows: How to support 2 chip in a single driver? by Don

Don
Tue May 24 10:30:06 CDT 2005

Mark is correct, (the problem of doing too many things at once). Use the
properties in AddDevice or wait till the PnP Start Device then use the
resource sizes.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"Mark Roddy" <markr@hollistech.com> wrote in message
news:OrI3uRHYFHA.3188@TK2MSFTNGP09.phx.gbl...
> Don Burn wrote:
>> Andy,
>>
>> Driver entry is called once. AddDevice will be called for each
>> device. If your resource sizes are different, for instance one model has
>> some extended registers, this is the typical way to detect in AddDevice
>> which device you are dealing with, otherwise things get a trickier.
>>
>>
> Actually you should ask PnP for the pnp id of the device in add device to
> distinguish which of your devices this device instance represents. You do
> not have any resources to look at in add device. Use IoGetDeviceProperty
> and DevicePropertyHardwareID.



Re: Windows: How to support 2 chip in a single driver? by Maxim

Maxim
Tue May 24 10:47:18 CDT 2005

> Thanks for reply. If I have to support 2 different PCI chip in a
> driver, I have to add the ID information in INF file, am I right?

Correct. For all of your supported hardware models. Even by different vendors.

> If so, how many times does DriverEntry get called? Twice?

Once at binary load.

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



Re: Windows: How to support 2 chip in a single driver? by trivalchang

trivalchang
Wed May 25 08:49:52 CDT 2005

Thanks, guys. My assignment is to write a RAID driver that must handle
2 IDE chips to control 4 disks. My understanding is I can control chips
in one driver. In DriverEntry of SCSI miniport driver, I call
ScsiPortInitialize for each chip, and I get the base addresses of the
chip in HwInitialize() and then I can do my work. Please correct me.


Re: Windows: How to support 2 chip in a single driver? by Maxim

Maxim
Wed May 25 09:32:23 CDT 2005

> in one driver. In DriverEntry of SCSI miniport driver, I call
> ScsiPortInitialize for each chip

No, you call ScsiPortInitialize for each bus type.

For PnP busses like PCI, this call creates some internal structures in
SCSIPORT. The HwFindAdapter will be called much later from SCSIPORT
MN_START_DEVICE path. The hardware addresses are provided to HwFindAdapter
(from the START IRP).

For non-PnP buses, HwFindAdapter is called in a loop within ScsiPortInitialize
and must do the hardware probing itself - SCSIPORT provides the way to do this.
The addresses are not provided, and HwFindAdapter must probe the next possible
location of the hardware (via the hard-coded table usually). This is how
SCSIPORT worked in NT4.

I would un-recommend controlling 2 pieces of the hardware from the single
hardware-level driver, unless they are on the same PCI card. If it is not so -
then write the software-only RAID (BTW - any need in it? Why Dynamic Disk is
bad?)

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



Re: Windows: How to support 2 chip in a single driver? by trivalchang

trivalchang
Thu May 26 09:30:30 CDT 2005

Got it. Thanks

Why is it a bad idea to control 2 chip in a driver? Any side effect?

Actually, I'm also wondering why my customers don't like Dynamic Disk.
I guess it's because driver level RAID is more flexible and chip vendor
could have more add-on value. I have never tested Dynamic Disk. How is
it implemented? By filter driver?

Andy


Re: Windows: How to support 2 chip in a single driver? by Maxim

Maxim
Thu May 26 12:51:05 CDT 2005

> Actually, I'm also wondering why my customers don't like Dynamic Disk.
> I guess it's because driver level RAID is more flexible

No. By definition no. Veritas is more trustworthy vendor then most RAID driver
vendors, and hardware independence is always good. Being tied to particular
hardware vendor is always bad.

>and chip vendor
> could have more add-on value. I have never tested Dynamic Disk. How is
> it implemented? By filter driver?

By volume manager.

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