diff --git a/devices/ioctrl/grandcentral.cpp b/devices/ioctrl/grandcentral.cpp index d93336b..10826b2 100644 --- a/devices/ioctrl/grandcentral.cpp +++ b/devices/ioctrl/grandcentral.cpp @@ -77,8 +77,11 @@ GrandCentral::GrandCentral() : PCIDevice("mac-io/grandcentral"), InterruptCtrl() this->mesh->set_dma_channel(this->mesh_dma.get()); } - // connect SCSI HW - this->scsi_0 = dynamic_cast(gMachineObj->get_comp_by_name("Sc53C94")); + // connect external SCSI controller (Curio) to its DMA channel + this->ext_scsi = dynamic_cast(gMachineObj->get_comp_by_name("Sc53C94")); + this->ext_scsi_dma = std::unique_ptr (new DMAChannel()); + this->ext_scsi_dma->register_dma_int(this, this->register_dma_int(IntSrc::DMA_SCSI_CURIO)); + this->ext_scsi->set_dma_channel(this->ext_scsi_dma.get()); // connect Ethernet HW this->mace = dynamic_cast(gMachineObj->get_comp_by_name("Mace")); @@ -112,7 +115,7 @@ uint32_t GrandCentral::read(uint32_t rgn_start, uint32_t offset, int size) switch (subdev_num) { case 0: // Curio SCSI - return this->scsi_0->read((offset >> 4) & 0xF); + return this->ext_scsi->read((offset >> 4) & 0xF); case 1: // MACE return this->mace->read((offset >> 4) & 0x1F); case 2: // ESCC compatible addressing @@ -153,6 +156,8 @@ uint32_t GrandCentral::read(uint32_t rgn_start, uint32_t offset, int size) unsigned subdev_num = (offset >> 8) & 0xF; switch (subdev_num) { + case 0: + return this->ext_scsi_dma->reg_read(offset & 0xFF, size); case 1: return this->floppy_dma->reg_read(offset & 0xFF, size); case 8: @@ -189,7 +194,7 @@ void GrandCentral::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in switch (subdev_num) { case 0: // Curio SCSI - this->scsi_0->write((offset >> 4) & 0xF, value); + this->ext_scsi->write((offset >> 4) & 0xF, value); break; case 1: // MACE registers this->mace->write((offset >> 4) & 0x1F, value); @@ -251,6 +256,9 @@ void GrandCentral::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in unsigned subdev_num = (offset >> 8) & 0xF; switch (subdev_num) { + case 0: + this->ext_scsi_dma->reg_write(offset & 0xFF, value, size); + break; case 1: this->floppy_dma->reg_write(offset & 0xFF, value, size); break; diff --git a/devices/ioctrl/macio.h b/devices/ioctrl/macio.h index 431e3ee..2d2cac1 100644 --- a/devices/ioctrl/macio.h +++ b/devices/ioctrl/macio.h @@ -136,14 +136,15 @@ private: // subdevice objects std::unique_ptr awacs; // AWACS audio codec instance - NVram* nvram; // NVRAM module + NVram* nvram; // NVRAM module MaceController* mace; - ViaCuda* viacuda; // VIA cell with Cuda MCU attached to it - EsccController* escc; // ESCC serial controller - MeshController* mesh; // internal SCSI (fast) - Sc53C94* scsi_0; // external SCSI (slow) - Swim3::Swim3Ctrl* swim3; // floppy disk controller + ViaCuda* viacuda; // VIA cell with Cuda MCU attached to it + EsccController* escc; // ESCC serial controller + MeshController* mesh; // internal SCSI (fast) + Sc53C94* ext_scsi; // external SCSI (slow) + Swim3::Swim3Ctrl* swim3; // floppy disk controller + std::unique_ptr ext_scsi_dma; std::unique_ptr mesh_dma; std::unique_ptr snd_out_dma; std::unique_ptr floppy_dma;