# This holds information about each type of output file dtoc can create
# type: Type of file (Ftype)
-# fname: Filename excluding directory, e.g. 'dt-platdata.c'
-OutputFile = collections.namedtuple('OutputFile', ['ftype', 'fname'])
+# fname: Filename excluding directory, e.g. 'dt-plat.c'
+# hdr_comment: Comment explaining the purpose of the file
+OutputFile = collections.namedtuple('OutputFile',
+ ['ftype', 'fname', 'hdr_comment'])
# This holds information about a property which includes phandles.
#
self._lines = []
return lines
- def out_header(self):
- """Output a message indicating that this is an auto-generated file"""
+ def out_header(self, outfile):
+ """Output a message indicating that this is an auto-generated file
+
+ Args:
+ outfile: OutputFile describing the file being generated
+ """
self.out('''/*
* DO NOT MODIFY
*
- * This file was generated by dtoc from a .dtb (device tree binary) file.
+ * %s.
+ * This was generated by dtoc from a .dtb (device tree binary) file.
*/
-''')
+''' % outfile.hdr_comment)
def get_phandle_argc(self, prop, node_name):
"""Check if a node contains phandles
value: Prop object with field information
"""
- self.out_header()
self.out('#include <stdbool.h>\n')
self.out('#include <linux/libfdt.h>\n')
See the documentation in doc/driver-model/of-plat.rst for more
information.
"""
- self.out_header()
self.out('/* Allow use of U_BOOT_DRVINFO() in this file */\n')
self.out('#define DT_PLATDATA_C\n')
self.out('\n')
# key: Command used to generate this file
# value: OutputFile for this command
OUTPUT_FILES = {
- 'struct': OutputFile(Ftype.HEADER, 'dt-structs-gen.h'),
- 'platdata': OutputFile(Ftype.SOURCE, 'dt-platdata.c'),
+ 'struct':
+ OutputFile(Ftype.HEADER, 'dt-structs-gen.h',
+ 'Defines the structs used to hold devicetree data'),
+ 'platdata':
+ OutputFile(Ftype.SOURCE, 'dt-platdata.c',
+ 'Declares the U_BOOT_DRIVER() records and platform data'),
}
(cmd, ', '.join(sorted(OUTPUT_FILES.keys()))))
plat.setup_output(outfile.ftype,
outfile.fname if output_dirs else output)
+ plat.out_header(outfile)
if cmd == 'struct':
plat.generate_structs(structs)
elif cmd == 'platdata':