From c3939e3b25466cd497ec2247dbcc80fad84d2c10 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Wed, 20 Jul 2022 20:08:37 +0200 Subject: [PATCH] Gossamer: factory test control. --- devices/ioctrl/heathrow.cpp | 14 +++++++++----- devices/ioctrl/macio.h | 14 ++++++++++++-- machines/machinegossamer.cpp | 2 ++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/devices/ioctrl/heathrow.cpp b/devices/ioctrl/heathrow.cpp index bd8bb0a..80a5622 100644 --- a/devices/ioctrl/heathrow.cpp +++ b/devices/ioctrl/heathrow.cpp @@ -83,6 +83,9 @@ HeathrowIC::HeathrowIC() : PCIDevice("mac-io/heathrow"), InterruptCtrl() // connect floppy disk HW this->swim3 = dynamic_cast(gMachineObj->get_comp_by_name("Swim3")); + + // set EMMO pin status (active low) + this->emmo_pin = GET_BIN_PROP("emmo") ^ 1; } void HeathrowIC::notify_bar_change(int bar_num) @@ -234,11 +237,12 @@ uint32_t HeathrowIC::mio_ctrl_read(uint32_t offset, int size) { case MIO_INT_LEVELS1: res = this->int_levels1; break; - case 0x34: /* heathrowIDs / HEATHROW_MBCR (Linux): media bay config reg? */ + case MIO_HEAT_ID: LOG_F(9, "read from MIO:ID register at Address %x \n", ppc_state.pc); - res = this->macio_id; + res = (this->fp_id << 24) | (this->mon_id << 16) | (this->mb_id << 8) | + (this->cpu_id | this->emmo_pin); break; - case 0x38: + case MIO_HEAT_FEAT_CTRL: LOG_F(9, "read from MIO:Feat_Ctrl register \n"); res = this->feat_ctrl; break; @@ -274,10 +278,10 @@ void HeathrowIC::mio_ctrl_write(uint32_t offset, uint32_t value, int size) { this->int_events1 &= BYTESWAP_32(value); } break; - case 0x34: + case MIO_HEAT_ID: LOG_F(WARNING, "Attempted to write %x to MIO:ID at %x; Address : %x \n", value, offset, ppc_state.pc); break; - case 0x38: + case MIO_HEAT_FEAT_CTRL: this->feature_control(BYTESWAP_32(value)); break; case 0x3C: diff --git a/devices/ioctrl/macio.h b/devices/ioctrl/macio.h index 7ad2c1e..2011b76 100644 --- a/devices/ioctrl/macio.h +++ b/devices/ioctrl/macio.h @@ -155,6 +155,12 @@ private: VIA-CUDA register space: 0x00016000, size: 0x00002000 */ +/** Heathrow specific registers. */ +enum { + MIO_HEAT_ID = 0x34, // IDs register + MIO_HEAT_FEAT_CTRL = 0x38, // feature control register +}; + class HeathrowIC : public PCIDevice, public InterruptCtrl { public: HeathrowIC(); @@ -193,13 +199,17 @@ private: uint32_t int_events1 = 0; uint32_t int_mask1 = 0; uint32_t int_levels1 = 0; - uint32_t macio_id = 0xF0700008UL; uint32_t feat_ctrl = 0; // features control register uint32_t aux_ctrl = 0; // aux features control register + uint8_t cpu_id = 0xE0; // CPUID field (LSB of the MIO_HEAT_ID) + uint8_t mb_id = 0x70; // Media Bay ID (bits 15:8 of the MIO_HEAT_ID) + uint8_t mon_id = 0x10; // Monitor ID (bits 23:16 of the MIO_HEAT_ID) + uint8_t fp_id = 0x70; // Flat panel ID (MSB of the MIO_HEAT_ID) + uint8_t emmo_pin; // factory tester status, active low + // subdevice objects std::unique_ptr screamer; // Screamer audio codec instance - //std::unique_ptr mesh; // MESH SCSI cell instance NVram* nvram; // NVRAM ViaCuda* viacuda; // VIA cell with Cuda MCU attached to it diff --git a/machines/machinegossamer.cpp b/machines/machinegossamer.cpp index 4b6e50b..a7dbb50 100644 --- a/machines/machinegossamer.cpp +++ b/machines/machinegossamer.cpp @@ -102,6 +102,8 @@ static const PropMap gossamer_settings = { new IntProperty( 0, vector({0, 8, 16, 32, 64, 128, 256}))}, {"rambank3_size", new IntProperty( 0, vector({0, 8, 16, 32, 64, 128, 256}))}, + {"emmo", + new BinProperty(0)}, }; static vector pmg3_devices = {