Fix dino pci config access.

-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJcbvX+AAoJEGTfOOivfiFf6IwH/RxUSMPG2bYlfenrwDPKkp+7
 T5jhwJjoOye0n972HNIWT/T5pF1NFzgV90A1wgwnxdB2d34+8Co9AqrlXlzA/9mf
 JheGPcOftAdsy5wvwgLC9GCS+HbHTPGG2LwVrtvSyksQ8VgtmomFk8U1jbQOIDDi
 m3bgmhlPgcsW7xxw8/pGpkwAly+9AbYzrRZa9SL2AXeHgdkHLzS7F3tgPhpkI4MM
 CVrqfYhlmQNO0rfeC+zdmnMc9848XAGa7qTjqzt9801TvgmXpXATAKFXXyBWsIPv
 MHXg3i/t7VI98rE7I8qxNUrWAyCIDAL+e+ocouulhfFjInzef19o1OdKkjrDqt8=
 =6fVI
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-hppa-20190221' into staging

Fix dino pci config access.

# gpg: Signature made Thu 21 Feb 2019 19:03:26 GMT
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-hppa-20190221:
  hw/hppa/dino: mask out lower 2 bits of PCI config addr

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-02-22 13:53:12 +00:00
commit a05838cb2a
2 changed files with 24 additions and 3 deletions

View File

@ -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,27 @@ 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;
}
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,
.valid.min_access_size = 4,
.valid.max_access_size = 4,
.endianness = DEVICE_BIG_ENDIAN,
};
static AddressSpace *dino_pcihost_set_iommu(PCIBus *bus, void *opaque,
int devfn)
{
@ -440,7 +461,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,

Binary file not shown.