[OpenBIOS] sbus slot probing

Bob Breuer breuerr at mc.net
Mon Aug 15 17:01:51 CEST 2011


Here's a preliminary patch for sbus slot probing.

This can be used for the preliminary dbri device patch, see my dbri-pre1
branch at github: https://github.com/breuerr/qemu/tree/dbri-pre1
That branch also has a rewritten fcode rom to avoid the use of the
obsolete intr forth word.  Use the SS-20 machine to get the dbri device.

Todo:
  non-faulting reads so that an empty slot can be probed
  extend to probe other (all?) slots as well
  only add the slot E range for SS-20, but not SS-10

Is there any existing code for sparc32 which does a non-faulting read?  It
looks like even cpeek doesn't try to catch any faults.

Bob

Index: drivers/sbus.c
===================================================================
--- drivers/sbus.c	(revision 1046)
+++ drivers/sbus.c	(working copy)
@@ -451,11 +451,36 @@
 static void
 sbus_probe_slot_ss10(unsigned int slot, uint64_t base)
 {
+    ucell fcode;
+    unsigned char start;
+
     // OpenBIOS and Qemu don't know how to do Sbus probing
     switch(slot) {
     case 2: // SUNW,tcx
         ob_tcx_init(slot, "/iommu/sbus/SUNW,tcx");
         break;
+    case 0xe: // dbri
+        fcode = ofmem_map_io(base, 0x1000);
+        // TODO: non-faulting read
+        start = *(unsigned char*)fcode;
+        if (start == 0xfd || start == 0xf1) {
+            push_str("/iommu/sbus");
+            fword("select-dev");
+            fword("new-device");
+            push_str(NULL);
+            PUSH(0);    // offset
+            PUSH(slot); // space
+            push_str("encode-unit");
+            fword("$call-parent");
+            fword("set-args");
+            PUSH(fcode);
+            PUSH(1);
+            fword("byte-load");
+            fword("finish-device");
+            fword("unselect-dev");
+        }
+        ofmem_unmap(fcode, 0x1000);
+        break;
     case 0xf: // le, esp, bpp, power-management
         ob_macio_init(slot, base, 0);
         // Power management (APC) XXX should not exist
@@ -534,6 +559,7 @@
     { 1, 0, 0xe10000000ULL, 0x10000000,},
     { 2, 0, 0xe20000000ULL, 0x10000000,},
     { 3, 0, 0xe30000000ULL, 0x10000000,},
+    [0xe] = { 0xe, 0, 0xee0000000ULL, 0x10000000,},
     [0xf] = { 0xf, 0, 0xef0000000ULL, 0x10000000,},
 };





More information about the OpenBIOS mailing list