From e1baf39cb523bd7b35052bc1ffa2414af999e543 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Fri, 20 Mar 2015 16:54:23 +0100 Subject: [PATCH] dtc: drop unneeded patch --- ...-support-for-named-integer-constants.patch | 331 ------------------ .../recipes-kernel/dtc/dtc_git.bbappend | 3 - 2 files changed, 334 deletions(-) delete mode 100644 meta-opendreambox/recipes-kernel/dtc/dtc/0001-dtc-Add-support-for-named-integer-constants.patch delete mode 100644 meta-opendreambox/recipes-kernel/dtc/dtc_git.bbappend diff --git a/meta-opendreambox/recipes-kernel/dtc/dtc/0001-dtc-Add-support-for-named-integer-constants.patch b/meta-opendreambox/recipes-kernel/dtc/dtc/0001-dtc-Add-support-for-named-integer-constants.patch deleted file mode 100644 index 1d5e270c..00000000 --- a/meta-opendreambox/recipes-kernel/dtc/dtc/0001-dtc-Add-support-for-named-integer-constants.patch +++ /dev/null @@ -1,331 +0,0 @@ -From c9c1e212591017d10d8c0887142da737bbacf8fb Mon Sep 17 00:00:00 2001 -From: Stephen Warren -Date: Tue, 30 Aug 2011 15:30:18 -0600 -Subject: [PATCH] dtc: Add support for named integer constants - -You may define constants as follows: - -/define/ CHROME_OS_BOOT_DEVICES "emmc", "spi"; -/define/ GBB_BASE <0x00e08000>; -/define/ UART_BAUD_OPTIONS <115200 57600 19200>; - -And properties may use these values as follows: - -test-node { - boot-devices = ; - gbb = ; - baud-rates = ; -}; - -BUG=chromium-os:29014 -TEST=compile the above code and see with fdtdump that we get correct results. - -Change-Id: I891fb9446c76adc90b78c3021cc33acce13d12e7 -Signed-off-by: Stephen Warren -Signed-off-by: Simon Glass - -Conflicts: - dtc-lexer.l - dtc-parser.y - tests/Makefile.tests ---- - dtc-lexer.l | 13 +++++++++ - dtc-parser.y | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/.gitignore | 1 + - tests/Makefile.tests | 1 + - tests/identifiers.c | 44 +++++++++++++++++++++++++++++ - tests/identifiers.dts | 11 ++++++++ - tests/run_tests.sh | 4 +++ - 7 files changed, 150 insertions(+) - create mode 100644 tests/identifiers.c - create mode 100644 tests/identifiers.dts - -diff --git a/dtc-lexer.l b/dtc-lexer.l -index 3b41bfc..4abf7b0 100644 ---- a/dtc-lexer.l -+++ b/dtc-lexer.l -@@ -28,6 +28,7 @@ - PROPNODECHAR [a-zA-Z0-9,._+*#?@-] - PATHCHAR ({PROPNODECHAR}|[/]) - LABEL [a-zA-Z_][a-zA-Z0-9_]* -+IDENTIFIER [a-zA-Z_][a-zA-Z0-9_]* - STRING \"([^\\"]|\\.)*\" - CHAR_LITERAL '([^']|\\')*' - WS [[:space:]] -@@ -124,6 +125,12 @@ static int pop_input_file(void); - return DT_BITS; - } - -+<*>"/define/" { -+ DPRINT("Keyword: /define/\n"); -+ BEGIN_DEFAULT(); -+ return DT_DEFINE; -+ } -+ - <*>"/delete-property/" { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("\n"); -@@ -145,6 +152,12 @@ static int pop_input_file(void); - return DT_LABEL; - } - -+{IDENTIFIER} { -+ DPRINT("identifier: %s\n", yytext); -+ yylval.identifier = xstrdup(yytext + 1); -+ return DT_IDENTIFIER; -+ } -+ - ([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? { - yylval.literal = xstrdup(yytext); - DPRINT("Literal: '%s'\n", yylval.literal); -diff --git a/dtc-parser.y b/dtc-parser.y -index f412460..56b0572 100644 ---- a/dtc-parser.y -+++ b/dtc-parser.y -@@ -33,6 +33,9 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern int treesource_error; - -+static struct identifier *get_identifier(const char *s); -+static void set_identifier(const char *name, struct data data); -+static void eval_identifier(struct data *data, const char *name); - static unsigned long long eval_literal(const char *s, int base, int bits); - static unsigned char eval_char_literal(const char *s); - %} -@@ -41,6 +44,7 @@ static unsigned char eval_char_literal(const char *s); - char *propnodename; - char *literal; - char *labelref; -+ char *identifier; - unsigned int cbase; - uint8_t byte; - struct data data; -@@ -61,10 +65,12 @@ static unsigned char eval_char_literal(const char *s); - %token DT_V1 - %token DT_MEMRESERVE - %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR -+%token DT_DEFINE - %token DT_BITS - %token DT_DEL_PROP - %token DT_DEL_NODE - %token DT_PROPNODENAME -+%token DT_IDENTIFIER - %token DT_LITERAL - %token DT_CHAR_LITERAL - %token DT_BASE -@@ -74,6 +80,7 @@ static unsigned char eval_char_literal(const char *s); - %token DT_REF - %token DT_INCBIN - -+%type define - %type propdata - %type propdataprefix - %type memreserve -@@ -136,15 +143,30 @@ memreserve: - } - ; - -+define: -+ DT_DEFINE DT_IDENTIFIER propdata ';' -+ { -+ set_identifier($2, $3); -+ } -+ ; -+ - devicetree: - '/' nodedef - { - $$ = name_node($2, ""); - } -+ | define -+ { -+ $$ = name_node(build_node(NULL, NULL), ""); -+ } - | devicetree '/' nodedef - { - $$ = merge_nodes($1, $3); - } -+ | devicetree define -+ { -+ $$ = $1; -+ } - | devicetree DT_REF nodedef - { - struct node *target = get_node_by_ref($1, $2); -@@ -330,6 +352,13 @@ arrayprefix: - { - $$.data = data_add_marker($1.data, LABEL, $2); - } -+ | arrayprefix DT_IDENTIFIER -+ { -+ struct data data; -+ -+ eval_identifier(&data, $2); -+ $$.data = data_merge($1.data, data); -+ } - ; - - integer_prim: -@@ -485,6 +514,53 @@ void yyerror(char const *s) { - print_error("%s", s); - } - -+struct identifier { -+ const char *name; -+ struct data data; -+ struct identifier *next; -+}; -+static struct identifier *identifiers; -+ -+static struct identifier *get_identifier(const char *name) -+{ -+ struct identifier *identifier = identifiers; -+ -+ while (identifier != NULL) { -+ if (streq(name, identifier->name)) -+ return identifier; -+ identifier = identifier->next; -+ } -+ -+ return NULL; -+} -+ -+static void set_identifier(const char *name, struct data data) -+{ -+ struct identifier *identifier; -+ -+ if (get_identifier(name) != NULL) { -+ print_error("redefining %s", name); -+ return; -+ } -+ -+ identifier = xmalloc(sizeof(*identifier)); -+ identifier->name = name; -+ identifier->data = data; -+ identifier->next = identifiers; -+ identifiers = identifier; -+} -+ -+void eval_identifier(struct data *data, const char *name) -+{ -+ struct identifier *identifier = get_identifier(name); -+ -+ if (identifier == NULL) { -+ print_error("identifier %s does not exist", name); -+ return; -+ } -+ *data = identifier->data; -+} -+ - static unsigned long long eval_literal(const char *s, int base, int bits) - { - unsigned long long val; -diff --git a/tests/.gitignore b/tests/.gitignore -index bb5e33a..8bcbb66 100644 ---- a/tests/.gitignore -+++ b/tests/.gitignore -@@ -21,6 +21,7 @@ tmp.* - /get_path - /get_phandle - /getprop -+/identifiers - /incbin - /integer-expressions - /mangle-layout -diff --git a/tests/Makefile.tests b/tests/Makefile.tests -index dafb618..3737505 100644 ---- a/tests/Makefile.tests -+++ b/tests/Makefile.tests -@@ -21,6 +21,7 @@ LIB_TESTS_L = get_mem_rsv \ - add_subnode_with_nops path_offset_aliases \ - utilfdt_test \ - integer-expressions \ -+ utilfdt_test identifiers \ - subnode_iterate - LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%) - -diff --git a/tests/identifiers.c b/tests/identifiers.c -new file mode 100644 -index 0000000..a013d00 ---- /dev/null -+++ b/tests/identifiers.c -@@ -0,0 +1,44 @@ -+/* -+ * libfdt - Flat Device Tree manipulation -+ * Testcase for /define/ -+ * Copyright (C) 2011 NVIDIA, Inc. -+ * Derived from code: -+ * Copyright (C) 2006 David Gibson, IBM Corporation. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public License -+ * as published by the Free Software Foundation; either version 2.1 of -+ * the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "tests.h" -+#include "testdata.h" -+ -+int main(int argc, char *argv[]) -+{ -+ void *fdt; -+ -+ test_init(argc, argv); -+ fdt = load_blob_arg(argc, argv); -+ -+ check_property_cell(fdt, 0, "var1", TEST_VALUE_1); -+ check_property_cell(fdt, 0, "var2", TEST_VALUE_1); -+ -+ PASS(); -+} -diff --git a/tests/identifiers.dts b/tests/identifiers.dts -new file mode 100644 -index 0000000..098e8f5 ---- /dev/null -+++ b/tests/identifiers.dts -@@ -0,0 +1,11 @@ -+/dts-v1/; -+ -+/define/ VAR1 <0xdeadbeef>; -+/define/ VAR2 ; -+ -+/ { -+ var1 = ; -+ var2 = ; -+}; -+ -+/define/ OTHER <0xdeadbeef>; -diff --git a/tests/run_tests.sh b/tests/run_tests.sh -index c0a136b..cfe64ec 100755 ---- a/tests/run_tests.sh -+++ b/tests/run_tests.sh -@@ -434,6 +434,10 @@ dtc_tests () { - run_dtc_test -I dts -O dtb -o integer-expressions.test.dtb integer-expressions.test.dts - run_test integer-expressions integer-expressions.test.dtb - -+ # Test identifiers -+ run_dtc_test -I dts -O dtb -o identifiers.dtb identifiers.dts -+ run_test identifiers identifiers.dtb -+ - # Check for graceful failure in some error conditions - run_sh_test dtc-fatal.sh -I dts -O dtb nosuchfile.dts - run_sh_test dtc-fatal.sh -I dtb -O dtb nosuchfile.dtb --- -1.8.1.2 - diff --git a/meta-opendreambox/recipes-kernel/dtc/dtc_git.bbappend b/meta-opendreambox/recipes-kernel/dtc/dtc_git.bbappend deleted file mode 100644 index 25177959..00000000 --- a/meta-opendreambox/recipes-kernel/dtc/dtc_git.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -SRC_URI += "file://0001-dtc-Add-support-for-named-integer-constants.patch" - -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -- 2.20.1