From: Paolo Bonzini <pbonzini@redhat.com>
To: Sven Schnelle <svens@stackframe.org>, qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>
Subject: Re: [Qemu-devel] [PATCH v2] lsi: implement basic SBCL functionality
Date: Mon, 4 Mar 2019 11:07:20 +0100 [thread overview]
Message-ID: <93c05ffc-0771-ff4c-d989-318e1777b82d@redhat.com> (raw)
In-Reply-To: <20190304082258.GA4629@t470p.stackframe.org>
On 04/03/19 09:22, Sven Schnelle wrote:
> Hi All,
>
> is this patch going to be accepted?
Yes, I have queued it now.
Paolo
> Thanks
> Sven
>
> On Fri, Feb 15, 2019 at 08:40:21PM +0100, Sven Schnelle wrote:
>> 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 possible
>> without having a real SCSI bus.
>>
>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>> ---
>> hw/scsi/lsi53c895a.c | 31 +++++++++++++++++++++++++++----
>> 1 file changed, 27 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
>> index 89def1421f..8ba07f8756 100644
>> --- a/hw/scsi/lsi53c895a.c
>> +++ b/hw/scsi/lsi53c895a.c
>> @@ -160,6 +160,11 @@ static const char *names[] = {
>> #define LSI_CCNTL1_DDAC 0x08
>> #define LSI_CCNTL1_ZMOD 0x80
>>
>> +#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
>>
>> @@ -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 = 0;
>> s->sdid = 0;
>> s->ssid = 0;
>> + s->sbcl = 0;
>> s->stest1 = 0;
>> s->stest2 = 0;
>> s->stest3 = 0;
>> @@ -530,6 +537,8 @@ static void lsi_script_dma_interrupt(LSIState *s, int stat)
>>
>> static inline void lsi_set_phase(LSIState *s, int phase)
>> {
>> + s->sbcl &= ~PHASE_MASK;
>> + s->sbcl |= phase | LSI_SBCL_REQ;
>> s->sstat1 = (s->sstat1 & ~PHASE_MASK) | phase;
>> }
>>
>> @@ -567,6 +576,7 @@ static void lsi_disconnect(LSIState *s)
>> {
>> s->scntl1 &= ~LSI_SCNTL1_CON;
>> s->sstat1 &= ~PHASE_MASK;
>> + s->sbcl = 0;
>> }
>>
>> static void lsi_bad_selection(LSIState *s, uint32_t id)
>> @@ -1265,7 +1275,9 @@ again:
>> s->scntl1 |= LSI_SCNTL1_CON;
>> if (insn & (1 << 3)) {
>> s->socl |= LSI_SOCL_ATN;
>> + s->sbcl |= LSI_SBCL_ATN;
>> }
>> + s->sbcl |= 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 |= LSI_SOCL_ATN;
>> + s->sbcl |= LSI_SBCL_ATN;
>> lsi_set_phase(s, PHASE_MO);
>> }
>> +
>> + if (insn & (1 << 6)) {
>> + s->sbcl |= 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 &= ~LSI_SOCL_ATN;
>> + s->sbcl &= ~LSI_SBCL_ATN;
>> }
>> +
>> + if (insn & (1 << 6)) {
>> + s->sbcl &= ~LSI_SBCL_ACK;
>> + }
>> +
>> if (insn & (1 << 10))
>> s->carry = 0;
>> break;
>> @@ -1591,9 +1615,7 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)
>> ret = s->ssid;
>> break;
>> case 0xb: /* SBCL */
>> - /* ??? This is not correct. However it's (hopefully) only
>> - used for diagnostics, so should be ok. */
>> - ret = 0;
>> + ret = s->sbcl;
>> break;
>> case 0xc: /* DSTAT */
>> ret = s->dstat | LSI_DSTAT_DFE;
>> @@ -2143,7 +2165,7 @@ static int lsi_post_load(void *opaque, int version_id)
>>
>> static const VMStateDescription vmstate_lsi_scsi = {
>> .name = "lsiscsi",
>> - .version_id = 0,
>> + .version_id = 1,
>> .minimum_version_id = 0,
>> .pre_save = lsi_pre_save,
>> .post_load = lsi_post_load,
>> @@ -2202,6 +2224,7 @@ static const VMStateDescription vmstate_lsi_scsi = {
>> VMSTATE_UINT8(stime0, LSIState),
>> VMSTATE_UINT8(respid0, LSIState),
>> VMSTATE_UINT8(respid1, LSIState),
>> + VMSTATE_UINT8_V(sbcl, LSIState, 1),
>> VMSTATE_UINT32(mmrs, LSIState),
>> VMSTATE_UINT32(mmws, LSIState),
>> VMSTATE_UINT32(sfs, LSIState),
>> --
>> 2.20.1
>>
>>
next prev parent reply other threads:[~2019-03-04 10:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 22:04 [Qemu-devel] [PATCH] lsi: implement basic SBCL functionality Sven Schnelle
2019-02-15 9:36 ` Paolo Bonzini
2019-02-15 19:36 ` Sven Schnelle
2019-02-15 19:40 ` [Qemu-devel] [PATCH v2] " Sven Schnelle
2019-03-04 8:22 ` Sven Schnelle
2019-03-04 10:07 ` Paolo Bonzini [this message]
2019-03-04 10:19 ` [Qemu-devel] [PATCH] " Peter Maydell
2019-03-04 10:50 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93c05ffc-0771-ff4c-d989-318e1777b82d@redhat.com \
--to=pbonzini@redhat.com \
--cc=fam@euphon.net \
--cc=qemu-devel@nongnu.org \
--cc=svens@stackframe.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).