Some internal values in pci.c are now 8-bit, which should reduce the number of screw-ups;

ET4000/W32p PCI writes now sanitize the address first;
Removed excess logging related to the ET4000/W32p.
This commit is contained in:
OBattler
2016-11-05 02:19:15 +01:00
parent 1b1b18f1dd
commit 72bf852e07
3 changed files with 15 additions and 11 deletions

View File

@@ -10,7 +10,7 @@
void (*pci_card_write[32])(int func, int addr, uint8_t val, void *priv);
uint8_t (*pci_card_read[32])(int func, int addr, void *priv);
void *pci_priv[32];
static int pci_index, pci_func, pci_card, pci_bus, pci_enable, pci_key;
static uint8_t pci_index pci_func, pci_card, pci_bus, pci_enable, pci_key;
static int pci_min_card, pci_max_card;
int pci_burst_time, pci_nonburst_time;

View File

@@ -321,14 +321,14 @@ void et4000w32p_recalcmapping(et4000w32p_t *et4000)
if (!(et4000->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM))
{
pclog("Update mapping - PCI disabled\n");
// pclog("Update mapping - PCI disabled\n");
mem_mapping_disable(&svga->mapping);
mem_mapping_disable(&et4000->linear_mapping);
mem_mapping_disable(&et4000->mmu_mapping);
return;
}
pclog("recalcmapping %p\n", svga);
// pclog("recalcmapping %p\n", svga);
if (svga->crtc[0x36] & 0x10) /*Linear frame buffer*/
{
mem_mapping_set_addr(&et4000->linear_mapping, et4000->linearbase, 0x200000);
@@ -1098,7 +1098,9 @@ uint8_t et4000w32p_pci_read(int func, int addr, void *p)
et4000w32p_t *et4000 = (et4000w32p_t *)p;
svga_t *svga = &et4000->svga;
pclog("ET4000 PCI read %08X\n", addr);
addr &= 0xff;
// pclog("ET4000 PCI read %08X\n", addr);
switch (addr)
{
@@ -1139,7 +1141,9 @@ void et4000w32p_pci_write(int func, int addr, uint8_t val, void *p)
svga_t *svga = &et4000->svga;
uint32_t temp = 0;
pclog("ET4000 PCI Write: value %02X to address %08X\n");
addr &= 0xff;
// pclog("ET4000 PCI Write: value %02X to address %08X\n");
switch (addr)
{

View File

@@ -13,7 +13,7 @@ void icd2061_write(icd2061_t *icd2061, int val)
int q, p, m, i, a;
if ((val & 1) && !(icd2061->state & 1))
{
pclog("ICD2061 write %02X %i %08X %i\n", val, icd2061->unlock, icd2061->data, icd2061->pos);
// pclog("ICD2061 write %02X %i %08X %i\n", val, icd2061->unlock, icd2061->data, icd2061->pos);
if (!icd2061->status)
{
if (val & 2)
@@ -35,7 +35,7 @@ void icd2061_write(icd2061_t *icd2061, int val)
icd2061->pos++;
if (icd2061->pos == 26)
{
pclog("ICD2061 data - %08X\n", icd2061->data);
// pclog("ICD2061 data - %08X\n", icd2061->data);
a = (icd2061->data >> 21) & 0x7;
if (!(a & 4))
{
@@ -43,16 +43,16 @@ void icd2061_write(icd2061_t *icd2061, int val)
m = 1 << ((icd2061->data >> 7) & 0x7);
p = ((icd2061->data >> 10) & 0x7f) - 3;
i = (icd2061->data >> 17) & 0xf;
pclog("p %i q %i m %i\n", p, q, m);
// pclog("p %i q %i m %i\n", p, q, m);
if (icd2061->ctrl & (1 << a))
p <<= 1;
icd2061->freq[a] = ((double)p / (double)q) * 2.0 * 14318184.0 / (double)m;
pclog("ICD2061 freq %i = %f\n", a, icd2061->freq[a]);
// pclog("ICD2061 freq %i = %f\n", a, icd2061->freq[a]);
}
else if (a == 6)
{
icd2061->ctrl = val;
pclog("ICD2061 ctrl = %08X\n", val);
// pclog("ICD2061 ctrl = %08X\n", val);
}
icd2061->unlock = icd2061->data = 0;
icd2061->status = 0;
@@ -64,6 +64,6 @@ void icd2061_write(icd2061_t *icd2061, int val)
double icd2061_getfreq(icd2061_t *icd2061, int i)
{
pclog("Return freq %f\n", icd2061->freq[i]);
// pclog("Return freq %f\n", icd2061->freq[i]);
return icd2061->freq[i];
}