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.

Change-Id: Iec1c23484e85cab3f80a34f2b082088f38ac4de9
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/1472
Tested-by: build bot (Jenkins)
This commit is contained in:
Kyösti Mälkki 2012-10-07 15:08:32 +02:00 committed by Patrick Georgi
parent 9c9eb8cbc9
commit aada2e127b
4 changed files with 59 additions and 28 deletions

View File

@ -12,6 +12,9 @@ ramstage-y += pnp_device.c
ramstage-y += pci_ops.c ramstage-y += pci_ops.c
ramstage-y += smbus_ops.c ramstage-y += smbus_ops.c
# Work-around for chip.h removal
ramstage-y += dummy_chip_ops.c
romstage-y+= device_romstage.c romstage-y+= device_romstage.c
subdirs-y += oprom subdirs-y += oprom

View File

@ -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 = {};

View File

@ -179,7 +179,6 @@ struct device *new_chip(struct device *parent, struct device *bus, char *path) {
} }
void add_header(struct device *dev) { void add_header(struct device *dev) {
if ((dev->chiph_exists) || (scan_mode == KCONFIG_MODE)){
int include_exists = 0; int include_exists = 0;
struct header *h = &headers; struct header *h = &headers;
while (h->next) { while (h->next) {
@ -195,10 +194,10 @@ void add_header(struct device *dev) {
struct header *tmp = h->next; struct header *tmp = h->next;
h->next = malloc(sizeof(struct header)); h->next = malloc(sizeof(struct header));
memset(h->next, 0, sizeof(struct header)); memset(h->next, 0, sizeof(struct header));
h->next->chiph_exists = dev->chiph_exists;
h->next->name = dev->name; h->next->name = dev->name;
h->next->next = tmp; h->next->next = tmp;
} }
}
} }
struct device *new_device(struct device *parent, struct device *busdev, const int bus, const char *devnum, int enabled) { struct device *new_device(struct device *parent, struct device *busdev, const int bus, const char *devnum, int enabled) {
@ -418,16 +417,11 @@ static void pass1(FILE *fil, struct device *ptr)
fprintf(fil, "\t.link_list = NULL,\n"); fprintf(fil, "\t.link_list = NULL,\n");
if (ptr->sibling) if (ptr->sibling)
fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name); fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name);
if (ptr->chip->chiph_exists) {
fprintf(fil, "#ifndef __PRE_RAM__\n"); fprintf(fil, "#ifndef __PRE_RAM__\n");
fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore); fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore);
fprintf(fil, "#endif\n"); 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); 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) if (ptr->nextdev)
fprintf(fil, "\t.next=&%s\n", ptr->nextdev->name); fprintf(fil, "\t.next=&%s\n", ptr->nextdev->name);
fprintf(fil, "};\n"); fprintf(fil, "};\n");
@ -622,8 +616,10 @@ int main(int argc, char** argv) {
h = &headers; h = &headers;
while (h->next) { while (h->next) {
h = h->next; h = h->next;
if (h->chiph_exists)
fprintf(autogen, "#include \"%s/chip.h\"\n", h->name); fprintf(autogen, "#include \"%s/chip.h\"\n", h->name);
} }
fprintf(autogen, "\n#ifndef __PRE_RAM__\n");
h = &headers; h = &headers;
while (h->next) { while (h->next) {
h = 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); fprintf(autogen, "extern struct chip_operations %s_ops;\n", name_underscore);
free(name_underscore); free(name_underscore);
} }
fprintf(autogen, "#endif\n");
walk_device_tree(autogen, &root, inherit_subsystem_ids, NULL); walk_device_tree(autogen, &root, inherit_subsystem_ids, NULL);
fprintf(autogen, "\n/* pass 0 */\n"); fprintf(autogen, "\n/* pass 0 */\n");

View File

@ -86,6 +86,7 @@ struct device *head;
struct header; struct header;
struct header { struct header {
char *name; char *name;
int chiph_exists;
struct header *next; struct header *next;
}; };