Reimplemented ALi M1543(C) NVR SMI# handling, fixes #3278.

This commit is contained in:
OBattler
2023-08-19 01:39:30 +02:00
parent 250b756af7
commit 274b44ab00
3 changed files with 58 additions and 11 deletions

View File

@@ -307,7 +307,7 @@ typedef struct local_t {
uint8_t wp_0d;
uint8_t wp_32;
uint8_t irq_state;
uint8_t pad0;
uint8_t smi_status;
uint8_t addr[8];
uint8_t wp[2];
@@ -317,6 +317,8 @@ typedef struct local_t {
int16_t count;
int16_t state;
int32_t smi_enable;
uint64_t ecount;
uint64_t rtc_time;
pc_timer_t update_timer;
@@ -444,6 +446,10 @@ timer_update_irq(nvr_t *nvr)
if (irq) {
nvr->regs[RTC_REGC] |= REGC_IRQF;
picintlevel(1 << nvr->irq, &local->irq_state);
if (local->smi_enable) {
smi_raise();
local->smi_status = 1;
}
} else {
nvr->regs[RTC_REGC] &= ~REGC_IRQF;
picintclevel(1 << nvr->irq, &local->irq_state);
@@ -981,6 +987,33 @@ nvr_irq_set(int irq, nvr_t *nvr)
nvr->irq = irq;
}
void
nvr_smi_enable(int enable, nvr_t *nvr)
{
local_t *local = (local_t *) nvr->data;
local->smi_enable = enable;
if (!enable)
local->smi_status = 0;
}
uint8_t
nvr_smi_status(nvr_t *nvr)
{
local_t *local = (local_t *) nvr->data;
return local->smi_status;
}
void
nvr_smi_status_clear(nvr_t *nvr)
{
local_t *local = (local_t *) nvr->data;
local->smi_status = 0;
}
static void
nvr_at_reset(void *priv)
{