Implemented the Chipset unlock mechanism properly for the ALi's

ALi M1217 & M1429 can be unlocked and locked back properly now.
This commit is contained in:
Panagiotis
2021-01-15 17:30:56 +02:00
committed by GitHub
parent e4ef95665e
commit 9f5ff6169f
2 changed files with 23 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ ali1217_log(const char *fmt, ...)
typedef struct
{
uint8_t index, regs[256];
int cfg_locked;
} ali1217_t;
static void ali1217_shadow_recalc(ali1217_t *dev)
@@ -65,7 +66,7 @@ static void ali1217_shadow_recalc(ali1217_t *dev)
shadowbios = !!(dev->regs[0x15] & 5);
shadowbios_write = !!(dev->regs[0x15] & 0x0a);
flushmmucache();
}
@@ -80,15 +81,22 @@ ali1217_write(uint16_t addr, uint8_t val, void *priv)
dev->index = val;
break;
case 0x23:
ali1217_log("ALi M1217: dev->regs[%02x] = %02x\n", dev->index, val);
dev->regs[dev->index] = val;
if (dev->index != 0x13)
ali1217_log("ALi M1217: dev->regs[%02x] = %02x\n", dev->index, val);
switch (dev->index)
if(dev->index == 0x13)
dev->cfg_locked = !(val == 0xc5);
if (!dev->cfg_locked)
{
case 0x14:
case 0x15:
ali1217_shadow_recalc(dev);
break;
dev->regs[dev->index] = val;
switch (dev->index)
{
case 0x14:
case 0x15:
ali1217_shadow_recalc(dev);
break;
}
}
break;
}
@@ -118,6 +126,8 @@ ali1217_init(const device_t *info)
device_add(&port_92_device);
dev->cfg_locked = 1;
/*
ALi M1217 Ports

View File

@@ -101,17 +101,16 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
/* Don't log register unlock patterns */
if(dev->index != 0x03)
{
ali1429_log("M1429: dev->regs[%02x] = %02x\n", dev->index, val);
}
dev->regs[dev->index] = val;
/* Unlock/Lock Registers */
dev->cfg_locked = !(dev->regs[0x03] && 0xc5);
if(dev->index == 0x03)
dev->cfg_locked = !(val == 0xc5);
if(dev->cfg_locked == 0)
if(!dev->cfg_locked)
{
dev->regs[dev->index] = val;
switch(dev->index){
/* Shadow RAM */
case 0x13: