Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/52144 )

 (

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one. )Change subject: dev: Separate generateDeviceTree into a RiscvUart8250 SimObject.
......................................................................

dev: Separate generateDeviceTree into a RiscvUart8250 SimObject.

The only difference between the RiscvUart8250 and the regular Uart8250
is that the Riscv version knows how to generate a device tree node
appropriate for use in a Riscv system. This lets us drop the TARGET_ISA
check from that method, since that should be called iff the target
system is Riscv.

Also update the HiFive platform to use the RiscvUart8250 so that it can
continue to generate device trees successfully.

Change-Id: I306596efffed5e5eed337d3db492d2782ebfaa8d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52144
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/dev/riscv/HiFive.py
M src/dev/serial/Uart.py
2 files changed, 37 insertions(+), 15 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/dev/riscv/HiFive.py b/src/dev/riscv/HiFive.py
index d945590..2923b88 100755
--- a/src/dev/riscv/HiFive.py
+++ b/src/dev/riscv/HiFive.py
@@ -38,7 +38,7 @@
 from m5.objects.Clint import Clint
 from m5.objects.Plic import Plic
 from m5.objects.RTC import RiscvRTC
-from m5.objects.Uart import Uart8250
+from m5.objects.Uart import RiscvUart8250
 from m5.objects.Terminal import Terminal
 from m5.params import *
 from m5.proxy import *
@@ -106,7 +106,7 @@
     plic = Param.Plic(Plic(pio_addr=0xc000000), "PLIC")

     # Uart
-    uart = Uart8250(pio_addr=0x10000000)
+    uart = RiscvUart8250(pio_addr=0x10000000)
     # Int source ID to redirect console interrupts to
     # Set to 0 if using a pci interrupt for Uart instead
     uart_int_id = Param.Int(0xa, "PLIC Uart interrupt ID")
diff --git a/src/dev/serial/Uart.py b/src/dev/serial/Uart.py
index aecdfe3..aea6fa6 100644
--- a/src/dev/serial/Uart.py
+++ b/src/dev/serial/Uart.py
@@ -67,17 +67,17 @@
     cxx_class = 'gem5::Uart8250'
     pio_size = Param.Addr(0x8, "Size of address range")

+class RiscvUart8250(Uart8250):
     def generateDeviceTree(self, state):
-        if buildEnv['TARGET_ISA'] == "riscv":
-            node = self.generateBasicPioDeviceNode(
-                state, "uart", self.pio_addr, self.pio_size)
-            platform = self.platform.unproxy(self)
-            plic = platform.plic
-            node.append(
-                FdtPropertyWords("interrupts", [platform.uart_int_id]))
-            node.append(
-                FdtPropertyWords("clock-frequency", [0x384000]))
-            node.append(
-                FdtPropertyWords("interrupt-parent", state.phandle(plic)))
-            node.appendCompatible(["ns8250"])
-            yield node
+        node = self.generateBasicPioDeviceNode(
+            state, "uart", self.pio_addr, self.pio_size)
+        platform = self.platform.unproxy(self)
+        plic = platform.plic
+        node.append(
+            FdtPropertyWords("interrupts", [platform.uart_int_id]))
+        node.append(
+            FdtPropertyWords("clock-frequency", [0x384000]))
+        node.append(
+            FdtPropertyWords("interrupt-parent", state.phandle(plic)))
+        node.appendCompatible(["ns8250"])
+        yield node

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52144
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I306596efffed5e5eed337d3db492d2782ebfaa8d
Gerrit-Change-Number: 52144
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to