From f94e5560accbead99c48ab0dfbfa40e2147b2bd6 Mon Sep 17 00:00:00 2001 From: bbracker Date: Tue, 8 Feb 2022 11:11:44 +0000 Subject: [PATCH] add trimmed-down virt devicetree to repo for QEMU --- .gitignore | 2 + linux/devicetree/debug/dumpdts.sh | 6 +++ linux/devicetree/virt-trimmed.dts | 75 +++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100755 linux/devicetree/debug/dumpdts.sh create mode 100644 linux/devicetree/virt-trimmed.dts diff --git a/.gitignore b/.gitignore index fca93ebb..94462b42 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ examples/asm/example/example examples/C/sum/sum examples/C/fir/fir synthDC/hdl/*.sv +linux/devicetree/debug/* +!linux/devicetree/debug/dumpdts.sh diff --git a/linux/devicetree/debug/dumpdts.sh b/linux/devicetree/debug/dumpdts.sh new file mode 100755 index 00000000..70057a78 --- /dev/null +++ b/linux/devicetree/debug/dumpdts.sh @@ -0,0 +1,6 @@ +#!/bin/bash +machine=virt + +qemu-system-riscv64 -M $machine,dumpdtb=$machine.dtb -bios $RISCV/buildroot/output/images/fw_jump.elf + +dtc -I dtb -O dts $machine.dtb > $machine.dts diff --git a/linux/devicetree/virt-trimmed.dts b/linux/devicetree/virt-trimmed.dts new file mode 100644 index 00000000..b517c3de --- /dev/null +++ b/linux/devicetree/virt-trimmed.dts @@ -0,0 +1,75 @@ +/dts-v1/; + +/ { + #address-cells = <0x02>; + #size-cells = <0x02>; + compatible = "riscv-virtio-trimmed"; + model = "riscv-virtio-trimmed,qemu"; + + chosen { + linux,initrd-end = <0x85c43a00>; + linux,initrd-start = <0x84200000>; + bootargs = "root=/dev/vda ro"; + stdout-path = "/soc/uart@10000000"; + }; + + memory@80000000 { + device_type = "memory"; + reg = <0x00 0x80000000 0x00 0x8000000>; + }; + + cpus { + #address-cells = <0x01>; + #size-cells = <0x00>; + timebase-frequency = <0x989680>; + + cpu@0 { + phandle = <0x01>; + device_type = "cpu"; + reg = <0x00>; + status = "okay"; + compatible = "riscv"; + riscv,isa = "rv64imafdcsu"; + mmu-type = "riscv,sv48"; + + interrupt-controller { + #interrupt-cells = <0x01>; + interrupt-controller; + compatible = "riscv,cpu-intc"; + phandle = <0x02>; + }; + }; + }; + + soc { + #address-cells = <0x02>; + #size-cells = <0x02>; + compatible = "simple-bus"; + ranges; + + uart@10000000 { + interrupts = <0x0a>; + interrupt-parent = <0x03>; + clock-frequency = <0x384000>; + reg = <0x00 0x10000000 0x00 0x100>; + compatible = "ns16550a"; + }; + + plic@c000000 { + phandle = <0x03>; + riscv,ndev = <0x35>; + reg = <0x00 0xc000000 0x00 0x210000>; + interrupts-extended = <0x02 0x0b 0x02 0x09>; + interrupt-controller; + compatible = "sifive,plic-1.0.0\0riscv,plic0"; + #interrupt-cells = <0x01>; + #address-cells = <0x00>; + }; + + clint@2000000 { + interrupts-extended = <0x02 0x03 0x02 0x07>; + reg = <0x00 0x2000000 0x00 0x10000>; + compatible = "sifive,clint0\0riscv,clint0"; + }; + }; +};