@@ -303,12 +303,26 @@ static void create_fb(AppleGFXState *s)
s->cursor_show = true;
}
+static size_t apple_gfx_get_default_mmio_range_size(void)
+{
+ size_t mmio_range_size;
+ @autoreleasepool {
+ PGDeviceDescriptor *desc = [PGDeviceDescriptor new];
+ mmio_range_size = desc.mmioLength;
+ [desc release];
+ }
+ return mmio_range_size;
+}
+
void apple_gfx_common_init(Object *obj, AppleGFXState *s, const char* obj_name)
{
Error *local_err = NULL;
int r;
+ size_t mmio_range_size = apple_gfx_get_default_mmio_range_size();
- memory_region_init_io(&s->iomem_gfx, obj, &apple_gfx_ops, s, obj_name, 0x4000);
+ trace_apple_gfx_common_init(obj_name, mmio_range_size);
+ memory_region_init_io(&s->iomem_gfx, obj, &apple_gfx_ops, s, obj_name,
+ mmio_range_size);
/* TODO: PVG framework supports serialising device state: integrate it! */
if (apple_gfx_mig_blocker == NULL) {
@@ -208,6 +208,7 @@ apple_gfx_mode_change(uint64_t x, uint64_t y) "x=%"PRId64" y=%"PRId64
apple_gfx_cursor_set(uint32_t bpp, uint64_t width, uint64_t height) "bpp=%d width=%"PRId64" height=0x%"PRId64
apple_gfx_cursor_show(uint32_t show) "show=%d"
apple_gfx_cursor_move(void) ""
+apple_gfx_common_init(const char *device_name, size_t mmio_size) "device: %s; MMIO size: %zu bytes"
# apple-gfx-vmapple.m
apple_iosfc_read(uint64_t offset, uint64_t res) "offset=0x%"PRIx64" res=0x%"PRIx64
Rather than specifying the length of the device's MMIO range as an unnamed literal constant (which is at least documented as a comment in the framework headers), we query the PVG framework's API for the recommended value. This also avoids problems in future, in case the currently documented value for the default changes. Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> --- hw/display/apple-gfx.m | 16 +++++++++++++++- hw/display/trace-events | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)