Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > restoring pci config space for a device

Reply
Thread Tools Display Modes

restoring pci config space for a device

 
 
kobi n
Guest
Posts: n/a

 
      02-28-2008
Hi.

a device (a DSP) that my driver handles has somekind of a reset process.
in this reset process the pci configuration space on the device, which was
written to the device by the OS on startup, is deleted and it is my
responsibility to restore it since the device should continue functioning
without restarting the machine (which is the only point of time where the OS
writes the pci config values to my understanding).

my question is if there's a common/acceptable way of doing so.

my cuurent thought will be -
keeping an instance of PCI_COMMON_CONFIG which was read by
irp_mn_read_config and use the irp_mn_write_config for restoring.

thanks a lot,
Kobi.



 
Reply With Quote
 
 
 
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      02-28-2008
You can implement reset as the driver's start/stop cycle.

And, if the device resets its PCI interface due to some device-side events,
then it is _just plain buggy_.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation

http://www.storagecraft.com

"kobi n" <> wrote in message
news:8D27D94F-DDFA-4ED2-8532-...
> Hi.
>
> a device (a DSP) that my driver handles has somekind of a reset process.
> in this reset process the pci configuration space on the device, which was
> written to the device by the OS on startup, is deleted and it is my
> responsibility to restore it since the device should continue functioning
> without restarting the machine (which is the only point of time where the OS
> writes the pci config values to my understanding).
>
> my question is if there's a common/acceptable way of doing so.
>
> my cuurent thought will be -
> keeping an instance of PCI_COMMON_CONFIG which was read by
> irp_mn_read_config and use the irp_mn_write_config for restoring.
>
> thanks a lot,
> Kobi.
>
>
>


 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      03-01-2008
kobi n <> wrote:
>
>a device (a DSP) that my driver handles has somekind of a reset process.
>in this reset process the pci configuration space on the device, which was
>written to the device by the OS on startup, is deleted and it is my
>responsibility to restore it since the device should continue functioning
>without restarting the machine (which is the only point of time where the OS
>writes the pci config values to my understanding).
>
>my question is if there's a common/acceptable way of doing so.


No, because your hardware is broken. This behavior violates the PCI
specification.
--
Tim Roberts,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
Pavel A.
Guest
Posts: n/a

 
      03-01-2008
yes. when your device resets, try to disable / enable it
using devcon.exe.

/* Maxim: you know, any hardware bug fixable in the sofware,
is a software bug ... */

--PA

"Maxim S. Shatskih" <> wrote in message news:...
> You can implement reset as the driver's start/stop cycle.
>
> And, if the device resets its PCI interface due to some device-side events,
> then it is _just plain buggy_.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
>
> http://www.storagecraft.com
>
> "kobi n" <> wrote in message
> news:8D27D94F-DDFA-4ED2-8532-...
>> Hi.
>>
>> a device (a DSP) that my driver handles has somekind of a reset process.
>> in this reset process the pci configuration space on the device, which was
>> written to the device by the OS on startup, is deleted and it is my
>> responsibility to restore it since the device should continue functioning
>> without restarting the machine (which is the only point of time where the OS
>> writes the pci config values to my understanding).
>>
>> my question is if there's a common/acceptable way of doing so.
>>
>> my cuurent thought will be -
>> keeping an instance of PCI_COMMON_CONFIG which was read by
>> irp_mn_read_config and use the irp_mn_write_config for restoring.
>>
>> thanks a lot,
>> Kobi.
>>
>>
>>

>



 
Reply With Quote
 
kobi n
Guest
Posts: n/a

 
      03-02-2008

sorry, i did not understand.
what do i earn by disable/enable using the devcon ? does the OS rewrites
pci config info ?

"Pavel A." wrote:

