Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1472
-gerrit
commit 2bc6e8cdd7910e2c0a1593370fe9839ca023400a Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Tue Aug 21 17:54:26 2012 +0300
Every chip must have chip_operations
Forcing this rule, chip_ops can be added in the static devicetree regardless of the existence of the chip.h files.
Take care of NULL .name case in dummy chip_operations. Fix typo in mPGA603 socket.
Change-Id: Iec1c23484e85cab3f80a34f2b082088f38ac4de9 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/arch/x86/boot/smbios.c | 3 +- .../intel/socket_mPGA603/socket_mPGA603_400Mhz.c | 2 +- src/devices/Makefile.inc | 3 ++ src/devices/dummy_chip_ops.c | 30 ++++++++++++ util/sconfig/main.c | 53 ++++++++++------------ util/sconfig/sconfig.h | 1 + 6 files changed, 62 insertions(+), 30 deletions(-)
diff --git a/src/arch/x86/boot/smbios.c b/src/arch/x86/boot/smbios.c index 8877f60..a171707 100644 --- a/src/arch/x86/boot/smbios.c +++ b/src/arch/x86/boot/smbios.c @@ -278,7 +278,8 @@ static int smbios_walk_device_tree(device_t tree, int *handle, unsigned long *cu int len = 0;
for(dev = tree; dev; dev = dev->next) { - printk(BIOS_INFO, "%s (%s)\n", dev_path(dev), dev->chip_ops ? dev->chip_ops->name : ""); + printk(BIOS_INFO, "%s (%s)\n", dev_path(dev), + (dev->chip_ops && dev->chip_ops->name) ? dev->chip_ops->name : "");
if (dev->ops && dev->ops->get_smbios_data) len += dev->ops->get_smbios_data(dev, handle, current); diff --git a/src/cpu/intel/socket_mPGA603/socket_mPGA603_400Mhz.c b/src/cpu/intel/socket_mPGA603/socket_mPGA603_400Mhz.c index 9154608..2436f96 100644 --- a/src/cpu/intel/socket_mPGA603/socket_mPGA603_400Mhz.c +++ b/src/cpu/intel/socket_mPGA603/socket_mPGA603_400Mhz.c @@ -2,6 +2,6 @@ #include "chip.h"
-struct chip_opertations cpu_intel_socket_mPGA603_ops = { +struct chip_operations cpu_intel_socket_mPGA603_ops = { CHIP_NAME("Socket mPGA603 400Mhz CPU") }; diff --git a/src/devices/Makefile.inc b/src/devices/Makefile.inc index 9a2f71e..cde8b3f 100644 --- a/src/devices/Makefile.inc +++ b/src/devices/Makefile.inc @@ -11,6 +11,9 @@ ramstage-y += pnp_device.c ramstage-y += pci_ops.c ramstage-y += smbus_ops.c
+# Work-around for chip.h removal +ramstage-y += dummy_chip_ops.c + romstage-y+= device_romstage.c
subdirs-y += oprom diff --git a/src/devices/dummy_chip_ops.c b/src/devices/dummy_chip_ops.c new file mode 100644 index 0000000..a2fc999 --- /dev/null +++ b/src/devices/dummy_chip_ops.c @@ -0,0 +1,30 @@ +#include <device/device.h> + +/* Dummy chip_operations, so every chip has one for sure. + * Temporary work-around before total chip.h removal. + */ + +struct chip_operations cpu_via_c3_ops = {}; +struct chip_operations cpu_via_c7_ops = {}; +struct chip_operations cpu_amd_geode_lx_ops = {}; +struct chip_operations cpu_amd_geode_gx1_ops = {}; +struct chip_operations cpu_amd_geode_gx2_ops = {}; +struct chip_operations drivers_ati_ragexl_ops = {}; +struct chip_operations drivers_dec_21143_ops = {}; +struct chip_operations drivers_generic_generic_ops = {}; +struct chip_operations drivers_oxford_oxpcie_ops = {}; +struct chip_operations drivers_realtek_ops = {}; +struct chip_operations drivers_sil_3114_ops = {}; +struct chip_operations drivers_trident_blade3d_ops = {}; +struct chip_operations southbridge_amd_amd8131_ops = {}; +struct chip_operations southbridge_amd_amd8132_ops = {}; +struct chip_operations southbridge_amd_amd8151_ops = {}; +struct chip_operations southbridge_broadcom_bcm21000_ops = {}; +struct chip_operations southbridge_broadcom_bcm5780_ops = {}; +struct chip_operations southbridge_intel_i82870_ops = {}; +struct chip_operations southbridge_rdc_r8610_ops = {}; +struct chip_operations southbridge_via_k8t890_ops = {}; +struct chip_operations superio_serverengines_pilot_ops = {}; +struct chip_operations superio_smsc_lpc47n207_ops = {}; +struct chip_operations superio_smsc_sio1007_ops = {}; + diff --git a/util/sconfig/main.c b/util/sconfig/main.c index fe4c3b8..f066d7b 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -179,25 +179,24 @@ struct device *new_chip(struct device *parent, struct device *bus, char *path) { }
void add_header(struct device *dev) { - if ((dev->chiph_exists) || (scan_mode == KCONFIG_MODE)){ - int include_exists = 0; - struct header *h = &headers; - while (h->next) { - int result = strcmp(dev->name, h->next->name); - if (result == 0) { - include_exists = 1; - break; - } - if (result < 0) break; - h = h->next; - } - if (!include_exists) { - struct header *tmp = h->next; - h->next = malloc(sizeof(struct header)); - memset(h->next, 0, sizeof(struct header)); - h->next->name = dev->name; - h->next->next = tmp; + int include_exists = 0; + struct header *h = &headers; + while (h->next) { + int result = strcmp(dev->name, h->next->name); + if (result == 0) { + include_exists = 1; + break; } + if (result < 0) break; + h = h->next; + } + if (!include_exists) { + struct header *tmp = h->next; + h->next = malloc(sizeof(struct header)); + memset(h->next, 0, sizeof(struct header)); + h->next->chiph_exists = dev->chiph_exists; + h->next->name = dev->name; + h->next->next = tmp; } }
@@ -418,16 +417,11 @@ static void pass1(FILE *fil, struct device *ptr) fprintf(fil, "\t.link_list = NULL,\n"); if (ptr->sibling) fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name); - if (ptr->chip->chiph_exists) { - fprintf(fil, "#ifndef __PRE_RAM__\n"); - fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore); - fprintf(fil, "#endif\n"); + fprintf(fil, "#ifndef __PRE_RAM__\n"); + fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore); + fprintf(fil, "#endif\n"); + if (ptr->chip->chiph_exists) fprintf(fil, "\t.chip_info = &%s_info_%d,\n", ptr->chip->name_underscore, ptr->chip->id); - } else if (ptr->chip->chip == &mainboard) { - fprintf(fil, "#ifndef __PRE_RAM__\n"); - fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore); - fprintf(fil, "#endif\n"); - } if (ptr->nextdev) fprintf(fil, "\t.next=&%s\n", ptr->nextdev->name); fprintf(fil, "};\n"); @@ -622,8 +616,10 @@ int main(int argc, char** argv) { h = &headers; while (h->next) { h = h->next; - fprintf(autogen, "#include "%s/chip.h"\n", h->name); + if (h->chiph_exists) + fprintf(autogen, "#include "%s/chip.h"\n", h->name); } + fprintf(autogen, "\n#ifndef __PRE_RAM__\n"); h = &headers; while (h->next) { h = h->next; @@ -632,6 +628,7 @@ int main(int argc, char** argv) { fprintf(autogen, "extern struct chip_operations %s_ops;\n", name_underscore); free(name_underscore); } + fprintf(autogen, "#endif\n");
walk_device_tree(autogen, &root, inherit_subsystem_ids, NULL); fprintf(autogen, "\n/* pass 0 */\n"); diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h index 1576600..b8a231a 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -86,6 +86,7 @@ struct device *head; struct header; struct header { char *name; + int chiph_exists; struct header *next; };