Merge pull request #4625 from 86Box/tc1995
Chips PCI card fixes (July 20th, 2024)
This commit is contained in:
@@ -161,6 +161,8 @@ typedef struct chips_69000_t {
|
|||||||
uint8_t st01;
|
uint8_t st01;
|
||||||
} chips_69000_t;
|
} chips_69000_t;
|
||||||
|
|
||||||
|
static chips_69000_t *reset_state = NULL;
|
||||||
|
|
||||||
/* TODO: Probe timings on real hardware. */
|
/* TODO: Probe timings on real hardware. */
|
||||||
static video_timings_t timing_chips = { .type = VIDEO_PCI, .write_b = 2, .write_w = 2, .write_l = 1, .read_b = 10, .read_w = 10, .read_l = 10 };
|
static video_timings_t timing_chips = { .type = VIDEO_PCI, .write_b = 2, .write_w = 2, .write_l = 1, .read_b = 10, .read_w = 10, .read_l = 10 };
|
||||||
|
|
||||||
@@ -1901,17 +1903,15 @@ chips_69000_pci_write(int func, int addr, uint8_t val, void *p)
|
|||||||
if (chips->pci_conf_status & PCI_COMMAND_MEM) {
|
if (chips->pci_conf_status & PCI_COMMAND_MEM) {
|
||||||
mem_mapping_enable(&chips->svga.mapping);
|
mem_mapping_enable(&chips->svga.mapping);
|
||||||
if (chips->linear_mapping.base)
|
if (chips->linear_mapping.base)
|
||||||
mem_mapping_enable(&chips->linear_mapping);
|
mem_mapping_set_addr(&chips->linear_mapping, chips->linear_mapping.base, (1 << 24));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x13:
|
case 0x13:
|
||||||
{
|
{
|
||||||
if (!chips->linear_mapping.enable) {
|
|
||||||
chips->linear_mapping.base = val << 24;
|
chips->linear_mapping.base = val << 24;
|
||||||
break;
|
if (chips->linear_mapping.base)
|
||||||
}
|
mem_mapping_set_addr(&chips->linear_mapping, chips->linear_mapping.base, (1 << 24));
|
||||||
mem_mapping_set_addr(&chips->linear_mapping, val << 24, (1 << 24));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x3c:
|
case 0x3c:
|
||||||
@@ -2434,10 +2434,44 @@ chips_69000_line_compare(svga_t* svga)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
chips_69000_disable_handlers(chips_69000_t *chips)
|
||||||
|
{
|
||||||
|
io_removehandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);
|
||||||
|
|
||||||
|
mem_mapping_disable(&chips->linear_mapping);
|
||||||
|
mem_mapping_disable(&chips->svga.mapping);
|
||||||
|
if (!chips->on_board)
|
||||||
|
mem_mapping_disable(&chips->bios_rom.mapping);
|
||||||
|
|
||||||
|
/* Save all the mappings and the timers because they are part of linked lists. */
|
||||||
|
reset_state->linear_mapping = chips->linear_mapping;
|
||||||
|
reset_state->svga.mapping = chips->svga.mapping;
|
||||||
|
reset_state->bios_rom.mapping = chips->bios_rom.mapping;
|
||||||
|
|
||||||
|
reset_state->decrement_timer = chips->decrement_timer;
|
||||||
|
reset_state->svga.timer = chips->svga.timer;
|
||||||
|
reset_state->svga.timer8514 = chips->svga.timer8514;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
chips_69000_reset(void *priv)
|
||||||
|
{
|
||||||
|
chips_69000_t *chips = (chips_69000_t *) priv;
|
||||||
|
|
||||||
|
if (reset_state != NULL) {
|
||||||
|
chips_69000_disable_handlers(chips);
|
||||||
|
reset_state->slot = chips->slot;
|
||||||
|
|
||||||
|
*chips = *reset_state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
chips_69000_init(const device_t *info)
|
chips_69000_init(const device_t *info)
|
||||||
{
|
{
|
||||||
chips_69000_t *chips = calloc(1, sizeof(chips_69000_t));
|
chips_69000_t *chips = calloc(1, sizeof(chips_69000_t));
|
||||||
|
reset_state = calloc(1, sizeof(chips_69000_t));
|
||||||
|
|
||||||
/* Appears to have an odd VBIOS size. */
|
/* Appears to have an odd VBIOS size. */
|
||||||
if (!info->local) {
|
if (!info->local) {
|
||||||
@@ -2450,7 +2484,7 @@ chips_69000_init(const device_t *info)
|
|||||||
svga_init(info, &chips->svga, chips, 1 << 21, /*2048kb*/
|
svga_init(info, &chips->svga, chips, 1 << 21, /*2048kb*/
|
||||||
chips_69000_recalctimings,
|
chips_69000_recalctimings,
|
||||||
chips_69000_in, chips_69000_out,
|
chips_69000_in, chips_69000_out,
|
||||||
NULL,
|
chips_69000_hwcursor_draw,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);
|
io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);
|
||||||
@@ -2459,9 +2493,7 @@ chips_69000_init(const device_t *info)
|
|||||||
|
|
||||||
chips->svga.bpp = 8;
|
chips->svga.bpp = 8;
|
||||||
chips->svga.miscout = 1;
|
chips->svga.miscout = 1;
|
||||||
chips->svga.recalctimings_ex = chips_69000_recalctimings;
|
|
||||||
chips->svga.vblank_start = chips_69000_vblank_start;
|
chips->svga.vblank_start = chips_69000_vblank_start;
|
||||||
chips->svga.hwcursor_draw = chips_69000_hwcursor_draw;
|
|
||||||
chips->svga.getclock = chips_69000_getclock;
|
chips->svga.getclock = chips_69000_getclock;
|
||||||
chips->svga.conv_16to32 = chips_69000_conv_16to32;
|
chips->svga.conv_16to32 = chips_69000_conv_16to32;
|
||||||
chips->svga.line_compare = chips_69000_line_compare;
|
chips->svga.line_compare = chips_69000_line_compare;
|
||||||
@@ -2482,6 +2514,8 @@ chips_69000_init(const device_t *info)
|
|||||||
|
|
||||||
chips->flat_panel_regs[0x01] = 1;
|
chips->flat_panel_regs[0x01] = 1;
|
||||||
|
|
||||||
|
*reset_state = *chips;
|
||||||
|
|
||||||
return chips;
|
return chips;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2503,6 +2537,9 @@ chips_69000_close(void *p)
|
|||||||
i2c_gpio_close(chips->i2c);
|
i2c_gpio_close(chips->i2c);
|
||||||
svga_close(&chips->svga);
|
svga_close(&chips->svga);
|
||||||
|
|
||||||
|
free(reset_state);
|
||||||
|
reset_state = NULL;
|
||||||
|
|
||||||
free(chips);
|
free(chips);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2519,7 +2556,7 @@ chips_69000_force_redraw(void *p)
|
|||||||
{
|
{
|
||||||
chips_69000_t *chips = (chips_69000_t *) p;
|
chips_69000_t *chips = (chips_69000_t *) p;
|
||||||
|
|
||||||
chips->svga.fullchange = changeframecount;
|
chips->svga.fullchange = chips->svga.monitor->mon_changeframecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
const device_t chips_69000_device = {
|
const device_t chips_69000_device = {
|
||||||
@@ -2529,7 +2566,7 @@ const device_t chips_69000_device = {
|
|||||||
.local = 0,
|
.local = 0,
|
||||||
.init = chips_69000_init,
|
.init = chips_69000_init,
|
||||||
.close = chips_69000_close,
|
.close = chips_69000_close,
|
||||||
.reset = NULL,
|
.reset = chips_69000_reset,
|
||||||
{ .available = chips_69000_available },
|
{ .available = chips_69000_available },
|
||||||
.speed_changed = chips_69000_speed_changed,
|
.speed_changed = chips_69000_speed_changed,
|
||||||
.force_redraw = chips_69000_force_redraw,
|
.force_redraw = chips_69000_force_redraw,
|
||||||
@@ -2543,7 +2580,7 @@ const device_t chips_69000_onboard_device = {
|
|||||||
.local = 1,
|
.local = 1,
|
||||||
.init = chips_69000_init,
|
.init = chips_69000_init,
|
||||||
.close = chips_69000_close,
|
.close = chips_69000_close,
|
||||||
.reset = NULL,
|
.reset = chips_69000_reset,
|
||||||
{ .available = chips_69000_available },
|
{ .available = chips_69000_available },
|
||||||
.speed_changed = chips_69000_speed_changed,
|
.speed_changed = chips_69000_speed_changed,
|
||||||
.force_redraw = chips_69000_force_redraw,
|
.force_redraw = chips_69000_force_redraw,
|
||||||
|
Reference in New Issue
Block a user