Corrections for refactors.
- Macros need parenthesis to enforce operation order when expanded. - Fix device and register numbers in log messages. - Unmapped I/O space reads don't necessarily return 0xffffffff. That's only for config space reads. Just return 0. Unhandled I/O space read should probably cause a memory check (TEA - Transfer Error Acknowledge) exception as it does on a Power Mac 8600.
This commit is contained in:
parent
e64aab1577
commit
fba2ff4231
|
@ -146,7 +146,7 @@ uint32_t BanditHost::read(uint32_t rgn_start, uint32_t offset, int size)
|
|||
if (this->config_addr & BANDIT_CAR_TYPE) { // type 1 configuration command
|
||||
LOG_F(
|
||||
WARNING, "%s: read config cycle type 1 not supported yet %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), BUS_NUM(), DEV_NUM(), FUN_NUM(), offset & 0xFCU
|
||||
this->name.c_str(), BUS_NUM(), DEV_NUM(), FUN_NUM(), REG_NUM() + (offset & 3)
|
||||
);
|
||||
return 0xFFFFFFFFUL; // PCI spec §6.1
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ uint32_t BanditHost::read(uint32_t rgn_start, uint32_t offset, int size)
|
|||
} else {
|
||||
LOG_F(
|
||||
ERROR, "%s err: read attempt from non-existing PCI device ??:%02x.%x @%02x",
|
||||
this->name.c_str(), WHAT_BIT_SET(idsel), FUN_NUM(), offset
|
||||
this->name.c_str(), WHAT_BIT_SET(idsel) + 11, FUN_NUM(), REG_NUM() + (offset & 3)
|
||||
);
|
||||
return 0xFFFFFFFFUL; // PCI spec §6.1
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ uint32_t BanditHost::read(uint32_t rgn_start, uint32_t offset, int size)
|
|||
}
|
||||
LOG_F(ERROR, "%s: attempt to read from unmapped PCI I/O space, offset=0x%X",
|
||||
this->name.c_str(), offset);
|
||||
// FIXME: add machine check exception (DEFAULT CATCH!, code=FFF00200)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0xFFFFFFFFUL; // PCI spec §6.1
|
||||
}
|
||||
|
||||
void BanditHost::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
|
@ -202,7 +202,7 @@ void BanditHost::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int
|
|||
if (this->config_addr & BANDIT_CAR_TYPE) { // type 1 configuration command
|
||||
LOG_F(
|
||||
WARNING, "%s: write config cycle type 1 not supported yet %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), BUS_NUM(), DEV_NUM(), FUN_NUM(), offset & 0xFCU
|
||||
this->name.c_str(), BUS_NUM(), DEV_NUM(), FUN_NUM(), REG_NUM() + (offset & 3)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ void BanditHost::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int
|
|||
} else {
|
||||
LOG_F(
|
||||
ERROR, "%s err: write attempt to non-existing PCI device ??:%02x.%x @%02x",
|
||||
this->name.c_str(), WHAT_BIT_SET(idsel), FUN_NUM(), offset
|
||||
this->name.c_str(), WHAT_BIT_SET(idsel) + 11, FUN_NUM(), REG_NUM() + (offset & 3)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -273,7 +273,7 @@ Bandit::Bandit(int bridge_num, std::string name, int dev_id, int rev)
|
|||
mem_ctrl->add_mmio_region(base_addr, 0x01000000, this);
|
||||
|
||||
// connnect Bandit PCI device
|
||||
this->my_pci_device = unique_ptr<BanditPciDevice>(
|
||||
this->my_pci_device = unique_ptr<BanditPciDevice>(
|
||||
new BanditPciDevice(bridge_num, name, dev_id, rev)
|
||||
);
|
||||
this->pci_register_device(1, this->my_pci_device.get());
|
||||
|
|
|
@ -49,10 +49,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
#define BANDIT_CAR_TYPE (1 << 0) // Bandit config address type bit
|
||||
|
||||
/* Convenient macros for parsing CONFIG_ADDR fields. */
|
||||
#define BUS_NUM() (this->config_addr >> 16) & 0xFFU
|
||||
#define DEV_NUM() (this->config_addr >> 11) & 0x1FU
|
||||
#define FUN_NUM() (this->config_addr >> 8) & 0x07U
|
||||
#define REG_NUM() (this->config_addr ) & 0xFCU
|
||||
#define BUS_NUM() ((this->config_addr >> 16) & 0xFFU)
|
||||
#define DEV_NUM() ((this->config_addr >> 11) & 0x1FU)
|
||||
#define FUN_NUM() ((this->config_addr >> 8) & 0x07U)
|
||||
#define REG_NUM() ((this->config_addr ) & 0xFCU)
|
||||
|
||||
/** Bandit specific configuration registers. */
|
||||
enum {
|
||||
|
|
|
@ -86,6 +86,7 @@ uint32_t MPC106::read(uint32_t rgn_start, uint32_t offset, int size) {
|
|||
}
|
||||
}
|
||||
LOG_F(ERROR, "Attempt to read from unmapped PCI I/O space, offset=0x%X", offset);
|
||||
// FIXME: add machine check exception (DEFAULT CATCH!, code=FFF00200)
|
||||
} else {
|
||||
if (offset >= 0x200000) {
|
||||
if (this->config_addr & 0x80) // process only if bit E (enable) is set
|
||||
|
@ -125,8 +126,8 @@ uint32_t MPC106::pci_read(uint32_t offset, uint32_t size) {
|
|||
int reg_offs = (this->config_addr >> 24) & 0xFC;
|
||||
|
||||
if (bus_num) {
|
||||
LOG_F(ERROR, "%s: read attempt from non-local PCI bus, %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), bus_num, dev_num, fun_num, offset & 0xFCU);
|
||||
LOG_F(ERROR, "%s: read attempt from non-local PCI bus, %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), bus_num, dev_num, fun_num, reg_offs + (offset & 3));
|
||||
return 0xFFFFFFFFUL; // PCI spec §6.1
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@ uint32_t MPC106::pci_read(uint32_t offset, uint32_t size) {
|
|||
return pci_conv_rd_data(result, details);
|
||||
} else {
|
||||
LOG_F(ERROR, "%s: read attempt from non-existing PCI device ??:%02x.%x @%02x",
|
||||
this->name.c_str(), dev_num, fun_num, offset);
|
||||
this->name.c_str(), dev_num, fun_num, reg_offs + (offset & 3));
|
||||
}
|
||||
|
||||
return 0xFFFFFFFFUL; // PCI spec §6.1
|
||||
|
@ -152,8 +153,8 @@ void MPC106::pci_write(uint32_t offset, uint32_t value, uint32_t size) {
|
|||
int reg_offs = (this->config_addr >> 24) & 0xFC;
|
||||
|
||||
if (bus_num) {
|
||||
LOG_F(ERROR, "%s: write attempt to non-local PCI bus, %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), bus_num, dev_num, fun_num, offset & 0xFCU);
|
||||
LOG_F(ERROR, "%s: write attempt to non-local PCI bus, %02x:%02x.%x @%02x",
|
||||
this->name.c_str(), bus_num, dev_num, fun_num, reg_offs + (offset & 3));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -172,7 +173,7 @@ void MPC106::pci_write(uint32_t offset, uint32_t value, uint32_t size) {
|
|||
}
|
||||
} else {
|
||||
LOG_F(ERROR, "%s: write attempt to non-existing PCI device ??:%02x.%x @%02x",
|
||||
this->name.c_str(), dev_num, fun_num, offset);
|
||||
this->name.c_str(), dev_num, fun_num, reg_offs + (offset & 3));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue