mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-10 13:29:38 +00:00
bandit: self-registration with the device registry.
This commit is contained in:
parent
2dfc160e30
commit
41a314d6d6
@ -21,7 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
/** Bandit ARBus-to-PCI Bridge emulation. */
|
||||
|
||||
#include "bandit.h"
|
||||
#include <devices/common/pci/bandit.h>
|
||||
#include <devices/deviceregistry.h>
|
||||
#include <devices/memctrl/memctrlbase.h>
|
||||
#include <endianswap.h>
|
||||
#include <loguru.hpp>
|
||||
@ -32,6 +33,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Bandit::Bandit(int bridge_num, std::string name) : PCIHost(), PCIDevice(name)
|
||||
{
|
||||
supports_types(HWCompType::PCI_HOST | HWCompType::PCI_DEV);
|
||||
|
||||
this->base_addr = 0xF0000000 + ((bridge_num & 3) << 25);
|
||||
|
||||
MemCtrlBase *mem_ctrl = dynamic_cast<MemCtrlBase *>
|
||||
@ -222,3 +225,9 @@ void Bandit::verbose_address_space()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const DeviceDescription Bandit1_Descriptor = {
|
||||
Bandit::create_first, {}, {}
|
||||
};
|
||||
|
||||
REGISTER_DEVICE(Bandit1, Bandit1_Descriptor);
|
||||
|
@ -33,6 +33,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <devices/common/pci/pcihost.h>
|
||||
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
@ -53,9 +54,9 @@ public:
|
||||
Bandit(int bridge_num, std::string name);
|
||||
~Bandit() = default;
|
||||
|
||||
bool supports_type(HWCompType type) {
|
||||
return (type == HWCompType::PCI_HOST || type == HWCompType::PCI_DEV);
|
||||
};
|
||||
static std::unique_ptr<HWComponent> create_first() {
|
||||
return std::unique_ptr<Bandit>(new Bandit(1, "Bandit-PCI1"));
|
||||
}
|
||||
|
||||
uint32_t pci_cfg_read(uint32_t reg_offs, uint32_t size);
|
||||
void pci_cfg_write(uint32_t reg_offs, uint32_t value, uint32_t size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user