Li-Ta Lo ollie@lanl.gov writes:
On Thu, 2004-10-21 at 11:23, YhLu wrote:
Driver add < static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) < { < pci_write_config32(dev, 0x2c, < ((device & 0xffff) << 16) | (vendor & 0xffff)); < } < < static struct pci_operations lops_pci = { < .set_subsystem = lpci_set_subsystem, < };
OOPS, we are doing it with "uses MAINBOARD_SUBSYSTEM_ID" and if I am right every on board device share the same ID. For devices who want its own ID it has to implement the .set_subsystem method. This is really ugly. IMHO, we should treat the subsystem ids as attributes of PCI device and it should be defined in the mainboard config file. It should look like this
As far as I know there is only one that we need to set. The subsystem id of the motherboard. And we need to set this for all devices.
The .set_subsystem simply exists because there is not a standard way to set that value. The almost generic version is in src/devices/pci_device.c but I can use it only occasionally.
device pci 0.0 on vendor 0x1234 device 0x5678 end
or
device pci 0.0 on register "subsystem_vendor_id" = "0x1234" register "subsystem_device_id" = "0x5678" end
I don't see the benefit of those methods over having an Option if you have exactly 1 subsystem vendor_id+device_id that need to be set.
and the PCI enumeration code will call the generic pci_set_subsystem() function to set subsystem ID for every PCI device.
It does.
For those device with subsystem ID unspecified, it is default to zero any.
Yes.
Eric