NdisReadPciSlotInformation problem

Hi all,

I have an NDIS 5.0 Driver, running on Windows 2000.
The driver currently maps a hardware register set into
virtual memory. This is done by calling
NdisReadPciSlotInformation to get the PCI base address
registers, and then calling NdisMMapIoSpace.

What I would like the driver to do now, is to scan the
PCI bus for another device, and map its registers into
virtual memory.

I have tried the NDIS function
NdisReadPciSlotInformation ( which according to the
documentation “returns bus-specific PCI configuration
information from the PCI configuration space for a
device at a particular slot on the bus”) The function
seems to return the same information, ignoring the
slot number parameter. (my theory seems to be
corroborated by old questions in this archive and the
E100bex DDK example)

I have tried calling HalGetBusData function, which
causes the machine to reboot.

Has anyone implemented such a driver? Is this approach
possible? any information would be greatly
appreciated,

Thanks,
Doug McLetchie
xxxxx@yahoo.com


Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> What I would like the driver to do now, is to scan the

PCI bus for another device, and map its registers into
virtual memory.

A seperate instance of your driver will be created for each instance of the
device that the driver supports. So, you should not have to map registers
of similar devices, and in fact you can’t. If it is a completely seperate
device for which you want to map registers well then there is no standard
way to do that either. Why do you want to do this?

Bill M.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> I have tried the NDIS function

NdisReadPciSlotInformation ( which according to the
documentation “returns bus-specific PCI configuration
information from the PCI configuration space for a
device at a particular slot on the bus”) The function
seems to return the same information, ignoring the
slot number parameter. (my theory seems to be
corroborated by old questions in this archive and the
E100bex DDK example)

On a Pnp OS you are supposed to pass 0 as the slot number or -1, it does not
let you specify a slot number, this can only be done a non-pnp os like NT.

Ramit.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

xxxxx@bsquare.com wrote:

> What I would like the driver to do now, is to scan
the
> PCI bus for another device, and map its registers
into
> virtual memory.

A seperate instance of your driver will be created
for each instance of the
device that the driver supports. So, you should not
have to map registers
of similar devices, and in fact you can’t. If it is
a completely seperate
device for which you want to map registers well then
there is no standard
way to do that either. Why do you want to do this?

Thanks for the replies. Here is the big picture: I
will have a PCI card that has a PCI bridge, and then
two device behind it. They are going to share an
interrupt. One of the devices (device1) already has an
NDIS driver written for it, the other (device2)has no
driver yet.

This product is only a prototype, none will ever be
sold, thus doing this the most proper way is not as
important as doing it fast.

For device2 I need to handle interrupts, and get/set
registers(no DMA or anything else). Since they will
share an interrupt, I can just add code to my isr so
that it checks both devices. If I can get/set
registers(to check and clear the interrupt on
device2), this won’t be hard.

So All that I need to do at this point is map register
space of another device on the PCI bus. Since I know
that the two devices are on the same pci bus, all that
I need to map the registers on the second device is
the BAR0 register on that device. (This is making on
large assumtion, that NDIS will allow me to map
register space without reading BAR0…BAR5 of the
device corrosponding to the driver that is executing-
but this is just the bus relative address, so It
should have not need to do such a thing)

One hack/kludge that I have thought of is browsing the
pci registers from use space and hardcoding it into
the registry. I would need to do that every time that
the machine is rebooted, since the BAR0 register may
be subject to change. then i could enable the
device1’s driver, it could read this information out
of the registry, and use that to map the registers to
I/O space.

I bring this up to show you how desperate I am and
that this fix does not have to be proper, or even
respectable.

All suggestions are welcome,
Thanks again,

Doug McLetchie
xxxxx@yahoo.com


Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> Thanks for the replies. Here is the big picture: I

will have a PCI card that has a PCI bridge, and then
two device behind it. They are going to share an
interrupt. One of the devices (device1) already has an
NDIS driver written for it, the other (device2)has no
driver yet.

This product is only a prototype, none will ever be
sold, thus doing this the most proper way is not as
important as doing it fast.

