I see a couple of different versions of lpci_set_subsystem function and I wonder why.
For example: src\southbridge\broadcom\bcm5780\bcm5780_nic.c: static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) { pci_write_config32(dev, 0x40, ((device & 0xffff) << 16) | (vendor & 0xffff)); }
src\southbridge\amd\amd8111\amd8111_ide.c: static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) { pci_write_config32(dev, 0x70, ((device & 0xffff) << 16) | (vendor & 0xffff)); }
src\southbridge\broadcom\bcm5780\bcm5780_sb_pci_main.c: static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) { pci_write_config32(dev, 0x2c, ((device & 0xffff) << 16) | (vendor & 0xffff)); }
Shouldn't the PCI config register always be 0x2c (subsystem ID register) like in the last example (bcm5780_sb_pci_main.c)? Should these functions even be there since there is a stock pci_dev_set_subsystem() that seems to be correct? Am I mis-understanding this function?
Thanks, Marc
On 8/15/07, Marc Jones marc.jones@amd.com wrote:
Shouldn't the PCI config register always be 0x2c (subsystem ID register) like in the last example (bcm5780_sb_pci_main.c)? Should these functions even be there since there is a stock pci_dev_set_subsystem() that seems to be correct?
IIRC it should be, but is not always. A lot of chips don't quite follow the spec, and this weird out-of-band setting of registers crops up. That's my take on it anyway.
ron
Shouldn't the PCI config register always be 0x2c (subsystem ID register) like in the last example (bcm5780_sb_pci_main.c)? Should these functions even be there since there is a stock pci_dev_set_subsystem() that seems to be correct?
IIRC it should be, but is not always. A lot of chips don't quite follow the spec, and this weird out-of-band setting of registers crops up. That's my take on it anyway.
The PCI spec only defines the "read" behaviour of the subsystem config registers as far as I know. Anything writing those regs is just as non-standard (or moreso!) as something using special regs is.
Segher
* Marc Jones marc.jones@amd.com [070815 23:01]:
Shouldn't the PCI config register always be 0x2c (subsystem ID register) like in the last example (bcm5780_sb_pci_main.c)? Should these functions even be there since there is a stock pci_dev_set_subsystem() that seems to be correct?
I think on some systems 2c is always read-only, while on others it is read/write or read-once. Those with read-only 2c have a writable register that mirrors the value to 2c.
Not sure if that's the case here.
Stefan Reinauer wrote:
- Marc Jones marc.jones@amd.com [070815 23:01]:
Shouldn't the PCI config register always be 0x2c (subsystem ID register) like in the last example (bcm5780_sb_pci_main.c)? Should these functions even be there since there is a stock pci_dev_set_subsystem() that seems to be correct?
I think on some systems 2c is always read-only, while on others it is read/write or read-once. Those with read-only 2c have a writable register that mirrors the value to 2c.
Not sure if that's the case here.
Ah, That could be it. I will see if I have some specs for those devices that look odd.
Thanks, Marc