Variations of this idea have been used in the past by companies who had to
support a variety of different chips and revs, for example, graphics chips
with multiple flavors and multiple revs at different hw bug levels.
If your chips and boards are distinguishable at PCI config register level, I
would just have two (or more) drivers, it’s simpler. The INF files do the
work of keeping them separated. Plus, that allows you to easily be able to
run old hw side by side with new hw.
I have seen drivers that supported multiple chips and that separated among
them through code in the driver itself, although I’m ready to admit, it’s
not the way I would do things. I would also steer away from distinguishing
between your chips at compile time, because with time the driver code
becomes very hard to read and to maintain.
If you need to dig within non-PCI registers to differentiate your hardware,
I would still have two or more drivers, and add a “supervisor” driver to
dispatch to the right one. If you have trouble fitting this tree
architecture into the wdm/wdf driver stack, there are subarchitectural ways
to pass information between your drivers, for example, through a common
kernel buffer. I used this way back when to interchange information between
my OpenGL ICD and the chip’s Graphics Driver, which were two totally
different pieces of code.
But, looks like we’re ready for versioning, no ? It’s already bread and
butter in .NET and the CLR. Sign of things to come ?
Alberto.
----- Original Message -----
From: “Martin O’Brien”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Saturday, December 29, 2007 7:48 PM
Subject: Re:[ntdev] Combine 2 drivers
> You could also compile your drivers/libraries as C++ (-TP), use a
> namespace for each version, and reflect the use of the proper namespace in
> your ‘new’ driver’s conditional logic. That being said, I couldn’t agree
> more with Mark that this is a disaster waiting to happen, and you would be
> much better off getting the new driver working correctly and fully. What
> you’re considering, in my opinion, even if it works, will be very
> confusing, give you more or less twice as much code to maintain, and the
> next person who has to maintain it will never forgive you for implementing
> this.
>
> Good luck,
>
> mm
>
> Mark Roddy wrote:
>> Offhand no, and this sounds like a terrible idea. Don’t release the new
>> driver until it is stabile, or only release the new driver for the new
>> hardware until it is able to handle the old hardware without problems.
>> You could of course rename all the functions in one or the other code
>> bases with some differentiating prefix or suffix. (For example,
>> Microsoft’s use of the ‘Ex’ suffix.)
>>
>> On Dec 26, 2007 5:07 PM, >> mailto:xxxxx> wrote:
>>
>> Hi,
>>
>> I have a miniport driver, which supports multiple HW.
>> I have a few versions of the driver and the newer version runs also
>> on a newer hardware.
>> Probably the older version (which runs only on the older HW) is more
>> stable.
>> I would like to merge both drivers into one driver and build a logic
>> which select the correct code to run after initialization. Off
>> course I have many multiple definitions of functions and types. Is
>> there any way to compile a lib from one driver and another lib from
>> the second driver and build a sys file from both lib together, which
>> won’t have multiple definitions (for example to add a const
>> different prefix to all symbol each lib).
>>
>> Thanks,
>> Shai
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars http:
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>>
>>
>> –
>> Mark Roddy
>
> —
> 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</http:></mailto:xxxxx>