From a75aa6f41242788d795cbcfc34975b475f9cb124 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Wed, 31 Aug 2022 18:23:38 -0400 Subject: [PATCH] Expose agpgart_t (#2655) --- src/chipset/intel_4x0.c | 4 ++-- src/chipset/via_apollo.c | 6 +++--- src/include/86box/agpgart.h | 35 +++++++++++++++++++++++++++++++++++ src/include/86box/video.h | 5 ----- src/video/agpgart.c | 16 +++------------- 5 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 src/include/86box/agpgart.h diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index 7e8ff9405..49b8f3fc2 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -29,7 +29,7 @@ #include <86box/chipset.h> #include <86box/spd.h> #include <86box/machine.h> -#include <86box/video.h> +#include <86box/agpgart.h> enum @@ -59,7 +59,7 @@ typedef struct uint8_t mem_state[256]; int type; smram_t *smram_low, *smram_high; - void *agpgart; + agpgart_t *agpgart; void (*write_drbs)(uint8_t *regs, uint8_t reg_min, uint8_t reg_max, uint8_t drb_unit); } i4x0_t; diff --git a/src/chipset/via_apollo.c b/src/chipset/via_apollo.c index 9a491478f..bb30a0264 100644 --- a/src/chipset/via_apollo.c +++ b/src/chipset/via_apollo.c @@ -33,7 +33,7 @@ #include <86box/pci.h> #include <86box/chipset.h> #include <86box/spd.h> -#include <86box/video.h> +#include <86box/agpgart.h> #define VIA_585 0x05851000 #define VIA_595 0x05950000 @@ -50,8 +50,8 @@ typedef struct via_apollo_t uint8_t drb_unit; uint8_t pci_conf[256]; - smram_t *smram; - void *agpgart; + smram_t *smram; + agpgart_t *agpgart; } via_apollo_t; diff --git a/src/include/86box/agpgart.h b/src/include/86box/agpgart.h new file mode 100644 index 000000000..c6823fc0f --- /dev/null +++ b/src/include/86box/agpgart.h @@ -0,0 +1,35 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * AGP Graphics Address Remapping Table remapping emulation. + * + * + * + * Authors: RichardG, + * + * Copyright 2021 RichardG. + */ + +#ifndef EMU_AGPGART_H +#define EMU_AGPGART_H + +typedef struct agpgart_s { + int aperture_enable; + uint32_t aperture_base, aperture_size, aperture_mask, gart_base; + mem_mapping_t aperture_mapping; +} agpgart_t; + +extern void agpgart_set_aperture(agpgart_t *dev, uint32_t base, uint32_t size, int enable); +extern void agpgart_set_gart(agpgart_t *dev, uint32_t base); + +#ifdef EMU_DEVICE_H +/* AGP GART */ +extern const device_t agpgart_device; +#endif + +#endif /*EMU_AGPGART_H*/ diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 34cc2cb81..4e5e426eb 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -258,9 +258,6 @@ extern int get_actual_size_y(void); extern uint32_t video_color_transform(uint32_t color); -extern void agpgart_set_aperture(void *handle, uint32_t base, uint32_t size, int enable); -extern void agpgart_set_gart(void *handle, uint32_t base); - #define video_inform(type, video_timings_ptr) video_inform_monitor(type, video_timings_ptr, monitor_index_global) #define video_get_type() video_get_type_monitor(0) #define video_blend(x, y) video_blend_monitor(x, y, monitor_index_global) @@ -532,8 +529,6 @@ extern const device_t velocity_100_agp_device; /* Wyse 700 */ extern const device_t wy700_device; -/* AGP GART */ -extern const device_t agpgart_device; #endif #endif /*EMU_VIDEO_H*/ diff --git a/src/video/agpgart.c b/src/video/agpgart.c index b115d0b54..a1374cb10 100644 --- a/src/video/agpgart.c +++ b/src/video/agpgart.c @@ -23,13 +23,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/mem.h> - - -typedef struct { - int aperture_enable; - uint32_t aperture_base, aperture_size, aperture_mask, gart_base; - mem_mapping_t aperture_mapping; -} agpgart_t; +#include <86box/agpgart.h> #ifdef ENABLE_AGPGART_LOG @@ -52,10 +46,8 @@ agpgart_log(const char *fmt, ...) void -agpgart_set_aperture(void *handle, uint32_t base, uint32_t size, int enable) +agpgart_set_aperture(agpgart_t *dev, uint32_t base, uint32_t size, int enable) { - agpgart_t *dev = (agpgart_t *) handle; - agpgart_log("AGP GART: set_aperture(%08X, %d, %d)\n", base, size, enable); /* Disable old aperture mapping. */ @@ -75,10 +67,8 @@ agpgart_set_aperture(void *handle, uint32_t base, uint32_t size, int enable) void -agpgart_set_gart(void *handle, uint32_t base) +agpgart_set_gart(agpgart_t *dev, uint32_t base) { - agpgart_t *dev = (agpgart_t *) handle; - agpgart_log("AGP GART: set_gart(%08X)\n", base); /* Set GART base address. */