Patchwork Moved 'pci_set_subsystem' to a weak function: Support for Siemens Mainboard

login
register
about
Submitter Joseph Kellermann
Date 2011-01-25 10:44:34
Message ID <ADF72474DB94FA47B566A9574D0ECA26038ACD4D@MX1.heitec.net>
Download mbox | patch
Permalink /patch/2555/
State Rejected
Headers show

Comments

Joseph Kellermann - 2011-01-25 10:44:34
I've compiled support for the Siemens 'sitemp' Mainboard. The board is similar to the AMD dbm690t.
I adapt the code from dbm690t according to customer requirement specification.
Linux is booting with seabios/filo.
Windows XP is booting with seabios.

This board comes with two hardware variants so I have to set up subvendor/device ids accordingly.
Also I've found an issue:
The default 'pci_set_subsystem' sets the subvendor/device id register# 0x2c. However, for a few devices in the RS690 the register is 0x4c respectively 0x50.

Moved 'pci_set_subsystem' to a weak function in 'pci_device.c'. So boards can add an override for the default function in mainboard/../override_df.c (or mainboard.c) and set it up too.

Hoping to receive a 'ack'.

Thanks


Signed-off-by: Josef Kellermann joseph.kellermann@heitec.de


**********************************************************************************************
IMPORTANT NOTICE / WICHTIGER HINWEIS
This communication contains information which is confidential and may also be privileged. It is for the 
exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any 
distribution, copying or use of this communication or the information in it is strictly prohibited. If you have 
received this communication in error please notify us immediately by email or by telephone and then delete 
this email and any copies of it.
Diese E-Mail koennte vertrauliche und/oder rechtlich geschuetzte Informationen enthalten. Wenn Sie nicht 
der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den 
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser 
Mail sind nicht gestattet.

HEITEC AG, Werner-von-Siemens-Str. 61, 91052 Erlangen, HRB 7754, RG Fuerth, Vorstandsvorsitzender: 
Richard Heindl, Vorstand: Harald Preiml, Finanzvorstand: Rene-Oliver Rosner, Aufsichtsratsvorsitzender: Dr. 
Lorenz M. Raith, WWW: http://www.heitec.de
**********************************************************************************************
Patrick Georgi - 2011-01-25 11:16:29
Am Dienstag, den 25.01.2011, 10:44 +0000 schrieb Joseph Kellermann:
> Also I've found an issue:
> The default 'pci_set_subsystem' sets the subvendor/device id register#
> 0x2c. However, for a few devices in the RS690 the register is 0x4c
> respectively 0x50. 
> 
> Moved 'pci_set_subsystem' to a weak function in 'pci_device.c'. So
> boards can add an override for the default function in
> mainboard/../override_df.c (or mainboard.c) and set it up too.
Given that these implement chipset specific behaviour (either the device
requires writing to 0x4c instead of 0x2c or it doesn't), and that
pci_dev_set_subsystem is always called indirectly (via function pointers
in the respective chipset drivers), couldn't you just modify the chipset
drivers to point to a different set_subsystem implementation where
necessary?

It seems like the GFX function of RS690 is affected (just skimmed
through the AMD docs, so others might also require such a change). In
this case, it should work to change src/southbridge/amd/rs690/gfx.c to
point lops.set_subsystem to your own implementation which does whatever
their GFX device needs (write to 0x4c in extended config space in that
case, if I understand the docs), no?

> Hoping to receive a 'ack'.
> Signed-off-by: Josef Kellermann joseph.kellermann@heitec.de 

If this change is actually required, I'll ack and commit it, but I'd
like to understand your use case better first. We already have a layer
of indirection in place, introducing another one will only create
confusion down the road.


Regards,
Patrick
Joseph Kellermann - 2011-01-25 12:03:39
> couldn't you just modify the chipset
> drivers to point to a different set_subsystem implementation where
> necessary?

Yes, I can do, but how can I implement these requirement:
> board comes with two hardware variants so I have to set up subvendor/device ids accordingly.
that's, in 'mainboard.c' I check for 'PLX device present' and set up subdevice ids accordingly.

Regards,
Joseph
Patrick Georgi - 2011-01-25 12:24:59
Am Dienstag, den 25.01.2011, 12:03 +0000 schrieb Joseph Kellermann:
> Yes, I can do, but how can I implement these requirement:
> > board comes with two hardware variants so I have to set up subvendor/device ids accordingly.
> that's, in 'mainboard.c' I check for 'PLX device present' and set up subdevice ids accordingly.
Hm.. we could route the CONFIG_* values through weak functions, that
default to identity functions.

This way, we don't intermix one issue (different register numbers to
program subsystem IDs) with another (different IDs depending on what
hardware the build runs on).

This mixing things has two disadvantages:
1. Devices that override pci_dev_set_subsystem with their own function
won't see your subsystem ID modification,
2. We have to copy&paste the register ID change between boards to have
them all benefit from it (or suffer #1).

I'm not quite sure if using weak functions to wrap the subsystem
CONFIG_* values is actually the right approach, I'll work on a patch to
discuss.

Will the subvendor/subdevice ids be the same for all devices or is that
modification special for certain devices (eg. gfx only)?


Regards,
Patrick

Patch

Index: src/devices/pci_device.c
===================================================================
--- src/devices/pci_device.c	(Revision 6297)
+++ src/devices/pci_device.c	(Arbeitskopie)
@@ -594,9 +594,6 @@ 
 	/* Set the subsystem vendor and device ID for mainboard devices. */
 	ops = ops_pci(dev);
 	if (dev->on_mainboard && ops && ops->set_subsystem) {
-		printk(BIOS_DEBUG, "%s subsystem <- %02x/%02x\n", dev_path(dev),
-		       CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID,
-		       CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID);
 		ops->set_subsystem(dev,
 				   CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID,
 				   CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID);
@@ -645,8 +642,9 @@ 
 	delay(1);
 }
 
-void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device)
+void __attribute__((weak)) pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device)
 {
+	printk(BIOS_DEBUG, "%s subsystem <- %02x/%02x\n", dev_path(dev), vendor, device);
 	pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
 			   ((device & 0xffff) << 16) | (vendor & 0xffff));
 }