From 28e7a806b4dc38b9f8ee8508aeeb39782d9e597f Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 12 Feb 2024 02:38:08 +0100 Subject: [PATCH] grandcentral: use MeshStub on machines without MESH. --- devices/common/scsi/mesh.h | 10 ++++++++++ devices/ioctrl/grandcentral.cpp | 4 +++- devices/ioctrl/macio.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/devices/common/scsi/mesh.h b/devices/common/scsi/mesh.h index 1909bb7..2a5a20b 100644 --- a/devices/common/scsi/mesh.h +++ b/devices/common/scsi/mesh.h @@ -109,6 +109,16 @@ enum SeqState : uint32_t { }; // namespace MeshScsi +class MeshStub : public HWComponent { +public: + MeshStub() = default; + ~MeshStub() = default; + + // registers access + uint8_t read(uint8_t reg_offset) { return 0; }; + void write(uint8_t reg_offset, uint8_t value) {}; +}; + class MeshController : public HWComponent { public: MeshController(uint8_t mesh_id) { diff --git a/devices/ioctrl/grandcentral.cpp b/devices/ioctrl/grandcentral.cpp index 10826b2..9479060 100644 --- a/devices/ioctrl/grandcentral.cpp +++ b/devices/ioctrl/grandcentral.cpp @@ -70,7 +70,9 @@ GrandCentral::GrandCentral() : PCIDevice("mac-io/grandcentral"), InterruptCtrl() // connect MESH (internal SCSI) this->mesh = dynamic_cast(gMachineObj->get_comp_by_name("MeshTnt")); if (this->mesh == nullptr) { - LOG_F(WARNING, "%s: Mesh not found, install MeshStub", this->name.c_str()); + LOG_F(WARNING, "%s: Mesh not found, using MeshStub instead", this->name.c_str()); + this->mesh_stub = std::unique_ptr(new MeshStub()); + this->mesh = dynamic_cast(this->mesh_stub.get()); } else { this->mesh_dma = std::unique_ptr (new DMAChannel()); this->mesh_dma->register_dma_int(this, this->register_dma_int(IntSrc::DMA_SCSI_MESH)); diff --git a/devices/ioctrl/macio.h b/devices/ioctrl/macio.h index 2d2cac1..5db9fac 100644 --- a/devices/ioctrl/macio.h +++ b/devices/ioctrl/macio.h @@ -135,6 +135,7 @@ private: // subdevice objects std::unique_ptr awacs; // AWACS audio codec instance + std::unique_ptr mesh_stub = nullptr; NVram* nvram; // NVRAM module MaceController* mace;