qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH 1/4] lsi53c895a: hide 53c895a registers in 53c810


From: Hervé Poussineau
Subject: Re: [Qemu-ppc] [PATCH 1/4] lsi53c895a: hide 53c895a registers in 53c810
Date: Sun, 14 Apr 2019 17:43:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
AIX/PReP does access to the aliased IO registers of 53810.
Implement aliasing to make the AIX driver work.

Signed-off-by: Artyom Tarasenko <address@hidden>
---
  hw/scsi/lsi53c895a.c | 31 ++++++++++++++++++++++++++-----
  1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index da7239d..08841e0 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2266,11 +2266,13 @@ static const struct SCSIBusInfo lsi_scsi_info = {
      .cancel = lsi_request_cancelled
  };
-static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
+static void lsi_scsi_realize_8xx(PCIDevice *dev, Error **errp, uint16_t type)

You can probably remove this change, and replace it by
uint16_t type = PCI_DEVICE_GET_CLASS(dev)->device_id;

  {
      LSIState *s = LSI53C895A(dev);
      DeviceState *d = DEVICE(dev);
      uint8_t *pci_conf;
+    uint64_t mmio_size;
+    MemoryRegion *mr;
pci_conf = dev->config; @@ -2279,13 +2281,21 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      /* Interrupt pin A */
      pci_conf[PCI_INTERRUPT_PIN] = 0x01;
- memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
-                          "lsi-mmio", 0x400);
      memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s,
                            "lsi-ram", 0x2000);
      memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                            "lsi-io", 256);
-
+    if (type == PCI_DEVICE_ID_LSI_53C895A) {
+        mmio_size = 0x400;
+    } else {
+        mr = g_new(MemoryRegion, 1);
+        memory_region_init_alias(mr, OBJECT(d), "lsi-io-alias", &s->io_io,
+                                 0, 0x80);
+        memory_region_add_subregion_overlap(&s->io_io, 0x80, mr, -1);
+        mmio_size = 0x80;
+    }
+    memory_region_init_io(&s->mmio_io, OBJECT(s), &lsi_mmio_ops, s,
+                          "lsi-mmio", mmio_size);
      address_space_init(&s->pci_io_as, pci_address_space_io(dev), 
"lsi-pci-io");
      qdev_init_gpio_out(d, &s->ext_irq, 1);
@@ -2297,6 +2307,16 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      scsi_bus_new(&s->bus, sizeof(s->bus), d, &lsi_scsi_info, NULL);
  }
+static void lsi_scsi_realize_895A(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C895A);
+}
+
+static void lsi_scsi_realize_810(PCIDevice *dev, Error **errp)
+{
+    lsi_scsi_realize_8xx(dev, errp, PCI_DEVICE_ID_LSI_53C810);
+}

... so you can also remove these functions
+
  static void lsi_scsi_unrealize(DeviceState *dev, Error **errp)
  {
      LSIState *s = LSI53C895A(dev);
@@ -2309,7 +2329,7 @@ static void lsi_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->realize = lsi_scsi_realize;
+    k->realize = lsi_scsi_realize_895A;

... so you can also remove this change
      k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
      k->device_id = PCI_DEVICE_ID_LSI_53C895A;
      k->class_id = PCI_CLASS_STORAGE_SCSI;
@@ -2335,6 +2355,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void 
*data)
  {
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ k->realize = lsi_scsi_realize_810;
... and this one.

      k->device_id = PCI_DEVICE_ID_LSI_53C810;
  }

Hervé



reply via email to

[Prev in Thread] Current Thread [Next in Thread]