This commit is contained in:
RichardG867
2020-10-30 14:18:31 -03:00
5 changed files with 200 additions and 31 deletions

View File

@@ -38,6 +38,8 @@
#define VIA_597 0x05970100
#define VIA_598 0x05980000
#define VIA_691 0x06910000
#define VIA_693A 0x06914400
#define VIA_694 0x0691c200
#define VIA_8601 0x86010500
typedef struct via_apollo_t
@@ -108,12 +110,18 @@ via_apollo_setup(via_apollo_t *dev)
dev->pci_conf[0x10] = 0x08;
dev->pci_conf[0x34] = 0xa0;
if (dev->id == VIA_8601)
dev->pci_conf[0x52] = 0x10;
if ((dev->id >= VIA_694))
dev->pci_conf[0x52] = (dev->id == VIA_694) ? 0x90 : 0x10;
if ((dev->id >= VIA_693A))
dev->pci_conf[0x53] = 0x10;
if (dev->id == VIA_691) {
dev->pci_conf[0x56] = 0x01;
dev->pci_conf[0x57] = 0x01;
}
if (dev->id >= VIA_693A)
dev->pci_conf[0x58] = 0x40;
dev->pci_conf[0x5a] = 0x01;
dev->pci_conf[0x5b] = 0x01;
dev->pci_conf[0x5c] = 0x01;
@@ -124,7 +132,7 @@ via_apollo_setup(via_apollo_t *dev)
dev->pci_conf[0x64] = 0xec;
dev->pci_conf[0x65] = 0xec;
dev->pci_conf[0x66] = 0xec;
if (dev->id == VIA_691)
if (dev->id >= VIA_691)
dev->pci_conf[0x67] = 0xec; /* DRAM Timing for Banks 6,7. */
dev->pci_conf[0x6b] = 0x01;
@@ -133,6 +141,16 @@ via_apollo_setup(via_apollo_t *dev)
dev->pci_conf[0xa4] = 0x03;
dev->pci_conf[0xa5] = 0x02;
dev->pci_conf[0xa7] = 0x07;
if(dev->id == VIA_693A) {
dev->pci_conf[0xac] = 0x08;
dev->pci_conf[0xad] = 0x02;
}
if(dev->id == VIA_694) {
dev->pci_conf[0xb0] = 0x80; /* The datasheet refers it as 8xh */
dev->pci_conf[0xb1] = 0x63;
}
}
@@ -168,6 +186,8 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x0d:
if(dev->id == VIA_8601)
dev->pci_conf[0x0d] = (dev->pci_conf[0x0d] & ~0x07) | (val & 0x07);
else if(dev->id == VIA_694)
dev->pci_conf[0x0d] = (dev->pci_conf[0x0d] & ~0xf8) | (val & 0xf8);
else
dev->pci_conf[0x0d] = (dev->pci_conf[0x0d] & ~0x07) | (val & 0x07);
@@ -184,13 +204,19 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x50: /* Cache Control 1 */
if (dev->id == VIA_8601)
dev->pci_conf[0x50] = (dev->pci_conf[0x50] & ~0xd3) | (val & 0xd3);
else if (dev->id >= VIA_693A)
dev->pci_conf[0x50] = (dev->pci_conf[0x50] & ~0xd1) | (val & 0xd1);
else if (dev->id == VIA_691)
dev->pci_conf[0x50] = val;
else
dev->pci_conf[0x50] = (dev->pci_conf[0x50] & ~0xf8) | (val & 0xf8);
break;
case 0x51: /* Cache Control 2 */
if (dev->id >= VIA_691)
if (dev->id == VIA_694)
dev->pci_conf[0x51] = (dev->pci_conf[0x51] & ~0xdd) | (val & 0xdd);
else if (dev->id >= VIA_693A)
dev->pci_conf[0x51] = (dev->pci_conf[0x51] & ~0xd9) | (val & 0xd9);
else if (dev->id >= VIA_691)
dev->pci_conf[0x51] = val;
else
dev->pci_conf[0x51] = (dev->pci_conf[0x51] & ~0xeb) | (val & 0xeb);
@@ -198,6 +224,8 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x52: /* Non_Cacheable Control */
if (dev->id == VIA_8601)
dev->pci_conf[0x52] = (dev->pci_conf[0x52] & ~0xdf) | (val & 0xdf);
else if (dev->id >= VIA_693A)
dev->pci_conf[0x52] = val;
else if (dev->id == VIA_691)
dev->pci_conf[0x52] = (dev->pci_conf[0x52] & ~0x9f) | (val & 0x9f);
else
@@ -206,11 +234,16 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x53: /* System Performance Control */
if (dev->id == VIA_8601)
dev->pci_conf[0x53] = (dev->pci_conf[0x53] & ~0xfc) | (val & 0xfc);
else if (dev->id == VIA_691)
else if ((dev->id == VIA_691) || (dev->id == VIA_694))
dev->pci_conf[0x53] = val;
else if (dev->id == VIA_693A)
dev->pci_conf[0x53] = (dev->pci_conf[0x53] & ~0xf8) | (val & 0xf8);
else
dev->pci_conf[0x53] = (dev->pci_conf[0x53] & ~0xf0) | (val & 0xf0);
break;
case 0x54:
dev->pci_conf[0x54] = (dev->pci_conf[0x54] & ~0x07) | (val & 0x07);
break;
case 0x56: case 0x57: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: /* DRAM Row Ending Address */
if (dev->id >= VIA_691)
@@ -220,13 +253,15 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
case 0x58:
if ((dev->id == VIA_597) || (dev->id == VIA_8601))
if ((dev->id == VIA_597) || ((dev->id >= VIA_693A) || (dev->id < VIA_8601)))
dev->pci_conf[0x58] = (dev->pci_conf[0x58] & ~0xee) | (val & 0xee);
else
dev->pci_conf[0x58] = val;
break;
case 0x59:
if (dev->id == VIA_691)
if (dev->id >= VIA_693A)
dev->pci_conf[0x59] = (dev->pci_conf[0x59] & ~0xee) | (val & 0xee);
else if (dev->id == VIA_691)
dev->pci_conf[0x59] = val;
else
dev->pci_conf[0x59] = (dev->pci_conf[0x59] & ~0xf0) | (val & 0xf0);
@@ -318,19 +353,21 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x68:
if (dev->id == VIA_597)
dev->pci_conf[0x68] = (dev->pci_conf[0x6b] & ~0xfe) | (val & 0xfe);
else if ((dev->id == VIA_598) || (dev->id == VIA_8601))
else if ((dev->id == VIA_598) || (dev->id == VIA_693A) || (dev->id == VIA_8601))
dev->pci_conf[0x68] = val;
else if (dev->id == VIA_694)
dev->pci_conf[0x68] = (dev->pci_conf[0x68] & ~0xdf) | (val & 0xdf);
else
dev->pci_conf[0x68] = (dev->pci_conf[0x6b] & ~0xfd) | (val & 0xfd);
break;
case 0x69:
if (dev->id == VIA_8601)
if ((dev->id == VIA_693A) || (dev->id < VIA_8601))
dev->pci_conf[0x69] = (dev->pci_conf[0x69] & ~0xfe) | (val & 0xfe);
else
dev->pci_conf[0x69] = val;
break;
case 0x6b:
if (dev->id == VIA_8601)
if ((dev->id == VIA_693A) || (dev->id < VIA_8601))
dev->pci_conf[0x6b] = val;
else if (dev->id == VIA_691)
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xcf) | (val & 0xcf);
@@ -338,7 +375,7 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xc1) | (val & 0xc1);
break;
case 0x6c:
if ((dev->id == VIA_597) || (dev->id == VIA_8601))
if ((dev->id == VIA_597) || ((dev->id == VIA_693A) || (dev->id < VIA_8601)))
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x1f) | (val & 0x1f);
else if (dev->id == VIA_598)
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x7f) | (val & 0x7f);
@@ -346,51 +383,62 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
dev->pci_conf[0x6c] = val;
break;
case 0x6d:
if (dev->id == VIA_597)
if ((dev->id == VIA_597) || (dev->id == VIA_694))
dev->pci_conf[0x6d] = (dev->pci_conf[0x6d] & ~0x0f) | (val & 0x0f);
else if ((dev->id == VIA_598) || (dev->id == VIA_8601))
else if ((dev->id == VIA_598) || (dev->id == VIA_693A) || (dev->id == VIA_8601))
dev->pci_conf[0x6d] = (dev->pci_conf[0x6d] & ~0x7f) | (val & 0x7f);
else
dev->pci_conf[0x6d] = val;
break;
case 0x6e:
if(dev->id == VIA_694)
dev->pci_conf[0x6e] = val;
else
dev->pci_conf[0x6e] = (dev->pci_conf[0x6e] & ~0xb7) | (val & 0xb7);
break;
case 0x70:
if (dev->id == VIA_8601)
if ((dev->id >= VIA_693A))
dev->pci_conf[0x70] = (dev->pci_conf[0x70] & ~0xdf) | (val & 0xdf);
else if (dev->id == VIA_597)
dev->pci_conf[0x70] = (dev->pci_conf[0x70] & ~0xf1) | (val & 0xf1);
else
dev->pci_conf[0x70] = val;
break;
case 0x71:
if(dev->id == VIA_694)
dev->pci_conf[0x71] = (dev->pci_conf[0x71] & ~0xdf) | (val & 0xdf);
else
dev->pci_conf[0x71] = val;
break;
case 0x73:
if (dev->id == VIA_8601)
if ((dev->id >= VIA_693A))
dev->pci_conf[0x73] = (dev->pci_conf[0x73] & ~0x7f) | (val & 0x7f);
else
dev->pci_conf[0x73] = val;
break;
case 0x74:
if (dev->id == VIA_8601)
if ((dev->id == VIA_693A) || (dev->id == VIA_8601))
dev->pci_conf[0x74] = (dev->pci_conf[0x74] & ~0xdf) | (val & 0xdf);
else if (dev->id == VIA_694)
dev->pci_conf[0x74] = (dev->pci_conf[0x74] & ~0x9f) | (val & 0x9f);
else
dev->pci_conf[0x74] = (dev->pci_conf[0x74] & ~0xc0) | (val & 0xc0);
break;
case 0x75:
if (dev->id == VIA_8601)
if (dev->id >= VIA_693A)
dev->pci_conf[0x75] = val;
else
dev->pci_conf[0x75] = (dev->pci_conf[0x75] & ~0xcf) | (val & 0xcf);
break;
case 0x76:
if (dev->id == VIA_8601)
if (dev->id >= VIA_693A)
dev->pci_conf[0x75] = val;
else
dev->pci_conf[0x76] = (dev->pci_conf[0x76] & ~0xf0) | (val & 0xf0);
break;
case 0x77:
if (dev->id != VIA_8601)
if (dev->id < VIA_693A)
dev->pci_conf[0x77] = (dev->pci_conf[0x77] & ~0xc0) | (val & 0xc0);
break;
case 0x78:
@@ -403,7 +451,7 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
dev->pci_conf[0x7a] = (dev->pci_conf[0x7a] & ~0x89) | (val & 0x89);
break;
case 0x7e:
if (dev->id != VIA_8601)
if ((dev->id != VIA_8601) || (dev->id != VIA_694))
dev->pci_conf[0x7e] = (dev->pci_conf[0x7e] & ~0x3f) | (val & 0x3f);
break;
@@ -413,13 +461,13 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x84:
/* The datasheet first mentions 7-0 but then says 3-0 are reserved -
- minimum of 16 MB for the graphics aperture? 8601 datasheet doesn't refer it. */
if(dev->id == VIA_8601)
if(dev->id >= VIA_693A)
dev->pci_conf[0x84] = val;
else
dev->pci_conf[0x84] = (dev->pci_conf[0x84] & ~0xf0) | (val & 0xf0);
break;
case 0x88:
if(dev->id == VIA_8601)
if((dev->id == VIA_693A) || (dev->id == VIA_8601))
dev->pci_conf[0x88] = (dev->pci_conf[0x88] & ~0x06) | (val & 0x06);
else
dev->pci_conf[0x88] = (dev->pci_conf[0x88] & ~0x07) | (val & 0x07);
@@ -427,13 +475,16 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
case 0x89:
case 0x8a:
case 0x8b:
if(dev->id == VIA_8601)
if((dev->id == VIA_693A) || (dev->id == VIA_8601))
dev->pci_conf[addr] = val;
else
dev->pci_conf[0x89] = (dev->pci_conf[0x89] & ~0xf0) | (val & 0xf0);
break;
case 0xa8:
if(dev->id == VIA_694)
dev->pci_conf[0xa8] = (dev->pci_conf[0xa8] & ~0x33) | (val & 0x33);
else
dev->pci_conf[0xa8] = (dev->pci_conf[0xa8] & ~0x03) | (val & 0x03);
break;
case 0xa9:
@@ -524,10 +575,6 @@ via_apollo_init(const device_t *info)
device_add(&via_vp3_agp_device);
break;
case VIA_598:
device_add(&via_mvp3_agp_device);
break;
case VIA_691:
device_add(&via_apro_agp_device);
break;
@@ -535,6 +582,12 @@ via_apollo_init(const device_t *info)
case VIA_8601:
device_add(&via_vt8601_agp_device);
break;
case VIA_598:
case VIA_693A:
case VIA_694:
device_add(&via_mvp3_agp_device);
break;
}
via_apollo_setup(dev);
@@ -596,6 +649,32 @@ const device_t via_apro_device = {
NULL
};
const device_t via_apro133_device = {
"VIA Apollo Pro133",
DEVICE_PCI,
VIA_693A, /*VT82C693A*/
via_apollo_init,
via_apollo_close,
via_apollo_reset,
NULL,
NULL,
NULL,
NULL
};
const device_t via_apro133a_device = {
"VIA Apollo Pro133A",
DEVICE_PCI,
VIA_694, /*VT82C694X*/
via_apollo_init,
via_apollo_close,
via_apollo_reset,
NULL,
NULL,
NULL,
NULL
};
const device_t via_vt8601_device = {
"VIA Apollo ProMedia",
DEVICE_PCI,