PCI changes.
This commit is contained in:
@@ -58,6 +58,9 @@ enum {
|
||||
PCI_CARD_NORTHBRIDGE = 0,
|
||||
PCI_CARD_AGPBRIDGE,
|
||||
PCI_CARD_SOUTHBRIDGE,
|
||||
PCI_CARD_SOUTHBRIDGE_IDE,
|
||||
PCI_CARD_SOUTHBRIDGE_PMU,
|
||||
PCI_CARD_SOUTHBRIDGE_USB,
|
||||
PCI_CARD_AGP = 0x0f,
|
||||
PCI_CARD_NORMAL = 0x10,
|
||||
PCI_CARD_VIDEO,
|
||||
@@ -72,6 +75,9 @@ enum {
|
||||
PCI_ADD_NORTHBRIDGE = 0,
|
||||
PCI_ADD_AGPBRIDGE,
|
||||
PCI_ADD_SOUTHBRIDGE,
|
||||
PCI_ADD_SOUTHBRIDGE_IDE,
|
||||
PCI_ADD_SOUTHBRIDGE_PMU,
|
||||
PCI_ADD_SOUTHBRIDGE_USB,
|
||||
PCI_ADD_AGP = 0x0f,
|
||||
PCI_ADD_NORMAL = 0x10,
|
||||
PCI_ADD_VIDEO,
|
||||
@@ -111,6 +117,7 @@ extern void pci_init(int type);
|
||||
extern uint8_t pci_register_bus();
|
||||
extern void pci_set_pmc(uint8_t pmc);
|
||||
extern void pci_remap_bus(uint8_t bus_index, uint8_t bus_number);
|
||||
extern void pci_relocate_slot(int type, int new_slot);
|
||||
extern void pci_register_slot(int card, int type,
|
||||
int inta, int intb, int intc, int intd);
|
||||
extern void pci_register_bus_slot(int bus, int card, int type,
|
||||
|
60
src/pci.c
60
src/pci.c
@@ -94,6 +94,53 @@ pci_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
pci_clear_slot(int card)
|
||||
{
|
||||
int i;
|
||||
|
||||
pci_card_to_slot_mapping[pci_cards[card].bus][pci_cards[card].id] = 0xff;
|
||||
|
||||
pci_cards[card].id = 0xff;
|
||||
pci_cards[card].type = 0xff;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
pci_cards[card].irq_routing[i] = 0;
|
||||
|
||||
pci_cards[card].read = NULL;
|
||||
pci_cards[card].write = NULL;
|
||||
pci_cards[card].priv = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pci_relocate_slot(int type, int new_slot)
|
||||
{
|
||||
int i, card = -1;
|
||||
int old_slot;
|
||||
uint8_t mapping;
|
||||
|
||||
if ((new_slot < 0) || (new_slot > 31))
|
||||
return;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
if ((pci_cards[i].bus == 0) && (pci_cards[i].type == type)) {
|
||||
card = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (card == -1)
|
||||
return;
|
||||
|
||||
old_slot = pci_cards[card].id;
|
||||
pci_cards[card].id = new_slot;
|
||||
mapping = pci_card_to_slot_mapping[0][old_slot];
|
||||
pci_card_to_slot_mapping[0][old_slot] = 0xff;
|
||||
pci_card_to_slot_mapping[0][new_slot] = mapping;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pci_cf8_write(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
@@ -809,17 +856,8 @@ pci_slots_clear(void)
|
||||
last_pci_card = last_normal_pci_card = 0;
|
||||
last_pci_bus = 1;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
pci_cards[i].id = 0xff;
|
||||
pci_cards[i].type = 0xff;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
pci_cards[i].irq_routing[j] = 0;
|
||||
|
||||
pci_cards[i].read = NULL;
|
||||
pci_cards[i].write = NULL;
|
||||
pci_cards[i].priv = NULL;
|
||||
}
|
||||
for (i = 0; i < 32; i++)
|
||||
pci_clear_slot(i);
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
|
Reference in New Issue
Block a user