Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dts/nutshell.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

chosen {
bootargs = "console=hvc0 earlycon=sbi";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};

memory@100000000 {
Expand Down
4 changes: 2 additions & 2 deletions dts/spike-2core.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
chosen {
stdout-path = &SERIAL0;
bootargs = "console=ttyS0 earlycon";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};
cpus {
#address-cells = <1>;
Expand Down
4 changes: 2 additions & 2 deletions dts/spike.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
chosen {
stdout-path = &SERIAL0;
bootargs = "console=ttyS0 earlycon";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};
cpus {
#address-cells = <1>;
Expand Down
184 changes: 184 additions & 0 deletions dts/xiangshan-fpga-noAIA-mem128g-novec.dts.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/*
* XiangShan FPGA DTS used by the fpga board flow.
*
* 1. AIA is disabled, so Linux should only see the legacy CLINT + PLIC path.
* 2. UART16550 is exposed as the serial console.
*/

/dts-v1/;

/ {
compatible = "freechips,rocketchip-unknown-dev";
model = "xiangshan,Kunminghu-dev";
#address-cells = <2>;
#size-cells = <2>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
timebase-frequency = <1000000>;

cpu0: cpu@0 {
compatible = "ICT,xiangshan", "riscv";
device_type = "cpu";
reg = <0x0>;
status = "okay";

d-cache-block-size = <64>;
d-cache-sets = <256>;
d-cache-size = <65536>;
d-tlb-sets = <1>;
d-tlb-size = <48>;
i-cache-block-size = <64>;
i-cache-sets = <256>;
i-cache-size = <65536>;
i-tlb-sets = <1>;
i-tlb-size = <48>;
mmu-type = "riscv,sv48";
clock-frequency = <0>;
timebase-frequency = <1000000>;
tlb-split;

/*
* Keep the Linux-friendly CPU capability description from the
* workload template while using the FPGA board interrupt/peripheral
* map below.
*/
riscv,isa = "rv64imafdcvh_smstateen_sscofpmf_sstc_zicntr_zihpm_svpbmt_sdtrig_smcsrind_sscsrind_svade";
riscv,isa-base = "rv64i";
riscv,isa-extensions =
"i", "m", "a", "f", "d", "c", "h",
"sdtrig", "sha", "shcounterenw", "shgatpa",
"shlcofideleg", "shtvala", "shvsatpa", "shvstvala",
"shvstvecd", "smcsrind", "smdbltrp",
"smmpm", "smnpm", "smrnmi", "smstateen",
"ss1p13", "ssccptr", "sscofpmf",
"sscounterenw", "sscsrind", "ssdbltrp", "ssnpm",
"sspm", "ssstateen", "ssstrict", "sstc",
"sstvala", "sstvecd", "ssu64xl", "supm",
"sv39", "sv48", "svade", "svbare", "svinval",
"svnapot", "svpbmt", "za64rs", "zacas", "zawrs",
"zba", "zbb", "zbc", "zbkb", "zbkc", "zbkx",
"zbs", "zcb", "zcmop", "zfa", "zfh", "zfhmin",
"zic64b",
"ziccamoa", "ziccif", "zicclsm", "ziccrse",
"zicntr", "zicond", "zicsr", "zifencei",
"zihintntl", "zihintpause", "zihpm", "zimop",
"zkn", "zknd", "zkne", "zknh", "zksed",
"zksh", "zkt";
riscv,cbom-block-size = <0x40>;
riscv,cboz-block-size = <0x40>;

next-level-cache = <&l2_cache>;

intc_cpu0: interrupt-controller {
#interrupt-cells = <1>;
compatible = "riscv,cpu-intc";
interrupt-controller;
};
};
};

l2_cache: l2-cache {
compatible = "cache";
cache-level = <2>;
cache-block-size = <64>;
cache-size = <1048576>;
};

memory: memory@80000000 {
device_type = "memory";
/*
* Static 64 GiB memory profile for SPEC CPU2026 speed workloads.
*/
reg = <0x0 0x80000000 0x20 0x00000000>;
};

reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;

reserved0: buffer@0 {
no-map;
reg = <0x0 0x80000000 0x0 0x100000>;
};
};

soc {
#address-cells = <2>;
#size-cells = <2>;
compatible = "freechips,rocketchip-unknown-soc", "simple-bus";
ranges;

/*
* This FPGA image boots without AIA. Describe only the CLINT + PLIC
* interrupt topology that the software stack should probe.
*/
clint: clint@38000000 {
compatible = "riscv,clint0";
reg = <0x0 0x38000000 0x0 0x10000>;
reg-names = "control";
interrupts-extended = <&intc_cpu0 3 &intc_cpu0 7>;
};

debug-controller@38020000 {
compatible = "sifive,debug-013", "riscv,debug-013";
debug-attach = "jtag";
reg = <0x0 0x38020000 0x0 0x1000>;
reg-names = "control";
interrupts-extended = <&intc_cpu0 65535>;
};

PLIC: interrupt-controller@3c000000 {
compatible = "riscv,plic0";
#interrupt-cells = <1>;
interrupt-controller;
reg = <0x0 0x3c000000 0x0 0x4000000>;
reg-names = "control";
interrupts-extended = <&intc_cpu0 11 &intc_cpu0 9>;
riscv,max-priority = <7>;
riscv,ndev = <66>;
};

/*
* Board-specific FPGA peripheral: the external AXI UART16550 used as
* the Linux console on fpga. Keep the 32-bit MMIO spacing and the
* 50 MHz input clock to match the FPGA wrapper.
*/
uart0: serial@310b0000 {
compatible = "ns16550a";
reg = <0x0 0x310b0000 0x0 0x10000>;
reg-shift = <0x2>;
reg-io-width = <0x4>;
clock-frequency = <50000000>;
current-speed = <115200>;
//interrupt-parent = <&PLIC>;
//interrupts = <40>;
status = "okay";
};
};

aliases {
serial0 = &uart0;
};

chosen {
/*
* On this FPGA DTS the UART16550 interrupt is not wired into Linux
* (`interrupt-parent` / `interrupts` are intentionally absent above).
* `ttyS0` can still print early boot logs via polling/earlycon, but the
* normal console path becomes unreliable once Linux switches away from
* earlycon. When the UART interrupt is absent, use the SBI console
* (`hvc0`) instead.
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
cold-boot-harts = <&cpu0>;
};
};
};
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem24g-novec.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem24g.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem64g-novec.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem64g.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem8g-novec.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-mem8g.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA-novec.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan-fpga-noAIA.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
*/
bootargs = "console=hvc0 earlycon=sbi loglevel=8";
stdout-path = "serial0:115200n8";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;

opensbi-config {
compatible = "opensbi,config";
Expand Down
4 changes: 2 additions & 2 deletions dts/xiangshan.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
};
chosen {
bootargs = "console=hvc0 earlycon=sbi";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};
L11: memory@80000000 {
device_type = "memory";
Expand Down
4 changes: 2 additions & 2 deletions dts/yanqihu-2core.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
};
chosen {
bootargs = "console=hvc0 earlycon=sbi";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};
L11: memory@80000000 {
device_type = "memory";
Expand Down
4 changes: 2 additions & 2 deletions dts/yanqihu.dts.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
};
chosen {
bootargs = "console=hvc0 earlycon=sbi";
linux,initrd-start = <0x0 INITRAMFS_BEGIN>;
linux,initrd-end = <0x0 INITRAMFS_END>;
linux,initrd-start = <INITRAMFS_BEGIN_HI INITRAMFS_BEGIN_LO>;
linux,initrd-end = <INITRAMFS_END_HI INITRAMFS_END_LO>;
};
L11: memory@80000000 {
device_type = "memory";
Expand Down
16 changes: 13 additions & 3 deletions scripts/build-firmware-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ KERNEL_SIZE=$(stat -c%s "$KERNEL_IMAGE")
KERNEL_SIZE_MB=$(( (KERNEL_SIZE + MEGABYTE - 1) / MEGABYTE ))
INITRAMFS_OFFSET_MB=$(( KERNEL_OFFSET_MB + KERNEL_SIZE_MB ))
INITRAMFS_SIZE=$(stat -c%s "$CPIO_ARCHIVE")
INITRAMFS_BEGIN_HEX=$(printf "0x%x" $(( MEM_BEGIN + INITRAMFS_OFFSET_MB*MEGABYTE )))
INITRAMFS_END_HEX=$(printf "0x%x" $(( INITRAMFS_BEGIN_HEX + INITRAMFS_SIZE )))
INITRAMFS_BEGIN_ADDR=$(( MEM_BEGIN + INITRAMFS_OFFSET_MB*MEGABYTE ))
INITRAMFS_END_ADDR=$(( INITRAMFS_BEGIN_ADDR + INITRAMFS_SIZE ))
INITRAMFS_BEGIN_HEX=$(printf "0x%x" "$INITRAMFS_BEGIN_ADDR")
INITRAMFS_END_HEX=$(printf "0x%x" "$INITRAMFS_END_ADDR")
INITRAMFS_BEGIN_HI=$(printf "0x%x" $(( INITRAMFS_BEGIN_ADDR >> 32 )))
INITRAMFS_BEGIN_LO=$(printf "0x%x" $(( INITRAMFS_BEGIN_ADDR & 0xffffffff )))
INITRAMFS_END_HI=$(printf "0x%x" $(( INITRAMFS_END_ADDR >> 32 )))
INITRAMFS_END_LO=$(printf "0x%x" $(( INITRAMFS_END_ADDR & 0xffffffff )))

# Build device tree files
DTC="${DTC:-dtc}"
Expand Down Expand Up @@ -84,7 +90,11 @@ build-dtb() {
local dts_file="$dt_dir/$dts_base.dts"
local dtb_file="$dt_dir/$dts_base.dtb"
mkdir -p "$dt_dir"
sed -e "s/INITRAMFS_BEGIN/$INITRAMFS_BEGIN_HEX/g" \
sed -e "s/INITRAMFS_BEGIN_HI/$INITRAMFS_BEGIN_HI/g" \
-e "s/INITRAMFS_BEGIN_LO/$INITRAMFS_BEGIN_LO/g" \
-e "s/INITRAMFS_END_HI/$INITRAMFS_END_HI/g" \
-e "s/INITRAMFS_END_LO/$INITRAMFS_END_LO/g" \
-e "s/INITRAMFS_BEGIN/$INITRAMFS_BEGIN_HEX/g" \
-e "s/INITRAMFS_END/$INITRAMFS_END_HEX/g" \
"$dts_template" > "$dts_file"
"$DTC" -I dts -O dtb -o "$dtb_file" "$dts_file"
Expand Down
Loading