From nobody Sat Apr 27 15:24:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550181982890957.980067142278; Thu, 14 Feb 2019 14:06:22 -0800 (PST) Received: from localhost ([127.0.0.1]:55875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guP95-0001Yx-8I for importer@patchew.org; Thu, 14 Feb 2019 17:06:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guP7x-0000vu-5R for qemu-devel@nongnu.org; Thu, 14 Feb 2019 17:05:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guP7w-0005Xa-6F for qemu-devel@nongnu.org; Thu, 14 Feb 2019 17:05:05 -0500 Received: from smtp.duncanthrax.net ([2001:470:70c5:1111::170]:43734) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guP7v-0005VQ-Q6 for qemu-devel@nongnu.org; Thu, 14 Feb 2019 17:05:04 -0500 Received: from hsi-kbw-109-193-150-175.hsi7.kabel-badenwuerttemberg.de ([109.193.150.175] helo=t470p.stackframe.org) by smtp.eurescom.eu with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1guP7q-0006NN-SZ; Thu, 14 Feb 2019 23:04:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=duncanthrax.net; s=dkim; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From; bh=TwrKZGLUHGSlPSZqOmDNNp/ZecMC2jWYYb+4YUGaOKM=; b=EicBirh6tBcofK13B/SHulhjrE BXJEp3DeeBPmJ2zCB1t+hqZRFWYGcluEkPcEVOTRu4SjcxVuRRRPU7VdiDLB3p9b6zWBO9gmVxisX BmzBxGvk0dwb5DuwV56e2v8hbho9yai4g5CphiekPpk0/iXdve2T+7qCR4btvaqLM1gg=; From: Sven Schnelle To: qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 23:04:53 +0100 Message-Id: <20190214220453.15858-1-svens@stackframe.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:470:70c5:1111::170 Subject: [Qemu-devel] [PATCH] lsi: implement basic SBCL functionality X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Paolo Bonzini , Sven Schnelle Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" HP-UX checks this register after sending data to the target. If there's no = valid information present, it assumes the client disconnected because the kernel = sent to much data. Implement at least some of the SBCL functionality that is pos= sible without having a real SCSI bus. Signed-off-by: Sven Schnelle --- hw/scsi/lsi53c895a.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 89def1421f..b12be02bf1 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -160,6 +160,11 @@ static const char *names[] =3D { #define LSI_CCNTL1_DDAC 0x08 #define LSI_CCNTL1_ZMOD 0x80 =20 +#define LSI_SBCL_ATN 0x08 +#define LSI_SBCL_BSY 0x20 +#define LSI_SBCL_ACK 0x40 +#define LSI_SBCL_REQ 0x80 + /* Enable Response to Reselection */ #define LSI_SCID_RRE 0x60 =20 @@ -258,6 +263,7 @@ typedef struct { uint8_t sdid; uint8_t ssid; uint8_t sfbr; + uint8_t sbcl; uint8_t stest1; uint8_t stest2; uint8_t stest3; @@ -356,6 +362,7 @@ static void lsi_soft_reset(LSIState *s) s->socl =3D 0; s->sdid =3D 0; s->ssid =3D 0; + s->sbcl =3D 0; s->stest1 =3D 0; s->stest2 =3D 0; s->stest3 =3D 0; @@ -530,6 +537,8 @@ static void lsi_script_dma_interrupt(LSIState *s, int s= tat) =20 static inline void lsi_set_phase(LSIState *s, int phase) { + s->sbcl &=3D ~PHASE_MASK; + s->sbcl |=3D phase | LSI_SBCL_REQ; s->sstat1 =3D (s->sstat1 & ~PHASE_MASK) | phase; } =20 @@ -567,6 +576,7 @@ static void lsi_disconnect(LSIState *s) { s->scntl1 &=3D ~LSI_SCNTL1_CON; s->sstat1 &=3D ~PHASE_MASK; + s->sbcl =3D 0; } =20 static void lsi_bad_selection(LSIState *s, uint32_t id) @@ -1265,7 +1275,9 @@ again: s->scntl1 |=3D LSI_SCNTL1_CON; if (insn & (1 << 3)) { s->socl |=3D LSI_SOCL_ATN; + s->sbcl |=3D LSI_SBCL_ATN; } + s->sbcl |=3D LSI_SBCL_BSY; lsi_set_phase(s, PHASE_MO); break; case 1: /* Disconnect */ @@ -1297,8 +1309,14 @@ again: insn & (1 << 10) ? " CC" : ""); if (insn & (1 << 3)) { s->socl |=3D LSI_SOCL_ATN; + s->sbcl |=3D LSI_SBCL_ATN; lsi_set_phase(s, PHASE_MO); } + + if (insn & (1 << 6)) { + s->sbcl |=3D LSI_SBCL_ACK; + } + if (insn & (1 << 9)) { qemu_log_mask(LOG_UNIMP, "lsi_scsi: Target mode not implemented\n"); @@ -1314,7 +1332,13 @@ again: insn & (1 << 10) ? " CC" : ""); if (insn & (1 << 3)) { s->socl &=3D ~LSI_SOCL_ATN; + s->sbcl &=3D ~LSI_SBCL_ATN; } + + if (insn & (1 << 6)) { + s->sbcl &=3D ~LSI_SBCL_ACK; + } + if (insn & (1 << 10)) s->carry =3D 0; break; @@ -1591,9 +1615,7 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset) ret =3D s->ssid; break; case 0xb: /* SBCL */ - /* ??? This is not correct. However it's (hopefully) only - used for diagnostics, so should be ok. */ - ret =3D 0; + ret =3D s->sbcl; break; case 0xc: /* DSTAT */ ret =3D s->dstat | LSI_DSTAT_DFE; @@ -2202,6 +2224,7 @@ static const VMStateDescription vmstate_lsi_scsi =3D { VMSTATE_UINT8(stime0, LSIState), VMSTATE_UINT8(respid0, LSIState), VMSTATE_UINT8(respid1, LSIState), + VMSTATE_UINT8(sbcl, LSIState), VMSTATE_UINT32(mmrs, LSIState), VMSTATE_UINT32(mmws, LSIState), VMSTATE_UINT32(sfs, LSIState), --=20 2.20.1