qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant
@ 2013-09-13 19:50 Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 1/4] lsi: use constant name instead of its value Hervé Poussineau
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-13 19:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hervé Poussineau, Paul Brook

Hi,

This small patchset fixes a few issues I encountered while trying to
add support for the IBM RS/6000 40p.

Patches 1 to 3 are small cleanups.
Patch 4 may be more controversial, as it adds support for an older
(albeit compatible) SCSI adapter, without removing emulation of newer
features.
However, there is some precedence in QEMU codebase, where for example
Intel 486 CPU can execute cmov instructions (like cmov) or AVX
instructions on Pentium 2...

Hervé Poussineau (4):
  lsi: use constant name instead of its value
  lsi: check ssid versus sdid only if ssid is valid
  lsi: ignore write accesses to CTEST0 registers
  lsi: add 53C810 variant

 hw/scsi/lsi53c895a.c     |   25 ++++++++++++++++++++++---
 include/hw/pci/pci_ids.h |    1 +
 2 files changed, 23 insertions(+), 3 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/4] lsi: use constant name instead of its value
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
@ 2013-09-13 19:50 ` Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 2/4] lsi: check ssid versus sdid only if ssid is valid Hervé Poussineau
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-13 19:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hervé Poussineau, Paul Brook


Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/scsi/lsi53c895a.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 0c36842..ca01e86 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1521,7 +1521,7 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)
            used for diagnostics, so should be ok.  */
         return 0;
     case 0xc: /* DSTAT */
-        tmp = s->dstat | 0x80;
+        tmp = s->dstat | LSI_DSTAT_DFE;
         if ((s->istat0 & LSI_ISTAT0_INTF) == 0)
             s->dstat = 0;
         lsi_update_irq(s);
@@ -2113,7 +2113,7 @@ static int lsi_scsi_init(PCIDevice *dev)
                           "lsi-io", 256);
 
     pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io);
-    pci_register_bar(dev, 1, 0, &s->mmio_io);
+    pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio_io);
     pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io);
     QTAILQ_INIT(&s->queue);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/4] lsi: check ssid versus sdid only if ssid is valid
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 1/4] lsi: use constant name instead of its value Hervé Poussineau
@ 2013-09-13 19:50 ` Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 3/4] lsi: ignore write accesses to CTEST0 registers Hervé Poussineau
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-13 19:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hervé Poussineau, Paul Brook

This prevents some (invalid) error messages on console.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/scsi/lsi53c895a.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index ca01e86..764feaa 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1705,8 +1705,9 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
         s->sxfer = val;
         break;
     case 0x06: /* SDID */
