Serial driver ddk example

I am in the process of taking the serial.sys ddk code and converting it to
be used for a PCI multiport device. I have written a bus driver which will
create pdo’s for each port, and attach the pdo’s to my modified serial
driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a
callback inside the serial driver to actually handle the interrupt (all
serial ports share 1 interrupt on the pci device, thus I am only ID-ing the
port in the parent ISR). So my intent was to connect to the interrupt only
in the parent bus driver (via IoConnectInterrupt()), and not to connect to
interrupt in the child (serial) driver. I use a custom interface (set up via
QUERY_INTERFACE) to register the child ISR to the parent. The problem comes
in the fact that in serial.sys there are many many instances of the
KeSynchronizeExecution call for hardware-type control (which of course needs
the Interrupt object). So I now am thinking that I do need to connect to
interrupt in both the parent and child. OR pass the Interrupt object
created in the parent down to the child to use for KeSynchronizeExecution.
Can I do that?? Can someone set me straight??

Why not just share the interrupt with the PDOs via the PnP resource
requirements and not use it at all in the parent? That way everything would
work normally from the OS perspective.

=====================
Mark Roddy


From: Larson, Jeffrey [mailto:xxxxx@analogic.com]
Sent: Thursday, July 15, 2004 5:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Serial driver ddk example

I am in the process of taking the serial.sys ddk code and converting it to
be used for a PCI multiport device. I have written a bus driver which will
create pdo’s for each port, and attach the pdo’s to my modified serial
driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a
callback inside the serial driver to actually handle the interrupt (all
serial ports share 1 interrupt on the pci device, thus I am only ID-ing the
port in the parent ISR). So my intent was to connect to the interrupt only
in the parent bus driver (via IoConnectInterrupt()), and not to connect to
interrupt in the child (serial) driver. I use a custom interface (set up via
QUERY_INTERFACE) to register the child ISR to the parent. The problem comes
in the fact that in serial.sys there are many many instances of the
KeSynchronizeExecution call for hardware-type control (which of course needs
the Interrupt object). So I now am thinking that I do need to connect to
interrupt in both the parent and child. OR pass the Interrupt object
created in the parent down to the child to use for KeSynchronizeExecution.
Can I do that?? Can someone set me straight??


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Can mf.sys with varying resource maps be used? or do you have a requirement of having a w2k version?

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

----- Original Message -----
From: Larson, Jeffrey
To: Windows System Software Devs Interest List
Sent: Friday, July 16, 2004 1:53 AM
Subject: [ntdev] Serial driver ddk example

I am in the process of taking the serial.sys ddk code and converting it to be used for a PCI multiport device. I have written a bus driver which will create pdo’s for each port, and attach the pdo’s to my modified serial driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a callback inside the serial driver to actually handle the interrupt (all serial ports share 1 interrupt on the pci device, thus I am only ID-ing the port in the parent ISR). So my intent was to connect to the interrupt only in the parent bus driver (via IoConnectInterrupt()), and not to connect to interrupt in the child (serial) driver. I use a custom interface (set up via QUERY_INTERFACE) to register the child ISR to the parent. The problem comes in the fact that in serial.sys there are many many instances of the KeSynchronizeExecution call for hardware-type control (which of course needs the Interrupt object). So I now am thinking that I do need to connect to interrupt in both the parent and child. OR pass the Interrupt object created in the parent down to the child to use for KeSynchronizeExecution. Can I do that?? Can someone set me straight??


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I am not sure what your hardware/driver requirements are, but it is possible to use multifunction inf files to create parent/child devices by using just the inf files, without any driver. The multifunction inf makes it possible to use the serial.sys, but specify the interrupts for each child device.

Murthy

----- Original Message -----
From: Maxim S. Shatskih
To: Windows System Software Devs Interest List
Sent: Thursday, July 15, 2004 3:14 PM
Subject: Re: [ntdev] Serial driver ddk example

