mirror of
git://nv-tegra.nvidia.com/3rdparty/dtc-src/1.4.5.git
synced 2025-12-22 09:12:08 +03:00
dfac199a7539a404407098a2541b9482279f690d - dtc-1.4.5/GPL 688431c05a68fedfcb7a36fb482a952d75b05a75 - dtc-1.4.5/Makefile a4555a920b020b1bb06ca45224d692c0094362c1 - dtc-1.4.5/fdtoverlay.c 81ec523838a03a9f6e95e6e6b4a57a0a2b81620a - dtc-1.4.5/.gitignore d525dcaa04b47f205c8cb69936399691e89b1fbb - dtc-1.4.5/README 29d5b51f10d7874704f2faaf9741d793e973a8ba - dtc-1.4.5/fdtget.c db29d7f8b36abb5ab1d3c0ff25a2e056cbb7471e - dtc-1.4.5/flattree.c cab130d5213077509e3b7c88fb99c589945625f1 - dtc-1.4.5/fdtput.c e6060b19e275bde4187546231ba289a486d987e9 - dtc-1.4.5/README.license 95a16c709f1da90f55607005158862d34bd777ca - dtc-1.4.5/data.c 01c714a2f40e85b39871ff83605edbf2078ffe57 - dtc-1.4.5/srcpos.c 3c3ab9789cf4a6bce3448e8fbfdc9f2df2bd2aff - dtc-1.4.5/treesource.c aa5cc18bcc85135e1d2a053a9ee8a3c40fc6ae7b - dtc-1.4.5/dtdiff ebfc1d387c8ae94200e421549e1a301add720c66 - dtc-1.4.5/dtc.c ce3d01a2829cf142f32579b9b429c0a53fc27bdb - dtc-1.4.5/dtc-lexer.l 53a52ecbb1b16bf144144f68c5e681f9554ff862 - dtc-1.4.5/util.h e565c2b61d5c44d608b35f52a321ea68ccc794b0 - dtc-1.4.5/dtc-parser.y 453c878d681e2e6bbfec2a0b522e7e05e2363056 - dtc-1.4.5/checks.c a39cc082f177f5f833b7fbfa2a35f8ca88f41826 - dtc-1.4.5/Makefile.dtc edc3f2659d0771955ddea5e11f6d4d8b73dbd85b - dtc-1.4.5/.travis.yml 0cb72d7f3aeaee1cb122bac3c9d4c2227725b8f0 - dtc-1.4.5/fstree.c e5147ec0a4049d9551c81c703e5fd4d51db8f366 - dtc-1.4.5/Makefile.convert-dtsv0 5ea9fc651c441c3cd5a381092581ed691dc49d5d - dtc-1.4.5/fdtdump.c ce99f6374471fc140add69b0c86f623b4fe23186 - dtc-1.4.5/util.c 597d528effbe428cb6bacc6d4a4d093644e3fbd4 - dtc-1.4.5/dtc.h cc0e7e5a498451c733e735ed95db6c2591aaf868 - dtc-1.4.5/Makefile.utils 25ae5e897cd351320137faa6577f11cf585f32da - dtc-1.4.5/srcpos.h c56abdacfd7fe1144c6e68e7b1d0465e66e1545b - dtc-1.4.5/TODO 2c9a841513149efc0f5234215752b58b1c93a0f6 - dtc-1.4.5/convert-dtsv0-lexer.l 2e76fbfb41b15c4a60f2479eb1657308d4a024e1 - dtc-1.4.5/livetree.c 23dae1b1e6d96cbf7557ceac42bfa1cf13936ad5 - dtc-1.4.5/libfdt/fdt_wip.c cb6dd625a5f8e41e0a0312c2bed4ba2167e62750 - dtc-1.4.5/libfdt/fdt_ro.c 2eb4a858b80211c6b700414b37b3ba1d9558ace1 - dtc-1.4.5/libfdt/fdt.h 9a1e89e0a6ad35bb3463e3a3f87dd7626d918c20 - dtc-1.4.5/libfdt/fdt_overlay.c ebadc1eeeb3e463427b13de190569c9ca3849c27 - dtc-1.4.5/libfdt/fdt_rw.c cb09ff924d581148c98dce072ecdaee4c5f289cd - dtc-1.4.5/libfdt/fdt.c 09a844c8978591b0af11e81928b851d4599a40fa - dtc-1.4.5/libfdt/fdt_empty_tree.c a288dd3281a869616871849278224af702129e47 - dtc-1.4.5/libfdt/libfdt_env.h e1c374080fc1e9f2101102f8aeb356082fe370c8 - dtc-1.4.5/libfdt/fdt_strerror.c e49c8031e598fa2956bb26367570d8c06745367f - dtc-1.4.5/libfdt/fdt_sw.c 9332862189cd63c6d7e7e80c6b67446181fdd4c4 - dtc-1.4.5/libfdt/libfdt_internal.h b929dc832e5ad67a6027aa0fdb3d39868f10125e - dtc-1.4.5/libfdt/Makefile.libfdt 431fd6a95e97ff1fec779f086cf35833c2bc33dd - dtc-1.4.5/libfdt/fdt_addresses.c 31ae7f44847e5a4e4a207f182dbb80f8714ec510 - dtc-1.4.5/libfdt/version.lds f88a9a1f847941e4e8d8cd75b8337251c2ac8a1b - dtc-1.4.5/libfdt/libfdt.h 96d83160ed4341696adae458a154984eec3c7dfc - dtc-1.4.5/libfdt/TODO 628865d7616d254cc4c7996d1e972842ad922d98 - dtc-1.4.5/scripts/kup-dtc 2a320e30ee21461af08bb76f4051052044441de8 - dtc-1.4.5/scripts/setlocalversion 5b6353ff199345f7dde7fd8dcaaf32441befef95 - dtc-1.4.5/tests/obsolete-chosen-interrupt-controller.dts 1a13a82806e74da0fe7e39587e6bb9d6323d0012 - dtc-1.4.5/tests/truncated_property.c e04703bdbb788f6f519059006d11a04c66c2d4e9 - dtc-1.4.5/tests/nonexist-label-ref.dts 6fb4a06a4267d2efe200ba82a2516817c70e7338 - dtc-1.4.5/tests/boot-cpuid.c 7e60aa8d9e1d0fc859d83bb287b12c7884b51d54 - dtc-1.4.5/tests/minusone-phandle.dts a92ee30ee224515ec9e74dd392d22f1c370583c1 - dtc-1.4.5/tests/test_tree1_wrong4.dts 17a04207b4941b17fd362cb2e4cd958e3e74ad91 - dtc-1.4.5/tests/test01.dts b1ee15fb5ad66b865f12e6994c4c8cd8ff125d57 - dtc-1.4.5/tests/dtbs_equal_ordered.c dc4372a1ce8bf6a8175133dbc747b8e5802ef767 - dtc-1.4.5/tests/bad-gpio.dts e597380112f351dc1d96530824b4c9eab2130c8b - dtc-1.4.5/tests/mangle-layout.supp 1a1de5c063dff543882f638a0dc5801628364556 - dtc-1.4.5/tests/extra-terminating-null.c db16441c4b330570a9ac83b0e0b006fcd74cc32b - dtc-1.4.5/tests/incbin.bin e94ef627a9dbfae24ea5eaccc985ced1738ad96f - dtc-1.4.5/tests/test_tree1_wrong9.dts b3d47e46906126d2e0277adb8c35e6fc22e6380e - dtc-1.4.5/tests/include8.dts a2cd7d79b779d2adfe2ec0c6b2a87312287c7abe - dtc-1.4.5/tests/include5a.dts 3e3767ef8b845fa7cace62543fda1fb19dd59d9d - dtc-1.4.5/tests/include2.dts 45e3fa0098f1d154ea2c1b3b61e87853f63cc4c2 - dtc-1.4.5/tests/sw_tree1.supp 58a4885d5573e8f0153839633f0c27820b373359 - dtc-1.4.5/tests/.gitignore 8f42d8e919b03dc09cac7ab58b2f9a28c830c9f5 - dtc-1.4.5/tests/stringlist.dts 968572da053916799c6b292dbd7ae6aba6755eda - dtc-1.4.5/tests/stacked_overlay_bar.dts 5fe77cdfa90bb405ded8bf20f7c3ed796f40abd5 - dtc-1.4.5/tests/reuse-label5.dts e7e02f700b8e537130b0bc7a5fd9459660f8060c - dtc-1.4.5/tests/subnode_offset.c 7eae2be2813b5dca217a4e56bf8fae289e35166b - dtc-1.4.5/tests/Makefile.tests e2d500c1ce6a9cff11cfba7b3859ebbcbbc588f4 - dtc-1.4.5/tests/trees.S d576360fbfe36cc1f2c8f8c879f9109ab7cf9001 - dtc-1.4.5/tests/overlay_bad_fixup_index_trailing.dts 0082526b79f4d6d567faa039b5bec0295b5ec40b - dtc-1.4.5/tests/incbin.c 0886327c6106fd381312af3ceca674a4101380e0 - dtc-1.4.5/tests/nonexist-node-ref2.dts fd68ece161bb07980e8ab678c61e293439906e2e - dtc-1.4.5/tests/run_tests.sh 4d98a0b920d0a7d37426b858e02387b16f007d58 - dtc-1.4.5/tests/overlay_overlay.dts 99c9cab16ce9f3db83dab99f1798f0bee79f055c - dtc-1.4.5/tests/open_pack.supp 210a4bfe688816869d79d5e9ce31a0a757441921 - dtc-1.4.5/tests/embedded_nul.dts 67c6674e15b3157690e444af5b5bedbd987659e2 - dtc-1.4.5/tests/overlay.c cfcd5acf194801ca0b01302bf1d64eabeca89f68 - dtc-1.4.5/tests/value-labels.c e3accfdb6f94c8d1bebcca85d9a5b52db0333670 - dtc-1.4.5/tests/sw_tree1.c 17846cb1d5428c6b0736ebcf8c2426dce37b47cf - dtc-1.4.5/tests/tests.h 773742f1338a51bde4d17f50b8ce97aac353a4ce - dtc-1.4.5/tests/overlay_bad_fixup_bad_index.dts 2a3c7f084000959f1b8fb4c405c23baf507835eb - dtc-1.4.5/tests/subnode_iterate.dts 7d6aa332681677fa7ac56d3390d1790b24ecc67f - dtc-1.4.5/tests/del_node.c 50be2e1000a7f0e19b94276143ed086a3081d161 - dtc-1.4.5/tests/get_path.c 4d1ae34edf08284d07b15103276d9c2a90059528 - dtc-1.4.5/tests/property_iterate.dts 097641bc7cdb15643af0ce67afa53910b559fa71 - dtc-1.4.5/tests/test_tree1_wrong5.dts b98faf87f6f8dc361fc5fb11938921027c08b84f - dtc-1.4.5/tests/overlay_bad_fixup.c cc5da65a932ea3005fb828dd16adb4b6049c0503 - dtc-1.4.5/tests/reuse-label6.dts 0bbd9c00bbe4150c13eed944cb787cf1480ddb9a - dtc-1.4.5/tests/references.dts 09c7a2b43ab5861b597da0497506e5a1a6ea1a9c - dtc-1.4.5/tests/include6.dts bdcecf87f4aeb28c666d1196253746415f459864 - dtc-1.4.5/tests/overlay_bad_fixup_path_empty_prop.dts 53d884493b1a91d6d94e2d9fef517f9edbbdb7ec - dtc-1.4.5/tests/test_kernel_dts 3f29e779d64b1fb3fe743c958473e6a37879e1d9 - dtc-1.4.5/tests/path_offset_aliases.c bace86d14d5a88839dc38c67b7bfdb78a0cd30f7 - dtc-1.4.5/tests/overlay_overlay_manual_fixups.dts e15294970cf6645789ecb2fa573f4cfcdfc18008 - dtc-1.4.5/tests/appendprop2.c 78c9a2794d6684c52e601e58a6348f808a667122 - dtc-1.4.5/tests/bad-interrupt-cells.dts dc911a4dd77c234586d0abdfccb66d23b990279f - dtc-1.4.5/tests/test01.asm c58561b0a7af860779d89d27ebd4fbcfe3dd9862 - dtc-1.4.5/tests/base01.asm 4c182e2cd290bbc9677007b2cc26d526525cea7e - dtc-1.4.5/tests/overlay_base_manual_symbols.dts 3d58b283fc73faeab28eddf460ba97a401469c8c - dtc-1.4.5/tests/nonexist-node-ref.dts 1450026fe5e5d5c0854803d9d90567e9999a7c94 - dtc-1.4.5/tests/getprop.c ca049c8511a0081118bca5cc76d17a5214b6fe9a - dtc-1.4.5/tests/fdtput-runtest.sh 557bd08f0cb8a37abd7568e5857508b1dd861474 - dtc-1.4.5/tests/parent_offset.c ff6959ed32b3495ef5766c03da4f312488bb3983 - dtc-1.4.5/tests/deps_inc1.dtsi 7856fa203be221173cb6bafca81bf394a4f355bd - dtc-1.4.5/tests/test_tree1_merge.dts 4e44e71434ff788af4781ee934c70331870458ca - dtc-1.4.5/tests/path-references.c e000be7a8d461e4a76027d36cc9c4839fbc2d58d - dtc-1.4.5/tests/node_offset_by_phandle.c 8abd5ffeb21a0ebc6795240d73152acb2240f442 - dtc-1.4.5/tests/include5.dts 7895dc6b800832b032bc29c87e78b1c97408f605 - dtc-1.4.5/tests/search_paths.dts d0d88754d30e63fedd93010747838960d98c915e - dtc-1.4.5/tests/dup-propname.dts e03aa51b95a671a3f98cae0051cd3474b7c207dd - dtc-1.4.5/tests/test_tree1_wrong7.dts 56b55df15337c52aac7c0246a5d44b3e82b76c6f - dtc-1.4.5/tests/overlay_base.dts 0e209c69b49d699ee05d19ae1424ea08585b1b6b - dtc-1.4.5/tests/pylibfdt_tests.py 4548237d664096155c80836bb9f273adddf7b6d6 - dtc-1.4.5/tests/comments-cmp.dts a9415e9554e16fc01e5978cea5881c7ef5ddee40 - dtc-1.4.5/tests/node_offset_by_prop_value.c 2b5cf055b95da40dfa61458471fe259db8e9d0ee - dtc-1.4.5/tests/extra-terminating-null.dts 6cf4266274b916b715ada14627a86b19435a202e - dtc-1.4.5/tests/subnode_iterate.c 95a8a947549e7daaea521605f6bd4613d006dd29 - dtc-1.4.5/tests/fdtget-runtest.sh b71203a02d1cb91de3b063e87aab076fee50cb3f - dtc-1.4.5/tests/references.c 064610a3c824b272b84c94e2518ed42b09e598ff - dtc-1.4.5/tests/reuse-label4.dts dfd7e528eefbe6be39865053c8d1787ab95faf81 - dtc-1.4.5/tests/add_subnode_with_nops.c 18a64c7d93e2dc77c78cca13d9d187a0a2ee5d83 - dtc-1.4.5/tests/del_property.c 825eaa2f39e18b03c44e4fc04869294fb955d56c - dtc-1.4.5/tests/dup-nodename.dts a34a59272e4ded11d69fa1563608a7cf417efb53 - dtc-1.4.5/tests/addresses.dts a9323cf5194c13e3c29af052c1a85286f9492fa4 - dtc-1.4.5/tests/overlay_bad_fixup_base.dtsi d2e394c31434137df0d3989fb15cebeec2bed2e7 - dtc-1.4.5/tests/base01.stderr c267915a9a6b62629b509d13990b19aac4ad44ca - dtc-1.4.5/tests/fdtoverlay-runtest.sh 6225480114e8a14d25c2bd170f55ed78529db893 - dtc-1.4.5/tests/bad-ncells.dts 1ea38bf20a653f9b757f98160739a90737c4ce00 - dtc-1.4.5/tests/reg-ranges-root.dts 03e8cf8533103cb87b399fef32a36514b64bdcbc - dtc-1.4.5/tests/dtbs_equal_unordered.c c3bbd9a0eb2ce642a716955eab223cca11e427ac - dtc-1.4.5/tests/overlay_bad_fixup_empty.dts a6f8e3450be51ce6cd2ec18fa592726889b616ee - dtc-1.4.5/tests/char_literal.dts 627781fdd8a4fc415142e12d0edd5f7ac92f8f14 - dtc-1.4.5/tests/check_path.c c27562784d986c84137d4e2500b8b3e321d46a1b - dtc-1.4.5/tests/nopulate.c 238b692003697e0cc242d047971bb6a3af60b464 - dtc-1.4.5/tests/nul-in-line-info2.dts 48599e299578b9ca040e45ab220edbb397a55108 - dtc-1.4.5/tests/embedded_nul_equiv.dts a577bd5b22f52302600164b952210ee0a69b86fe - dtc-1.4.5/tests/stringlist.c 606a0da173c3d23f841cf8f5184a867f3cc9b1f3 - dtc-1.4.5/tests/utilfdt_test.c 1171b227d4252d704d9a300c0cd5e85e244b55e9 - dtc-1.4.5/tests/include4.dts 6e38c669946d6d95d026f40d735e730ade3aa714 - dtc-1.4.5/tests/deps_inc2.dtsi c31535957cc2cea57dab87317a0bbb7c5a107b0c - dtc-1.4.5/tests/label01.dts 944504b8f4474793305037eddf9dd13979265432 - dtc-1.4.5/tests/get_name.c aadb873ed244256fb50ea64d1b25b7796ffcffca - dtc-1.4.5/tests/include7.dts 6ff537c825a6683b1e857eebd754a1cdfc18d75c - dtc-1.4.5/tests/phandle_format.c 4cdb0a0f5aeddf820d35d5f9154e4359325c3e2e - dtc-1.4.5/tests/reuse-label.dts fdf6935c1ab9032dc683ecfff2cc21f0185370f4 - dtc-1.4.5/tests/bad-name-property.dts b0a1a56999d7db375e2e52055cbcf8f60ebf7077 - dtc-1.4.5/tests/overlay_overlay_simple.dts b6517c85f38b3175d84d2986922d1751c92d242e - dtc-1.4.5/tests/appendprop.dts e7e1445b585cd04a7992a66c346374f9c97a1188 - dtc-1.4.5/tests/bad-reg-ranges.dts b5a2155cb7a8d9094f7de6f7bb16442abaf42436 - dtc-1.4.5/tests/unit-addr-leading-0s.dts 05057f2e73c3d8a5c9dfea99ccfe6553cafcbf74 - dtc-1.4.5/tests/bad-string-props.dts 27ac33471f9f470dd15959f1b43a58582b763298 - dtc-1.4.5/tests/root_node.c 8f1d286da170262b3ac2e705c175bd6cf1af14cd - dtc-1.4.5/tests/multilabel.dts df629984df17b68032f9e61a688865fe5ec52798 - dtc-1.4.5/tests/move_and_save.c 59f8b8532a360f30d639aee56ecf821d8810c39e - dtc-1.4.5/tests/empty.dts 587400ca7d9a39476a5162859da7d21f9e816d64 - dtc-1.4.5/tests/testdata.h 399a348f311be369f68220b3732fcefde0f740f1 - dtc-1.4.5/tests/test_tree1.dts 94e0a5da6d15f081a21a2a5d02bbf45c3f85b62b - dtc-1.4.5/tests/supernode_atdepth_offset.c c5deddb0fb0cd547da34fcaf924bdbe303b17492 - dtc-1.4.5/tests/test_tree1_wrong2.dts 49599b99ec6deb90718c05cb56711f1072ef623a - dtc-1.4.5/tests/reg-without-unit-addr.dts 6e6a7ec861bd63506d082a793bda483f8540be5b - dtc-1.4.5/tests/open_pack.c 08a95e2c1ce9ff35b2b6d9bad6a31bda3d2dadb4 - dtc-1.4.5/tests/overlay_bad_fixup_empty_index.dts 29a54f5c1c352e672dd7742b342629f356e5df6e - dtc-1.4.5/tests/zero-phandle.dts 8b046ab9a11a0c3a6780cf09cc82b5a6c5cec5c9 - dtc-1.4.5/tests/overlay_bad_fixup_path_prop.dts 9bc91516a068a176123a69777f41ad435c82933f - dtc-1.4.5/tests/string_escapes.c c33c776418f1a2f4206f32680137822d6665eb89 - dtc-1.4.5/tests/mangle-layout.c 2e52702a5a474751f42991a4c68246a7c6356102 - dtc-1.4.5/tests/default-addr-size.dts 7c16967c713c20f58949e9a1d64dd14fcc0006a1 - dtc-1.4.5/tests/escapes.dts 265a369071203707125f015936d258f095f7db10 - dtc-1.4.5/tests/dtc-fatal.sh da2bc0ecdecb507bfd11c951c3f0612834fcc922 - dtc-1.4.5/tests/nul-in-escape.dts 58bb1310303666817f190475c130e19a411a0c1f - dtc-1.4.5/tests/base01.dts a1720d7f7d1c022c7e4f6717009a691693556aa1 - dtc-1.4.5/tests/find_property.c 03e96eb3ee1f650106cb90e06a4841681de15197 - dtc-1.4.5/tests/addr_size_cells.c a748aadffd49ef78eeac7ad521a0d84aebcdbdbf - dtc-1.4.5/tests/dumptrees.c f0eeb4b91084a61d9008a90d09b86425f4733c0c - dtc-1.4.5/tests/test01.stderr 8700502c294e949f908fa5c0c44248bd96af5ca6 - dtc-1.4.5/tests/dtc-fails.sh 9dcc1f85d0c8a1ce34c57d64c8e3fff4920f2df7 - dtc-1.4.5/tests/asm_tree_dump.c 1e8705f0eaec9950cd074b09b8463ede99a019b6 - dtc-1.4.5/tests/test_label_ref.dts 1ab3cfcd6d35f35618dc3d0b90a1b093a3467c1d - dtc-1.4.5/tests/division-by-zero.dts 06d3aebaaa4a26b6cb8fc1b3804fbef8d3ddd9ac - dtc-1.4.5/tests/line_directives.dts 9f00325b7377977b942eb0a1e01f978c806482f4 - dtc-1.4.5/tests/property_iterate.c 0181f2cb1a32b682733fa9db274226c7745c80cd - dtc-1.4.5/tests/test_tree1_delete.dts bcc58605628d627ab670e8afe59d82916737e534 - dtc-1.4.5/tests/comments.dts 21e36b524a10b28810260a151e718818b79d87d1 - dtc-1.4.5/tests/sized_cells.c 3d6060bcbb5d4e369be0b5b518f0b80fd448faa0 - dtc-1.4.5/tests/setprop.c 82c9e391f5ba20d3b1c56ea7978a925f60481f18 - dtc-1.4.5/tests/overlay_overlay_no_fixups.dts c825d82e7ed5fa8bdc4b0cd04cca5cc73a156709 - dtc-1.4.5/tests/bad-octal-literal.dts 444db827745be8840705a7cce26b024194624d15 - dtc-1.4.5/tests/incbin.dts 6ea01b148f3a82e51d775f9fadc37602ffe095ed - dtc-1.4.5/tests/testutils.c 026b4b16a20b6e79c02dba88f997f35d9562bb30 - dtc-1.4.5/tests/appendprop1.c 132e01eefa23f6a8c7b88c2a234b04c7d6529e4c - dtc-1.4.5/tests/unit-addr-without-reg.dts 9533807e3b9982017e411ba37f29dc322e691b68 - dtc-1.4.5/tests/unit-addr-leading-0x.dts 5286525de751b12c681101f6336d48533d904aa5 - dtc-1.4.5/tests/node_check_compatible.c 3f3316bfa1b4b2e718c30765c999b5a7075af3bd - dtc-1.4.5/tests/sized_cells.dts 09d871f55acf837e1467bde782781212dfecabc1 - dtc-1.4.5/tests/dependencies.dts 66f3655753343a0b87ff386da265bede08f99aee - dtc-1.4.5/tests/path_offset.c f62430e11919a194daf565d6681a1df5fc6017f9 - dtc-1.4.5/tests/fdtdump-runtest.sh c05d5b477def26d28273932ffc2bac34a91f4b8e - dtc-1.4.5/tests/propname_escapes.c e6f56bdf21ace78b4e2150b088263c3ce7e1f1c9 - dtc-1.4.5/tests/test_tree1_merge_path.dts c95ed15e2b3847366ecf12d1a7c8f4756ee745e6 - dtc-1.4.5/tests/delete_reinstate_multilabel_ref.dts fd7d8b2bb9a288532134b0c82ee7fc3d7c983bfb - dtc-1.4.5/tests/dependencies.cmp 80911d8420ea3e794b86bd9c04aeae892eaad657 - dtc-1.4.5/tests/label_repeated.dts 3150edab60c72057f68b275f7f0bd2abeabf67de - dtc-1.4.5/tests/nop_property.c 1df4762532e24bf29f9cfaf82772fef9487683d2 - dtc-1.4.5/tests/search_paths_b.dts 52cf04b57ff7424ca1c57a12f5df19247940a3eb - dtc-1.4.5/tests/fdtdump.dts 332afd52254b8dbfaff4c7c1644d8c73cac2d855 - dtc-1.4.5/tests/stacked_overlay_baz.dts 02eef4caeaddab2f3722b86026ce2e1e434cde14 - dtc-1.4.5/tests/reuse-label1.dts bdd28adcd03ea8a4c41a3e75de84a85c6938a044 - dtc-1.4.5/tests/dtc-checkfails.sh 53995be36144e22baca01a26b5c2113e5e9dea11 - dtc-1.4.5/tests/overlay_bad_fixup_path_only_sep.dts 6d74b16a531067c828acfdf118ecd5765f3168da - dtc-1.4.5/tests/node_offset_by_compatible.c 05a8ec0dae916212ba5e29c17ab63c766b8f6142 - dtc-1.4.5/tests/nop_node.c badb0d8f62608674030ca278620b061f1d53f625 - dtc-1.4.5/tests/notfound.c 52ffd7a9b99beedbf46df87b18396daf91187d2d - dtc-1.4.5/tests/test_tree1_label_noderef.dts ccecd5a83df37929613b6fdde5c88c3ecc8e84a8 - dtc-1.4.5/tests/include3.dts 78c91d2a0808bae30377b1dae9731c15725a972d - dtc-1.4.5/tests/prop-after-subnode.dts 42a972b76e039f30913fa708eb708901ed470c38 - dtc-1.4.5/tests/test_tree1_wrong8.dts c7f82cecdd0ce4ca602890f2dd9d029d216deddf - dtc-1.4.5/tests/get_alias.c 771dc03d722d5c951a41f1fbab202f3f66f9a91e - dtc-1.4.5/tests/aliases.dts 2d816cf202120e151e9a4c10a11a68c4115f4f29 - dtc-1.4.5/tests/value-labels.dts 555bcf861816bdd82884301d1de455221cb1d288 - dtc-1.4.5/tests/data.S c925cf6f789d4e7b879863a4414b3805a201cbae - dtc-1.4.5/tests/base01.cmd 03535626db5128f181593328582a7ef441776e2f - dtc-1.4.5/tests/sourceoutput.dts a82abc5909ca25c13485da36752562db0acb1d3e - dtc-1.4.5/tests/get_mem_rsv.c 7b4ee02efa4d17433ba49c82dd2f30f1773c9d7a - dtc-1.4.5/tests/boot-cpuid.dts 55074ad8e933275058412606c278e1002a94b55a - dtc-1.4.5/tests/bad-size-cells.dts fda3eb684c8ea2dae5845f23fd2f18ac8719d3e1 - dtc-1.4.5/tests/reuse-label3.dts 1187a7fb193ca9eb92ddbfb1500cf9ec7595a43a - dtc-1.4.5/tests/dtb_reverse.c cd3ebe8d5c0e89669dc866b78d74611ec1d399cb - dtc-1.4.5/tests/reuse-label2.dts fbaa8c4c9b156b24b74456bc8824f1aa6e777ec3 - dtc-1.4.5/tests/include1.dts 18a5eaaf67886b19caeec13d1f91fbac9dab40ea - dtc-1.4.5/tests/include0.dts e220e5db0820592bd028adb9431401970522cd93 - dtc-1.4.5/tests/nul-in-line-info1.dts 9cb78df0d0f7fd73119b57ce7a171704631af5e4 - dtc-1.4.5/tests/delete_reinstate_multilabel.dts ba55daa9627a9fa3af7ddbbb4c8e23b159fef96b - dtc-1.4.5/tests/char_literal.c 7997cfd671338152e5947ad6e3a7476b762f84b0 - dtc-1.4.5/tests/set_name.c f7c3f569b0ef5a9c2ffe17656de222437bdcba78 - dtc-1.4.5/tests/overlay_bad_fixup_path_only.dts 738ebbc0f6e1fc9e4462d3b74081a83335be17aa - dtc-1.4.5/tests/bad-empty-ranges.dts 3a30897484d829884db97735b23fedec00d1df18 - dtc-1.4.5/tests/test_tree1_wrong3.dts f3b0a0b0586f072ca642e33648ad6a8cc88f0ac9 - dtc-1.4.5/tests/setprop_inplace.c 549b82463e24ea3d3cbb8992cc21c8ea65686671 - dtc-1.4.5/tests/test_tree1_merge_labelled.dts 7ff38d835b0084e9a2fa409cd697a2e0d135ac19 - dtc-1.4.5/tests/tests.sh 86e03f6d539ccb33585658f93b9b53e89534719c - dtc-1.4.5/tests/path-references.dts 42c311ee4bcf10bd46c6894d5338d00b69a0a7e7 - dtc-1.4.5/tests/propname_escapes.dts 32913f10eab70e2a11e13a7d4a0f31aee903a53d - dtc-1.4.5/tests/test_tree1_wrong6.dts d7da06091195ba54e6904bd46ccd5aeb5445c22a - dtc-1.4.5/tests/test_tree1_wrong1.dts 54b58cc0e02047df34ab21ff906ad4d8669521c8 - dtc-1.4.5/tests/bad-phandle-cells.dts 2c7f7bed3fa31d608e32095cc3469559a80376df - dtc-1.4.5/tests/multilabel_merge.dts 81c4b081a92462f90ffa24915b2cad76cb687f88 - dtc-1.4.5/tests/dup-phandle.dts 665f89ab83944d57bb09f3a18a1391280f446db3 - dtc-1.4.5/tests/rw_tree1.c 90fd6ea3d82dfc9cadd37a93e3a62fc72e6b336d - dtc-1.4.5/tests/integer-expressions.c e8c561bde2558fb895f327e6e005c7af8818a1f5 - dtc-1.4.5/tests/stacked_overlay_base.dts 0ea1b9337b59fd9872199301ac37114c37a2a620 - dtc-1.4.5/tests/get_phandle.c 448994a1143852a9b1154db51a9db49d717d9c31 - dtc-1.4.5/tests/search_dir_b/search_test_c.dtsi 74d5e33802b093e2abd21b884a018223a853c93d - dtc-1.4.5/tests/search_dir_b/search_test_b.dtsi 60d17f79adc996b2b1ea979208cca39f6acf4145 - dtc-1.4.5/tests/search_dir_b/search_paths_subdir.dts e3a9bc2e23703093aca0d62db5587a8c7da3e9a3 - dtc-1.4.5/tests/search_dir_b/search_test_b2.dtsi a3efef7df14727a6a4e97a1a6c5c5dc70ee761d9 - dtc-1.4.5/tests/search_dir/search_test2.dtsi 2adb422636000206499201175d397a4e065118d1 - dtc-1.4.5/tests/search_dir/search_test.dtsi cbaff71343d90c58f78fa1ee686fc0114bc88399 - dtc-1.4.5/pylibfdt/.gitignore 950f95518e818abf2c8f84f1074b6f7c67002a36 - dtc-1.4.5/pylibfdt/Makefile.pylibfdt 103f0f23a13380d020ea07587574e3c16a8812d2 - dtc-1.4.5/pylibfdt/setup.py efd79993fabe982fc1c772d90d796f9ca3be096c - dtc-1.4.5/pylibfdt/libfdt.i edcd4769af7d6adf1bd71db82c02b377a55a665f - dtc-1.4.5/Documentation/dtc-paper.tex 657ff4514367b424637b70b785eda2b5f527374c - dtc-1.4.5/Documentation/dtc-paper.bib Change-Id: I04541e456153a88e2473a41fc8b25f256c12f7d3
1357 lines
36 KiB
C
1357 lines
36 KiB
C
/*
|
|
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2007.
|
|
*
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program 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
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
* USA
|
|
*/
|
|
|
|
#include "dtc.h"
|
|
|
|
#ifdef TRACE_CHECKS
|
|
#define TRACE(c, ...) \
|
|
do { \
|
|
fprintf(stderr, "=== %s: ", (c)->name); \
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
fprintf(stderr, "\n"); \
|
|
} while (0)
|
|
#else
|
|
#define TRACE(c, fmt, ...) do { } while (0)
|
|
#endif
|
|
|
|
enum checkstatus {
|
|
UNCHECKED = 0,
|
|
PREREQ,
|
|
PASSED,
|
|
FAILED,
|
|
};
|
|
|
|
struct check;
|
|
|
|
typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
|
|
|
|
struct check {
|
|
const char *name;
|
|
check_fn fn;
|
|
void *data;
|
|
bool warn, error;
|
|
enum checkstatus status;
|
|
bool inprogress;
|
|
int num_prereqs;
|
|
struct check **prereq;
|
|
};
|
|
|
|
#define CHECK_ENTRY(_nm, _fn, _d, _w, _e, ...) \
|
|
static struct check *_nm##_prereqs[] = { __VA_ARGS__ }; \
|
|
static struct check _nm = { \
|
|
.name = #_nm, \
|
|
.fn = (_fn), \
|
|
.data = (_d), \
|
|
.warn = (_w), \
|
|
.error = (_e), \
|
|
.status = UNCHECKED, \
|
|
.num_prereqs = ARRAY_SIZE(_nm##_prereqs), \
|
|
.prereq = _nm##_prereqs, \
|
|
};
|
|
#define WARNING(_nm, _fn, _d, ...) \
|
|
CHECK_ENTRY(_nm, _fn, _d, true, false, __VA_ARGS__)
|
|
#define ERROR(_nm, _fn, _d, ...) \
|
|
CHECK_ENTRY(_nm, _fn, _d, false, true, __VA_ARGS__)
|
|
#define CHECK(_nm, _fn, _d, ...) \
|
|
CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
|
|
|
|
static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
|
|
const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
|
|
if ((c->warn && (quiet < 1))
|
|
|| (c->error && (quiet < 2))) {
|
|
fprintf(stderr, "%s: %s (%s): ",
|
|
strcmp(dti->outname, "-") ? dti->outname : "<stdout>",
|
|
(c->error) ? "ERROR" : "Warning", c->name);
|
|
vfprintf(stderr, fmt, ap);
|
|
fprintf(stderr, "\n");
|
|
}
|
|
va_end(ap);
|
|
}
|
|
|
|
#define FAIL(c, dti, ...) \
|
|
do { \
|
|
TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \
|
|
(c)->status = FAILED; \
|
|
check_msg((c), dti, __VA_ARGS__); \
|
|
} while (0)
|
|
|
|
static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
struct node *child;
|
|
|
|
TRACE(c, "%s", node->fullpath);
|
|
if (c->fn)
|
|
c->fn(c, dti, node);
|
|
|
|
for_each_child(node, child)
|
|
check_nodes_props(c, dti, child);
|
|
}
|
|
|
|
static bool run_check(struct check *c, struct dt_info *dti)
|
|
{
|
|
struct node *dt = dti->dt;
|
|
bool error = false;
|
|
int i;
|
|
|
|
assert(!c->inprogress);
|
|
|
|
if (c->status != UNCHECKED)
|
|
goto out;
|
|
|
|
c->inprogress = true;
|
|
|
|
for (i = 0; i < c->num_prereqs; i++) {
|
|
struct check *prq = c->prereq[i];
|
|
error = error || run_check(prq, dti);
|
|
if (prq->status != PASSED) {
|
|
c->status = PREREQ;
|
|
check_msg(c, dti, "Failed prerequisite '%s'",
|
|
c->prereq[i]->name);
|
|
}
|
|
}
|
|
|
|
if (c->status != UNCHECKED)
|
|
goto out;
|
|
|
|
check_nodes_props(c, dti, dt);
|
|
|
|
if (c->status == UNCHECKED)
|
|
c->status = PASSED;
|
|
|
|
TRACE(c, "\tCompleted, status %d", c->status);
|
|
|
|
out:
|
|
c->inprogress = false;
|
|
if ((c->status != PASSED) && (c->error))
|
|
error = true;
|
|
return error;
|
|
}
|
|
|
|
/*
|
|
* Utility check functions
|
|
*/
|
|
|
|
/* A check which always fails, for testing purposes only */
|
|
static inline void check_always_fail(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
FAIL(c, dti, "always_fail check");
|
|
}
|
|
CHECK(always_fail, check_always_fail, NULL);
|
|
|
|
static void check_is_string(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
char *propname = c->data;
|
|
|
|
prop = get_property(node, propname);
|
|
if (!prop)
|
|
return; /* Not present, assumed ok */
|
|
|
|
if (!data_is_one_string(prop->val))
|
|
FAIL(c, dti, "\"%s\" property in %s is not a string",
|
|
propname, node->fullpath);
|
|
}
|
|
#define WARNING_IF_NOT_STRING(nm, propname) \
|
|
WARNING(nm, check_is_string, (propname))
|
|
#define ERROR_IF_NOT_STRING(nm, propname) \
|
|
ERROR(nm, check_is_string, (propname))
|
|
|
|
static void check_is_cell(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
char *propname = c->data;
|
|
|
|
prop = get_property(node, propname);
|
|
if (!prop)
|
|
return; /* Not present, assumed ok */
|
|
|
|
if (prop->val.len != sizeof(cell_t))
|
|
FAIL(c, dti, "\"%s\" property in %s is not a single cell",
|
|
propname, node->fullpath);
|
|
}
|
|
#define WARNING_IF_NOT_CELL(nm, propname) \
|
|
WARNING(nm, check_is_cell, (propname))
|
|
#define ERROR_IF_NOT_CELL(nm, propname) \
|
|
ERROR(nm, check_is_cell, (propname))
|
|
|
|
/*
|
|
* Structural check functions
|
|
*/
|
|
|
|
static void check_duplicate_node_names(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *child, *child2;
|
|
|
|
for_each_child(node, child)
|
|
for (child2 = child->next_sibling;
|
|
child2;
|
|
child2 = child2->next_sibling)
|
|
if (streq(child->name, child2->name))
|
|
FAIL(c, dti, "Duplicate node name %s",
|
|
child->fullpath);
|
|
}
|
|
ERROR(duplicate_node_names, check_duplicate_node_names, NULL);
|
|
|
|
static void check_duplicate_property_names(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop, *prop2;
|
|
|
|
for_each_property(node, prop) {
|
|
for (prop2 = prop->next; prop2; prop2 = prop2->next) {
|
|
if (prop2->deleted)
|
|
continue;
|
|
if (streq(prop->name, prop2->name))
|
|
FAIL(c, dti, "Duplicate property name %s in %s",
|
|
prop->name, node->fullpath);
|
|
}
|
|
}
|
|
}
|
|
ERROR(duplicate_property_names, check_duplicate_property_names, NULL);
|
|
|
|
#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"
|
|
#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
#define DIGITS "0123456789"
|
|
#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
|
|
#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-"
|
|
|
|
static void check_node_name_chars(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
int n = strspn(node->name, c->data);
|
|
|
|
if (n < strlen(node->name))
|
|
FAIL(c, dti, "Bad character '%c' in node %s",
|
|
node->name[n], node->fullpath);
|
|
}
|
|
ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
|
|
|
|
static void check_node_name_chars_strict(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
int n = strspn(node->name, c->data);
|
|
|
|
if (n < node->basenamelen)
|
|
FAIL(c, dti, "Character '%c' not recommended in node %s",
|
|
node->name[n], node->fullpath);
|
|
}
|
|
CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT);
|
|
|
|
static void check_node_name_format(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
if (strchr(get_unitname(node), '@'))
|
|
FAIL(c, dti, "Node %s has multiple '@' characters in name",
|
|
node->fullpath);
|
|
}
|
|
ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
|
|
|
|
static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
const char *unitname = get_unitname(node);
|
|
struct property *prop = get_property(node, "reg");
|
|
|
|
if (!prop) {
|
|
prop = get_property(node, "ranges");
|
|
if (prop && !prop->val.len)
|
|
prop = NULL;
|
|
}
|
|
|
|
if (prop) {
|
|
if (!unitname[0])
|
|
FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name",
|
|
node->fullpath);
|
|
} else {
|
|
if (unitname[0])
|
|
FAIL(c, dti, "Node %s has a unit name, but no reg property",
|
|
node->fullpath);
|
|
}
|
|
}
|
|
WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL);
|
|
|
|
static void check_property_name_chars(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
for_each_property(node, prop) {
|
|
int n = strspn(prop->name, c->data);
|
|
|
|
if (n < strlen(prop->name))
|
|
FAIL(c, dti, "Bad character '%c' in property name \"%s\", node %s",
|
|
prop->name[n], prop->name, node->fullpath);
|
|
}
|
|
}
|
|
ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
|
|
|
|
static void check_property_name_chars_strict(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
for_each_property(node, prop) {
|
|
const char *name = prop->name;
|
|
int n = strspn(name, c->data);
|
|
|
|
if (n == strlen(prop->name))
|
|
continue;
|
|
|
|
/* Certain names are whitelisted */
|
|
if (streq(name, "device_type"))
|
|
continue;
|
|
|
|
/*
|
|
* # is only allowed at the beginning of property names not counting
|
|
* the vendor prefix.
|
|
*/
|
|
if (name[n] == '#' && ((n == 0) || (name[n-1] == ','))) {
|
|
name += n + 1;
|
|
n = strspn(name, c->data);
|
|
}
|
|
if (n < strlen(name))
|
|
FAIL(c, dti, "Character '%c' not recommended in property name \"%s\", node %s",
|
|
name[n], prop->name, node->fullpath);
|
|
}
|
|
}
|
|
CHECK(property_name_chars_strict, check_property_name_chars_strict, PROPNODECHARSSTRICT);
|
|
|
|
#define DESCLABEL_FMT "%s%s%s%s%s"
|
|
#define DESCLABEL_ARGS(node,prop,mark) \
|
|
((mark) ? "value of " : ""), \
|
|
((prop) ? "'" : ""), \
|
|
((prop) ? (prop)->name : ""), \
|
|
((prop) ? "' in " : ""), (node)->fullpath
|
|
|
|
static void check_duplicate_label(struct check *c, struct dt_info *dti,
|
|
const char *label, struct node *node,
|
|
struct property *prop, struct marker *mark)
|
|
{
|
|
struct node *dt = dti->dt;
|
|
struct node *othernode = NULL;
|
|
struct property *otherprop = NULL;
|
|
struct marker *othermark = NULL;
|
|
|
|
othernode = get_node_by_label(dt, label);
|
|
|
|
if (!othernode)
|
|
otherprop = get_property_by_label(dt, label, &othernode);
|
|
if (!othernode)
|
|
othermark = get_marker_label(dt, label, &othernode,
|
|
&otherprop);
|
|
|
|
if (!othernode)
|
|
return;
|
|
|
|
if ((othernode != node) || (otherprop != prop) || (othermark != mark))
|
|
FAIL(c, dti, "Duplicate label '%s' on " DESCLABEL_FMT
|
|
" and " DESCLABEL_FMT,
|
|
label, DESCLABEL_ARGS(node, prop, mark),
|
|
DESCLABEL_ARGS(othernode, otherprop, othermark));
|
|
}
|
|
|
|
static void check_duplicate_label_node(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct label *l;
|
|
struct property *prop;
|
|
|
|
for_each_label(node->labels, l)
|
|
check_duplicate_label(c, dti, l->label, node, NULL, NULL);
|
|
|
|
for_each_property(node, prop) {
|
|
struct marker *m = prop->val.markers;
|
|
|
|
for_each_label(prop->labels, l)
|
|
check_duplicate_label(c, dti, l->label, node, prop, NULL);
|
|
|
|
for_each_marker_of_type(m, LABEL)
|
|
check_duplicate_label(c, dti, m->ref, node, prop, m);
|
|
}
|
|
}
|
|
ERROR(duplicate_label, check_duplicate_label_node, NULL);
|
|
|
|
static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
|
|
struct node *node, const char *propname)
|
|
{
|
|
struct node *root = dti->dt;
|
|
struct property *prop;
|
|
struct marker *m;
|
|
cell_t phandle;
|
|
|
|
prop = get_property(node, propname);
|
|
if (!prop)
|
|
return 0;
|
|
|
|
if (prop->val.len != sizeof(cell_t)) {
|
|
FAIL(c, dti, "%s has bad length (%d) %s property",
|
|
node->fullpath, prop->val.len, prop->name);
|
|
return 0;
|
|
}
|
|
|
|
m = prop->val.markers;
|
|
for_each_marker_of_type(m, REF_PHANDLE) {
|
|
assert(m->offset == 0);
|
|
if (node != get_node_by_ref(root, m->ref))
|
|
/* "Set this node's phandle equal to some
|
|
* other node's phandle". That's nonsensical
|
|
* by construction. */ {
|
|
FAIL(c, dti, "%s in %s is a reference to another node",
|
|
prop->name, node->fullpath);
|
|
}
|
|
/* But setting this node's phandle equal to its own
|
|
* phandle is allowed - that means allocate a unique
|
|
* phandle for this node, even if it's not otherwise
|
|
* referenced. The value will be filled in later, so
|
|
* we treat it as having no phandle data for now. */
|
|
return 0;
|
|
}
|
|
|
|
phandle = propval_cell(prop);
|
|
|
|
if ((phandle == 0) || (phandle == -1)) {
|
|
FAIL(c, dti, "%s has bad value (0x%x) in %s property",
|
|
node->fullpath, phandle, prop->name);
|
|
return 0;
|
|
}
|
|
|
|
return phandle;
|
|
}
|
|
|
|
static void check_explicit_phandles(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *root = dti->dt;
|
|
struct node *other;
|
|
cell_t phandle, linux_phandle;
|
|
|
|
/* Nothing should have assigned phandles yet */
|
|
assert(!node->phandle);
|
|
|
|
phandle = check_phandle_prop(c, dti, node, "phandle");
|
|
|
|
linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle");
|
|
|
|
if (!phandle && !linux_phandle)
|
|
/* No valid phandles; nothing further to check */
|
|
return;
|
|
|
|
if (linux_phandle && phandle && (phandle != linux_phandle))
|
|
FAIL(c, dti, "%s has mismatching 'phandle' and 'linux,phandle'"
|
|
" properties", node->fullpath);
|
|
|
|
if (linux_phandle && !phandle)
|
|
phandle = linux_phandle;
|
|
|
|
other = get_node_by_phandle(root, phandle);
|
|
if (other && (other != node)) {
|
|
FAIL(c, dti, "%s has duplicated phandle 0x%x (seen before at %s)",
|
|
node->fullpath, phandle, other->fullpath);
|
|
return;
|
|
}
|
|
|
|
node->phandle = phandle;
|
|
}
|
|
ERROR(explicit_phandles, check_explicit_phandles, NULL);
|
|
|
|
static void check_name_properties(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property **pp, *prop = NULL;
|
|
|
|
for (pp = &node->proplist; *pp; pp = &((*pp)->next))
|
|
if (streq((*pp)->name, "name")) {
|
|
prop = *pp;
|
|
break;
|
|
}
|
|
|
|
if (!prop)
|
|
return; /* No name property, that's fine */
|
|
|
|
if ((prop->val.len != node->basenamelen+1)
|
|
|| (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
|
|
FAIL(c, dti, "\"name\" property in %s is incorrect (\"%s\" instead"
|
|
" of base node name)", node->fullpath, prop->val.val);
|
|
} else {
|
|
/* The name property is correct, and therefore redundant.
|
|
* Delete it */
|
|
*pp = prop->next;
|
|
free(prop->name);
|
|
data_free(prop->val);
|
|
free(prop);
|
|
}
|
|
}
|
|
ERROR_IF_NOT_STRING(name_is_string, "name");
|
|
ERROR(name_properties, check_name_properties, NULL, &name_is_string);
|
|
|
|
/*
|
|
* Reference fixup functions
|
|
*/
|
|
|
|
static void fixup_phandle_references(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *dt = dti->dt;
|
|
struct property *prop;
|
|
|
|
for_each_property(node, prop) {
|
|
struct marker *m = prop->val.markers;
|
|
struct node *refnode;
|
|
cell_t phandle;
|
|
|
|
for_each_marker_of_type(m, REF_PHANDLE) {
|
|
assert(m->offset + sizeof(cell_t) <= prop->val.len);
|
|
|
|
refnode = get_node_by_ref(dt, m->ref);
|
|
if (! refnode) {
|
|
if (!(dti->dtsflags & DTSF_PLUGIN))
|
|
FAIL(c, dti, "Reference to non-existent node or "
|
|
"label \"%s\"\n", m->ref);
|
|
else /* mark the entry as unresolved */
|
|
*((fdt32_t *)(prop->val.val + m->offset)) =
|
|
cpu_to_fdt32(0xffffffff);
|
|
continue;
|
|
}
|
|
|
|
phandle = get_node_phandle(dt, refnode);
|
|
*((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
|
|
}
|
|
}
|
|
}
|
|
ERROR(phandle_references, fixup_phandle_references, NULL,
|
|
&duplicate_node_names, &explicit_phandles);
|
|
|
|
static void fixup_path_references(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *dt = dti->dt;
|
|
struct property *prop;
|
|
|
|
for_each_property(node, prop) {
|
|
struct marker *m = prop->val.markers;
|
|
struct node *refnode;
|
|
char *path;
|
|
|
|
for_each_marker_of_type(m, REF_PATH) {
|
|
assert(m->offset <= prop->val.len);
|
|
|
|
refnode = get_node_by_ref(dt, m->ref);
|
|
if (!refnode) {
|
|
FAIL(c, dti, "Reference to non-existent node or label \"%s\"\n",
|
|
m->ref);
|
|
continue;
|
|
}
|
|
|
|
path = refnode->fullpath;
|
|
prop->val = data_insert_at_marker(prop->val, m, path,
|
|
strlen(path) + 1);
|
|
}
|
|
}
|
|
}
|
|
ERROR(path_references, fixup_path_references, NULL, &duplicate_node_names);
|
|
|
|
/*
|
|
* Semantic checks
|
|
*/
|
|
WARNING_IF_NOT_CELL(address_cells_is_cell, "#address-cells");
|
|
WARNING_IF_NOT_CELL(size_cells_is_cell, "#size-cells");
|
|
WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells");
|
|
|
|
WARNING_IF_NOT_STRING(device_type_is_string, "device_type");
|
|
WARNING_IF_NOT_STRING(model_is_string, "model");
|
|
WARNING_IF_NOT_STRING(status_is_string, "status");
|
|
|
|
static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
node->addr_cells = -1;
|
|
node->size_cells = -1;
|
|
|
|
prop = get_property(node, "#address-cells");
|
|
if (prop)
|
|
node->addr_cells = propval_cell(prop);
|
|
|
|
prop = get_property(node, "#size-cells");
|
|
if (prop)
|
|
node->size_cells = propval_cell(prop);
|
|
}
|
|
WARNING(addr_size_cells, fixup_addr_size_cells, NULL,
|
|
&address_cells_is_cell, &size_cells_is_cell);
|
|
|
|
#define node_addr_cells(n) \
|
|
(((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
|
|
#define node_size_cells(n) \
|
|
(((n)->size_cells == -1) ? 1 : (n)->size_cells)
|
|
|
|
static void check_reg_format(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
int addr_cells, size_cells, entrylen;
|
|
|
|
prop = get_property(node, "reg");
|
|
if (!prop)
|
|
return; /* No "reg", that's fine */
|
|
|
|
if (!node->parent) {
|
|
FAIL(c, dti, "Root node has a \"reg\" property");
|
|
return;
|
|
}
|
|
|
|
if (prop->val.len == 0)
|
|
FAIL(c, dti, "\"reg\" property in %s is empty", node->fullpath);
|
|
|
|
addr_cells = node_addr_cells(node->parent);
|
|
size_cells = node_size_cells(node->parent);
|
|
entrylen = (addr_cells + size_cells) * sizeof(cell_t);
|
|
|
|
if (!entrylen || (prop->val.len % entrylen) != 0)
|
|
FAIL(c, dti, "\"reg\" property in %s has invalid length (%d bytes) "
|
|
"(#address-cells == %d, #size-cells == %d)",
|
|
node->fullpath, prop->val.len, addr_cells, size_cells);
|
|
}
|
|
WARNING(reg_format, check_reg_format, NULL, &addr_size_cells);
|
|
|
|
static void check_ranges_format(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
int c_addr_cells, p_addr_cells, c_size_cells, p_size_cells, entrylen;
|
|
|
|
prop = get_property(node, "ranges");
|
|
if (!prop)
|
|
return;
|
|
|
|
if (!node->parent) {
|
|
FAIL(c, dti, "Root node has a \"ranges\" property");
|
|
return;
|
|
}
|
|
|
|
p_addr_cells = node_addr_cells(node->parent);
|
|
p_size_cells = node_size_cells(node->parent);
|
|
c_addr_cells = node_addr_cells(node);
|
|
c_size_cells = node_size_cells(node);
|
|
entrylen = (p_addr_cells + c_addr_cells + c_size_cells) * sizeof(cell_t);
|
|
|
|
if (prop->val.len == 0) {
|
|
if (p_addr_cells != c_addr_cells)
|
|
FAIL(c, dti, "%s has empty \"ranges\" property but its "
|
|
"#address-cells (%d) differs from %s (%d)",
|
|
node->fullpath, c_addr_cells, node->parent->fullpath,
|
|
p_addr_cells);
|
|
if (p_size_cells != c_size_cells)
|
|
FAIL(c, dti, "%s has empty \"ranges\" property but its "
|
|
"#size-cells (%d) differs from %s (%d)",
|
|
node->fullpath, c_size_cells, node->parent->fullpath,
|
|
p_size_cells);
|
|
} else if ((prop->val.len % entrylen) != 0) {
|
|
FAIL(c, dti, "\"ranges\" property in %s has invalid length (%d bytes) "
|
|
"(parent #address-cells == %d, child #address-cells == %d, "
|
|
"#size-cells == %d)", node->fullpath, prop->val.len,
|
|
p_addr_cells, c_addr_cells, c_size_cells);
|
|
}
|
|
}
|
|
WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
|
|
|
|
static const struct bus_type pci_bus = {
|
|
.name = "PCI",
|
|
};
|
|
|
|
static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
struct property *prop;
|
|
cell_t *cells;
|
|
|
|
prop = get_property(node, "device_type");
|
|
if (!prop || !streq(prop->val.val, "pci"))
|
|
return;
|
|
|
|
node->bus = &pci_bus;
|
|
|
|
if (!strneq(node->name, "pci", node->basenamelen) &&
|
|
!strneq(node->name, "pcie", node->basenamelen))
|
|
FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"",
|
|
node->fullpath);
|
|
|
|
prop = get_property(node, "ranges");
|
|
if (!prop)
|
|
FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)",
|
|
node->fullpath);
|
|
|
|
if (node_addr_cells(node) != 3)
|
|
FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge",
|
|
node->fullpath);
|
|
if (node_size_cells(node) != 2)
|
|
FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge",
|
|
node->fullpath);
|
|
|
|
prop = get_property(node, "bus-range");
|
|
if (!prop) {
|
|
FAIL(c, dti, "Node %s missing bus-range for PCI bridge",
|
|
node->fullpath);
|
|
return;
|
|
}
|
|
if (prop->val.len != (sizeof(cell_t) * 2)) {
|
|
FAIL(c, dti, "Node %s bus-range must be 2 cells",
|
|
node->fullpath);
|
|
return;
|
|
}
|
|
cells = (cell_t *)prop->val.val;
|
|
if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1]))
|
|
FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell",
|
|
node->fullpath);
|
|
if (fdt32_to_cpu(cells[1]) > 0xff)
|
|
FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256",
|
|
node->fullpath);
|
|
}
|
|
WARNING(pci_bridge, check_pci_bridge, NULL,
|
|
&device_type_is_string, &addr_size_cells);
|
|
|
|
static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
struct property *prop;
|
|
unsigned int bus_num, min_bus, max_bus;
|
|
cell_t *cells;
|
|
|
|
if (!node->parent || (node->parent->bus != &pci_bus))
|
|
return;
|
|
|
|
prop = get_property(node, "reg");
|
|
if (!prop)
|
|
return;
|
|
|
|
cells = (cell_t *)prop->val.val;
|
|
bus_num = (fdt32_to_cpu(cells[0]) & 0x00ff0000) >> 16;
|
|
|
|
prop = get_property(node->parent, "bus-range");
|
|
if (!prop) {
|
|
min_bus = max_bus = 0;
|
|
} else {
|
|
cells = (cell_t *)prop->val.val;
|
|
min_bus = fdt32_to_cpu(cells[0]);
|
|
max_bus = fdt32_to_cpu(cells[0]);
|
|
}
|
|
if ((bus_num < min_bus) || (bus_num > max_bus))
|
|
FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)",
|
|
node->fullpath, bus_num, min_bus, max_bus);
|
|
}
|
|
WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, ®_format, &pci_bridge);
|
|
|
|
static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
struct property *prop;
|
|
const char *unitname = get_unitname(node);
|
|
char unit_addr[5];
|
|
unsigned int dev, func, reg;
|
|
cell_t *cells;
|
|
|
|
if (!node->parent || (node->parent->bus != &pci_bus))
|
|
return;
|
|
|
|
prop = get_property(node, "reg");
|
|
if (!prop) {
|
|
FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath);
|
|
return;
|
|
}
|
|
|
|
cells = (cell_t *)prop->val.val;
|
|
if (cells[1] || cells[2])
|
|
FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0",
|
|
node->fullpath);
|
|
|
|
reg = fdt32_to_cpu(cells[0]);
|
|
dev = (reg & 0xf800) >> 11;
|
|
func = (reg & 0x700) >> 8;
|
|
|
|
if (reg & 0xff000000)
|
|
FAIL(c, dti, "Node %s PCI reg address is not configuration space",
|
|
node->fullpath);
|
|
if (reg & 0x000000ff)
|
|
FAIL(c, dti, "Node %s PCI reg config space address register number must be 0",
|
|
node->fullpath);
|
|
|
|
if (func == 0) {
|
|
snprintf(unit_addr, sizeof(unit_addr), "%x", dev);
|
|
if (streq(unitname, unit_addr))
|
|
return;
|
|
}
|
|
|
|
snprintf(unit_addr, sizeof(unit_addr), "%x,%x", dev, func);
|
|
if (streq(unitname, unit_addr))
|
|
return;
|
|
|
|
FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"",
|
|
node->fullpath, unit_addr);
|
|
}
|
|
WARNING(pci_device_reg, check_pci_device_reg, NULL, ®_format, &pci_bridge);
|
|
|
|
static const struct bus_type simple_bus = {
|
|
.name = "simple-bus",
|
|
};
|
|
|
|
static bool node_is_compatible(struct node *node, const char *compat)
|
|
{
|
|
struct property *prop;
|
|
const char *str, *end;
|
|
|
|
prop = get_property(node, "compatible");
|
|
if (!prop)
|
|
return false;
|
|
|
|
for (str = prop->val.val, end = str + prop->val.len; str < end;
|
|
str += strnlen(str, end - str) + 1) {
|
|
if (strneq(str, compat, end - str))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
if (node_is_compatible(node, "simple-bus"))
|
|
node->bus = &simple_bus;
|
|
}
|
|
WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL, &addr_size_cells);
|
|
|
|
static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
|
|
{
|
|
struct property *prop;
|
|
const char *unitname = get_unitname(node);
|
|
char unit_addr[17];
|
|
unsigned int size;
|
|
uint64_t reg = 0;
|
|
cell_t *cells = NULL;
|
|
|
|
if (!node->parent || (node->parent->bus != &simple_bus))
|
|
return;
|
|
|
|
prop = get_property(node, "reg");
|
|
if (prop)
|
|
cells = (cell_t *)prop->val.val;
|
|
else {
|
|
prop = get_property(node, "ranges");
|
|
if (prop && prop->val.len)
|
|
/* skip of child address */
|
|
cells = ((cell_t *)prop->val.val) + node_addr_cells(node);
|
|
}
|
|
|
|
if (!cells) {
|
|
if (node->parent->parent && !(node->bus == &simple_bus))
|
|
FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath);
|
|
return;
|
|
}
|
|
|
|
size = node_addr_cells(node->parent);
|
|
while (size--)
|
|
reg = (reg << 32) | fdt32_to_cpu(*(cells++));
|
|
|
|
snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg);
|
|
if (!streq(unitname, unit_addr))
|
|
FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
|
|
node->fullpath, unit_addr);
|
|
}
|
|
WARNING(simple_bus_reg, check_simple_bus_reg, NULL, ®_format, &simple_bus_bridge);
|
|
|
|
static void check_unit_address_format(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
const char *unitname = get_unitname(node);
|
|
|
|
if (node->parent && node->parent->bus)
|
|
return;
|
|
|
|
if (!unitname[0])
|
|
return;
|
|
|
|
if (!strncmp(unitname, "0x", 2)) {
|
|
FAIL(c, dti, "Node %s unit name should not have leading \"0x\"",
|
|
node->fullpath);
|
|
/* skip over 0x for next test */
|
|
unitname += 2;
|
|
}
|
|
if (unitname[0] == '0' && isxdigit(unitname[1]))
|
|
FAIL(c, dti, "Node %s unit name should not have leading 0s",
|
|
node->fullpath);
|
|
}
|
|
WARNING(unit_address_format, check_unit_address_format, NULL,
|
|
&node_name_format, &pci_bridge, &simple_bus_bridge);
|
|
|
|
/*
|
|
* Style checks
|
|
*/
|
|
static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *reg, *ranges;
|
|
|
|
if (!node->parent)
|
|
return; /* Ignore root node */
|
|
|
|
reg = get_property(node, "reg");
|
|
ranges = get_property(node, "ranges");
|
|
|
|
if (!reg && !ranges)
|
|
return;
|
|
|
|
if (node->parent->addr_cells == -1)
|
|
FAIL(c, dti, "Relying on default #address-cells value for %s",
|
|
node->fullpath);
|
|
|
|
if (node->parent->size_cells == -1)
|
|
FAIL(c, dti, "Relying on default #size-cells value for %s",
|
|
node->fullpath);
|
|
}
|
|
WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
|
|
&addr_size_cells);
|
|
|
|
static void check_obsolete_chosen_interrupt_controller(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *dt = dti->dt;
|
|
struct node *chosen;
|
|
struct property *prop;
|
|
|
|
if (node != dt)
|
|
return;
|
|
|
|
|
|
chosen = get_node_by_path(dt, "/chosen");
|
|
if (!chosen)
|
|
return;
|
|
|
|
prop = get_property(chosen, "interrupt-controller");
|
|
if (prop)
|
|
FAIL(c, dti, "/chosen has obsolete \"interrupt-controller\" "
|
|
"property");
|
|
}
|
|
WARNING(obsolete_chosen_interrupt_controller,
|
|
check_obsolete_chosen_interrupt_controller, NULL);
|
|
|
|
struct provider {
|
|
const char *prop_name;
|
|
const char *cell_name;
|
|
bool optional;
|
|
};
|
|
|
|
static void check_property_phandle_args(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node,
|
|
struct property *prop,
|
|
const struct provider *provider)
|
|
{
|
|
struct node *root = dti->dt;
|
|
int cell, cellsize = 0;
|
|
|
|
if (prop->val.len % sizeof(cell_t)) {
|
|
FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s",
|
|
prop->name, prop->val.len, sizeof(cell_t), node->fullpath);
|
|
return;
|
|
}
|
|
|
|
for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize + 1) {
|
|
struct node *provider_node;
|
|
struct property *cellprop;
|
|
int phandle;
|
|
|
|
phandle = propval_cell_n(prop, cell);
|
|
/*
|
|
* Some bindings use a cell value 0 or -1 to skip over optional
|
|
* entries when each index position has a specific definition.
|
|
*/
|
|
if (phandle == 0 || phandle == -1) {
|
|
cellsize = 0;
|
|
continue;
|
|
}
|
|
|
|
/* If we have markers, verify the current cell is a phandle */
|
|
if (prop->val.markers) {
|
|
struct marker *m = prop->val.markers;
|
|
for_each_marker_of_type(m, REF_PHANDLE) {
|
|
if (m->offset == (cell * sizeof(cell_t)))
|
|
break;
|
|
}
|
|
if (!m)
|
|
FAIL(c, dti, "Property '%s', cell %d is not a phandle reference in %s",
|
|
prop->name, cell, node->fullpath);
|
|
}
|
|
|
|
provider_node = get_node_by_phandle(root, phandle);
|
|
if (!provider_node) {
|
|
FAIL(c, dti, "Could not get phandle node for %s:%s(cell %d)",
|
|
node->fullpath, prop->name, cell);
|
|
break;
|
|
}
|
|
|
|
cellprop = get_property(provider_node, provider->cell_name);
|
|
if (cellprop) {
|
|
cellsize = propval_cell(cellprop);
|
|
} else if (provider->optional) {
|
|
cellsize = 0;
|
|
} else {
|
|
FAIL(c, dti, "Missing property '%s' in node %s or bad phandle (referred from %s:%s[%d])",
|
|
provider->cell_name,
|
|
provider_node->fullpath,
|
|
node->fullpath, prop->name, cell);
|
|
break;
|
|
}
|
|
|
|
if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) {
|
|
FAIL(c, dti, "%s property size (%d) too small for cell size %d in %s",
|
|
prop->name, prop->val.len, cellsize, node->fullpath);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void check_provider_cells_property(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct provider *provider = c->data;
|
|
struct property *prop;
|
|
|
|
prop = get_property(node, provider->prop_name);
|
|
if (!prop)
|
|
return;
|
|
|
|
check_property_phandle_args(c, dti, node, prop, provider);
|
|
}
|
|
#define WARNING_PROPERTY_PHANDLE_CELLS(nm, propname, cells_name, ...) \
|
|
static struct provider nm##_provider = { (propname), (cells_name), __VA_ARGS__ }; \
|
|
WARNING(nm##_property, check_provider_cells_property, &nm##_provider, &phandle_references);
|
|
|
|
WARNING_PROPERTY_PHANDLE_CELLS(clocks, "clocks", "#clock-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(cooling_device, "cooling-device", "#cooling-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(dmas, "dmas", "#dma-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(hwlocks, "hwlocks", "#hwlock-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(interrupts_extended, "interrupts-extended", "#interrupt-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(io_channels, "io-channels", "#io-channel-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(iommus, "iommus", "#iommu-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(mboxes, "mboxes", "#mbox-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(msi_parent, "msi-parent", "#msi-cells", true);
|
|
WARNING_PROPERTY_PHANDLE_CELLS(mux_controls, "mux-controls", "#mux-control-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(sound_dais, "sound-dais", "#sound-dai-cells");
|
|
WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells");
|
|
|
|
static bool prop_is_gpio(struct property *prop)
|
|
{
|
|
char *str;
|
|
|
|
/*
|
|
* *-gpios and *-gpio can appear in property names,
|
|
* so skip over any false matches (only one known ATM)
|
|
*/
|
|
if (strstr(prop->name, "nr-gpio"))
|
|
return false;
|
|
|
|
str = strrchr(prop->name, '-');
|
|
if (str)
|
|
str++;
|
|
else
|
|
str = prop->name;
|
|
if (!(streq(str, "gpios") || streq(str, "gpio")))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
static void check_gpios_property(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
/* Skip GPIO hog nodes which have 'gpios' property */
|
|
if (get_property(node, "gpio-hog"))
|
|
return;
|
|
|
|
for_each_property(node, prop) {
|
|
struct provider provider;
|
|
|
|
if (!prop_is_gpio(prop))
|
|
continue;
|
|
|
|
provider.prop_name = prop->name;
|
|
provider.cell_name = "#gpio-cells";
|
|
provider.optional = false;
|
|
check_property_phandle_args(c, dti, node, prop, &provider);
|
|
}
|
|
|
|
}
|
|
WARNING(gpios_property, check_gpios_property, NULL, &phandle_references);
|
|
|
|
static void check_deprecated_gpio_property(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
for_each_property(node, prop) {
|
|
char *str;
|
|
|
|
if (!prop_is_gpio(prop))
|
|
continue;
|
|
|
|
str = strstr(prop->name, "gpio");
|
|
if (!streq(str, "gpio"))
|
|
continue;
|
|
|
|
FAIL(c, dti, "'[*-]gpio' is deprecated, use '[*-]gpios' instead for %s:%s",
|
|
node->fullpath, prop->name);
|
|
}
|
|
|
|
}
|
|
CHECK(deprecated_gpio_property, check_deprecated_gpio_property, NULL);
|
|
|
|
static bool node_is_interrupt_provider(struct node *node)
|
|
{
|
|
struct property *prop;
|
|
|
|
prop = get_property(node, "interrupt-controller");
|
|
if (prop)
|
|
return true;
|
|
|
|
prop = get_property(node, "interrupt-map");
|
|
if (prop)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
static void check_interrupts_property(struct check *c,
|
|
struct dt_info *dti,
|
|
struct node *node)
|
|
{
|
|
struct node *root = dti->dt;
|
|
struct node *irq_node = NULL, *parent = node;
|
|
struct property *irq_prop, *prop = NULL;
|
|
int irq_cells, phandle;
|
|
|
|
irq_prop = get_property(node, "interrupts");
|
|
if (!irq_prop)
|
|
return;
|
|
|
|
if (irq_prop->val.len % sizeof(cell_t))
|
|
FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s",
|
|
irq_prop->name, irq_prop->val.len, sizeof(cell_t),
|
|
node->fullpath);
|
|
|
|
while (parent && !prop) {
|
|
if (parent != node && node_is_interrupt_provider(parent)) {
|
|
irq_node = parent;
|
|
break;
|
|
}
|
|
|
|
prop = get_property(parent, "interrupt-parent");
|
|
if (prop) {
|
|
phandle = propval_cell(prop);
|
|
irq_node = get_node_by_phandle(root, phandle);
|
|
if (!irq_node) {
|
|
FAIL(c, dti, "Bad interrupt-parent phandle for %s",
|
|
node->fullpath);
|
|
return;
|
|
}
|
|
if (!node_is_interrupt_provider(irq_node))
|
|
FAIL(c, dti,
|
|
"Missing interrupt-controller or interrupt-map property in %s",
|
|
irq_node->fullpath);
|
|
|
|
break;
|
|
}
|
|
|
|
parent = parent->parent;
|
|
}
|
|
|
|
if (!irq_node) {
|
|
FAIL(c, dti, "Missing interrupt-parent for %s", node->fullpath);
|
|
return;
|
|
}
|
|
|
|
prop = get_property(irq_node, "#interrupt-cells");
|
|
if (!prop) {
|
|
FAIL(c, dti, "Missing #interrupt-cells in interrupt-parent %s",
|
|
irq_node->fullpath);
|
|
return;
|
|
}
|
|
|
|
irq_cells = propval_cell(prop);
|
|
if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) {
|
|
FAIL(c, dti,
|
|
"interrupts size is (%d), expected multiple of %d in %s",
|
|
irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)),
|
|
node->fullpath);
|
|
}
|
|
}
|
|
WARNING(interrupts_property, check_interrupts_property, &phandle_references);
|
|
|
|
static struct check *check_table[] = {
|
|
&duplicate_node_names, &duplicate_property_names,
|
|
&node_name_chars, &node_name_format, &property_name_chars,
|
|
&name_is_string, &name_properties,
|
|
|
|
&duplicate_label,
|
|
|
|
&explicit_phandles,
|
|
&phandle_references, &path_references,
|
|
|
|
&address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
|
|
&device_type_is_string, &model_is_string, &status_is_string,
|
|
|
|
&property_name_chars_strict,
|
|
&node_name_chars_strict,
|
|
|
|
&addr_size_cells, ®_format, &ranges_format,
|
|
|
|
&unit_address_vs_reg,
|
|
&unit_address_format,
|
|
|
|
&pci_bridge,
|
|
&pci_device_reg,
|
|
&pci_device_bus_num,
|
|
|
|
&simple_bus_bridge,
|
|
&simple_bus_reg,
|
|
|
|
&avoid_default_addr_size,
|
|
&obsolete_chosen_interrupt_controller,
|
|
|
|
&clocks_property,
|
|
&cooling_device_property,
|
|
&dmas_property,
|
|
&hwlocks_property,
|
|
&interrupts_extended_property,
|
|
&io_channels_property,
|
|
&iommus_property,
|
|
&mboxes_property,
|
|
&msi_parent_property,
|
|
&mux_controls_property,
|
|
&phys_property,
|
|
&power_domains_property,
|
|
&pwms_property,
|
|
&resets_property,
|
|
&sound_dais_property,
|
|
&thermal_sensors_property,
|
|
|
|
&deprecated_gpio_property,
|
|
&gpios_property,
|
|
&interrupts_property,
|
|
|
|
&always_fail,
|
|
};
|
|
|
|
static void enable_warning_error(struct check *c, bool warn, bool error)
|
|
{
|
|
int i;
|
|
|
|
/* Raising level, also raise it for prereqs */
|
|
if ((warn && !c->warn) || (error && !c->error))
|
|
for (i = 0; i < c->num_prereqs; i++)
|
|
enable_warning_error(c->prereq[i], warn, error);
|
|
|
|
c->warn = c->warn || warn;
|
|
c->error = c->error || error;
|
|
}
|
|
|
|
static void disable_warning_error(struct check *c, bool warn, bool error)
|
|
{
|
|
int i;
|
|
|
|
/* Lowering level, also lower it for things this is the prereq
|
|
* for */
|
|
if ((warn && c->warn) || (error && c->error)) {
|
|
for (i = 0; i < ARRAY_SIZE(check_table); i++) {
|
|
struct check *cc = check_table[i];
|
|
int j;
|
|
|
|
for (j = 0; j < cc->num_prereqs; j++)
|
|
if (cc->prereq[j] == c)
|
|
disable_warning_error(cc, warn, error);
|
|
}
|
|
}
|
|
|
|
c->warn = c->warn && !warn;
|
|
c->error = c->error && !error;
|
|
}
|
|
|
|
void parse_checks_option(bool warn, bool error, const char *arg)
|
|
{
|
|
int i;
|
|
const char *name = arg;
|
|
bool enable = true;
|
|
|
|
if ((strncmp(arg, "no-", 3) == 0)
|
|
|| (strncmp(arg, "no_", 3) == 0)) {
|
|
name = arg + 3;
|
|
enable = false;
|
|
}
|
|
|
|
for (i = 0; i < ARRAY_SIZE(check_table); i++) {
|
|
struct check *c = check_table[i];
|
|
|
|
if (streq(c->name, name)) {
|
|
if (enable)
|
|
enable_warning_error(c, warn, error);
|
|
else
|
|
disable_warning_error(c, warn, error);
|
|
return;
|
|
}
|
|
}
|
|
|
|
die("Unrecognized check name \"%s\"\n", name);
|
|
}
|
|
|
|
void process_checks(bool force, struct dt_info *dti)
|
|
{
|
|
int i;
|
|
int error = 0;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(check_table); i++) {
|
|
struct check *c = check_table[i];
|
|
|
|
if (c->warn || c->error)
|
|
error = error || run_check(c, dti);
|
|
}
|
|
|
|
if (error) {
|
|
if (!force) {
|
|
fprintf(stderr, "ERROR: Input tree has errors, aborting "
|
|
"(use -f to force output)\n");
|
|
exit(2);
|
|
} else if (quiet < 3) {
|
|
fprintf(stderr, "Warning: Input tree has errors, "
|
|
"output forced\n");
|
|
}
|
|
}
|
|
}
|