> yes. when your device resets, try to disable / enable it
> using devcon.exe.
>
> /* Maxim: you know, any hardware bug fixable in the sofware,
> is a software bug ... */
>
> --PA
>
> "Maxim S. Shatskih" <> wrote in message news:...
> > You can implement reset as the driver's start/stop cycle.
> >
> > And, if the device resets its PCI interface due to some device-side events,
> > then it is _just plain buggy_.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> >
> > http://www.storagecraft.com
> >
> > "kobi n" <> wrote in message
> > news:8D27D94F-DDFA-4ED2-8532-...
> >> Hi.
> >>
> >> a device (a DSP) that my driver handles has somekind of a reset process.
> >> in this reset process the pci configuration space on the device, which was
> >> written to the device by the OS on startup, is deleted and it is my
> >> responsibility to restore it since the device should continue functioning
> >> without restarting the machine (which is the only point of time where the OS
> >> writes the pci config values to my understanding).
> >>
> >> my question is if there's a common/acceptable way of doing so.
> >>
> >> my cuurent thought will be -
> >> keeping an instance of PCI_COMMON_CONFIG which was read by
> >> irp_mn_read_config and use the irp_mn_write_config for restoring.
> >>
> >> thanks a lot,
> >> Kobi.
> >>
> >>
> >>

> >

>
>
>

 
Reply With Quote
 
kobi n
Guest
Posts: n/a

 
      03-02-2008

ok. i understand the problem.
but i have a very difficult time understanding the "IRP_MN_WRITE_CONFIG".

i can't seem to perform any writes with that. i can't even find a single
example.

assuming i used IRP_MN_WRITE_CONFIG to obtain a device's configuratino space
and hold it in a PCI_COMMON_CONFIG struct. i then change , for example,
the value of VendorId in it. then i try to write it again using the
"IRP_MN_WRITE_CONFIG" but nothing seems to happen. on the next READ i get
the same old value.

any idea why can't i perform the write ??



"Maxim S. Shatskih" wrote:

> You can implement reset as the driver's start/stop cycle.
>
> And, if the device resets its PCI interface due to some device-side events,
> then it is _just plain buggy_.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
>
> http://www.storagecraft.com
>
> "kobi n" <> wrote in message
> news:8D27D94F-DDFA-4ED2-8532-...
> > Hi.
> >
> > a device (a DSP) that my driver handles has somekind of a reset process.
> > in this reset process the pci configuration space on the device, which was
> > written to the device by the OS on startup, is deleted and it is my
> > responsibility to restore it since the device should continue functioning
> > without restarting the machine (which is the only point of time where the OS
> > writes the pci config values to my understanding).
> >
> > my question is if there's a common/acceptable way of doing so.
> >
> > my cuurent thought will be -
> > keeping an instance of PCI_COMMON_CONFIG which was read by
> > irp_mn_read_config and use the irp_mn_write_config for restoring.
> >
> > thanks a lot,
> > Kobi.
> >
> >
> >

>
>

 
Reply With Quote
 
kobi n
Guest
Posts: n/a

 
      03-02-2008
isn't using IRP_MN_WRITE_CONFIG and IRP_MN_READ_CONFIG is fully equivalent
to the obsolete HalSetBusData & HalGetBusData ?

it is described so in the documentation.
BUT. using the Hal routines in an old driver i was able to perform both
read and write, now using the IRP_MN_WRITE_CONFIG doesnt seem to work at
all


"Maxim S. Shatskih" wrote:

> You can implement reset as the driver's start/stop cycle.
>
> And, if the device resets its PCI interface due to some device-side events,
> then it is _just plain buggy_.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
>
> http://www.storagecraft.com
>
> "kobi n" <> wrote in message
> news:8D27D94F-DDFA-4ED2-8532-...
> > Hi.
> >
> > a device (a DSP) that my driver handles has somekind of a reset process.
> > in this reset process the pci configuration space on the device, which was
> > written to the device by the OS on startup, is deleted and it is my
> > responsibility to restore it since the device should continue functioning
> > without restarting the machine (which is the only point of time where the OS
> > writes the pci config values to my understanding).
> >
> > my question is if there's a common/acceptable way of doing so.
> >
> > my cuurent thought will be -
> > keeping an instance of PCI_COMMON_CONFIG which was read by
> > irp_mn_read_config and use the irp_mn_write_config for restoring.
> >
> > thanks a lot,
> > Kobi.
> >
> >
> >

