Can someone please review this? Besides moving mainboard-specific hardware configuration from Kconfig to DTS (where it belongs), it also reduces the amount of per-mainboard code in the tree.
Regards, Carl-Daniel
On 05.07.2008 16:35, Carl-Daniel Hailfinger wrote:
Move default mainboard vendor/subsystem from Kconfig to dts. Compile tested including boundary cases.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/Kconfig
--- LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/Kconfig (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/Kconfig (Arbeitskopie) @@ -26,19 +26,3 @@ help This is the name for the Advanced Digital Logic MSM800SEV mainboard.
-config MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID
- hex
- # TODO: Fix the PCI ID.
- default 0x1022
- depends BOARD_ADL_MSM800SEV
- help
Mainboard specific PCI subsystem vendor ID.
-config MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID
- hex
- # TODO: Fix the PCI ID.
- default 0x2323
- depends BOARD_ADL_MSM800SEV
- help
Mainboard specific PCI subsystem vendor ID.
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/dts
--- LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/dts (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/adl/msm800sev/dts (Arbeitskopie) @@ -23,6 +23,8 @@ /{ mainboard-vendor = "Advanced Digital Logic"; mainboard-name = "MSM800SEV";
- mainboard_pci_subsystem_vendor = "0x1022";
- mainboard_pci_subsystem_device = "0x2323"; cpus { }; apic@0 { /config/("northbridge/amd/geodelx/apic");
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/Kconfig
--- LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/Kconfig (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/Kconfig (Arbeitskopie) @@ -26,19 +26,3 @@ help This is the default mainboard name.
-config MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID
- hex
- # TODO: Fix PCI ID.
- default 0x1022
- depends BOARD_AMD_NORWICH
- help
Mainboard specific PCI subsystem vendor ID.
-config MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID
- hex
- # TODO: Fix PCI ID.
- default 0x2323
- depends BOARD_AMD_NORWICH
- help
Mainboard specific PCI subsystem device ID.
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/dts
--- LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/dts (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/amd/norwich/dts (Arbeitskopie) @@ -21,6 +21,8 @@ /{ mainboard-vendor = "AMD"; mainboard-name = "NORWICH";
- mainboard_pci_subsystem_vendor = "0x1022";
- mainboard_pci_subsystem_device = "0x2323"; cpus { }; apic@0 { /config/("northbridge/amd/geodelx/apic");
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/Kconfig
--- LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/Kconfig (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/Kconfig (Arbeitskopie) @@ -26,19 +26,3 @@ help This is the default mainboard name.
-config MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID
- hex
- # TODO: Fix PCI ID.
- default 0x1022
- depends BOARD_ARTECGROUP_DBE61
- help
Mainboard specific PCI subsystem vendor ID.
-config MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID
- hex
- # TODO: Fix PCI ID.
- default 0x2323
- depends BOARD_ARTECGROUP_DBE61
- help
Mainboard specific PCI subsystem device ID.
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/dts
--- LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/dts (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/artecgroup/dbe61/dts (Arbeitskopie) @@ -75,6 +75,8 @@ /{ mainboard-vendor = "Artec Group"; mainboard-name = "DBE61";
- mainboard_pci_subsystem_vendor = "0x1022";
- mainboard_pci_subsystem_device = "0x2323"; cpus { }; apic@0 { /config/("northbridge/amd/geodelx/apic");
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/Kconfig
--- LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/Kconfig (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/Kconfig (Arbeitskopie) @@ -27,17 +27,3 @@ help This is the default mainboard name.
-config MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID
- hex
- default 0x15ad
- depends BOARD_EMULATION_QEMU_X86
- help
Mainboard specific PCI subsystem vendor ID.
-config MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID
- hex
- default 0x1976
- depends BOARD_EMULATION_QEMU_X86
- help
Mainboard specific PCI subsystem device ID.
Index: LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/dts
--- LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/dts (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/mainboard/emulation/qemu-x86/dts (Arbeitskopie) @@ -21,6 +21,8 @@ /{ mainboard-vendor = "Emulation"; mainboard-name = "QEMU x86";
- mainboard_pci_subsystem_vendor = "0x15ad";
- mainboard_pci_subsystem_device = "0x1976"; device_operations = "qemuvga_pci_ops_dev"; cpus {}; domain@0 {
Index: LinuxBIOSv3-mainboard_subsystem/device/pci_device.c
--- LinuxBIOSv3-mainboard_subsystem/device/pci_device.c (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/device/pci_device.c (Arbeitskopie) @@ -50,6 +50,7 @@ #if CONFIG_CARDBUS_PLUGIN_SUPPORT == 1 #include <device/cardbus.h> #endif +#include <statictree.h>
u8 pci_moving_config8(struct device *dev, unsigned int reg) { @@ -627,19 +628,18 @@ /* Set the subsystem vendor and device ID for mainboard devices. */ ops = ops_pci(dev);
-#if defined(CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID) && \
- defined(CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID)
+#ifdef HAVE_MAINBOARD_PCI_SUBSYSTEM_ID if (dev->on_mainboard && ops && ops->set_subsystem) { printk(BIOS_DEBUG, "%s: Setting subsystem VID/DID to %02x/%02x\n",
dev_path(dev), CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID,
CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID);
dev_path(dev), mainboard_pci_subsystem_vendor,
mainboard_pci_subsystem_device);
ops->set_subsystem(dev,
CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID,
CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID);
ops->set_subsystem(dev, mainboard_pci_subsystem_vendor,
}mainboard_pci_subsystem_device);
#endif
- command = pci_read_config16(dev, PCI_COMMAND); command |= dev->command; command |= (PCI_COMMAND_PARITY + PCI_COMMAND_SERR); // Error check.
Index: LinuxBIOSv3-mainboard_subsystem/util/dtc/flattree.c
--- LinuxBIOSv3-mainboard_subsystem/util/dtc/flattree.c (Revision 692) +++ LinuxBIOSv3-mainboard_subsystem/util/dtc/flattree.c (Arbeitskopie) @@ -1328,7 +1328,7 @@ extern char *code; struct node *next; extern struct node *first_node;
- int found_mainboard_vendor = 0, found_mainboard_partnumber = 0;
int found_mainboard_vendor = 0, found_mainboard_partnumber = 0, found_mainboard_subsys = 0;
labeltree(bi->dt);
@@ -1361,6 +1361,14 @@ found_mainboard_partnumber = 1; fprintf(f, "const char *mainboard_part_number = "%s";\n", prop->val.val); }
if (streq(prop->name, "mainboard_pci_subsystem_vendor")){
found_mainboard_subsys++;
fprintf(f, "const u16 mainboard_pci_subsystem_vendor = %s;\n", prop->val.val);
}
if (streq(prop->name, "mainboard_pci_subsystem_device")){
found_mainboard_subsys++;
fprintf(f, "const u16 mainboard_pci_subsystem_device = %s;\n", prop->val.val);
}
}
if (! found_mainboard_vendor){
@@ -1374,6 +1382,17 @@ "(and make sure there is a mainboard-vendor property too"); }
switch (found_mainboard_subsys) {
case 0:
break;
case 1:
die("There is only one of mainboard_pci_subsystem_vendor and "
"mainboard_pci_subsystem_device properties in the root. "
"Please add the other one or remove the existing one.");
break;
case 2:
break;
}
/* emit the code, if any */ if (code)
@@ -1395,6 +1414,8 @@ char *symprefix = "dt"; extern char *code; struct node *next;
struct property *prop;
int found_mainboard_subsys = 0; extern struct node *first_node;
labeltree(bi->dt);
@@ -1416,6 +1437,31 @@ /* emit any includes that we need -- TODO: ONLY ONCE PER TYPE*/ fprintf(f, "#include <device/device.h>\n#include <device/pci.h>\n"); fprintf(f, "extern const char *mainboard_vendor, *mainboard_part_number;\n");
for_each_property(bi->dt, prop) {
if (streq(prop->name, "mainboard_pci_subsystem_vendor")){
found_mainboard_subsys++;
}
if (streq(prop->name, "mainboard_pci_subsystem_device")){
found_mainboard_subsys++;
}
}
switch (found_mainboard_subsys) {
case 0:
break;
case 1:
die("There is only one of mainboard_pci_subsystem_vendor and "
"mainboard_pci_subsystem_device properties in the root. "
"Please add the other one or remove the existing one.");
break;
case 2:
fprintf(f, "#define HAVE_MAINBOARD_PCI_SUBSYSTEM_ID\n");
fprintf(f, "extern const u16 mainboard_pci_subsystem_vendor;\n");
fprintf(f, "extern const u16 mainboard_pci_subsystem_device;\n");
break;
}
flatten_tree_emit_includes(bi->dt, &coreboot_emitter, f, &strbuf, vi);
flatten_tree_emit_structdecls(bi->dt, &coreboot_emitter, f, &strbuf, vi);