Add has_io_space flag.

PCIDevice
- supports_io_space method now uses a flag has_io_space which is automatically set for PCI bridges or PCI devices that have an I/O BAR.

atirage
- Devices that have I/O BARs don't need a supports_io_space method.

mpc106
- Devices that don't have I/O methods don't need a supports_io_space method.
This commit is contained in:
joevt 2023-02-05 01:03:26 -08:00
parent 99eb93f9e1
commit f61854a0ae
4 changed files with 3 additions and 9 deletions

View File

@ -240,6 +240,7 @@ void PCIDevice::finish_config_bars()
if (bar_cfg & 1) {
bars_typ[bar_num] = (bar_cfg & 0xffff0000) ? PCIBarType::Io_32_Bit :
PCIBarType::Io_16_Bit;
has_io_space = true;
}
else {
int pci_space_type = (bar_cfg >> 1) & 3;

View File

@ -81,7 +81,7 @@ public:
virtual ~PCIDevice() = default;
virtual bool supports_io_space() {
return false;
return has_io_space;
};
/* I/O space access methods */
@ -156,6 +156,7 @@ protected:
uint8_t irq_pin = 0;
uint8_t irq_line = 0;
bool has_io_space = false;
int num_bars = 6;
uint32_t bars[6] = { 0 }; // base address registers
uint32_t bars_cfg[6] = { 0 }; // configuration values for base address registers

View File

@ -92,10 +92,6 @@ protected:
uint32_t pci_cfg_read(uint32_t reg_offs, AccessDetails &details);
void pci_cfg_write(uint32_t reg_offs, uint32_t value, AccessDetails &details);
bool supports_io_space(void) {
return true;
};
void setup_ram(void);
private:

View File

@ -60,10 +60,6 @@ public:
void write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size);
/* PCI device methods */
bool supports_io_space(void) {
return true;
};
uint32_t pci_cfg_read(uint32_t reg_offs, AccessDetails &details);
void pci_cfg_write(uint32_t reg_offs, uint32_t value, AccessDetails &details);