mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-22 15:29:58 +00:00
Add pci_find_device for pci type 0 requests.
This commit is contained in:
parent
b0d33a5385
commit
a11770961e
@ -200,7 +200,6 @@ inline void BanditHost::cfg_setup(uint32_t offset, int size, int &bus_num,
|
||||
int &dev_num, int &fun_num, uint8_t ®_offs,
|
||||
AccessDetails &details, PCIBase *&device)
|
||||
{
|
||||
device = NULL;
|
||||
details.size = size;
|
||||
details.offset = offset & 3;
|
||||
fun_num = FUN_NUM();
|
||||
@ -219,12 +218,11 @@ inline void BanditHost::cfg_setup(uint32_t offset, int size, int &bus_num,
|
||||
for (dev_num = -1, idsel = this->config_addr; idsel; idsel >>= 1, dev_num++) {}
|
||||
LOG_F(ERROR, "%s: config_addr 0x%08x does not contain valid IDSEL",
|
||||
this->name.c_str(), (uint32_t)this->config_addr);
|
||||
device = NULL;
|
||||
return;
|
||||
}
|
||||
dev_num = WHAT_BIT_SET(idsel);
|
||||
if (this->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
||||
device = this->dev_map[DEV_FUN(dev_num, fun_num)];
|
||||
}
|
||||
device = pci_find_device(dev_num, fun_num);
|
||||
}
|
||||
|
||||
int BanditHost::device_postinit()
|
||||
|
@ -187,14 +187,20 @@ PCIBase *PCIHost::pci_find_device(uint8_t bus_num, uint8_t dev_num, uint8_t fun_
|
||||
for (auto& bridge : this->bridge_devs) {
|
||||
if (bridge->secondary_bus <= bus_num) {
|
||||
if (bridge->secondary_bus == bus_num) {
|
||||
if (bridge->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
||||
return bridge->dev_map[DEV_FUN(dev_num, fun_num)];
|
||||
}
|
||||
return bridge->pci_find_device(dev_num, fun_num);
|
||||
}
|
||||
else if (bridge->subordinate_bus >= bus_num) {
|
||||
if (bridge->subordinate_bus >= bus_num) {
|
||||
return bridge->pci_find_device(bus_num, dev_num, fun_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PCIBase *PCIHost::pci_find_device(uint8_t dev_num, uint8_t fun_num)
|
||||
{
|
||||
if (this->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
||||
return this->dev_map[DEV_FUN(dev_num, fun_num)];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
virtual void pci_io_write_broadcast(uint32_t offset, int size, uint32_t value);
|
||||
|
||||
virtual PCIBase *pci_find_device(uint8_t bus_num, uint8_t dev_num, uint8_t fun_num);
|
||||
virtual PCIBase *pci_find_device(uint8_t dev_num, uint8_t fun_num);
|
||||
|
||||
virtual void pci_interrupt(uint8_t irq_line_state, PCIBase *dev) {}
|
||||
|
||||
|
@ -168,7 +168,6 @@ inline void MPC106::cfg_setup(uint32_t offset, int size, int &bus_num, int &dev_
|
||||
int &fun_num, uint8_t ®_offs, AccessDetails &details,
|
||||
PCIBase *&device)
|
||||
{
|
||||
device = NULL;
|
||||
details.size = size;
|
||||
details.offset = offset & 3;
|
||||
|
||||
@ -183,9 +182,7 @@ inline void MPC106::cfg_setup(uint32_t offset, int size, int &bus_num, int &dev_
|
||||
}
|
||||
else {
|
||||
details.flags = PCI_CONFIG_TYPE_0;
|
||||
if (this->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
||||
device = this->dev_map[DEV_FUN(dev_num, fun_num)];
|
||||
}
|
||||
device = pci_find_device(dev_num, fun_num);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user