For device2 I need to handle interrupts, and get/set
registers(no DMA or anything else). Since they will
share an interrupt, I can just add code to my isr so
that it checks both devices. If I can get/set
registers(to check and clear the interrupt on
device2), this won’t be hard.

You could use HalGetBusData() to walk the PCI bus and find your device, but
doing this from an NDIS driver will require you to set the NDIS_WDM=1
compile switch when building the driver.

So All that I need to do at this point is map register
space of another device on the PCI bus. Since I know
that the two devices are on the same pci bus, all that
I need to map the registers on the second device is
the BAR0 register on that device. (This is making on
large assumtion, that NDIS will allow me to map
register space without reading BAR0…BAR5 of the
device corrosponding to the driver that is executing-
but this is just the bus relative address, so It
should have not need to do such a thing)

NDIS will never read the BAR.

One hack/kludge that I have thought of is browsing the
pci registers from use space and hardcoding it into
the registry. I would need to do that every time that
the machine is rebooted, since the BAR0 register may
be subject to change. then i could enable the
device1’s driver, it could read this information out
of the registry, and use that to map the registers to
I/O space.

Yuck, you think this would be quicker than just writing a second driver?
You could make driver number 2 a straight WDM driver and have it just
handle the register manipulation for you. You could still handle the ISR
in driver #1. This wouldn’t take that much work.

I bring this up to show you how desperate I am and
that this fix does not have to be proper, or even
respectable.

All suggestions are welcome,
Thanks again,

Doug McLetchie
xxxxx@yahoo.com

Good luck.

Bill M.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Doug,

I have done this before. Use the PCI registers in your NDIS driver to get
BAR 0 of the other device. Then use NdisMMapIoSpace.

Ed Hamlet

Doug McLetchie

o.com> cc:
Sent by: Subject: [ntdev] Re: NdisReadPciSlotInformation problem
xxxxx@lis
ts.osr.com

05/04/01 06:57 AM
Please respond to
“NT Developers
Interest List”

xxxxx@bsquare.com wrote:
> > What I would like the driver to do now, is to scan
> the
> > PCI bus for another device, and map its registers
> into
> > virtual memory.
>
> A seperate instance of your driver will be created
> for each instance of the
> device that the driver supports. So, you should not
> have to map registers
> of similar devices, and in fact you can’t. If it is
> a completely seperate
> device for which you want to map registers well then
> there is no standard
> way to do that either. Why do you want to do this?
>

Thanks for the replies. Here is the big picture: I
will have a PCI card that has a PCI bridge, and then
two device behind it. They are going to share an
interrupt. One of the devices (device1) already has an
NDIS driver written for it, the other (device2)has no
driver yet.

This product is only a prototype, none will ever be
sold, thus doing this the most proper way is not as
important as doing it fast.

For device2 I need to handle interrupts, and get/set
registers(no DMA or anything else). Since they will
share an interrupt, I can just add code to my isr so
that it checks both devices. If I can get/set
registers(to check and clear the interrupt on
device2), this won’t be hard.

So All that I need to do at this point is map register
space of another device on the PCI bus. Since I know
that the two devices are on the same pci bus, all that
I need to map the registers on the second device is
the BAR0 register on that device. (This is making on
large assumtion, that NDIS will allow me to map
register space without reading BAR0…BAR5 of the
device corrosponding to the driver that is executing-
but this is just the bus relative address, so It
should have not need to do such a thing)

One hack/kludge that I have thought of is browsing the
pci registers from use space and hardcoding it into
the registry. I would need to do that every time that
the machine is rebooted, since the BAR0 register may
be subject to change. then i could enable the
device1’s driver, it could read this information out
of the registry, and use that to map the registers to
I/O space.

I bring this up to show you how desperate I am and
that this fix does not have to be proper, or even
respectable.

All suggestions are welcome,
Thanks again,

Doug McLetchie
xxxxx@yahoo.com

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


You are currently subscribed to ntdev as: xxxxx@conexant.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com