Skip to contentSkip to conversation

hw/hppa/dino: mask out lower 2 bits of PCI config addr

PATCH Superseded Sven Schnelle 2 participants 3 messages Feb 18, 2019 – Mar 4, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/hppa/dino: mask out lower 2 bits of PCI config addr

some versions of HP-UX 10.20 seems to rely on the fact that DINO strips out the lower 2 bits of the PCI configuration address. Also update the binary SeaBIOS distributed to the latest version from Helge's repository, which is required with that change.

---
 hw/hppa/dino.c            |  25 ++++++++++++++++++++++---
 pc-bios/hppa-firmware.img | Bin 215936 -> 53 bytes
 2 files changed, 22 insertions(+), 3 deletions(-)
 mode change 100644 => 120000 pc-bios/hppa-firmware.img
hw/hppa/dino.c +22 -3
index 360716de57..63441783c4 100644
@@ -178,7 +178,7 @@ static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr,
     case DINO_PCI_IO_DATA ... DINO_PCI_IO_DATA + 3:
         /* Read from PCI IO space. */
         io = &address_space_io;
-        ioaddr = s->parent_obj.config_reg;
+        ioaddr = s->parent_obj.config_reg + (addr & 3);
         switch (size) {
         case 1:
             val = address_space_ldub(io, ioaddr, attrs, &ret);
@@ -250,7 +250,7 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr,
     case DINO_IO_DATA ... DINO_PCI_IO_DATA + 3:
         /* Write into PCI IO space.  */
         io = &address_space_io;
-        ioaddr = s->parent_obj.config_reg;
+        ioaddr = s->parent_obj.config_reg + (addr & 3);
         switch (size) {
         case 1:
             address_space_stb(io, ioaddr, val, attrs, &ret);
@@ -360,6 +360,25 @@ static const MemoryRegionOps dino_config_data_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+static uint64_t dino_config_addr_read(void *opaque, hwaddr addr, unsigned len)
+{
+    PCIHostState *s = opaque;
+    return s->config_reg & ~3U;
+}
+
+static void dino_config_addr_write(void *opaque, hwaddr addr,
+                                   uint64_t val, unsigned len)
+{
+    PCIHostState *s = opaque;
+    s->config_reg = val & ~3U;
+}
+
+static const MemoryRegionOps dino_config_addr_ops = {
+    .read = dino_config_addr_read,
+    .write = dino_config_addr_write,
+    .endianness = DEVICE_BIG_ENDIAN,
+};
+
 static AddressSpace *dino_pcihost_set_iommu(PCIBus *bus, void *opaque,
                                             int devfn)
 {
@@ -440,7 +459,7 @@ PCIBus *dino_init(MemoryRegion *addr_space,
 
     /* Dino PCI config. */
     memory_region_init_io(&s->parent_obj.conf_mem, OBJECT(&s->parent_obj),
-                          &pci_host_conf_be_ops, dev, "pci-conf-idx", 4);
+                          &dino_config_addr_ops, dev, "pci-conf-idx", 4);
     memory_region_init_io(&s->parent_obj.data_mem, OBJECT(&s->parent_obj),
                           &dino_config_data_ops, dev, "pci-conf-data", 4);
     memory_region_add_subregion(&s->this_mem, DINO_PCI_CONFIG_ADDR,
pc-bios/hppa-firmware.img deleted binary +0 -0
deleted file mode 100644
index 4ec0dbfc4ae065c29004156ce2933e66b761adf2..0000000000000000000000000000000000000000
GIT binary patch
pc-bios/hppa-firmware.img new file +1 -0
new file mode 120000
index 0000000000..1d3165026d
@@ -0,0 +1 @@
+/home/svens/parisc/seabios-hppa/out/hppa-firmware.img
\ No newline at end of file
Signature · 1 line
2.20.1
#1 lore raw

Hi List,

Quoted 5 lines · Sven Schnelle

some versions of HP-UX 10.20 seems to rely on the fact that DINO strips out the lower 2 bits of the PCI configuration address. Also update the binary SeaBIOS distributed to the latest version from Helge's repository, which is required with that change.

Quoted 7 lines
---
 hw/hppa/dino.c            |  25 ++++++++++++++++++++++---
 pc-bios/hppa-firmware.img | Bin 215936 -> 53 bytes
 2 files changed, 22 insertions(+), 3 deletions(-)
 mode change 100644 => 120000 pc-bios/hppa-firmware.img

please ignore that patch and use v2 instead. I've accidently committed a symlink to hppa-firmware.img.

Regards
Sven

#2 lore raw
In reply to Sven Schnelle
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]