@@ -24,8 +24,8 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/chipset.h>
|
||||
#include <86box/spd.h>
|
||||
@@ -52,10 +52,10 @@ enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t pm2_cntrl, max_func,
|
||||
uint8_t pm2_cntrl,
|
||||
smram_locked, max_drb,
|
||||
drb_unit, drb_default;
|
||||
uint8_t regs[2][256], regs_locked[2][256];
|
||||
uint8_t regs[256], regs_locked[256];
|
||||
int type;
|
||||
} i4x0_t;
|
||||
|
||||
@@ -137,7 +137,7 @@ i4x0_smram_handler_phase0(i4x0_t *dev)
|
||||
static void
|
||||
i4x0_smram_handler_phase1(i4x0_t *dev)
|
||||
{
|
||||
uint8_t *regs = (uint8_t *) dev->regs[0];
|
||||
uint8_t *regs = (uint8_t *) dev->regs;
|
||||
uint32_t tom = (mem_size << 10);
|
||||
|
||||
uint32_t s, base[2] = { 0x000a0000, 0x00020000 };
|
||||
@@ -273,11 +273,11 @@ static void
|
||||
i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
i4x0_t *dev = (i4x0_t *) priv;
|
||||
uint8_t *regs = (uint8_t *) dev->regs[func];
|
||||
uint8_t *regs_l = (uint8_t *) dev->regs_locked[func];
|
||||
uint8_t *regs = (uint8_t *) dev->regs;
|
||||
uint8_t *regs_l = (uint8_t *) dev->regs_locked;
|
||||
int i;
|
||||
|
||||
if (func > dev->max_func)
|
||||
if (func)
|
||||
return;
|
||||
|
||||
if ((addr >= 0x10) && (addr < 0x4f))
|
||||
@@ -447,7 +447,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
regs[0x51] |= 0x10; /* Virtual PC 2007 BIOS requires a reserved bus speed bit to be set */
|
||||
break;
|
||||
case INTEL_440GX:
|
||||
regs[0x51] = (regs[0x50] & 0x88) | (val & 0x08);
|
||||
regs[0x51] = (regs[0x50] & 0x88) | (val & 0x08);
|
||||
/*regs[0x51] = (regs[0x50] & 0x88) | (val & 0x77);*/
|
||||
break;
|
||||
}
|
||||
@@ -1256,9 +1256,9 @@ i4x0_read(int func, int addr, void *priv)
|
||||
{
|
||||
i4x0_t *dev = (i4x0_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
uint8_t *regs = (uint8_t *) dev->regs[func];
|
||||
uint8_t *regs = (uint8_t *) dev->regs;
|
||||
|
||||
if (func > dev->max_func)
|
||||
if (func)
|
||||
ret = 0xff;
|
||||
else {
|
||||
ret = regs[addr];
|
||||
@@ -1290,16 +1290,15 @@ i4x0_reset(void *priv)
|
||||
i4x0_write(0, 0x60 + i, dev->drb_default, priv);
|
||||
|
||||
if (dev->type >= INTEL_430FX) {
|
||||
dev->regs[0][0x72] &= 0xef; /* Forcibly unlock the SMRAM register. */
|
||||
dev->regs[0x72] &= 0xef; /* Forcibly unlock the SMRAM register. */
|
||||
i4x0_write(0, 0x72, 0x02, priv);
|
||||
} else {
|
||||
dev->regs[0][0x72] &= 0xf7; /* Forcibly unlock the SMRAM register. */
|
||||
dev->regs[0x72] &= 0xf7; /* Forcibly unlock the SMRAM register. */
|
||||
i4x0_write(0, 0x72, 0x00, priv);
|
||||
}
|
||||
|
||||
if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440BX) || (dev->type == INTEL_440ZX)) {
|
||||
for (i = 0; i <= dev->max_func; i++)
|
||||
memset(dev->regs_locked[i], 0x00, 256 * sizeof(uint8_t));
|
||||
memset(dev->regs_locked, 0x00, 256 * sizeof(uint8_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1323,7 +1322,7 @@ static void
|
||||
|
||||
dev->type = info->local & 0xff;
|
||||
|
||||
regs = (uint8_t *) dev->regs[0];
|
||||
regs = (uint8_t *) dev->regs;
|
||||
|
||||
regs[0x00] = 0x86; regs[0x01] = 0x80; /*Intel*/
|
||||
|
||||
@@ -1492,8 +1491,6 @@ static void
|
||||
dev->drb_default = 0x02;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
dev->max_func = 1;
|
||||
|
||||
regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443LX */
|
||||
regs[0x06] = 0x90;
|
||||
regs[0x10] = 0x08;
|
||||
@@ -1517,8 +1514,6 @@ static void
|
||||
dev->drb_default = 0x01;
|
||||
break;
|
||||
case INTEL_440EX:
|
||||
dev->max_func = 1;
|
||||
|
||||
regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443EX. Same Vendor ID as 440LX */
|
||||
regs[0x06] = 0x90;
|
||||
regs[0x10] = 0x08;
|
||||
@@ -1543,7 +1538,6 @@ static void
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x7a] = (info->local >> 8) & 0xff;
|
||||
dev->max_func = (regs[0x7a] & 0x02) ? 0 : 1;
|
||||
|
||||
regs[0x02] = (regs[0x7a] & 0x02) ? 0x92 : 0x90; regs[0x03] = 0x71; /* 82443BX */
|
||||
regs[0x06] = (regs[0x7a] & 0x02) ? 0x00 : 0x10;
|
||||
@@ -1574,7 +1568,6 @@ static void
|
||||
break;
|
||||
case INTEL_440GX:
|
||||
regs[0x7a] = (info->local >> 8) & 0xff;
|
||||
dev->max_func = (regs[0x7a] & 0x02) ? 0 : 1;
|
||||
|
||||
regs[0x02] = (regs[0x7a] & 0x02) ? 0xa2 : 0xa0; regs[0x03] = 0x71; /* 82443GX */
|
||||
regs[0x06] = (regs[0x7a] & 0x02) ? 0x00 : 0x10;
|
||||
@@ -1617,42 +1610,13 @@ static void
|
||||
i4x0_write(regs[0x5f], 0x5f, 0x00, dev);
|
||||
i4x0_write(regs[0x72], 0x72, 0x00, dev);
|
||||
|
||||
if (((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX)) && (dev->max_func == 1)) {
|
||||
regs = (uint8_t *) dev->regs[1];
|
||||
|
||||
regs[0x00] = 0x86; regs[0x01] = 0x80; /* Intel */
|
||||
regs[0x02] = 0x81; regs[0x03] = 0x71; /* 82443LX */
|
||||
regs[0x06] = 0xa0; regs[0x07] = 0x02;
|
||||
regs[0x0a] = 0x04; regs[0x0b] = 0x06;
|
||||
regs[0x0e] = 0x01;
|
||||
regs[0x1c] = 0xf0;
|
||||
regs[0x1e] = 0xa0; regs[0x1f] = 0x02;
|
||||
regs[0x20] = 0xf0; regs[0x21] = 0xff;
|
||||
regs[0x24] = 0xf0; regs[0x25] = 0xff;
|
||||
}
|
||||
|
||||
if (((dev->type == INTEL_440BX) || (dev->type == INTEL_440GX) || (dev->type == INTEL_440ZX)) && (dev->max_func == 1)) {
|
||||
regs = (uint8_t *) dev->regs[1];
|
||||
|
||||
regs[0x00] = 0x86; regs[0x01] = 0x80; /* Intel */
|
||||
if(dev->type != INTEL_440GX) {
|
||||
regs[0x02] = 0x91; regs[0x03] = 0x71; /* 82443BX */
|
||||
} else {
|
||||
regs[0x02] = 0xa1; regs[0x03] = 0x71; /* 82443GX (They seem to share the same deal*/
|
||||
}
|
||||
regs[0x06] = 0x20; regs[0x07] = 0x02;
|
||||
regs[0x08] = 0x02;
|
||||
regs[0x0a] = 0x04; regs[0x0b] = 0x06;
|
||||
regs[0x0e] = 0x01;
|
||||
regs[0x1c] = 0xf0;
|
||||
regs[0x1e] = 0xa0; regs[0x1f] = 0x02;
|
||||
regs[0x20] = 0xf0; regs[0x21] = 0xff;
|
||||
regs[0x24] = 0xf0; regs[0x25] = 0xff;
|
||||
regs[0x3e] = 0x80;
|
||||
}
|
||||
|
||||
pci_add_card(PCI_ADD_NORTHBRIDGE, i4x0_read, i4x0_write, dev);
|
||||
|
||||
if ((dev->type >= INTEL_440BX) && !(regs[0x7a] & 0x02))
|
||||
device_add((dev->type == INTEL_440GX) ? &i440gx_agp_device : &i440bx_agp_device);
|
||||
else if (dev->type >= INTEL_440LX)
|
||||
device_add(&i440lx_agp_device);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/chipset.h>
|
||||
#include <86box/spd.h>
|
||||
@@ -38,7 +38,7 @@
|
||||
typedef struct via_apollo_t
|
||||
{
|
||||
uint16_t id;
|
||||
uint8_t pci_conf[2][256];
|
||||
uint8_t pci_conf[256];
|
||||
} via_apollo_t;
|
||||
|
||||
|
||||
@@ -84,80 +84,52 @@ static void
|
||||
via_apollo_setup(via_apollo_t *dev)
|
||||
{
|
||||
/* Host Bridge */
|
||||
dev->pci_conf[0][0x00] = 0x06; /*VIA*/
|
||||
dev->pci_conf[0][0x01] = 0x11;
|
||||
dev->pci_conf[0][0x02] = dev->id & 0xff;
|
||||
dev->pci_conf[0][0x03] = (dev->id >> 8);
|
||||
dev->pci_conf[0x00] = 0x06; /*VIA*/
|
||||
dev->pci_conf[0x01] = 0x11;
|
||||
dev->pci_conf[0x02] = dev->id & 0xff;
|
||||
dev->pci_conf[0x03] = (dev->id >> 8);
|
||||
|
||||
dev->pci_conf[0][0x04] = 6;
|
||||
dev->pci_conf[0][0x05] = 0;
|
||||
dev->pci_conf[0x04] = 6;
|
||||
dev->pci_conf[0x05] = 0;
|
||||
|
||||
dev->pci_conf[0][0x06] = 0x90;
|
||||
dev->pci_conf[0][0x07] = 0x02;
|
||||
dev->pci_conf[0x06] = 0x90;
|
||||
dev->pci_conf[0x07] = 0x02;
|
||||
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x08] = 1; /* Production Silicon ("Revision B") */
|
||||
dev->pci_conf[0][0x09] = 0;
|
||||
dev->pci_conf[0][0x0a] = 0;
|
||||
dev->pci_conf[0][0x0b] = 6;
|
||||
dev->pci_conf[0][0x0c] = 0;
|
||||
dev->pci_conf[0][0x0d] = 0;
|
||||
dev->pci_conf[0][0x0e] = 0;
|
||||
dev->pci_conf[0][0x0f] = 0;
|
||||
dev->pci_conf[0][0x10] = 0x08;
|
||||
dev->pci_conf[0][0x34] = 0xa0;
|
||||
dev->pci_conf[0x08] = 1; /* Production Silicon ("Revision B") */
|
||||
dev->pci_conf[0x09] = 0;
|
||||
dev->pci_conf[0x0a] = 0;
|
||||
dev->pci_conf[0x0b] = 6;
|
||||
dev->pci_conf[0x0c] = 0;
|
||||
dev->pci_conf[0x0d] = 0;
|
||||
dev->pci_conf[0x0e] = 0;
|
||||
dev->pci_conf[0x0f] = 0;
|
||||
dev->pci_conf[0x10] = 0x08;
|
||||
dev->pci_conf[0x34] = 0xa0;
|
||||
|
||||
if (dev->id == 0x0691) {
|
||||
dev->pci_conf[0][0x56] = 0x01;
|
||||
dev->pci_conf[0][0x57] = 0x01;
|
||||
dev->pci_conf[0x56] = 0x01;
|
||||
dev->pci_conf[0x57] = 0x01;
|
||||
}
|
||||
dev->pci_conf[0][0x5a] = 0x01;
|
||||
dev->pci_conf[0][0x5b] = 0x01;
|
||||
dev->pci_conf[0][0x5c] = 0x01;
|
||||
dev->pci_conf[0][0x5d] = 0x01;
|
||||
dev->pci_conf[0][0x5e] = 0x01;
|
||||
dev->pci_conf[0][0x5f] = 0x01;
|
||||
dev->pci_conf[0x5a] = 0x01;
|
||||
dev->pci_conf[0x5b] = 0x01;
|
||||
dev->pci_conf[0x5c] = 0x01;
|
||||
dev->pci_conf[0x5d] = 0x01;
|
||||
dev->pci_conf[0x5e] = 0x01;
|
||||
dev->pci_conf[0x5f] = 0x01;
|
||||
|
||||
dev->pci_conf[0][0x64] = 0xec;
|
||||
dev->pci_conf[0][0x65] = 0xec;
|
||||
dev->pci_conf[0][0x66] = 0xec;
|
||||
dev->pci_conf[0x64] = 0xec;
|
||||
dev->pci_conf[0x65] = 0xec;
|
||||
dev->pci_conf[0x66] = 0xec;
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x67] = 0xec; /* DRAM Timing for Banks 6,7. */
|
||||
dev->pci_conf[0][0x6b] = 0x01;
|
||||
dev->pci_conf[0x67] = 0xec; /* DRAM Timing for Banks 6,7. */
|
||||
dev->pci_conf[0x6b] = 0x01;
|
||||
|
||||
dev->pci_conf[0][0xa0] = 0x02;
|
||||
dev->pci_conf[0][0xa2] = 0x10;
|
||||
dev->pci_conf[0][0xa4] = 0x03;
|
||||
dev->pci_conf[0][0xa5] = 0x02;
|
||||
dev->pci_conf[0][0xa7] = 0x07;
|
||||
|
||||
/* PCI-to-PCI Bridge */
|
||||
|
||||
dev->pci_conf[1][0x00] = 0x06; /*VIA*/
|
||||
dev->pci_conf[1][0x01] = 0x11;
|
||||
dev->pci_conf[1][0x02] = dev->id & 0xff;
|
||||
dev->pci_conf[1][0x03] = (dev->id >> 8) | 0x80;
|
||||
|
||||
dev->pci_conf[1][0x04] = 7;
|
||||
dev->pci_conf[1][0x05] = 0;
|
||||
|
||||
dev->pci_conf[1][0x06] = 0x20;
|
||||
dev->pci_conf[1][0x07] = 0x02;
|
||||
|
||||
dev->pci_conf[1][0x09] = 0;
|
||||
dev->pci_conf[1][0x0a] = 4;
|
||||
dev->pci_conf[1][0x0b] = 6;
|
||||
dev->pci_conf[1][0x0c] = 0;
|
||||
dev->pci_conf[1][0x0d] = 0;
|
||||
dev->pci_conf[1][0x0e] = 1;
|
||||
dev->pci_conf[1][0x0f] = 0;
|
||||
|
||||
dev->pci_conf[1][0x1c] = 0xf0;
|
||||
|
||||
dev->pci_conf[1][0x20] = 0xf0;
|
||||
dev->pci_conf[1][0x21] = 0xff;
|
||||
dev->pci_conf[1][0x24] = 0xf0;
|
||||
dev->pci_conf[1][0x25] = 0xff;
|
||||
dev->pci_conf[0xa0] = 0x02;
|
||||
dev->pci_conf[0xa2] = 0x10;
|
||||
dev->pci_conf[0xa4] = 0x03;
|
||||
dev->pci_conf[0xa5] = 0x02;
|
||||
dev->pci_conf[0xa7] = 0x07;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,98 +157,98 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
|
||||
switch(addr) {
|
||||
case 0x04:
|
||||
dev->pci_conf[0][0x04] = (dev->pci_conf[0][0x04] & ~0x40) | (val & 0x40);
|
||||
dev->pci_conf[0x04] = (dev->pci_conf[0x04] & ~0x40) | (val & 0x40);
|
||||
break;
|
||||
case 0x07:
|
||||
dev->pci_conf[0][0x07] &= ~(val & 0xb0);
|
||||
dev->pci_conf[0x07] &= ~(val & 0xb0);
|
||||
break;
|
||||
case 0x0d:
|
||||
dev->pci_conf[0][0x0d] = (dev->pci_conf[0][0x0d] & ~0x07) | (val & 0x07);
|
||||
dev->pci_conf[0][0x75] = (dev->pci_conf[0][0x75] & ~0x30) | ((val & 0x06) << 3);
|
||||
dev->pci_conf[0x0d] = (dev->pci_conf[0x0d] & ~0x07) | (val & 0x07);
|
||||
dev->pci_conf[0x75] = (dev->pci_conf[0x75] & ~0x30) | ((val & 0x06) << 3);
|
||||
break;
|
||||
|
||||
case 0x12: /* Graphics Aperture Base */
|
||||
dev->pci_conf[0][0x12] = (val & 0xf0);
|
||||
dev->pci_conf[0x12] = (val & 0xf0);
|
||||
break;
|
||||
case 0x13: /* Graphics Aperture Base */
|
||||
dev->pci_conf[0][0x13] = val;
|
||||
dev->pci_conf[0x13] = val;
|
||||
break;
|
||||
|
||||
case 0x50: /* Cache Control 1 */
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x50] = val;
|
||||
dev->pci_conf[0x50] = val;
|
||||
else
|
||||
dev->pci_conf[0][0x50] = (dev->pci_conf[0][0x50] & ~0xf8) | (val & 0xf8);
|
||||
dev->pci_conf[0x50] = (dev->pci_conf[0x50] & ~0xf8) | (val & 0xf8);
|
||||
break;
|
||||
case 0x51: /* Cache Control 2 */
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x51] = val;
|
||||
dev->pci_conf[0x51] = val;
|
||||
else
|
||||
dev->pci_conf[0][0x51] = (dev->pci_conf[0][0x51] & ~0xeb) | (val & 0xeb);
|
||||
dev->pci_conf[0x51] = (dev->pci_conf[0x51] & ~0xeb) | (val & 0xeb);
|
||||
break;
|
||||
case 0x52: /* Non_Cacheable Control */
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x52] = (dev->pci_conf[0][0x52] & ~0x9f) | (val & 0x9f);
|
||||
dev->pci_conf[0x52] = (dev->pci_conf[0x52] & ~0x9f) | (val & 0x9f);
|
||||
else
|
||||
dev->pci_conf[0][0x52] = (dev->pci_conf[0][0x52] & ~0xf5) | (val & 0xf5);
|
||||
dev->pci_conf[0x52] = (dev->pci_conf[0x52] & ~0xf5) | (val & 0xf5);
|
||||
break;
|
||||
case 0x53: /* System Performance Control */
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x53] = val;
|
||||
dev->pci_conf[0x53] = val;
|
||||
else
|
||||
dev->pci_conf[0][0x53] = (dev->pci_conf[0][0x53] & ~0xf0) | (val & 0xf0);
|
||||
dev->pci_conf[0x53] = (dev->pci_conf[0x53] & ~0xf0) | (val & 0xf0);
|
||||
break;
|
||||
|
||||
case 0x56: case 0x57: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: /* DRAM Row Ending Address */
|
||||
if (dev->id >= 0x0691)
|
||||
spd_write_drbs(dev->pci_conf[0], 0x5a, 0x56, 8);
|
||||
spd_write_drbs(dev->pci_conf, 0x5a, 0x56, 8);
|
||||
else if (addr >= 0x5a)
|
||||
spd_write_drbs(dev->pci_conf[0], 0x5a, 0x5f, 8);
|
||||
spd_write_drbs(dev->pci_conf, 0x5a, 0x5f, 8);
|
||||
break;
|
||||
|
||||
case 0x58:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x58] = (dev->pci_conf[0][0x58] & ~0xee) | (val & 0xee);
|
||||
dev->pci_conf[0x58] = (dev->pci_conf[0x58] & ~0xee) | (val & 0xee);
|
||||
else
|
||||
dev->pci_conf[0][0x58] = val;
|
||||
dev->pci_conf[0x58] = val;
|
||||
break;
|
||||
case 0x59:
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x59] = val;
|
||||
dev->pci_conf[0x59] = val;
|
||||
else
|
||||
dev->pci_conf[0][0x59] = (dev->pci_conf[0][0x59] & ~0xf0) | (val & 0xf0);
|
||||
dev->pci_conf[0x59] = (dev->pci_conf[0x59] & ~0xf0) | (val & 0xf0);
|
||||
break;
|
||||
|
||||
case 0x61: /* Shadow RAM Control 1 */
|
||||
if ((dev->pci_conf[0][0x61] ^ val) & 0x03)
|
||||
if ((dev->pci_conf[0x61] ^ val) & 0x03)
|
||||
apollo_map(0xc0000, 0x04000, val & 0x03);
|
||||
if ((dev->pci_conf[0][0x61] ^ val) & 0x0c)
|
||||
if ((dev->pci_conf[0x61] ^ val) & 0x0c)
|
||||
apollo_map(0xc4000, 0x04000, (val & 0x0c) >> 2);
|
||||
if ((dev->pci_conf[0][0x61] ^ val) & 0x30)
|
||||
if ((dev->pci_conf[0x61] ^ val) & 0x30)
|
||||
apollo_map(0xc8000, 0x04000, (val & 0x30) >> 4);
|
||||
if ((dev->pci_conf[0][0x61] ^ val) & 0xc0)
|
||||
if ((dev->pci_conf[0x61] ^ val) & 0xc0)
|
||||
apollo_map(0xcc000, 0x04000, (val & 0xc0) >> 6);
|
||||
dev->pci_conf[0][0x61] = val;
|
||||
dev->pci_conf[0x61] = val;
|
||||
break;
|
||||
case 0x62: /* Shadow RAM Control 2 */
|
||||
if ((dev->pci_conf[0][0x62] ^ val) & 0x03)
|
||||
if ((dev->pci_conf[0x62] ^ val) & 0x03)
|
||||
apollo_map(0xd0000, 0x04000, val & 0x03);
|
||||
if ((dev->pci_conf[0][0x62] ^ val) & 0x0c)
|
||||
if ((dev->pci_conf[0x62] ^ val) & 0x0c)
|
||||
apollo_map(0xd4000, 0x04000, (val & 0x0c) >> 2);
|
||||
if ((dev->pci_conf[0][0x62] ^ val) & 0x30)
|
||||
if ((dev->pci_conf[0x62] ^ val) & 0x30)
|
||||
apollo_map(0xd8000, 0x04000, (val & 0x30) >> 4);
|
||||
if ((dev->pci_conf[0][0x62] ^ val) & 0xc0)
|
||||
if ((dev->pci_conf[0x62] ^ val) & 0xc0)
|
||||
apollo_map(0xdc000, 0x04000, (val & 0xc0) >> 6);
|
||||
dev->pci_conf[0][0x62] = val;
|
||||
dev->pci_conf[0x62] = val;
|
||||
break;
|
||||
case 0x63: /* Shadow RAM Control 3 */
|
||||
if ((dev->pci_conf[0][0x63] ^ val) & 0x30) {
|
||||
if ((dev->pci_conf[0x63] ^ val) & 0x30) {
|
||||
apollo_map(0xf0000, 0x10000, (val & 0x30) >> 4);
|
||||
shadowbios = (((val & 0x30) >> 4) & 0x02);
|
||||
}
|
||||
if ((dev->pci_conf[0][0x63] ^ val) & 0xc0)
|
||||
if ((dev->pci_conf[0x63] ^ val) & 0xc0)
|
||||
apollo_map(0xe0000, 0x10000, (val & 0xc0) >> 6);
|
||||
dev->pci_conf[0][0x63] = val;
|
||||
dev->pci_conf[0x63] = val;
|
||||
if (smram[0].size != 0x00000000) {
|
||||
mem_set_mem_state_smram_ex(0, smram[0].host_base, smram[0].size, 0x00);
|
||||
mem_set_mem_state_smram_ex(1, smram[0].host_base, smram[0].size, 0x00);
|
||||
@@ -340,151 +312,91 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0x68:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x68] = (dev->pci_conf[0][0x6b] & ~0xfe) | (val & 0xfe);
|
||||
dev->pci_conf[0x68] = (dev->pci_conf[0x6b] & ~0xfe) | (val & 0xfe);
|
||||
else if (dev->id == 0x0598)
|
||||
dev->pci_conf[0][0x68] = val;
|
||||
dev->pci_conf[0x68] = val;
|
||||
else
|
||||
dev->pci_conf[0][0x68] = (dev->pci_conf[0][0x6b] & ~0xfd) | (val & 0xfd);
|
||||
dev->pci_conf[0x68] = (dev->pci_conf[0x6b] & ~0xfd) | (val & 0xfd);
|
||||
break;
|
||||
case 0x6b:
|
||||
if (dev->id == 0x0691)
|
||||
dev->pci_conf[0][0x6b] = (dev->pci_conf[0][0x6b] & ~0xcf) | (val & 0xcf);
|
||||
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xcf) | (val & 0xcf);
|
||||
else
|
||||
dev->pci_conf[0][0x6b] = (dev->pci_conf[0][0x6b] & ~0xc1) | (val & 0xc1);
|
||||
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xc1) | (val & 0xc1);
|
||||
break;
|
||||
case 0x6c:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x6c] = (dev->pci_conf[0][0x6c] & ~0x1f) | (val & 0x1f);
|
||||
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x1f) | (val & 0x1f);
|
||||
else if (dev->id == 0x0598)
|
||||
dev->pci_conf[0][0x6c] = (dev->pci_conf[0][0x6c] & ~0x7f) | (val & 0x7f);
|
||||
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x7f) | (val & 0x7f);
|
||||
else
|
||||
dev->pci_conf[0][0x6c] = val;
|
||||
dev->pci_conf[0x6c] = val;
|
||||
break;
|
||||
case 0x6d:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x6d] = (dev->pci_conf[0][0x6d] & ~0x0f) | (val & 0x0f);
|
||||
dev->pci_conf[0x6d] = (dev->pci_conf[0x6d] & ~0x0f) | (val & 0x0f);
|
||||
else if (dev->id == 0x0598)
|
||||
dev->pci_conf[0][0x6d] = (dev->pci_conf[0][0x6d] & ~0x7f) | (val & 0x7f);
|
||||
dev->pci_conf[0x6d] = (dev->pci_conf[0x6d] & ~0x7f) | (val & 0x7f);
|
||||
else
|
||||
dev->pci_conf[0][0x6d] = val;
|
||||
dev->pci_conf[0x6d] = val;
|
||||
break;
|
||||
case 0x6e:
|
||||
dev->pci_conf[0][0x6e] = (dev->pci_conf[0][0x6e] & ~0xb7) | (val & 0xb7);
|
||||
dev->pci_conf[0x6e] = (dev->pci_conf[0x6e] & ~0xb7) | (val & 0xb7);
|
||||
break;
|
||||
|
||||
case 0x70:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x70] = (dev->pci_conf[0][0x70] & ~0xf1) | (val & 0xf1);
|
||||
dev->pci_conf[0x70] = (dev->pci_conf[0x70] & ~0xf1) | (val & 0xf1);
|
||||
else
|
||||
dev->pci_conf[0][0x70] = val;
|
||||
dev->pci_conf[0x70] = val;
|
||||
break;
|
||||
case 0x74:
|
||||
dev->pci_conf[0][0x74] = (dev->pci_conf[0][0x74] & ~0xc0) | (val & 0xc0);
|
||||
dev->pci_conf[0x74] = (dev->pci_conf[0x74] & ~0xc0) | (val & 0xc0);
|
||||
break;
|
||||
case 0x75:
|
||||
dev->pci_conf[0][0x75] = (dev->pci_conf[0][0x75] & ~0xcf) | (val & 0xcf);
|
||||
dev->pci_conf[0x75] = (dev->pci_conf[0x75] & ~0xcf) | (val & 0xcf);
|
||||
break;
|
||||
case 0x76:
|
||||
dev->pci_conf[0][0x76] = (dev->pci_conf[0][0x76] & ~0xf0) | (val & 0xf0);
|
||||
dev->pci_conf[0x76] = (dev->pci_conf[0x76] & ~0xf0) | (val & 0xf0);
|
||||
break;
|
||||
case 0x77:
|
||||
dev->pci_conf[0][0x77] = (dev->pci_conf[0][0x77] & ~0xc0) | (val & 0xc0);
|
||||
dev->pci_conf[0x77] = (dev->pci_conf[0x77] & ~0xc0) | (val & 0xc0);
|
||||
break;
|
||||
case 0x7e:
|
||||
dev->pci_conf[0][0x7e] = (dev->pci_conf[0][0x7e] & ~0x3f) | (val & 0x3f);
|
||||
dev->pci_conf[0x7e] = (dev->pci_conf[0x7e] & ~0x3f) | (val & 0x3f);
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
dev->pci_conf[0][0x80] = (dev->pci_conf[0][0x80] & ~0x8f) | (val & 0x8f);
|
||||
dev->pci_conf[0x80] = (dev->pci_conf[0x80] & ~0x8f) | (val & 0x8f);
|
||||
break;
|
||||
case 0x84:
|
||||
/* The datasheet first mentions 7-0 but then says 3-0 are reserved -
|
||||
- minimum of 16 MB for the graphics aperture? */
|
||||
dev->pci_conf[0][0x84] = (dev->pci_conf[0][0x84] & ~0xf0) | (val & 0xf0);
|
||||
dev->pci_conf[0x84] = (dev->pci_conf[0x84] & ~0xf0) | (val & 0xf0);
|
||||
break;
|
||||
case 0x88:
|
||||
dev->pci_conf[0][0x88] = (dev->pci_conf[0][0x88] & ~0x07) | (val & 0x07);
|
||||
dev->pci_conf[0x88] = (dev->pci_conf[0x88] & ~0x07) | (val & 0x07);
|
||||
break;
|
||||
case 0x89:
|
||||
dev->pci_conf[0][0x89] = (dev->pci_conf[0][0x89] & ~0xf0) | (val & 0xf0);
|
||||
dev->pci_conf[0x89] = (dev->pci_conf[0x89] & ~0xf0) | (val & 0xf0);
|
||||
break;
|
||||
|
||||
case 0xa8:
|
||||
dev->pci_conf[0][0xa8] = (dev->pci_conf[0][0xa8] & ~0x03) | (val & 0x03);
|
||||
dev->pci_conf[0xa8] = (dev->pci_conf[0xa8] & ~0x03) | (val & 0x03);
|
||||
break;
|
||||
case 0xa9:
|
||||
dev->pci_conf[0][0xa9] = (dev->pci_conf[0][0xa9] & ~0x03) | (val & 0x03);
|
||||
dev->pci_conf[0xa9] = (dev->pci_conf[0xa9] & ~0x03) | (val & 0x03);
|
||||
break;
|
||||
case 0xac:
|
||||
dev->pci_conf[0][0xac] = (dev->pci_conf[0][0xac] & ~0x0f) | (val & 0x0f);
|
||||
dev->pci_conf[0xac] = (dev->pci_conf[0xac] & ~0x0f) | (val & 0x0f);
|
||||
break;
|
||||
case 0xfc:
|
||||
if (dev->id > 0x0597)
|
||||
dev->pci_conf[0][0xfc] = (dev->pci_conf[0][0xfc] & ~0x01) | (val & 0x01);
|
||||
dev->pci_conf[0xfc] = (dev->pci_conf[0xfc] & ~0x01) | (val & 0x01);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->pci_conf[0][addr] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
via_apollo_pci_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
via_apollo_t *dev = (via_apollo_t *) priv;
|
||||
|
||||
if (func != 1)
|
||||
return;
|
||||
|
||||
/*Read-only addresses*/
|
||||
|
||||
if ((addr < 4) || ((addr >= 5) && (addr < 7)) ||
|
||||
((addr >= 8) && (addr < 0x18)) || (addr == 0x1b) ||
|
||||
((addr >= 0x1e) && (addr < 0x20)) || ((addr >= 0x28) && (addr < 0x3e)) ||
|
||||
(addr == 0x3f) || (addr >= 0x43))
|
||||
return;
|
||||
|
||||
switch(addr) {
|
||||
case 0x04:
|
||||
dev->pci_conf[1][0x04] = (dev->pci_conf[1][0x04] & ~0x47) | (val & 0x47);
|
||||
break;
|
||||
case 0x07:
|
||||
dev->pci_conf[1][0x07] &= ~(val & 0x30);
|
||||
break;
|
||||
|
||||
case 0x20: /* Memory Base */
|
||||
dev->pci_conf[1][0x20] = val & 0xf0;
|
||||
break;
|
||||
case 0x22: /* Memory Limit */
|
||||
dev->pci_conf[1][0x22] = val & 0xf0;
|
||||
break;
|
||||
case 0x24: /* Prefetchable Memory Base */
|
||||
dev->pci_conf[1][0x24] = val & 0xf0;
|
||||
break;
|
||||
case 0x26: /* Prefetchable Memory Limit */
|
||||
dev->pci_conf[1][0x26] = val & 0xf0;
|
||||
break;
|
||||
|
||||
case 0x3e:
|
||||
dev->pci_conf[0][0x3e] = (dev->pci_conf[0][0x3e] & ~0x06) | (val & 0x06);
|
||||
break;
|
||||
|
||||
case 0x41:
|
||||
dev->pci_conf[0][0x41] = (dev->pci_conf[0][0x41] & ~0xfe) | (val & 0xfe);
|
||||
break;
|
||||
case 0x42:
|
||||
if (dev->id == 0x0597)
|
||||
dev->pci_conf[0][0x42] = (dev->pci_conf[0][0x42] & ~0xec) | (val & 0xec);
|
||||
else if (dev->id == 0x0598)
|
||||
dev->pci_conf[0][0x42] = (dev->pci_conf[0][0x42] & ~0xfc) | (val & 0xfc);
|
||||
else
|
||||
dev->pci_conf[0][0x42] = (dev->pci_conf[0][0x42] & ~0xf4) | (val & 0xf4);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->pci_conf[1][addr] = val;
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -498,10 +410,7 @@ via_apollo_read(int func, int addr, void *priv)
|
||||
|
||||
switch(func) {
|
||||
case 0:
|
||||
ret = dev->pci_conf[0][addr];
|
||||
break;
|
||||
case 1:
|
||||
ret = dev->pci_conf[1][addr];
|
||||
ret = dev->pci_conf[addr];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -516,9 +425,6 @@ via_apollo_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0:
|
||||
via_apollo_host_bridge_write(func, addr, val, priv);
|
||||
break;
|
||||
case 1:
|
||||
via_apollo_pci_bridge_write(func, addr, val, priv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,6 +447,21 @@ via_apollo_init(const device_t *info)
|
||||
pci_add_card(PCI_ADD_NORTHBRIDGE, via_apollo_read, via_apollo_write, dev);
|
||||
|
||||
dev->id = info->local;
|
||||
|
||||
switch (dev->id) {
|
||||
case 0x0597:
|
||||
device_add(&via_vp3_agp_device);
|
||||
break;
|
||||
|
||||
case 0x0598:
|
||||
device_add(&via_mvp3_agp_device);
|
||||
break;
|
||||
|
||||
case 0x0691:
|
||||
device_add(&via_apro_agp_device);
|
||||
break;
|
||||
}
|
||||
|
||||
via_apollo_setup(dev);
|
||||
via_apollo_reset(dev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user