From 5f8a927846802e170fd45ff1931ed408aad00837 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Sun, 17 Jul 2022 05:35:17 +0200 Subject: [PATCH] platinum: self-registration with the device registry. --- devices/memctrl/platinum.cpp | 9 +++++++++ devices/memctrl/platinum.h | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/devices/memctrl/platinum.cpp b/devices/memctrl/platinum.cpp index 1d03669..5dfe0af 100644 --- a/devices/memctrl/platinum.cpp +++ b/devices/memctrl/platinum.cpp @@ -21,6 +21,7 @@ along with this program. If not, see . /** Platinum Memory/Display Controller emulation. */ +#include #include #include #include @@ -34,6 +35,8 @@ PlatinumCtrl::PlatinumCtrl() : MemCtrlBase() { this->name = "Platinum Memory Controller"; + supports_types(HWCompType::MEM_CTRL | HWCompType::MMIO_DEV); + // add MMIO region for the configuration and status registers add_mmio_region(0xF8000000, 0x500, this); @@ -196,3 +199,9 @@ void PlatinumCtrl::map_phys_ram() ABORT_F("Platinum: could not allocate RAM storage"); } } + +static const DeviceDescription Platinum_Descriptor = { + PlatinumCtrl::create, {}, {} +}; + +REGISTER_DEVICE(Platinum, Platinum_Descriptor); diff --git a/devices/memctrl/platinum.h b/devices/memctrl/platinum.h index c83e9a4..c493ad9 100644 --- a/devices/memctrl/platinum.h +++ b/devices/memctrl/platinum.h @@ -160,8 +160,8 @@ public: PlatinumCtrl(); ~PlatinumCtrl() = default; - bool supports_type(HWCompType type) { - return (type == HWCompType::MEM_CTRL || type == HWCompType::MMIO_DEV); + static std::unique_ptr create() { + return std::unique_ptr(new PlatinumCtrl()); } /* MMIODevice methods */