Subject: Re: pci_read_config_byte
To: Allen Briggs <>
From: Ed <>
List: tech-kern
Date: 05/28/2005 22:46:58
Allen Briggs wrote:
> On Sat, May 28, 2005 at 01:26:29PM -0500, Ed wrote:
>>Here's the original Linux code:
>>	pci_read_config_byte(dev, SIS_DETECT_REGISTER, &reg);
>>	pci_write_config_byte(dev, SIS_DETECT_REGISTER, reg | (1 << 6));
>>	pci_read_config_word(dev, PCI_DEVICE_ID, &devid);
>>	if (((devid & 0xfff0) != 0x0960) && (devid != 0x0018)) {
>>		pci_write_config_byte(dev, SIS_DETECT_REGISTER, reg);
>>		return;
>>	}
> Oh, that's whacked.
>>Here's my (working, but questionably correct) implementation for NetBSD:
> That looks like a fine translation.

Yes it is whacked.  You bang a register in the config space and the 
device's ID changes.  If you don't do that then the siside code uses 
timing values for the 503 even though the device is really a 96x which 
results in lost interrupts instead of a working system.

> What does the Linux comment mean about picking up quirks for the 96x ?

There's another quirk in the chipset where the BIOS might hide the SMBus 
  that comes with the 96x until you bang some other registers in the 
config space.  That additional quirk is keyed off the 96x 
PCI_DEVICE_ID's.  Of course, the 96x device may be hiding as a 503 
device until the code I translated above is executed.  Thus, the comment 
meant that the 96x device must be "unhidden" before the 96x SMBus quirk 
code could recognize the device.  Personally, I just wanted my IDE to 
work, so I haven't worried about the SMBus stuff.  I'm not even sure 
what it does (temperature?)

I need to clean up my translation a little by adding an appropriate 
define for register 0x40 and using an existing define for the 0x0018 
device.  After I do that, what is the appropriate venue for submitting 
the patch?

Thank you for your input!


Rob Fuller