>
>

 
Reply With Quote
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      03-02-2008
> and hold it in a PCI_COMMON_CONFIG struct. i then change , for example,
> the value of VendorId in it. then i try to write it again using the


If you change the vendor ID, then you change the PnP ID of the device, which
means that your driver is gone and another driver will be loaded, so, you will
not be able to restore the config space.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation

http://www.storagecraft.com

 
Reply With Quote
 
Pavel A.
Guest
Posts: n/a

 
      03-02-2008
"kobi n" <> wrote in message news:5BEAFD38-210C-4DFB-A47C-...
>
> sorry, i did not understand.
> what do i earn by disable/enable using the devcon ? does the OS rewrites
> pci config info ?


There is a chance that after re-enabling, the OS ( = the PCI bus driver) would
re-initialize the config info of your card, so your driver will restart and go on.
Of course this chance depends on how bad is the h/w bug
(are the vendor/device ID regs etc. erased?) but this shoud be easy to test.

Regards,
--PA

>
> "Pavel A." wrote:
>
>> yes. when your device resets, try to disable / enable it
>> using devcon.exe.
>>
>> /* Maxim: you know, any hardware bug fixable in the sofware,
>> is a software bug ... */
>>
>> --PA
>>
>> "Maxim S. Shatskih" <> wrote in message news:...
>> > You can implement reset as the driver's start/stop cycle.
>> >
>> > And, if the device resets its PCI interface due to some device-side events,
>> > then it is _just plain buggy_.
>> >
>> > --
>> > Maxim Shatskih, Windows DDK MVP
>> > StorageCraft Corporation
>> >
>> > http://www.storagecraft.com
>> >
>> > "kobi n" <> wrote in message
>> > news:8D27D94F-DDFA-4ED2-8532-...
>> >> Hi.
>> >>
>> >> a device (a DSP) that my driver handles has somekind of a reset process.
>> >> in this reset process the pci configuration space on the device, which was
>> >> written to the device by the OS on startup, is deleted and it is my
>> >> responsibility to restore it since the device should continue functioning
>> >> without restarting the machine (which is the only point of time where the OS
>> >> writes the pci config values to my understanding).
>> >>
>> >> my question is if there's a common/acceptable way of doing so.
>> >>
>> >> my cuurent thought will be -
>> >> keeping an instance of PCI_COMMON_CONFIG which was read by
>> >> irp_mn_read_config and use the irp_mn_write_config for restoring.
>> >>
>> >> thanks a lot,
>> >> Kobi.
>> >>
>> >>
>> >>
>> >

>>
>>
>>





 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      03-03-2008
kobi n <> wrote:
>
>isn't using IRP_MN_WRITE_CONFIG and IRP_MN_READ_CONFIG is fully equivalent
>to the obsolete HalSetBusData & HalGetBusData ?


Not fully, no. HalSetBusData can write to arbitrary PCI devices, by
specifying bus/slot/function numbers. IRP_MN_WRITE_CONFIG can only affect
the device that has been assigned to your driver.
--
Tim Roberts,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PCI : try to get parent's device config space Benoit Windows Vista Drivers 2 10-02-2007 06:59 AM
reading/writing config space for any/all devices Hua-Ying Ling Windows Vista Drivers 1 11-10-2005 12:37 PM
PCI-Extended Config Space Rupesh Windows Vista Drivers 4 09-01-2005 05:20 AM
PCI Bus Filter driver to read config space? HyperWalker Windows Vista Drivers 5 07-15-2004 11:21 AM
Questions on PCI config space when ressetting a PCI board User1964 Windows Vista Drivers 5 03-03-2004 10:44 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59