Can mf.sys with varying resource maps be used? or do you have a requirement of having a w2k version?

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

----- Original Message -----
From: Larson, Jeffrey
To: Windows System Software Devs Interest List
Sent: Friday, July 16, 2004 1:53 AM
Subject: [ntdev] Serial driver ddk example

I am in the process of taking the serial.sys ddk code and converting it to be used for a PCI multiport device. I have written a bus driver which will create pdo’s for each port, and attach the pdo’s to my modified serial driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a callback inside the serial driver to actually handle the interrupt (all serial ports share 1 interrupt on the pci device, thus I am only ID-ing the port in the parent ISR). So my intent was to connect to the interrupt only in the parent bus driver (via IoConnectInterrupt()), and not to connect to interrupt in the child (serial) driver. I use a custom interface (set up via QUERY_INTERFACE) to register the child ISR to the parent. The problem comes in the fact that in serial.sys there are many many instances of the KeSynchronizeExecution call for hardware-type control (which of course needs the Interrupt object). So I now am thinking that I do need to connect to interrupt in both the parent and child. OR pass the Interrupt object created in the parent down to the child to use for KeSynchronizeExecution. Can I do that?? Can someone set me straight??


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@apflex.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

In same situation I implemented KeSynchronizeExecution as method of similar custom interface, see http://leo.yuriev.ru/?125

Remove spam4 from the xxxxx@yuriev.ru to reply.
But xxxxx@leo.yuriev.ru is for spam only :slight_smile:

“Larson, Jeffrey” ???/??? ? ??? ???: news:xxxxx@ntdev…

I am in the process of taking the serial.sys ddk code and converting it to be used for a PCI multiport device. I have written a bus driver which will create pdo’s for each port, and attach the pdo’s to my modified serial driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a callback inside the serial driver to actually handle the interrupt (all serial ports share 1 interrupt on the pci device, thus I am only ID-ing the port in the parent ISR). So my intent was to connect to the interrupt only in the parent bus driver (via IoConnectInterrupt()), and not to connect to interrupt in the child (serial) driver. I use a custom interface (set up via QUERY_INTERFACE) to register the child ISR to the parent. The problem comes in the fact that in serial.sys there are many many instances of the KeSynchronizeExecution call for hardware-type control (which of course needs the Interrupt object). So I now am thinking that I do need to connect to interrupt in both the parent and child. OR pass the Interrupt object created in the parent down to the child to use for KeSynchronizeExecution. Can I do that?? Can someone set me straight??

In same situation I implemented KeSynchronizeExecution as method of similar
custom interface,
see http://leo.yuriev.ru/?125

Remove spam4 from the xxxxx@yuriev.ru to reply.
But xxxxx@leo.yuriev.ru is for spam only :slight_smile:

I seems that you have decided to have two binaries for your driver - the bus
driver and the serial port driver. As Walter Oney said in his 2003-09-22
post on microsoft.public.development.device.drivers
“Most people don’t design the multiport serial drivers this way”.

If you can still change the architecture, I suggest you put the serial
functionality in the PDOs created by the bus driver. This way you avoid the
interrupt object problem and other complexities related to setting up a
custom interface. It will also give you an opportunity to trim the legacy
stuff from the DDK’s serial sample code.

If you decide to stay with a two-binaries model, you should probably read
2003-09-02 Bill McKenzie’s post on
microsoft.public.development.device.driver (search for “you can’t hand the
PCI resources that the bus driver receives to the child devices and expect
them to work properly,especially interrupts”).

Slawomir

P.S. Thanks to Leo Yuriev for great sample code.

“Larson, Jeffrey” wrote in message
news:xxxxx@ntdev…

I am in the process of taking the serial.sys ddk code and converting it to
be used for a PCI multiport device. I have written a bus driver which will
create pdo’s for each port, and attach the pdo’s to my modified serial
driver. What I am encountering is the legacy mess of serial.sys.

