[OpenBIOS] [PATCH 3/5] SPARC64: add power device under the ebus device

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Jan 15 22:04:34 CET 2018


Due to limitations in the current QEMU PCI IO BAR layout, it isn't possible
to use the offset of 0x7240000 as used in a real Ultra 5.

For the moment locate the power device at offset 0x7240 as a reminder of its
true origin.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/pci.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/pci.c b/drivers/pci.c
index 672dcd0..ce329ce 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -1044,6 +1044,40 @@ int ebus_config_cb(const pci_config_t *config)
     fword("device-name");
     fword("finish-device");
 
+    /* Build power node */
+    fword("new-device");
+    PUSH(0x14);
+    fword("encode-int");
+    PUSH(0x7240);
+    fword("encode-int");
+    fword("encode+");
+    PUSH(0x4);
+    fword("encode-int");
+    fword("encode+");
+    push_str("reg");
+    fword("property");
+
+    PUSH(0);
+    PUSH(0);
+    push_str("button");
+    fword("property");
+
+    PUSH(1);
+    fword("encode-int");
+    push_str("interrupts");
+    fword("property");
+
+    /* Map the power registers so we can use them */
+    virt = ofmem_map_io(io_phys_base + 0x7240, 0x4);
+    PUSH(virt);
+    fword("encode-int");
+    push_str("address");
+    fword("property");
+
+    push_str("power");
+    fword("device-name");
+    fword("finish-device");
+
 #ifdef CONFIG_DRIVER_FLOPPY
     ob_floppy_init(config->path, "fdthree", 0x3f0ULL, 0);
 #endif
-- 
2.11.0




More information about the OpenBIOS mailing list