diff --git a/device/pci_device.c b/device/pci_device.c index 322149c27e..6d9e0a81db 100644 --- a/device/pci_device.c +++ b/device/pci_device.c @@ -50,6 +50,7 @@ #if CONFIG_CARDBUS_PLUGIN_SUPPORT == 1 #include #endif +#include u8 pci_moving_config8(struct device *dev, unsigned int reg) { @@ -627,19 +628,18 @@ void pci_dev_enable_resources(struct device *dev) /* 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. diff --git a/mainboard/adl/msm800sev/Kconfig b/mainboard/adl/msm800sev/Kconfig index 0e6870338b..918d546386 100644 --- a/mainboard/adl/msm800sev/Kconfig +++ b/mainboard/adl/msm800sev/Kconfig @@ -26,19 +26,3 @@ config MAINBOARD_NAME 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. - diff --git a/mainboard/adl/msm800sev/dts b/mainboard/adl/msm800sev/dts index 671ff64e1a..490fbf1733 100644 --- a/mainboard/adl/msm800sev/dts +++ b/mainboard/adl/msm800sev/dts @@ -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"); diff --git a/mainboard/amd/db800/Kconfig b/mainboard/amd/db800/Kconfig index 1b805f5907..450927d3a8 100644 --- a/mainboard/amd/db800/Kconfig +++ b/mainboard/amd/db800/Kconfig @@ -26,19 +26,3 @@ config MAINBOARD_NAME help This is the default mainboard name. -config MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID - hex - # TODO: Fix PCI ID. - default 0x1022 - depends BOARD_AMD_DB800 - help - Mainboard specific PCI subsystem vendor ID. - -config MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID - hex - # TODO: Fix PCI ID. - default 0x2323 - depends BOARD_AMD_DB800 - help - Mainboard specific PCI subsystem device ID. - diff --git a/mainboard/amd/db800/dts b/mainboard/amd/db800/dts index b8bf46caea..5ef63f0db2 100644 --- a/mainboard/amd/db800/dts +++ b/mainboard/amd/db800/dts @@ -21,6 +21,8 @@ /{ mainboard-vendor = "AMD"; mainboard-name = "DB800"; + mainboard_pci_subsystem_vendor = "0x1022"; + mainboard_pci_subsystem_device = "0x2323"; cpus { }; apic@0 { /config/("northbridge/amd/geodelx/apic"); diff --git a/mainboard/amd/norwich/Kconfig b/mainboard/amd/norwich/Kconfig index 5fe1a66b37..8cf392787a 100644 --- a/mainboard/amd/norwich/Kconfig +++ b/mainboard/amd/norwich/Kconfig @@ -26,19 +26,3 @@ config MAINBOARD_NAME 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. - diff --git a/mainboard/amd/norwich/dts b/mainboard/amd/norwich/dts index 85ecb906bc..230c4d223d 100644 --- a/mainboard/amd/norwich/dts +++ b/mainboard/amd/norwich/dts @@ -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"); @@ -28,7 +30,7 @@ domain@0 { /config/("northbridge/amd/geodelx/domain"); /* Video RAM has to be in 2MB chunks. */ - geode_video_mb = "8"; + geode_video_mb = "8"; pci@1,0 { /config/("northbridge/amd/geodelx/pci"); }; diff --git a/mainboard/artecgroup/dbe61/Kconfig b/mainboard/artecgroup/dbe61/Kconfig index 33f046e2ac..f34739c3dd 100644 --- a/mainboard/artecgroup/dbe61/Kconfig +++ b/mainboard/artecgroup/dbe61/Kconfig @@ -26,19 +26,3 @@ config MAINBOARD_NAME 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. - diff --git a/mainboard/artecgroup/dbe61/dts b/mainboard/artecgroup/dbe61/dts index 735fdb03fd..e0ca759412 100644 --- a/mainboard/artecgroup/dbe61/dts +++ b/mainboard/artecgroup/dbe61/dts @@ -75,6 +75,8 @@ end /{ 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"); diff --git a/mainboard/emulation/qemu-x86/Kconfig b/mainboard/emulation/qemu-x86/Kconfig index 040e4086ee..a6ecd7a4c5 100644 --- a/mainboard/emulation/qemu-x86/Kconfig +++ b/mainboard/emulation/qemu-x86/Kconfig @@ -27,17 +27,3 @@ config MAINBOARD_NAME 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. - diff --git a/mainboard/emulation/qemu-x86/defconfig b/mainboard/emulation/qemu-x86/defconfig index a97f7b1d16..c1742ffa9e 100644 --- a/mainboard/emulation/qemu-x86/defconfig +++ b/mainboard/emulation/qemu-x86/defconfig @@ -20,8 +20,6 @@ CONFIG_LOCALVERSION="" CONFIG_VENDOR_EMULATION=y # CONFIG_VENDOR_PCENGINES is not set CONFIG_MAINBOARD_NAME="emulation/qemu-x86" -CONFIG_MAINBOARD_PCI_SUBSYSTEM_VENDOR_ID=0x15ad -CONFIG_MAINBOARD_PCI_SUBSYSTEM_DEVICE_ID=0x1976 CONFIG_BOARD_EMULATION_QEMU_X86=y # CONFIG_COREBOOT_ROMSIZE_KB_128 is not set CONFIG_COREBOOT_ROMSIZE_KB_256=y diff --git a/mainboard/emulation/qemu-x86/dts b/mainboard/emulation/qemu-x86/dts index 453caf45cd..42ea56dafd 100644 --- a/mainboard/emulation/qemu-x86/dts +++ b/mainboard/emulation/qemu-x86/dts @@ -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 { diff --git a/util/dtc/flattree.c b/util/dtc/flattree.c index 8c3e52291a..fd221244e5 100644 --- a/util/dtc/flattree.c +++ b/util/dtc/flattree.c @@ -1328,7 +1328,7 @@ void dt_to_coreboot(FILE *f, struct boot_info *bi, int version, int boot_cpuid_p 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 @@ void dt_to_coreboot(FILE *f, struct boot_info *bi, int version, int boot_cpuid_p 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 @@ void dt_to_coreboot(FILE *f, struct boot_info *bi, int version, int boot_cpuid_p "(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 @@ void dt_to_corebooth(FILE *f, struct boot_info *bi, int version, int boot_cpuid_ 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 @@ void dt_to_corebooth(FILE *f, struct boot_info *bi, int version, int boot_cpuid_ /* emit any includes that we need -- TODO: ONLY ONCE PER TYPE*/ fprintf(f, "#include \n#include \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);