Anyway, on to my question. I am using the bus driver’s ISR to call a
callback inside the serial driver to actually handle the interrupt (all
serial ports share 1 interrupt on the pci device, thus I am only ID-ing the
port in the parent ISR). So my intent was to connect to the interrupt only
in the parent bus driver (via IoConnectInterrupt()), and not to connect to
interrupt in the child (serial) driver. I use a custom interface (set up via
QUERY_INTERFACE) to register the child ISR to the parent. The problem comes
in the fact that in serial.sys there are many many instances of the
KeSynchronizeExecution call for hardware-type control (which of course needs
the Interrupt object). So I now am thinking that I do need to connect to
interrupt in both the parent and child. OR pass the Interrupt object
created in the parent down to the child to use for KeSynchronizeExecution.
Can I do that?? Can someone set me straight??

The architecture that he described doesn’t necessarily imply two binaries.
You can easily implement both the bus driver and the children in on binary
image. With that said, he’s certainly trying to stay architecturally clean,
using interfaces between the child and the parent.

In either case, the answer is that as long as you manage the lifetime of the
object correctly, there is no reason that a child can’t synchronize against
an interrupt object that was obtained by the parent. That doesn’t mean that
I think it would be a good idea. If I were implementing it, I would do it
by calling a wrapper function exposed by the PDOs through QueryInterface,
which seems to be what some of the other respondants are suggesting.

Furthermore, the quote from Bill isn’t quite relevant. He was talking about
handing PnP interrupt resources (i.e. your IRQ) to your child. The O.P. was
talking about handing out access to the interrupt object that the bus driver
got after it connected its interrupt.


Jake Oshins
Windows Kernel Group

This posting is provided “AS IS” with no warranties, and confers no rights.

“Slawek” wrote in message news:xxxxx@ntdev…
>I seems that you have decided to have two binaries for your driver - the
>bus
> driver and the serial port driver. As Walter Oney said in his 2003-09-22
> post on microsoft.public.development.device.drivers
> “Most people don’t design the multiport serial drivers this way”.
>
> If you can still change the architecture, I suggest you put the serial
> functionality in the PDOs created by the bus driver. This way you avoid
> the
> interrupt object problem and other complexities related to setting up a
> custom interface. It will also give you an opportunity to trim the legacy
> stuff from the DDK’s serial sample code.
>
> If you decide to stay with a two-binaries model, you should probably read
> 2003-09-02 Bill McKenzie’s post on
> microsoft.public.development.device.driver (search for “you can’t hand the
> PCI resources that the bus driver receives to the child devices and expect
> them to work properly,especially interrupts”).
>
> Slawomir
>
> P.S. Thanks to Leo Yuriev for great sample code.
>
>
>
> “Larson, Jeffrey” wrote in message
> news:xxxxx@ntdev…
>
> I am in the process of taking the serial.sys ddk code and converting it to
> be used for a PCI multiport device. I have written a bus driver which
> will
> create pdo’s for each port, and attach the pdo’s to my modified serial
> driver. What I am encountering is the legacy mess of serial.sys.
>
> Anyway, on to my question. I am using the bus driver’s ISR to call a
> callback inside the serial driver to actually handle the interrupt (all
> serial ports share 1 interrupt on the pci device, thus I am only ID-ing
> the
> port in the parent ISR). So my intent was to connect to the interrupt
> only
> in the parent bus driver (via IoConnectInterrupt()), and not to connect to
> interrupt in the child (serial) driver. I use a custom interface (set up
> via
> QUERY_INTERFACE) to register the child ISR to the parent. The problem
> comes
> in the fact that in serial.sys there are many many instances of the
> KeSynchronizeExecution call for hardware-type control (which of course
> needs
> the Interrupt object). So I now am thinking that I do need to connect to
> interrupt in both the parent and child. OR pass the Interrupt object
> created in the parent down to the child to use for KeSynchronizeExecution.
> Can I do that?? Can someone set me straight??
>
>
>