Merge "Stub out the pinmux address range so that OT bootrom can boot."
diff --git a/platforms/secure.repl b/platforms/secure.repl
index 8ed36f2..cf7957a 100644
--- a/platforms/secure.repl
+++ b/platforms/secure.repl
@@ -104,7 +104,16 @@
 // RSTMGR_AON        [‘h4041_0000 - ‘h4041_0FFF)   4KB Reset Manger Control
 // CLKMGR_AON        [‘h4042_0000 - ‘h4042_0FFF)   4KB Clock Manger Control
 // ADCMGR_AON        [‘h4044_0000 - ‘h4044_0FFF)   4KB ADC
+
+// The OpenTitan bootrom will error out if pinmux registers are locked,
+// so we work around that by stubbing out the pinmux range to return
+// 0xFFFFFFFF which means "unlocked"
+
 // PINMUX            [‘h4046_0000 - ‘h4046_0FFF)   4KB PINMUX
+pinmux_stub : AddressRangeStub @ sysbus 0x40460000
+    size: 0x1000
+    value: 0xFFFFFFFF
+
 // AON_TIMER         [‘h4047_0000 - ‘h4047_0FFF)   4KB AON_TIMER
 // AST               [‘h4048_0000 - ‘h4048_0FFF)   4KB AST
 // SENSOR_CTRL       [‘h4049_0000 - ‘h4049_0FFF)   4KB Sensor Ctrl  (Details need to be added for mic/cam interface)
diff --git a/shodan.resc b/shodan.resc
index e22df1d..d42e8b1 100644
--- a/shodan.resc
+++ b/shodan.resc
@@ -13,6 +13,7 @@
 include @sim/config/shodan_infrastructure/OpenTitan2_UART.cs
 include @sim/config/shodan_infrastructure/Mailbox.cs
 include @sim/renode/tools/sel4_extensions/seL4Extensions.cs
+include @sim/config/shodan_infrastructure/AddressRangeStub.cs
 
 machine LoadPlatformDescription @sim/config/platforms/shodan.repl
 
diff --git a/shodan_infrastructure/AddressRangeStub.cs b/shodan_infrastructure/AddressRangeStub.cs
new file mode 100644
index 0000000..db112f1
--- /dev/null
+++ b/shodan_infrastructure/AddressRangeStub.cs
@@ -0,0 +1,35 @@
+using Antmicro.Renode.Core;
+using Antmicro.Renode.Logging;
+using Antmicro.Renode.Peripherals.Bus;
+
+// All this stub does is mark an address range as always returning a fixed
+// value.
+
+namespace Antmicro.Renode.Peripherals
+{
+    public class AddressRangeStub : IDoubleWordPeripheral, IKnownSize
+    {
+        public AddressRangeStub(long size, uint value)
+        {
+            this.size = size;
+            this.value = value;
+        }
+
+        public void Reset()
+        {
+        }
+
+        public uint ReadDoubleWord(long offset)
+        {
+            return this.value;
+        }
+
+        public void WriteDoubleWord(long offset, uint value)
+        {
+        }
+        public long Size { get { return this.size; } }
+
+        long size;
+        uint value;
+    }
+}