diff options
author | Yilun Lin <yllin@google.com> | 2019-04-15 18:16:54 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-30 06:08:07 -0700 |
commit | 3c49473cd607bc5debbbbd22118bad18d11b8611 (patch) | |
tree | fd1fa234a159a3436559b8f3a79a81615041bd50 /util/gen_ipi_table.c | |
parent | 631000bdf478b8ad206753f4ffeb2af879129866 (diff) | |
download | chrome-ec-3c49473cd607bc5debbbbd22118bad18d11b8611.tar.gz |
mt_scp: Generate IPI tables with util gen_ipi_table.
IPI table is board-specific. This CL removes the original
IPI table in chip layer, and uses gen_ipi_table to generate
the table for each board to reduce the maintenance effort.
TEST=make BOARD=kukui_scp, and see build/kukui_scp/ipi_table_gen.inc
exists. Push to Kukui, and see SCP boots.
TEST=modify IPI_COUNT in board.h and see it generates a new
ipi_table_gen.inc
BUG=b:130508869
BRANCH=None
Change-Id: I0c05319447d15917e8833aa80d61166c4e396370
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1568890
Commit-Ready: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'util/gen_ipi_table.c')
-rw-r--r-- | util/gen_ipi_table.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/util/gen_ipi_table.c b/util/gen_ipi_table.c new file mode 100644 index 0000000000..07a3a39be0 --- /dev/null +++ b/util/gen_ipi_table.c @@ -0,0 +1,58 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Generate IPI tables, and inputs come from IPI_COUNT macro in board.h. + */ + +#include <stdio.h> + +/* Prevent from including gpio configs . */ +#define __ASSEMBLER__ + +#include "board.h" + +#define FPRINTF(format, args...) fprintf(fout, format, ## args) + +int main(int argc, char **argv) +{ + FILE *fout; + int i; + + if (argc != 2) { + fprintf(stderr, "USAGE: %s <output>\n", argv[0]); + return 1; + } + + fout = fopen(argv[1], "w"); + + if (!fout) { + fprintf(stderr, "Cannot open output file %s\n", argv[1]); + return 1; + } + + FPRINTF("/* This is a generated file. Do not modify. */\n"); + FPRINTF("\n"); + FPRINTF("/*\n"); + FPRINTF(" * Table to hold all the IPI handler function pointer.\n"); + FPRINTF(" */\n"); + FPRINTF("table(ipi_handler_t, ipi_handler_table,\n"); + + for (i = 0; i < IPI_COUNT; ++i) + FPRINTF("ipi_x_func(handler, ipi_arguments, %d)\n", i); + + FPRINTF(");\n"); + + FPRINTF("/*\n"); + FPRINTF(" * Table to hold all the wake-up bool address.\n"); + FPRINTF(" */\n"); + FPRINTF("table(int *, ipi_wakeup_table,\n"); + + for (i = 0; i < IPI_COUNT; ++i) + FPRINTF("ipi_x_var(wakeup, %d)\n", i); + + FPRINTF(");\n"); + + fclose(fout); + return 0; +} |