macio: fix SWIM3 register space accesses.

This commit is contained in:
Maxim Poliakovski 2022-06-13 23:15:48 +02:00
parent 913944c607
commit 5668fc161f
4 changed files with 23 additions and 10 deletions

View File

@ -22,6 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <cpu/ppc/ppcemu.h>
#include <devices/common/scsi/sc53c94.h>
#include <devices/ethernet/mace.h>
#include <devices/floppy/swim3.h>
#include <devices/ioctrl/macio.h>
#include <devices/serial/escc.h>
#include <endianswap.h>
@ -67,6 +68,9 @@ GrandCentral::GrandCentral() : PCIDevice("mac-io/grandcentral"), InterruptCtrl()
this->scsi_0 = std::unique_ptr<Sc53C94> (new Sc53C94());
gMachineObj->add_subdevice("Curio_SCSI0", this->scsi_0.get());
this->swim3 = std::unique_ptr<Swim3::Swim3Ctrl> (new Swim3::Swim3Ctrl());
gMachineObj->add_subdevice("SWIM3", this->swim3.get());
}
void GrandCentral::notify_bar_change(int bar_num)
@ -103,6 +107,8 @@ uint32_t GrandCentral::read(uint32_t reg_start, uint32_t offset, int size)
return this->escc->read((offset >> 4) & 0xF);
case 4: // AWACS
return this->awacs->snd_ctrl_read(offset & 0xFF, size);
case 5: // SWIM3
return this->swim3->read((offset >> 4) & 0xF);
case 6:
case 7: // VIA-CUDA
return this->viacuda->read((offset >> 9) & 0xF);
@ -163,6 +169,9 @@ void GrandCentral::write(uint32_t reg_start, uint32_t offset, uint32_t value, in
case 4: // AWACS
this->awacs->snd_ctrl_write(offset & 0xFF, value, size);
break;
case 5:
this->swim3->write((offset >> 4) & 0xF, value);
break;
case 6:
case 7: // VIA-CUDA
this->viacuda->write((offset >> 9) & 0xF, value);

View File

@ -76,7 +76,10 @@ HeathrowIC::HeathrowIC() : PCIDevice("mac-io/heathrow"), InterruptCtrl()
this->mesh = std::unique_ptr<MESHController> (new MESHController(HeathrowMESHID));
this->escc = std::unique_ptr<EsccController> (new EsccController());
// intialize floppy disk HW
this->swim3 = std::unique_ptr<Swim3::Swim3Ctrl> (new Swim3::Swim3Ctrl());
gMachineObj->add_subdevice("SWIM3", this->swim3.get());
}
void HeathrowIC::notify_bar_change(int bar_num)
@ -147,7 +150,7 @@ uint32_t HeathrowIC::read(uint32_t reg_start, uint32_t offset, int size) {
res = this->screamer->snd_ctrl_read(offset - 0x14000, size);
break;
case 0x15: // SWIM3
return this->swim3->read(offset & 0xF);
return this->swim3->read((offset >> 4 )& 0xF);
case 0x16:
case 0x17:
res = this->viacuda->read((offset - 0x16000) >> 9);
@ -190,8 +193,8 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
case 0x14:
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);
break;
case 0x15:
this->swim3->write(offset & 0xF, value);
case 0x15: // SWIM3
this->swim3->write((offset >> 4) & 0xF, value);
break;
case 0x16:
case 0x17:

View File

@ -113,12 +113,13 @@ private:
uint32_t nvram_addr_hi;
// device cells
std::unique_ptr<MaceController> mace;
std::unique_ptr<AwacsScreamer> awacs; // AWACS audio codec instance
std::unique_ptr<ViaCuda> viacuda; // VIA cell with Cuda MCU attached to it
std::unique_ptr<NVram> nvram; // NVRAM module
std::unique_ptr<EsccController> escc; // ESCC serial controller
std::unique_ptr<Sc53C94> scsi_0; // external SCSI
std::unique_ptr<MaceController> mace;
std::unique_ptr<AwacsScreamer> awacs; // AWACS audio codec instance
std::unique_ptr<ViaCuda> viacuda; // VIA cell with Cuda MCU attached to it
std::unique_ptr<NVram> nvram; // NVRAM module
std::unique_ptr<EsccController> escc; // ESCC serial controller
std::unique_ptr<Sc53C94> scsi_0; // external SCSI
std::unique_ptr<Swim3::Swim3Ctrl> swim3; // floppy disk controller
std::unique_ptr<DMAChannel> snd_out_dma;
};

View File

@ -72,7 +72,7 @@ int create_gossamer(std::string& id) {
MPC106* grackle_obj = dynamic_cast<MPC106*>(gMachineObj->get_comp_by_name("Grackle"));
/* add the machine ID register */
gMachineObj->add_component("MachineID", new GossamerID(0x3d8c));
gMachineObj->add_component("MachineID", new GossamerID(0xBF3D));
grackle_obj->add_mmio_region(
0xFF000004, 4096, dynamic_cast<MMIODevice*>(gMachineObj->get_comp_by_name("MachineID")));