From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Helge Deller" <deller@gmx.de>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Fam Zheng" <fam@euphon.net>,
"Keith Monahan" <keith@techtravels.org>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [RFC PATCH-for-11.2? v4 06/14] hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h
Date: Fri, 20 Nov 2026 18:12:26 +0100 [thread overview]
Message-ID: <20261120171235.61325-7-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20261120171235.61325-1-philmd@oss.qualcomm.com>
From: Keith Monahan <keith@techtravels.org>
Move common defines and structures of the lsi53c895a driver to
lsi_scsi.h so that the 53c710 driver can share them.
Pure code movement, no functional change: nothing is renamed and the
lsi53c895a device is unchanged.
Licence: the moved code comes from lsi53c895a.c, which is licensed under
the LGPL (Copyright (c) 2006 CodeSourcery, written by Paul Brook), so
the new header keeps that licence (SPDX LGPL-2.1-or-later) rather than
the preferred GPL-2.0-or-later; it is not relicensed.
Suggested-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
AI-used-for: Patch series decomposition (commit splitting and ordering)
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
MAINTAINERS | 1 +
hw/scsi/lsi_scsi.h | 104 +++++++++++++++++++++++++++++++++++++++++++
hw/scsi/lsi53c895a.c | 79 +-------------------------------
3 files changed, 106 insertions(+), 78 deletions(-)
create mode 100644 hw/scsi/lsi_scsi.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a9b4d34a0fc..752519a7f82f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2431,6 +2431,7 @@ R: Fam Zheng <fam@euphon.net>
S: Supported
F: include/hw/scsi/*
F: hw/scsi/*
+F: hw/scsi/lsi_scsi.h
F: tests/qtest/virtio-scsi-test.c
F: tests/qtest/fuzz-virtio-scsi-test.c
F: tests/qtest/am53c974-test.c
diff --git a/hw/scsi/lsi_scsi.h b/hw/scsi/lsi_scsi.h
new file mode 100644
index 000000000000..de0941dd23a7
--- /dev/null
+++ b/hw/scsi/lsi_scsi.h
@@ -0,0 +1,104 @@
+/*
+ * QEMU LSI53C895A SCSI Host Bus Adapter emulation
+ * Definitions shared with other NCR/LSI SCRIPTS based controllers
+ *
+ * Copyright (c) 2006 CodeSourcery.
+ * Written by Paul Brook
+ *
+ * This code is licensed under the LGPL.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef HW_SCSI_LSI_SCSI_H
+#define HW_SCSI_LSI_SCSI_H
+
+#include "qemu/queue.h"
+#include "hw/scsi/scsi.h"
+
+#define LSI_SCNTL0_TRG 0x01
+#define LSI_SCNTL0_AAP 0x02
+#define LSI_SCNTL0_EPC 0x08
+#define LSI_SCNTL0_WATN 0x10
+#define LSI_SCNTL0_START 0x20
+
+#define LSI_SCNTL1_AESP 0x04
+#define LSI_SCNTL1_RST 0x08
+#define LSI_SCNTL1_CON 0x10
+#define LSI_SCNTL1_ADB 0x40
+#define LSI_SCNTL1_EXC 0x80
+
+#define LSI_ISTAT0_DIP 0x01
+#define LSI_ISTAT0_SIP 0x02
+#define LSI_ISTAT0_CON 0x08
+#define LSI_ISTAT0_SIGP 0x20
+#define LSI_ISTAT0_SRST 0x40
+#define LSI_ISTAT0_ABRT 0x80
+
+#define LSI_SOCL_ATN 0x08
+
+#define LSI_DSTAT_IID 0x01
+#define LSI_DSTAT_SIR 0x04
+#define LSI_DSTAT_SSI 0x08
+#define LSI_DSTAT_ABRT 0x10
+#define LSI_DSTAT_BF 0x20
+#define LSI_DSTAT_DFE 0x80
+
+#define LSI_DCNTL_COM 0x01
+#define LSI_DCNTL_STD 0x04
+#define LSI_DCNTL_SSM 0x10
+
+#define LSI_DMODE_MAN 0x01
+
+#define LSI_CTEST2_DACK 0x01
+#define LSI_CTEST2_SIGP 0x40
+
+#define LSI_SBCL_ATN 0x08
+#define LSI_SBCL_BSY 0x20
+#define LSI_SBCL_ACK 0x40
+#define LSI_SBCL_REQ 0x80
+
+#define PHASE_DO 0
+#define PHASE_DI 1
+#define PHASE_CMD 2
+#define PHASE_ST 3
+#define PHASE_MO 6
+#define PHASE_MI 7
+#define PHASE_MASK 7
+
+/* Maximum length of MSG IN data. */
+#define LSI_MAX_MSGIN_LEN 8
+
+/* Flag set if this is a tagged command. */
+#define LSI_TAG_VALID (1 << 16)
+
+/* Maximum instructions to process. */
+#define LSI_MAX_INSN 500
+
+typedef struct lsi_request {
+ SCSIRequest *req;
+ uint32_t tag;
+ uint32_t dma_len;
+ uint8_t *dma_buf;
+ uint32_t pending;
+ int out;
+ bool orphan;
+ QTAILQ_ENTRY(lsi_request) next;
+} lsi_request;
+
+enum {
+ LSI_NOWAIT, /* SCRIPTS are running or stopped */
+ LSI_WAIT_RESELECT, /* Wait Reselect instruction has been issued */
+ LSI_DMA_SCRIPTS, /* processing DMA from lsi_execute_script */
+ LSI_DMA_IN_PROGRESS, /* DMA operation is in progress */
+ LSI_WAIT_SCRIPTS, /* SCRIPTS stopped because of instruction count limit */
+};
+
+enum {
+ LSI_MSG_ACTION_COMMAND = 0,
+ LSI_MSG_ACTION_DISCONNECT = 1,
+ LSI_MSG_ACTION_DOUT = 2,
+ LSI_MSG_ACTION_DIN = 3,
+};
+
+#endif
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 1b7f02fc7c91..2a7c6e9c8dc9 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -18,6 +18,7 @@
#include "hw/core/irq.h"
#include "hw/pci/pci_device.h"
#include "hw/scsi/scsi.h"
+#include "lsi_scsi.h"
#include "migration/vmstate.h"
#include "system/dma.h"
#include "qemu/log.h"
@@ -42,20 +43,9 @@ static const char *names[] = {
#define LSI_MAX_DEVS 7
-#define LSI_SCNTL0_TRG 0x01
-#define LSI_SCNTL0_AAP 0x02
-#define LSI_SCNTL0_EPC 0x08
-#define LSI_SCNTL0_WATN 0x10
-#define LSI_SCNTL0_START 0x20
-
#define LSI_SCNTL1_SST 0x01
#define LSI_SCNTL1_IARB 0x02
-#define LSI_SCNTL1_AESP 0x04
-#define LSI_SCNTL1_RST 0x08
-#define LSI_SCNTL1_CON 0x10
#define LSI_SCNTL1_DHP 0x20
-#define LSI_SCNTL1_ADB 0x40
-#define LSI_SCNTL1_EXC 0x80
#define LSI_SCNTL2_WSR 0x01
#define LSI_SCNTL2_VUE0 0x02
@@ -66,14 +56,8 @@ static const char *names[] = {
#define LSI_SCNTL2_CHM 0x40
#define LSI_SCNTL2_SDU 0x80
-#define LSI_ISTAT0_DIP 0x01
-#define LSI_ISTAT0_SIP 0x02
#define LSI_ISTAT0_INTF 0x04
-#define LSI_ISTAT0_CON 0x08
#define LSI_ISTAT0_SEM 0x10
-#define LSI_ISTAT0_SIGP 0x20
-#define LSI_ISTAT0_SRST 0x40
-#define LSI_ISTAT0_ABRT 0x80
#define LSI_ISTAT1_SI 0x01
#define LSI_ISTAT1_SRUN 0x02
@@ -105,43 +89,30 @@ static const char *names[] = {
#define LSI_SOCL_IO 0x01
#define LSI_SOCL_CD 0x02
#define LSI_SOCL_MSG 0x04
-#define LSI_SOCL_ATN 0x08
#define LSI_SOCL_SEL 0x10
#define LSI_SOCL_BSY 0x20
#define LSI_SOCL_ACK 0x40
#define LSI_SOCL_REQ 0x80
-#define LSI_DSTAT_IID 0x01
-#define LSI_DSTAT_SIR 0x04
-#define LSI_DSTAT_SSI 0x08
-#define LSI_DSTAT_ABRT 0x10
-#define LSI_DSTAT_BF 0x20
#define LSI_DSTAT_MDPE 0x40
-#define LSI_DSTAT_DFE 0x80
-#define LSI_DCNTL_COM 0x01
#define LSI_DCNTL_IRQD 0x02
-#define LSI_DCNTL_STD 0x04
#define LSI_DCNTL_IRQM 0x08
-#define LSI_DCNTL_SSM 0x10
#define LSI_DCNTL_PFEN 0x20
#define LSI_DCNTL_PFF 0x40
#define LSI_DCNTL_CLSE 0x80
-#define LSI_DMODE_MAN 0x01
#define LSI_DMODE_BOF 0x02
#define LSI_DMODE_ERMP 0x04
#define LSI_DMODE_ERL 0x08
#define LSI_DMODE_DIOM 0x10
#define LSI_DMODE_SIOM 0x20
-#define LSI_CTEST2_DACK 0x01
#define LSI_CTEST2_DREQ 0x02
#define LSI_CTEST2_TEOP 0x04
#define LSI_CTEST2_PCICIE 0x08
#define LSI_CTEST2_CM 0x10
#define LSI_CTEST2_CIO 0x20
-#define LSI_CTEST2_SIGP 0x40
#define LSI_CTEST2_DDIR 0x80
#define LSI_CTEST5_BL2 0x04
@@ -163,59 +134,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
#define LSI_CCNTL1_40BIT (LSI_CCNTL1_EN64TIBMV|LSI_CCNTL1_64TIMOD)
-#define PHASE_DO 0
-#define PHASE_DI 1
-#define PHASE_CMD 2
-#define PHASE_ST 3
-#define PHASE_MO 6
-#define PHASE_MI 7
-#define PHASE_MASK 7
-
-/* Maximum length of MSG IN data. */
-#define LSI_MAX_MSGIN_LEN 8
-
-/* Flag set if this is a tagged command. */
-#define LSI_TAG_VALID (1 << 16)
-
-/* Maximum instructions to process. */
-#define LSI_MAX_INSN 500
-
-typedef struct lsi_request {
- SCSIRequest *req;
- uint32_t tag;
- uint32_t dma_len;
- uint8_t *dma_buf;
- uint32_t pending;
- int out;
- bool orphan;
- QTAILQ_ENTRY(lsi_request) next;
-} lsi_request;
-
-enum {
- LSI_NOWAIT, /* SCRIPTS are running or stopped */
- LSI_WAIT_RESELECT, /* Wait Reselect instruction has been issued */
- LSI_DMA_SCRIPTS, /* processing DMA from lsi_execute_script */
- LSI_DMA_IN_PROGRESS, /* DMA operation is in progress */
- LSI_WAIT_SCRIPTS, /* SCRIPTS stopped because of instruction count limit */
-};
-
-enum {
- LSI_MSG_ACTION_COMMAND = 0,
- LSI_MSG_ACTION_DISCONNECT = 1,
- LSI_MSG_ACTION_DOUT = 2,
- LSI_MSG_ACTION_DIN = 3,
-};
-
struct LSIState {
/*< private >*/
PCIDevice parent_obj;
--
2.55.0
next prev parent reply other threads:[~2026-11-20 17:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 17:12 [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 01/14] hw/scsi/ncr53c710: Cancel the in-flight request on soft reset Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 02/14] hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase move Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 03/14] hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the 715 Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 04/14] hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7 Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 05/14] hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST reset Philippe Mathieu-Daudé
2026-11-20 17:12 ` Philippe Mathieu-Daudé [this message]
2026-11-20 22:10 ` [RFC PATCH-for-11.2? v4 06/14] hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2??? v4 07/14] hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine Philippe Mathieu-Daudé
2026-11-20 22:13 ` BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 08/14] hw/scsi/ncr53c710: Deliver completions from bottom halves Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 09/14] hw/scsi/ncr53c710: Drain asynchronous transfers in the register write Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 10/14] hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for HP-UX Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 11/14] hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on soft reset Philippe Mathieu-Daudé
2026-11-20 22:17 ` BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 12/14] hw/scsi/lasi_ncr710: Map the full LASI SCSI module page Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 13/14] hw/scsi/ncr53c710: Document the SIGP latch deviation Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 14/14] hw/scsi/ncr53c710: Bump the migration version Philippe Mathieu-Daudé
2026-11-20 22:21 ` BALATON Zoltan
2026-11-20 17:20 ` [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite Philippe Mathieu-Daudé
2026-11-20 22:09 ` BALATON Zoltan
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=20261120171235.61325-7-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=balaton@eik.bme.hu \
--cc=deller@gmx.de \
--cc=fam@euphon.net \
--cc=keith@techtravels.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.