Skip to contentSkip to conversation

esp: Handle CMD_BUSRESET by resetting the SCSI bus

PATCH New John Millikin 2 participants 3 messages Aug 17, 2022 – Aug 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 esp: Handle CMD_BUSRESET by resetting the SCSI bus

Per investigation on the linked ticket, SunOS issues a SCSI bus reset to the ESP as part of its boot sequence. If this ESP command doesn't cause devices to assert sense flag UNIT ATTENTION, SunOS will consider the CD-ROM device to be non-compliant with Common Command Set (CCS). In this condition, the SunOS installer's early userspace doesn't set the installation source location to sr0 and the miniroot copy fails.

---
 hw/scsi/esp.c | 6 ++++++
 1 file changed, 6 insertions(+)

With this patch in place, booting the SunOS installation contains the new output line:

sr0 at esp0 target 6 lun 0

and the early userspace successfully writes the CD-ROM's device name to the ramdisk, where the installer script expects it:

  # dd if=/dev/rd0a of=/tmp.bin bs=1 count=3
  3+0 records in
  3+0 records out
  # cat /tmp.bin; echo ''
  sr0
  #
hw/scsi/esp.c +6 -0
index 2d3c649567..c799c19bd4 100644
@@ -939,6 +939,11 @@ static void esp_soft_reset(ESPState *s)
     esp_hard_reset(s);
 }
 
+static void esp_bus_reset(ESPState *s)
+{
+    qbus_reset_all(BUS(&s->bus));
+}
+
 static void parent_esp_reset(ESPState *s, int irq, int level)
 {
     if (level) {
@@ -1067,6 +1072,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
             break;
         case CMD_BUSRESET:
             trace_esp_mem_writeb_cmd_bus_reset(val);
+            esp_bus_reset(s);
             if (!(s->wregs[ESP_CFG1] & CFG1_RESREPT)) {
                 s->rregs[ESP_RINTR] |= INTR_RST;
                 esp_raise_irq(s);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 esp: Handle CMD_BUSRESET by resetting the SCSI bus

Per investigation on the linked ticket, SunOS issues a SCSI bus reset to the ESP as part of its boot sequence. If this ESP command doesn't cause devices to assert sense flag UNIT ATTENTION, SunOS will consider the CD-ROM device to be non-compliant with Common Command Set (CCS). In this condition, the SunOS installer's early userspace doesn't set the installation source location to sr0 and the miniroot copy fails.

---
 hw/scsi/esp.c | 6 ++++++
 1 file changed, 6 insertions(+)

(re-sending because I forgot the Signed-off-by; sorry)

hw/scsi/esp.c +6 -0
index 2d3c649567..c799c19bd4 100644
@@ -939,6 +939,11 @@ static void esp_soft_reset(ESPState *s)
     esp_hard_reset(s);
 }
 
+static void esp_bus_reset(ESPState *s)
+{
+    qbus_reset_all(BUS(&s->bus));
+}
+
 static void parent_esp_reset(ESPState *s, int irq, int level)
 {
     if (level) {
@@ -1067,6 +1072,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
             break;
         case CMD_BUSRESET:
             trace_esp_mem_writeb_cmd_bus_reset(val);
+            esp_bus_reset(s);
             if (!(s->wregs[ESP_CFG1] & CFG1_RESREPT)) {
                 s->rregs[ESP_RINTR] |= INTR_RST;
                 esp_raise_irq(s);
Signature · 1 line
2.25.1