-        if ((val & 0xf) != (s->ssid & 0xf))
+        if ((s->ssid & 0x80) && (val & 0xf) != (s->ssid & 0xf)) {
             BADF("Destination ID does not match SSID\n");
+        }
         s->sdid = val & 0xf;
         break;
     case 0x07: /* GPREG0 */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 3/4] lsi: ignore write accesses to CTEST0 registers
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 1/4] lsi: use constant name instead of its value Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 2/4] lsi: check ssid versus sdid only if ssid is valid Hervé Poussineau
@ 2013-09-13 19:50 ` Hervé Poussineau
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 4/4] lsi: add 53C810 variant Hervé Poussineau
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-13 19:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hervé Poussineau, Paul Brook

53C895A datasheet says that this register is read/write, and that the value
returned on read access is dependant of DMA FIFO state. However, nothing is
said for written value.

53C810A datasheet gives more insight about this register:
"This was a general purpose read/write register in previous SYM53C8XX
family chips. Although it is still a read/write register, Symbios reserves
the right to use these bits for future 53C8XX family enhancements."

This prevents going to the default case, which prints an error message.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/scsi/lsi53c895a.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 764feaa..a9a9eca 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1749,6 +1749,9 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
     case 0x17: /* MBOX1 */
         s->mbox1 = val;
         break;
+    case 0x18: /* CTEST0 */
+        /* nothing to do */
+        break;
     case 0x1a: /* CTEST2 */
 	s->ctest2 = val & LSI_CTEST2_PCICIE;
 	break;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 4/4] lsi: add 53C810 variant
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
                   ` (2 preceding siblings ...)
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 3/4] lsi: ignore write accesses to CTEST0 registers Hervé Poussineau
@ 2013-09-13 19:50 ` Hervé Poussineau
  2013-09-14  0:13 ` [Qemu-devel] [PATCH 0/4] lsi: small cleanup and " Peter Maydell
  2013-09-14  7:26 ` Paolo Bonzini
  5 siblings, 0 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-13 19:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Hervé Poussineau, Paul Brook

Currently, treat it exactly as a 53C895A.
53C895A is a 53C810 with more capabilities, so this should work.

However, this lets us test different code paths on Linux, which
don't use lastest features if it detect a 810, or on some OSes
which only support 810 and not 895A (like very old Windows NT
versions).

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/scsi/lsi53c895a.c     |   15 +++++++++++++++
 include/hw/pci/pci_ids.h |    1 +
 2 files changed, 16 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index a9a9eca..f048780 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -278,6 +278,7 @@ typedef struct {
     uint32_t script_ram[2048];
 } LSIState;
 
+#define TYPE_LSI53C810  "lsi53c810"
 #define TYPE_LSI53C895A "lsi53c895a"
 
 #define LSI53C895A(obj) \
@@ -2155,9 +2156,23 @@ static const TypeInfo lsi_info = {
     .class_init    = lsi_class_init,
 };
 
+static void lsi53c810_class_init(ObjectClass *klass, void *data)
+{
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->device_id = PCI_DEVICE_ID_LSI_53C810;
+}
+
+static TypeInfo lsi53c810_info = {
+    .name          = TYPE_LSI53C810,
+    .parent        = TYPE_LSI53C895A,
+    .class_init    = lsi53c810_class_init,
+};
+
 static void lsi53c895a_register_types(void)
 {
     type_register_static(&lsi_info);
+    type_register_static(&lsi53c810_info);
 }
 
 type_init(lsi53c895a_register_types)
diff --git a/include/hw/pci/pci_ids.h b/include/hw/pci/pci_ids.h
index 3ddaf6a..4c0002b 100644
--- a/include/hw/pci/pci_ids.h
+++ b/include/hw/pci/pci_ids.h
@@ -53,6 +53,7 @@
 /* Vendors and devices.  Sort key: vendor first, device next. */
 
 #define PCI_VENDOR_ID_LSI_LOGIC          0x1000
+#define PCI_DEVICE_ID_LSI_53C810         0x0001
 #define PCI_DEVICE_ID_LSI_53C895A        0x0012
 #define PCI_DEVICE_ID_LSI_SAS1078        0x0060
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
                   ` (3 preceding siblings ...)
  2013-09-13 19:50 ` [Qemu-devel] [PATCH 4/4] lsi: add 53C810 variant Hervé Poussineau
@ 2013-09-14  0:13 ` Peter Maydell
  2013-09-14  7:26 ` Paolo Bonzini
  5 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2013-09-14  0:13 UTC (permalink / raw)
  To: Hervé Poussineau; +Cc: Paolo Bonzini, QEMU Developers, Paul Brook

On 13 September 2013 20:50, Hervé Poussineau <hpoussin@reactos.org> wrote:
> However, there is some precedence in QEMU codebase, where for example
> Intel 486 CPU can execute cmov instructions (like cmov)

Poor choice of example, since that's just a bug and the
fix is hopefully going to get committed in the not too distant
future :-)

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant
  2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
                   ` (4 preceding siblings ...)
  2013-09-14  0:13 ` [Qemu-devel] [PATCH 0/4] lsi: small cleanup and " Peter Maydell
@ 2013-09-14  7:26 ` Paolo Bonzini
  2013-09-14  8:05   ` Hervé Poussineau
  5 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2013-09-14  7:26 UTC (permalink / raw)
  To: Hervé Poussineau; +Cc: qemu-devel, Paul Brook

Il 13/09/2013 21:50, Hervé Poussineau ha scritto:
> Patch 4 may be more controversial, as it adds support for an older
> (albeit compatible) SCSI adapter, without removing emulation of newer
> features.

I don't think that's a huge problem, but please add a comment about it.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant
  2013-09-14  7:26 ` Paolo Bonzini
@ 2013-09-14  8:05   ` Hervé Poussineau
  0 siblings, 0 replies; 8+ messages in thread
From: Hervé Poussineau @ 2013-09-14  8:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini a écrit :
> Il 13/09/2013 21:50, Hervé Poussineau ha scritto:
>> Patch 4 may be more controversial, as it adds support for an older
>> (albeit compatible) SCSI adapter, without removing emulation of newer
>> features.
> 
> I don't think that's a huge problem, but please add a comment about it.

OK, will respin soon with an added comment.

Hervé

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-09-14  8:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13 19:50 [Qemu-devel] [PATCH 0/4] lsi: small cleanup and add 53C810 variant Hervé Poussineau
2013-09-13 19:50 ` [Qemu-devel] [PATCH 1/4] lsi: use constant name instead of its value Hervé Poussineau
2013-09-13 19:50 ` [Qemu-devel] [PATCH 2/4] lsi: check ssid versus sdid only if ssid is valid Hervé Poussineau
2013-09-13 19:50 ` [Qemu-devel] [PATCH 3/4] lsi: ignore write accesses to CTEST0 registers Hervé Poussineau
2013-09-13 19:50 ` [Qemu-devel] [PATCH 4/4] lsi: add 53C810 variant Hervé Poussineau
2013-09-14  0:13 ` [Qemu-devel] [PATCH 0/4] lsi: small cleanup and " Peter Maydell
2013-09-14  7:26 ` Paolo Bonzini
2013-09-14  8:05   ` Hervé Poussineau

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).