json2dts: add the framebuffer memory in the 'reserved-memory' entry, so that Linux doesn't try to use it for something else.

This commit is contained in:
Romain Dolbeau 2021-04-06 13:44:50 +02:00
parent 8db1a619f5
commit dac6c1cbb1
1 changed files with 17 additions and 3 deletions

View File

@ -115,19 +115,33 @@ def generate_dts(d, initrd_start=None, initrd_size=None, polling=False):
main_ram_base = d["memories"]["main_ram"]["base"], main_ram_base = d["memories"]["main_ram"]["base"],
main_ram_size = d["memories"]["main_ram"]["size"]) main_ram_size = d["memories"]["main_ram"]["size"])
if "opensbi" in d["memories"]: if (("opensbi" in d["memories"]) or ("video_framebuffer" in d["csr_bases"])):
dts += """ dts += """
reserved-memory {{ reserved-memory {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; ranges;
"""
if "opensbi" in d["memories"]:
dts += """
opensbi@{opensbi_base:x} {{ opensbi@{opensbi_base:x} {{
reg = <0x{opensbi_base:x} 0x{opensbi_size:x}>; reg = <0x{opensbi_base:x} 0x{opensbi_size:x}>;
}}; }};
}};
""".format( """.format(
opensbi_base = d["memories"]["opensbi"]["base"], opensbi_base = d["memories"]["opensbi"]["base"],
opensbi_size = d["memories"]["opensbi"]["size"]) opensbi_size = d["memories"]["opensbi"]["size"])
if "video_framebuffer" in d["csr_bases"]:
dts += """
framebuffer@f0000000 {{
reg = <0x{framebuffer_base:x} 0x{framebuffer_size:x}>;
}};
""".format(
framebuffer_base = d["constants"]["video_framebuffer_base"],
framebuffer_size = (d["constants"]["video_framebuffer_hres"] * d["constants"]["video_framebuffer_vres"] * 4))
dts += """
};
"""
# SoC ------------------------------------------------------------------------------------------ # SoC ------------------------------------------------------------------------------------------