mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-12 11:31:16 +00:00
Add pci_find_device for pci type 0 requests.
This commit is contained in:
parent
b0d33a5385
commit
a11770961e
devices
@ -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,
|
int &dev_num, int &fun_num, uint8_t ®_offs,
|
||||||
AccessDetails &details, PCIBase *&device)
|
AccessDetails &details, PCIBase *&device)
|
||||||
{
|
{
|
||||||
device = NULL;
|
|
||||||
details.size = size;
|
details.size = size;
|
||||||
details.offset = offset & 3;
|
details.offset = offset & 3;
|
||||||
fun_num = FUN_NUM();
|
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++) {}
|
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",
|
LOG_F(ERROR, "%s: config_addr 0x%08x does not contain valid IDSEL",
|
||||||
this->name.c_str(), (uint32_t)this->config_addr);
|
this->name.c_str(), (uint32_t)this->config_addr);
|
||||||
|
device = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dev_num = WHAT_BIT_SET(idsel);
|
dev_num = WHAT_BIT_SET(idsel);
|
||||||
if (this->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
device = pci_find_device(dev_num, fun_num);
|
||||||
device = this->dev_map[DEV_FUN(dev_num, fun_num)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int BanditHost::device_postinit()
|
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) {
|
for (auto& bridge : this->bridge_devs) {
|
||||||
if (bridge->secondary_bus <= bus_num) {
|
if (bridge->secondary_bus <= bus_num) {
|
||||||
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->pci_find_device(dev_num, fun_num);
|
||||||
return bridge->dev_map[DEV_FUN(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 bridge->pci_find_device(bus_num, dev_num, fun_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
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 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 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) {}
|
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,
|
int &fun_num, uint8_t ®_offs, AccessDetails &details,
|
||||||
PCIBase *&device)
|
PCIBase *&device)
|
||||||
{
|
{
|
||||||
device = NULL;
|
|
||||||
details.size = size;
|
details.size = size;
|
||||||
details.offset = offset & 3;
|
details.offset = offset & 3;
|
||||||
|
|
||||||
@ -183,9 +182,7 @@ inline void MPC106::cfg_setup(uint32_t offset, int size, int &bus_num, int &dev_
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
details.flags = PCI_CONFIG_TYPE_0;
|
details.flags = PCI_CONFIG_TYPE_0;
|
||||||
if (this->dev_map.count(DEV_FUN(dev_num, fun_num))) {
|
device = pci_find_device(dev_num, fun_num);
|
||||||
device = this->dev_map[DEV_FUN(dev_num, fun_num)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user