sconfig: Remove bootblock and Kconfig modes

The command line parameters for these modes haven't worked in two
years and nobody noticed.  They're obviously not getting used, so
remove them.

TEST=Generate static.c before and after the change, verify they're
identical.

Change-Id: I1d746fb53a2f232155f663f4debc447d53d4cf6b
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/16079
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-08-05 17:40:39 -06:00
parent 25f8a4f6d4
commit 824255ea28
1 changed files with 33 additions and 120 deletions

View File

@ -26,14 +26,6 @@ struct header headers;
static int devcount = 0; static int devcount = 0;
typedef enum {
STATIC_MODE,
BOOTBLOCK_MODE,
KCONFIG_MODE
} scan_t;
static scan_t scan_mode = STATIC_MODE;
typedef enum { typedef enum {
UNSLASH, UNSLASH,
SPLIT_1ST, SPLIT_1ST,
@ -174,15 +166,10 @@ struct device *new_chip(struct device *parent, struct device *bus, char *path) {
} }
} }
if (scan_mode == STATIC_MODE)
sprintf(chip_h, "src/%s/chip.h", path); sprintf(chip_h, "src/%s/chip.h", path);
else if (scan_mode == BOOTBLOCK_MODE)
sprintf(chip_h, "src/%s/bootblock.c", path);
if ((scan_mode == STATIC_MODE) || (scan_mode == BOOTBLOCK_MODE)) {
if ((stat(chip_h, &st) == -1) && (errno == ENOENT)) if ((stat(chip_h, &st) == -1) && (errno == ENOENT))
new_chip->chiph_exists = 0; new_chip->chiph_exists = 0;
}
if (parent->latestchild) { if (parent->latestchild) {
parent->latestchild->next_sibling = new_chip; parent->latestchild->next_sibling = new_chip;
@ -551,56 +538,25 @@ static void inherit_subsystem_ids(FILE *file, struct device *dev)
static void usage(void) static void usage(void)
{ {
printf("usage: sconfig vendor/mainboard devicetree_file output_file [-{s|b|k}]\n"); printf("usage: sconfig vendor/mainboard devicetree_file output_file\n");
printf("\t-s file\tcreate ramstage static device map\n");
printf("\t-b file\tcreate bootblock init_mainboard()\n");
printf("\t-k file\tcreate Kconfig devicetree section\n");
printf("Defaults to \"-s static.c\" if no {s|b|k} specified.\n");
exit (1); exit (1);
} }
enum { enum {
MAINBOARD_ARG = 1, MAINBOARD_ARG = 1,
DEVICEFILE_ARG, DEVICEFILE_ARG,
OUTPUTFILE_ARG, OUTPUTFILE_ARG};
OUTPUTTYPE_ARG
};
#define MIN_ARGS 4 #define ARG_COUNT 4
#define MAX_ARGS 5
int main(int argc, char** argv) { int main(int argc, char** argv) {
if (argc != MIN_ARGS && argc != MAX_ARGS) if (argc != ARG_COUNT)
usage(); usage();
char *mainboard = argv[MAINBOARD_ARG]; char *mainboard = argv[MAINBOARD_ARG];
char *devtree = argv[DEVICEFILE_ARG]; char *devtree = argv[DEVICEFILE_ARG];
char *outputc = argv[OUTPUTFILE_ARG]; char *outputc = argv[OUTPUTFILE_ARG];
if (argc == MIN_ARGS) {
scan_mode = STATIC_MODE;
} else if (argc == MAX_ARGS) {
if ((argv[OUTPUTTYPE_ARG][0] != '-') ||
(argv[OUTPUTTYPE_ARG][2] == 0)) {
usage();
}
switch (argv[OUTPUTTYPE_ARG][1]) {
case 's':
scan_mode = STATIC_MODE;
break;
case 'b':
scan_mode = BOOTBLOCK_MODE;
break;
case 'k':
scan_mode = KCONFIG_MODE;
break;
default:
usage();
break;
}
}
headers.next = 0; headers.next = 0;
#ifdef MAINBOARDS_HAVE_CHIP_H #ifdef MAINBOARDS_HAVE_CHIP_H
if (scan_mode == STATIC_MODE) { if (scan_mode == STATIC_MODE) {
@ -639,8 +595,6 @@ int main(int argc, char** argv) {
} }
struct header *h; struct header *h;
if (scan_mode == STATIC_MODE) {
fprintf(autogen, "#include <device/device.h>\n"); fprintf(autogen, "#include <device/device.h>\n");
fprintf(autogen, "#include <device/pci.h>\n"); fprintf(autogen, "#include <device/pci.h>\n");
h = &headers; h = &headers;
@ -670,47 +624,6 @@ int main(int argc, char** argv) {
#endif #endif
walk_device_tree(autogen, &root, pass1, NULL); walk_device_tree(autogen, &root, pass1, NULL);
} else if (scan_mode == BOOTBLOCK_MODE) {
h = &headers;
while (h->next) {
h = h->next;
fprintf(autogen, "#include \"%s/bootblock.c\"\n", h->name);
}
fprintf(autogen, "\n#if CONFIG_HAS_MAINBOARD_BOOTBLOCK\n");
fprintf(autogen, "#include \"mainboard/%s/bootblock.c\"\n", mainboard);
fprintf(autogen, "#else\n");
fprintf(autogen, "static unsigned long init_mainboard(int bsp_cpu)\n{\n");
fprintf(autogen, "\tif (! bsp_cpu) return 0;\n");
h = &headers;
while (h->next) {
h = h->next;
char * buf = translate_name(h->name, UNSLASH);
if (buf) {
fprintf(autogen, "\tinit_%s();\n", buf);
free(buf);
}
}
fprintf(autogen, "\treturn 0;\n}\n");
fprintf(autogen, "#endif\n");
} else if (scan_mode == KCONFIG_MODE) {
fprintf(autogen, "\nconfig MAINBOARD_DIR\n\tstring\n");
fprintf(autogen, "\tdefault %s\n", mainboard);
fprintf(autogen, "\nconfig MAINBOARD_DEVTREE\n\tdef_bool y\n");
h = &headers;
while (h->next) {
h = h->next;
char * buf = translate_name(h->name, TO_UPPER);
if (buf) {
fprintf(autogen, "\tselect %s\n", buf);
free(buf);
}
}
}
fclose(autogen); fclose(autogen);
return 0; return 0;