Implement the DEC/Intel 21152-AB PCI bridge for the Dell Gn+/GXa riser card.
This commit is contained in:
@@ -30,8 +30,10 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/plat_fallthrough.h>
|
||||
|
||||
#define PCI_BRIDGE_DEC_21150 0x10110022
|
||||
#define PCI_BRIDGE_DEC_21152 0x10110024
|
||||
#define AGP_BRIDGE_ALI_M5243 0x10b95243
|
||||
#define AGP_BRIDGE_ALI_M5247 0x10b95247
|
||||
#define AGP_BRIDGE_INTEL_440LX 0x80867181
|
||||
@@ -242,12 +244,15 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x40:
|
||||
if (dev->local == PCI_BRIDGE_DEC_21150)
|
||||
val &= 0x32;
|
||||
else if (dev->local == PCI_BRIDGE_DEC_21152)
|
||||
val &= 0x12;
|
||||
break;
|
||||
|
||||
case 0x41:
|
||||
if (AGP_BRIDGE_VIA(dev->local))
|
||||
val &= 0x7e;
|
||||
else if (dev->local == PCI_BRIDGE_DEC_21150)
|
||||
else if ((dev->local == PCI_BRIDGE_DEC_21150) ||
|
||||
(dev->local == PCI_BRIDGE_DEC_21152))
|
||||
val &= 0x07;
|
||||
break;
|
||||
|
||||
@@ -257,18 +262,22 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
|
||||
case 0x43:
|
||||
if (dev->local == PCI_BRIDGE_DEC_21150)
|
||||
if ((dev->local == PCI_BRIDGE_DEC_21150) ||
|
||||
(dev->local == PCI_BRIDGE_DEC_21152))
|
||||
val &= 0x03;
|
||||
break;
|
||||
|
||||
case 0x64:
|
||||
if (dev->local == PCI_BRIDGE_DEC_21150)
|
||||
if ((dev->local == PCI_BRIDGE_DEC_21150) ||
|
||||
(dev->local == PCI_BRIDGE_DEC_21152))
|
||||
val &= 0x7e;
|
||||
break;
|
||||
|
||||
case 0x69:
|
||||
if (dev->local == PCI_BRIDGE_DEC_21150)
|
||||
val &= 0x3f;
|
||||
else if (dev->local == PCI_BRIDGE_DEC_21152)
|
||||
val = (val & 0x01) | 0x3e;
|
||||
break;
|
||||
|
||||
case 0x86:
|
||||
@@ -302,6 +311,15 @@ pci_bridge_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
|
||||
case 0xe0:
|
||||
if (AGP_BRIDGE_ALI(dev->local)) {
|
||||
if (!(dev->ctl & 0x20))
|
||||
return;
|
||||
} else if (dev->local == PCI_BRIDGE_DEC_21152)
|
||||
val &= 0x03;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
|
||||
case 0xe1:
|
||||
if (AGP_BRIDGE_ALI(dev->local)) {
|
||||
if (!(dev->ctl & 0x20))
|
||||
@@ -399,6 +417,14 @@ pci_bridge_reset(void *priv)
|
||||
|
||||
/* command and status */
|
||||
switch (dev->local) {
|
||||
case PCI_BRIDGE_DEC_21152:
|
||||
dev->regs[0x08] = 0x03;
|
||||
dev->regs[0x34] = 0xdc;
|
||||
dev->regs[0x69] = 0x3e;
|
||||
dev->regs[0xdc] = 0x01;
|
||||
dev->regs[0xde] = 0x01;
|
||||
dev->regs[0xe2] = 0x80;
|
||||
fallthrough;
|
||||
case PCI_BRIDGE_DEC_21150:
|
||||
dev->regs[0x06] = 0x80;
|
||||
dev->regs[0x07] = 0x02;
|
||||
@@ -490,6 +516,8 @@ pci_bridge_init(const device_t *info)
|
||||
uint8_t interrupt_count;
|
||||
uint8_t interrupt_mask;
|
||||
uint8_t slot_count;
|
||||
uint8_t dell_slots[3] = { 0x09, 0x0a, 0x0b };
|
||||
uint8_t dell_interrupts[3][4] = { { 1, 2, 3, 4 }, { 4, 2, 1, 3 }, { 1, 3, 4, 2 } };
|
||||
|
||||
pci_bridge_t *dev = (pci_bridge_t *) calloc(1, sizeof(pci_bridge_t));
|
||||
|
||||
@@ -499,7 +527,10 @@ pci_bridge_init(const device_t *info)
|
||||
|
||||
pci_bridge_reset(dev);
|
||||
|
||||
pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot);
|
||||
if (info->local == PCI_BRIDGE_DEC_21152)
|
||||
pci_add_card(PCI_ADD_BRIDGE, pci_bridge_read, pci_bridge_write, dev, &dev->slot);
|
||||
else
|
||||
pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot);
|
||||
|
||||
interrupt_count = sizeof(interrupts);
|
||||
interrupt_mask = interrupt_count - 1;
|
||||
@@ -513,16 +544,23 @@ pci_bridge_init(const device_t *info)
|
||||
|
||||
if (info->local == PCI_BRIDGE_DEC_21150)
|
||||
slot_count = 9; /* 9 bus masters */
|
||||
else if (info->local == PCI_BRIDGE_DEC_21152)
|
||||
slot_count = 3; /* 3 bus masters */
|
||||
else
|
||||
slot_count = 1; /* AGP bridges always have 1 slot */
|
||||
|
||||
for (uint8_t i = 0; i < slot_count; i++) {
|
||||
uint8_t slot = i;
|
||||
if (info->local == PCI_BRIDGE_DEC_21152) {
|
||||
slot = dell_slots[i];
|
||||
memcpy(interrupts, dell_interrupts[i], 4);
|
||||
}
|
||||
/* Interrupts for bridge slots are assigned in round-robin: ABCD, BCDA, CDAB and so on. */
|
||||
pci_bridge_log("PCI Bridge %d: downstream slot %02X interrupts %02X %02X %02X %02X\n",
|
||||
dev->bus_index, i, interrupts[i & interrupt_mask],
|
||||
dev->bus_index, slot, interrupts[i & interrupt_mask],
|
||||
interrupts[(i + 1) & interrupt_mask], interrupts[(i + 2) & interrupt_mask],
|
||||
interrupts[(i + 3) & interrupt_mask]);
|
||||
pci_register_bus_slot(dev->bus_index, i, AGP_BRIDGE(dev->local) ? PCI_CARD_AGP : PCI_CARD_NORMAL,
|
||||
pci_register_bus_slot(dev->bus_index, slot, AGP_BRIDGE(dev->local) ? PCI_CARD_AGP : PCI_CARD_NORMAL,
|
||||
interrupts[i & interrupt_mask],
|
||||
interrupts[(i + 1) & interrupt_mask],
|
||||
interrupts[(i + 2) & interrupt_mask],
|
||||
@@ -547,6 +585,20 @@ const device_t dec21150_device = {
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t dec21152_device = {
|
||||
.name = "DEC 21152 PCI Bridge",
|
||||
.internal_name = "dec21152",
|
||||
.flags = DEVICE_PCI,
|
||||
.local = PCI_BRIDGE_DEC_21152,
|
||||
.init = pci_bridge_init,
|
||||
.close = NULL,
|
||||
.reset = pci_bridge_reset,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
/* AGP bridges */
|
||||
const device_t ali5243_agp_device = {
|
||||
.name = "ALi M5243 AGP Bridge",
|
||||
|
||||
@@ -286,6 +286,7 @@ extern void pci_bridge_set_ctl(void *priv, uint8_t ctl);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t dec21150_device;
|
||||
extern const device_t dec21152_device;
|
||||
|
||||
extern const device_t ali5243_agp_device;
|
||||
extern const device_t ali5247_agp_device;
|
||||
|
||||
@@ -164,18 +164,20 @@ machine_at_optiplex_gxa_init(const machine_t *model)
|
||||
machine_at_common_init_ex(model, 2);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4);
|
||||
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 1, 3, 4);
|
||||
pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 2, 1);
|
||||
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0);
|
||||
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
|
||||
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4);
|
||||
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
|
||||
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0);
|
||||
pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 2, 1);
|
||||
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 1, 3, 4);
|
||||
pci_register_slot(0x0F, PCI_CARD_BRIDGE, 1, 2, 3, 4);
|
||||
|
||||
if (sound_card_current[0] == SOUND_INTERNAL)
|
||||
device_add(machine_get_snd_device(machine));
|
||||
|
||||
device_add(&i440lx_device);
|
||||
device_add(&piix4_device);
|
||||
device_add(&dec21152_device);
|
||||
device_add_params(&pc87307_device, (void *) (PCX730X_PHOENIX_42 | PCX7307_PC87307));
|
||||
device_add(&intel_flash_bxt_device);
|
||||
spd_register(SPD_TYPE_SDRAM, 0x7, 256);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/chipset.h>
|
||||
#include <86box/hdc.h>
|
||||
@@ -45,6 +44,7 @@
|
||||
#include <86box/scsi_ncr53c8xx.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/pci.h>
|
||||
|
||||
int
|
||||
machine_at_acerv35n_init(const machine_t *model)
|
||||
@@ -989,6 +989,7 @@ machine_at_optiplex_gn_init(const machine_t *model)
|
||||
pci_register_slot(0x10, PCI_CARD_VIDEO, 4, 0, 0, 0); /* Trio64V2/GX, temporarily Trio64V2/DX is given */
|
||||
pci_register_slot(0x11, PCI_CARD_NETWORK, 4, 0, 0, 0); /* 3C905, not yet emulated */
|
||||
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4);
|
||||
pci_register_slot(0x0F, PCI_CARD_BRIDGE, 1, 2, 3, 4);
|
||||
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(machine_get_vid_device(machine));
|
||||
@@ -998,6 +999,7 @@ machine_at_optiplex_gn_init(const machine_t *model)
|
||||
|
||||
device_add(&i430tx_device);
|
||||
device_add(&piix4_device);
|
||||
device_add(&dec21152_device);
|
||||
device_add_params(&pc87307_device, (void *) (PCX730X_PHOENIX_42 | PCX7307_PC87307));
|
||||
device_add(&intel_flash_bxt_device);
|
||||
spd_register(SPD_TYPE_SDRAM, 0x3, 128);
|
||||
|
||||
Reference in New Issue
Block a user