pci: Replace pci_name with get_name.

It's redundant to have two names.
This commit is contained in:
joevt
2024-04-19 03:49:31 -07:00
committed by dingusdev
parent 6154b7cbe2
commit 9a2303c495
6 changed files with 13 additions and 15 deletions

View File

@@ -122,7 +122,7 @@ void BanditPciDevice::verbose_address_space()
return; return;
} }
LOG_F(INFO, "%s address spaces:", this->pci_name.c_str()); LOG_F(INFO, "%s address spaces:", this->get_name().c_str());
// verbose coarse aka 256MB memory regions // verbose coarse aka 256MB memory regions
for (mask = 0x10000, bit_pos = 0; mask != 0x80000000UL; mask <<= 1, bit_pos++) { for (mask = 0x10000, bit_pos = 0; mask != 0x80000000UL; mask <<= 1, bit_pos++) {

View File

@@ -32,7 +32,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
PCIBase::PCIBase(std::string name, PCIHeaderType hdr_type, int num_bars) PCIBase::PCIBase(std::string name, PCIHeaderType hdr_type, int num_bars)
{ {
this->name = name; this->name = name;
this->pci_name = name;
this->hdr_type = hdr_type; this->hdr_type = hdr_type;
this->num_bars = num_bars; this->num_bars = num_bars;
@@ -162,17 +161,17 @@ int PCIBase::attach_exp_rom_image(const std::string img_path)
if (exp_rom_image_size == this->exp_rom_size) { if (exp_rom_image_size == this->exp_rom_size) {
LOG_F(INFO, "%s: loaded expansion rom (%d bytes).", LOG_F(INFO, "%s: loaded expansion rom (%d bytes).",
this->pci_name.c_str(), this->exp_rom_size); this->get_name().c_str(), this->exp_rom_size);
} }
else { else {
LOG_F(WARNING, "%s: loaded expansion rom (%d bytes adjusted to %d bytes).", LOG_F(WARNING, "%s: loaded expansion rom (%d bytes adjusted to %d bytes).",
this->pci_name.c_str(), (int)exp_rom_image_size, this->exp_rom_size); this->get_name().c_str(), (int)exp_rom_image_size, this->exp_rom_size);
} }
this->exp_bar_cfg = ~(this->exp_rom_size - 1); this->exp_bar_cfg = ~(this->exp_rom_size - 1);
} }
catch (const std::exception& exc) { catch (const std::exception& exc) {
LOG_F(ERROR, "%s: %s", this->pci_name.c_str(), exc.what()); LOG_F(ERROR, "%s: %s", this->get_name().c_str(), exc.what());
result = -1; result = -1;
} }
@@ -192,7 +191,7 @@ void PCIBase::set_bar_value(int bar_num, uint32_t value)
case PCIBarType::Io_32_Bit: case PCIBarType::Io_32_Bit:
this->bars[bar_num] = (value & bar_cfg & ~3) | (bar_cfg & 3); this->bars[bar_num] = (value & bar_cfg & ~3) | (bar_cfg & 3);
if (value != 0xFFFFFFFFUL && (value & ~3) != (value & bar_cfg & ~3)) { if (value != 0xFFFFFFFFUL && (value & ~3) != (value & bar_cfg & ~3)) {
LOG_F(ERROR, "%s: BAR %d cannot be 0x%08x (set to 0x%08x)", this->pci_name.c_str(), bar_num, (value & ~3), (value & bar_cfg & ~3)); LOG_F(ERROR, "%s: BAR %d cannot be 0x%08x (set to 0x%08x)", this->get_name().c_str(), bar_num, (value & ~3), (value & bar_cfg & ~3));
} }
break; break;
@@ -201,7 +200,7 @@ void PCIBase::set_bar_value(int bar_num, uint32_t value)
case PCIBarType::Mem_64_Bit_Lo: case PCIBarType::Mem_64_Bit_Lo:
this->bars[bar_num] = (value & bar_cfg & ~0xF) | (bar_cfg & 0xF); this->bars[bar_num] = (value & bar_cfg & ~0xF) | (bar_cfg & 0xF);
if (value != 0xFFFFFFFFUL && (value & ~0xF) != (value & bar_cfg & ~0xF)) { if (value != 0xFFFFFFFFUL && (value & ~0xF) != (value & bar_cfg & ~0xF)) {
LOG_F(ERROR, "%s: BAR %d cannot be 0x%08x (set to 0x%08x)", this->pci_name.c_str(), bar_num, (value & ~0xF), (value & bar_cfg & ~0xF)); LOG_F(ERROR, "%s: BAR %d cannot be 0x%08x (set to 0x%08x)", this->get_name().c_str(), bar_num, (value & ~0xF), (value & bar_cfg & ~0xF));
} }
break; break;
@@ -239,11 +238,11 @@ void PCIBase::finish_config_bars()
case 2: case 2:
if (bar_num >= num_bars - 1) { if (bar_num >= num_bars - 1) {
ABORT_F("%s: BAR %d cannot be 64-bit", ABORT_F("%s: BAR %d cannot be 64-bit",
this->pci_name.c_str(), bar_num); this->get_name().c_str(), bar_num);
} }
else if (this->bars_cfg[bar_num+1] == 0) { else if (this->bars_cfg[bar_num+1] == 0) {
ABORT_F("%s: 64-bit BAR %d has zero for upper 32 bits", ABORT_F("%s: 64-bit BAR %d has zero for upper 32 bits",
this->pci_name.c_str(), bar_num); this->get_name().c_str(), bar_num);
} }
else { else {
bars_typ[bar_num++] = PCIBarType::Mem_64_Bit_Lo; bars_typ[bar_num++] = PCIBarType::Mem_64_Bit_Lo;
@@ -252,7 +251,7 @@ void PCIBase::finish_config_bars()
break; break;
default: default:
ABORT_F("%s: invalid or unsupported PCI space type %d for BAR %d", ABORT_F("%s: invalid or unsupported PCI space type %d for BAR %d",
this->pci_name.c_str(), pci_space_type, bar_num); this->get_name().c_str(), pci_space_type, bar_num);
} // switch pci_space_type } // switch pci_space_type
} }
} // for bar_num } // for bar_num

