public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reverse pci config space restore order
@ 2006-04-25  6:50 Yu, Luming
  2006-04-25 10:48 ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: Yu, Luming @ 2006-04-25  6:50 UTC (permalink / raw)
  To: Andrew Morton, Brown, Len; +Cc: linux-acpi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]


According to Intel ICH spec, there are several rules that
Base Address should be programmed before IOSE 
(PCICMD register ) enabled. 

For example ICH7:
12.1.3  SATA : the base address register for the bus 
master register should be programmed before this bit is set.

11.1.3:  PCICMD (USB): The base address register for
USB should be programmed before this bit is set.
....
To make sure kernel code follow this rule 
, and prevent unnecessary confusion. I proposal this
patch. 

Note:
I'm sorry the patch is NOT in good format.
If you want to apply please use the attached patch file.
sorry for my email client.


Signed-off-by: Luming Yu <luming.yu@intel.com>

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bea1ad1..19a71a6 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -456,7 +456,7 @@ pci_restore_state(struct pci_dev *dev)
 {
 	int i;
 
-	for (i = 0; i < 16; i++)
+	for (i = 15; i >= 0 ; i--)
 		pci_write_config_dword(dev,i * 4,
dev->saved_config_space[i]);
 	return 0;
 }

[-- Attachment #2: reverse_pci_config_space_restore_order.patch --]
[-- Type: application/octet-stream, Size: 339 bytes --]

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bea1ad1..19a71a6 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -456,7 +456,7 @@ pci_restore_state(struct pci_dev *dev)
 {
 	int i;
 
-	for (i = 0; i < 16; i++)
+	for (i = 15; i >= 0 ; i--)
 		pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* RE: [PATCH] reverse pci config space restore order
@ 2006-04-25 18:22 Brown, Len
  2006-04-25 23:59 ` abelay
  0 siblings, 1 reply; 6+ messages in thread
From: Brown, Len @ 2006-04-25 18:22 UTC (permalink / raw)
  To: Arjan van de Ven, Matthew Garrett, abelay
  Cc: Yu, Luming, Andrew Morton, linux-acpi, linux-kernel


>On Tue, 2006-04-25 at 11:48 +0100, Matthew Garrett wrote:
>> On Tue, Apr 25, 2006 at 02:50:57PM +0800, Yu, Luming wrote:
>> 
>> > -	for (i = 0; i < 16; i++)
>> > +	for (i = 15; i >= 0 ; i--)
>> 
>> We certainly need to do /something/ here, but I'm not sure 
>> this is it. 
>> Adam Belay has code to limit PCI state restoration to the 
>> PCI-specified 
>> registers, with the idea being that individual drivers fix things up 
>> properly. While this has the obvious drawback that almost every PCI 
>> driver in the tree would then need fixing up, it's also probably the 
>> right thing.
>
>it has a second drawback: it assumes all devices HAVE a driver, which
>isn't normally the case...

Adam mentioned earlier, and I agree, that it is probably a bad
idea for this code to blindly scribble on the BIST field at i=3.
Probably we should clear that field before restoring it.

Re: this patch
I think that this patch is likely a positive forward step.
It seems logical to restore the BARs before the CMD/STATUS in general,
nothing specific to the ICH here.

But yes, this is a helper routine and devices where it hurts
instead of helps should have their own routine.  Complex devices
need to handle the device-specific config space state above these
1st 16 locations anyway.

-Len

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-26  0:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-25  6:50 [PATCH] reverse pci config space restore order Yu, Luming
2006-04-25 10:48 ` Matthew Garrett
2006-04-25 10:51   ` Arjan van de Ven
2006-04-25 11:01     ` Matthew Garrett
  -- strict thread matches above, loose matches on Subject: below --
2006-04-25 18:22 Brown, Len
2006-04-25 23:59 ` abelay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox