Skip to content

Commit

Permalink
hw/pci-host/astro: Map Astro chip into 64-bit I/O memory region
Browse files Browse the repository at this point in the history
Map Astro into high F-region and add alias for 32-bit OS in low region.

Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
hdeller authored and rth7680 committed Nov 7, 2023
1 parent 5dd5c00 commit fd842b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hw/pci-host/astro.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#define TYPE_ASTRO_IOMMU_MEMORY_REGION "astro-iommu-memory-region"

#define F_EXTEND(addr) ((addr) | MAKE_64BIT_MASK(32, 32))

#include "qemu/osdep.h"
#include "qemu/module.h"
#include "qemu/units.h"
Expand Down Expand Up @@ -821,15 +823,16 @@ static void astro_realize(DeviceState *obj, Error **errp)

/* map elroys mmio */
map_size = LMMIO_DIST_BASE_SIZE / ROPES_PER_IOC;
map_addr = (uint32_t) (LMMIO_DIST_BASE_ADDR + rope * map_size);
map_addr = F_EXTEND(LMMIO_DIST_BASE_ADDR + rope * map_size);
memory_region_init_alias(&elroy->pci_mmio_alias, OBJECT(elroy),
"pci-mmio-alias",
&elroy->pci_mmio, map_addr, map_size);
&elroy->pci_mmio, (uint32_t) map_addr, map_size);
memory_region_add_subregion(get_system_memory(), map_addr,
&elroy->pci_mmio_alias);

/* map elroys io */
map_size = IOS_DIST_BASE_SIZE / ROPES_PER_IOC;
map_addr = (uint32_t) (IOS_DIST_BASE_ADDR + rope * map_size);
map_addr = F_EXTEND(IOS_DIST_BASE_ADDR + rope * map_size);
memory_region_add_subregion(get_system_memory(), map_addr,
&elroy->pci_io);

Expand Down

0 comments on commit fd842b2

Please sign in to comment.