View File

@@ -142,7 +142,6 @@ protected:
void map_exp_rom_mem(); void map_exp_rom_mem();
void unmap_exp_rom_mem(); void unmap_exp_rom_mem();
std::string pci_name; // human-readable device name
PCIHost* host_instance; // host bridge instance to call back PCIHost* host_instance; // host bridge instance to call back
// PCI configuration space state (type 0, 1, and 2) // PCI configuration space state (type 0, 1, and 2)

View File

@@ -166,7 +166,7 @@ void GrandCentral::notify_bar_change(int bar_num)
} }
this->base_addr = this->bars[0] & 0xFFFFFFF0UL; this->base_addr = this->bars[0] & 0xFFFFFFF0UL;
this->host_instance->pci_register_mmio_region(this->base_addr, 0x20000, this); this->host_instance->pci_register_mmio_region(this->base_addr, 0x20000, this);
LOG_F(INFO, "%s: base address set to 0x%X", this->pci_name.c_str(), this->base_addr); LOG_F(INFO, "%s: base address set to 0x%X", this->get_name().c_str(), this->base_addr);
} }
} }

View File

@@ -114,7 +114,7 @@ void HeathrowIC::notify_bar_change(int bar_num)
} }
this->base_addr = this->bars[0] & 0xFFFFFFF0UL; this->base_addr = this->bars[0] & 0xFFFFFFF0UL;
this->host_instance->pci_register_mmio_region(this->base_addr, 0x80000, this); this->host_instance->pci_register_mmio_region(this->base_addr, 0x80000, this);
LOG_F(INFO, "%s: base address set to 0x%X", this->pci_name.c_str(), this->base_addr); LOG_F(INFO, "%s: base address set to 0x%X", this->get_name().c_str(), this->base_addr);
} }
} }

View File

@@ -77,11 +77,11 @@ void OHare::notify_bar_change(int bar_num)
if (this->base_addr != (this->bars[bar_num] & 0xFFFFFFF0UL)) { if (this->base_addr != (this->bars[bar_num] & 0xFFFFFFF0UL)) {
if (this->base_addr) { if (this->base_addr) {
LOG_F(WARNING, "%s: deallocating I/O memory not implemented", LOG_F(WARNING, "%s: deallocating I/O memory not implemented",
this->pci_name.c_str()); this->get_name().c_str());
} }
this->base_addr = this->bars[0] & 0xFFFFFFF0UL; this->base_addr = this->bars[0] & 0xFFFFFFF0UL;
this->host_instance->pci_register_mmio_region(this->base_addr, 0x80000, this); this->host_instance->pci_register_mmio_region(this->base_addr, 0x80000, this);
LOG_F(INFO, "%s: base address set to 0x%X", this->pci_name.c_str(), this->base_addr); LOG_F(INFO, "%s: base address set to 0x%X", this->get_name().c_str(), this->base_addr);
} }
} }