tools: rewrite hardware_gen.py

This is almost a complete rewrite from the old hardware_gen.py.

It separates the 'parse DT' stage from the 'generate output'
devices more strictly, and is hopefully easier to understand and
easier to extend.

We also no longer generate the 'devices' list (in YAML)
or the dev_p_regs array (in C), as the kernel will implicitly
expose all non-RAM untypeds as devices.
This commit is contained in:
Simon Shields
2019-08-13 14:26:22 +10:00
parent 6e3606d056
commit 75f2c54b42
15 changed files with 1490 additions and 1040 deletions

View File

@@ -169,9 +169,11 @@ if(DEFINED KernelDTSList AND (NOT "${KernelDTSList}" STREQUAL ""))
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/machine/")
execute_process(
COMMAND
${PYTHON3} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --compatibility-strings
"${compatibility_outfile}" --output "${device_dest}" --config "${config_file}"
--schema "${config_schema}" --yaml "${platform_yaml}" --arch "${KernelArch}"
${PYTHON3} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --compat-strings
--compat-strings-out "${compatibility_outfile}" --c-header --header-out
"${device_dest}" --hardware-config "${config_file}" --hardware-schema
"${config_schema}" --yaml --yaml-out "${platform_yaml}" --arch "${KernelArch}"
--addrspace-bits "${KernelPaddrBits}"
INPUT_FILE /dev/stdin
OUTPUT_FILE /dev/stdout
ERROR_FILE /dev/stderr