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 | |
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')
-rw-r--r-- | util/build.mk | 8 | ||||
-rw-r--r-- | util/gen_ipi_table.c | 58 |
2 files changed, 66 insertions, 0 deletions
diff --git a/util/build.mk b/util/build.mk index 7699ef4572..4fb6b7e1f0 100644 --- a/util/build.mk +++ b/util/build.mk @@ -66,6 +66,14 @@ build-util-bin += gen_emmc_transfer_data $(out)/util/gen_emmc_transfer_data: BUILD_LDFLAGS += -DSECTION_IS_RO endif # CONFIG_BOOTBLOCK +ifneq ($(CONFIG_IPI),) +build-util-bin += gen_ipi_table + +$(out)/util/gen_ipi_table: board/$(BOARD)/board.h +$(out)/ipi_table_gen.inc: $(out)/util/gen_ipi_table + $(call quiet,ipi_table,IPITBL ) +endif + ifneq ($(CONFIG_TOUCHPAD_HASH_FW),) build-util-bin += gen_touchpad_hash 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; +} |