Compare commits

...
9 changed files with 451 additions and 46 deletions

No files matched your search

+1
View File
@@ -37,6 +37,7 @@ enum HWCompType : int {
I2C_DEV = 61, /* I2C device */
ADB_HOST = 70, /* ADB host */
ADB_DEV = 71, /* ADB device */
INT_CTRL = 80, /* interrupt controller */
SND_SERVER = 100, /* host sound server */
};
+15
View File
@@ -45,6 +45,7 @@ ViaCuda::ViaCuda() {
this->via_regs[VIA_DIRB] = 0;
this->via_regs[VIA_DIRA] = 0;
this->via_regs[VIA_IER] = 0;
this->via_regs[VIA_SR] = 0;
this->via_regs[VIA_ACR] = 0;
this->via_regs[VIA_PCR] = 0;
this->via_regs[VIA_IFR] = 0;
@@ -89,6 +90,20 @@ uint8_t ViaCuda::read(int reg) {
case VIA_ANH:
LOG_F(WARNING, "Attempted read from VIA Port A!");
break;
case VIA_T1CL:
res = this->via_regs[VIA_T1CL];
this->via_regs[VIA_IFR] &= ~IFR_T1;
case VIA_T2CL:
res = this->via_regs[VIA_T2CL];
this->via_regs[VIA_IFR] &= ~IFR_T2;
case VIA_SR:
res = this->via_regs[VIA_SR];
this->via_regs[VIA_IFR] &= ~IFR_SR;
case VIA_IFR:
res = this->via_regs[VIA_IFR];
if (this->via_regs[VIA_IFR] & this->via_regs[VIA_IER])
res |= 0x80;
break;
case VIA_IER:
res |= 0x80; /* bit 7 always reads as "1" */
}
+14
View File
@@ -72,6 +72,20 @@ enum {
VIA_ANH = 0x0F, /* input/output register A, no handshake */
};
/** IFR and IER register bits */
enum {
IER_SET = 0x80,
IER_CLR = 0x00,
IFR_CA2 = 0x01,
IFR_CA1 = 0x02,
IFR_SR = 0x04,
IFR_CB2 = 0x08,
IFR_CB1 = 0x10,
IFR_T2 = 0x20,
IFR_T1 = 0x40,
};
/** Cuda communication signals. */
enum {
CUDA_TIP = 0x20, /* transaction in progress: 0 - true, 1 - false */
+92 -3
View File
@@ -61,24 +61,96 @@ AMIC::AMIC()
}
bool AMIC::supports_type(HWCompType type) {
if (type == HWCompType::MMIO_DEV) {
if ((type == HWCompType::MMIO_DEV)
|| (type == HWCompType::INT_CTRL)) {
return true;
} else {
return false;
}
}
uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size)
{
//Interrupt Register
void AMIC::process_interrupt(uint32_t cookie) {
bool confirm_interrupt = false;
uint32_t bit_field = 0;
if (this->int_ctrl_reg & 0x40) {
confirm_interrupt = true;
}
switch (cookie) {
case DEV_ID::VIA_CUDA:
if (this->viacuda->read(VIA_IFR)) {
bit_field = (1 << VIA1_Interrupt);
confirm_interrupt = true;
}
else if (via2_slot_int_enable || via2_int_enable) {
bit_field = (1 << VIA2_Interrupt);
confirm_interrupt = true;
}
break;
case DEV_ID::SCC_B:
case DEV_ID::SCC_A:
bit_field = (1 << SCC_Interrupt);
confirm_interrupt = true;
break;
case DEV_ID::ETHERNET:
bit_field = (1 << Eth_Interrupt);
confirm_interrupt = true;
break;
case DEV_ID::Swim3_DMA:
case DEV_ID::ETHERNET_DMA_OUT:
case DEV_ID::ETHERNET_DMA_IN:
case DEV_ID::SCC_A_DMA_OUT:
case DEV_ID::SCC_A_DMA_IN:
case DEV_ID::SCC_B_DMA_OUT:
case DEV_ID::SCC_B_DMA_IN:
if (dma_int_reg0) {
bit_field = (1 << DMA_Interrupt);
confirm_interrupt = true;
}
break;
case DEV_ID::SOUND_DMA_OUT:
case DEV_ID::SOUND_DMA_IN:
if (dma_int_reg1) {
bit_field = (1 << DMA_Interrupt);
confirm_interrupt = true;
}
break;
case DEV_ID::NMI:
bit_field = (1 << NMI_Interrupt);
confirm_interrupt = true;
break;
}
if (confirm_interrupt)
ack_interrupt(bit_field);
}
uint32_t AMIC::ack_interrupt(uint32_t device_bits) {
bool confirm_interrupt = false;
bool ack_bit = this->int_ctrl_reg & 0x80;
if (device_bits & this->int_ctrl_reg)
confirm_interrupt = true;
if (confirm_interrupt && ack_bit)
ack_cpu_interrupt();
return 0;
}
uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size) {
uint32_t phase_val;
// subdevices registers
switch(offset >> 12) {
case 0: // VIA1 registers
case 1:
process_interrupt(VIA_CUDA);
return this->viacuda->read(offset >> 9);
case 4: // SCC registers
this->escc->read_compat((offset >> 1) & 0xF);
this->process_interrupt(SCC_A);
return 0;
case 0xA: // MACE registers
return this->mace->read((offset >> 4) & 0xF);
@@ -112,6 +184,11 @@ uint32_t AMIC::read(uint32_t reg_start, uint32_t offset, int size)
return 0xFFU; // this value allows the machine to boot normally
case AMICReg::SCSI_DMA_Ctrl:
return this->scsi_dma_cs;
case AMICReg::Int_Ctrl:
if (this->int_ctrl_reg & 0x80) {
ack_cpu_interrupt();
}
return this->int_ctrl_reg;
default:
LOG_F(WARNING, "Unknown AMIC register read, offset=%x", offset);
}
@@ -151,6 +228,7 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
((this->imm_snd_regs[1] & 0xF) << 8) | this->imm_snd_regs[2]
);
}
this->process_interrupt(DEV_ID::DAVBUS);
return;
case AMICReg::Snd_Buf_Size_Hi:
case AMICReg::Snd_Buf_Size_Lo:
@@ -159,6 +237,7 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
((value & 0xFF) << (8 * ((offset & 1) ^1)));
this->snd_buf_size &= ~3; // sound buffer size is always a multiple of 4
LOG_F(9, "AMIC: Sound buffer size set to 0x%X", this->snd_buf_size);
this->process_interrupt(DEV_ID::DAVBUS);
return;
case AMICReg::Snd_Out_Ctrl:
LOG_F(9, "AMIC Sound Out Ctrl updated, val=%x", value);
@@ -182,6 +261,8 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
return;
case AMICReg::Snd_Out_DMA:
this->snd_out_dma->write_dma_out_ctrl(value);
this->dma_int_reg1 |= 0x2;
this->process_interrupt(DEV_ID::SOUND_DMA_OUT);
return;
}
}
@@ -189,15 +270,22 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
switch(offset) {
case AMICReg::VIA2_Slot_IER:
LOG_F(INFO, "AMIC VIA2 Slot Interrupt Enable Register updated, val=%x", value);
via2_slot_int_enable = value;
break;
case AMICReg::VIA2_IER:
LOG_F(INFO, "AMIC VIA2 Interrupt Enable Register updated, val=%x", value);
via2_int_enable = value;
break;
case AMICReg::Video_Mode_Reg:
LOG_F(INFO, "AMIC Video Mode Register set to %x", value);
break;
case AMICReg::Int_Ctrl:
LOG_F(INFO, "AMIC Interrupt Control Register set to %X", value);
if (value & 0x80) {
value &= 0xC0;
ack_cpu_interrupt();
}
this->int_ctrl_reg = value;
break;
case AMICReg::DMA_Base_Addr_0:
case AMICReg::DMA_Base_Addr_1:
@@ -207,6 +295,7 @@ void AMIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size)
this->dma_base = (this->dma_base & ~mask) |
((value & 0xFF) << (8 * (3 - (offset & 3))));
LOG_F(9, "AMIC: DMA base address set to 0x%X", this->dma_base);
this->process_interrupt(DEV_ID::PERCH_DMA);
break;
case AMICReg::Enet_DMA_Xmt_Ctrl:
LOG_F(INFO, "AMIC Ethernet Transmit DMA Ctrl updated, val=%x", value);
+37 -7
View File
@@ -28,6 +28,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/scsi/ncr53c94.h>
#include <devices/common/viacuda.h>
#include <devices/ethernet/mace.h>
#include <devices/ioctrl/interruptctrl.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
@@ -94,13 +95,20 @@ enum AMICReg : uint32_t {
Snd_Out_DMA = 0x14018, // sound output DMA status/control register
// VIA2 registers
VIA2_Slot_INT = 0x26002,
VIA2_Slot_IER = 0x26012,
VIA2_INT = 0x26003,
VIA2_IER = 0x26013,
// Video control registers
Video_Mode_Reg = 0x28000,
// Interrupt registers
Int_Ctrl = 0x2A000,
DMA_Int_0 = 0x2A008,
Bus_Error_Int_0 = 0x2A009,
DMA_Int_1 = 0x2A00A,
Bus_Error_Int_1 = 0x2A00B,
// Undocumented diagnostics register
Diag_Reg = 0x2C000,
@@ -120,13 +128,30 @@ enum AMICReg : uint32_t {
SCC_DMA_Rcv_B_Ctrl = 0x320B8,
};
/** Apple Memory-mapped I/O controller device. */
class AMIC : public MMIODevice {
enum AMICIntReg : uint32_t {
VIA1_Interrupt = 0,
VIA2_Interrupt = 1,
SCC_Interrupt = 2,
Eth_Interrupt = 3,
DMA_Interrupt = 4,
NMI_Interrupt = 5,
INT_Mode = 6,
ACK_Bit = 7,
};
enum {
FDC_PENDING = 0x40,
};
/** Apple Memory-mapped I/O controller device. */
class AMIC : public MMIODevice, public InterruptCtrl {
public:
AMIC();
~AMIC() = default;
bool supports_type(HWCompType type);
void process_interrupt(uint32_t cookie);
uint32_t ack_interrupt(uint32_t device_bits);
/* MMIODevice methods */
uint32_t read(uint32_t reg_start, uint32_t offset, int size);
@@ -138,11 +163,16 @@ protected:
private:
uint8_t imm_snd_regs[4]; // temporary storage for sound control registers
uint32_t dma_base = 0; // DMA physical base address
uint16_t snd_buf_size = 0; // sound buffer size in bytes
uint8_t snd_out_ctrl = 0;
uint32_t dma_base = 0; // DMA physical base address
uint16_t snd_buf_size = 0; // sound buffer size in bytes
uint8_t snd_out_ctrl = 0;
uint8_t scsi_dma_cs = 0; // SCSI DMA control/status register value
uint8_t scsi_dma_cs = 0; // SCSI DMA control/status register value
uint8_t int_ctrl_reg = 0;
uint8_t dma_int_reg0 = 0;
uint8_t dma_int_reg1 = 0;
uint8_t via2_int_enable = 0;
uint8_t via2_slot_int_enable = 0;
// AMIC subdevices instances
std::unique_ptr<Ncr53C94> scsi;
+78 -27
View File
@@ -23,6 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/dbdma.h>
#include <devices/common/viacuda.h>
#include <devices/ioctrl/macio.h>
#include <devices/ioctrl/interruptctrl.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
#include <endianswap.h>
@@ -56,10 +57,40 @@ HeathrowIC::HeathrowIC() : PCIDevice("mac-io/heathrow") {
std::bind(&AwacsScreamer::dma_end, this->screamer.get())
);
this->mesh = std::unique_ptr<MESHController> (new MESHController(HeathrowMESHID));
this->escc = std::unique_ptr<EsccController> (new EsccController());
this->mesh = std::unique_ptr<MESHController> (new MESHController(HeathrowMESHID));
this->escc = std::unique_ptr<EsccController>(new EsccController());
}
uint32_t HeathrowIC::register_device(DEV_ID dev_id){
return (1 << dev_id);
};
void HeathrowIC::process_interrupt(uint32_t cookie) {
bool confirm_interrupt = false;
uint32_t bit_field = 0;
switch (cookie) {
case DEV_ID::SOUND_DMA_OUT:
bit_field = (1 << DEV_ID::SOUND_DMA_OUT);
break;
case DEV_ID::SCSI0:
bit_field = (1 << DEV_ID::SCSI0);
break;
case DEV_ID::VIA_CUDA:
bit_field = (1 << DEV_ID::VIA_CUDA);
break;
case DEV_ID::SWIM3:
bit_field = (1 << DEV_ID::SWIM3);
break;
case DEV_ID::DAVBUS:
bit_field = (1 << DEV_ID::DAVBUS);
break;
}
if (confirm_interrupt)
ack_interrupt(bit_field);
};
uint32_t HeathrowIC::pci_cfg_read(uint32_t reg_offs, uint32_t size) {
return this->pci_cfg_hdr[reg_offs & 0xFF];
}
@@ -93,6 +124,7 @@ uint32_t HeathrowIC::dma_read(uint32_t offset, int size) {
switch (offset >> 8) {
case 8:
res = this->snd_out_dma->reg_read(offset & 0xFF, size);
this->ack_interrupt(DEV_ID::SOUND_DMA_OUT);
break;
default:
LOG_F(WARNING, "Unsupported DMA channel read, offset=0x%X", offset);
@@ -165,6 +197,7 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
break;
case 0x10:
this->mesh->write((offset >> 4) & 0xF, value);
this->process_interrupt(DEV_ID::SCSI0);
break;
case 0x12: // ESCC compatible
this->escc->write_compat((offset >> 4) & 0xF, value);
@@ -174,10 +207,12 @@ void HeathrowIC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int
break;
case 0x14:
this->screamer->snd_ctrl_write(offset - 0x14000, value, size);
this->process_interrupt(DEV_ID::DAVBUS);
break;
case 0x16:
case 0x17:
this->viacuda->write((offset - 0x16000) >> 9, value);
this->process_interrupt(DEV_ID::VIA_CUDA);
break;
default:
if (sub_addr >= 0x60) {
@@ -192,29 +227,37 @@ uint32_t HeathrowIC::mio_ctrl_read(uint32_t offset, int size) {
uint32_t res = 0;
switch (offset & 0xFC) {
case 0x10:
LOG_F(0, "read from MIO:Int_Events2 register \n");
res = this->retrieve_reg(REG_ID::events2);
break;
case 0x14:
LOG_F(9, "read from MIO:Int_Mask2 register \n");
res = this->int_mask2;
LOG_F(0, "read from MIO:Int_Mask2 register \n");
res = this->retrieve_reg(REG_ID::mask2);
break;
case 0x18:
LOG_F(9, "read from MIO:Int_Clear2 register \n");
res = this->int_clear2;
LOG_F(0, "read from MIO:Int_Clear2 register \n");
res = this->retrieve_reg(REG_ID::clear2);
break;
case 0x1C:
LOG_F(9, "read from MIO:Int_Levels2 register \n");
res = this->int_levels2;
LOG_F(0, "read from MIO:Int_Levels2 register \n");
res = this->retrieve_reg(REG_ID::levels2);
break;
case 0x20:
LOG_F(0, "read from MIO:Int_Events1 register \n");
res = this->retrieve_reg(REG_ID::events1);
break;
case 0x24:
LOG_F(9, "read from MIO:Int_Mask1 register \n");
res = this->int_mask1;
LOG_F(0, "read from MIO:Int_Mask1 register \n");
res = this->retrieve_reg(REG_ID::mask1);
break;
case 0x28:
LOG_F(9, "read from MIO:Int_Clear1 register \n");
res = this->int_clear1;
LOG_F(0, "read from MIO:Int_Clear1 register \n");
res = this->retrieve_reg(REG_ID::clear1);
break;
case 0x2C:
LOG_F(9, "read from MIO:Int_Levels1 register \n");
res = this->int_levels1;
LOG_F(0, "read from MIO:Int_Levels1 register \n");
res = this->retrieve_reg(REG_ID::levels1);
break;
case 0x34: /* heathrowIDs / HEATHROW_MBCR (Linux): media bay config reg? */
LOG_F(9, "read from MIO:ID register at Address %x \n", ppc_state.pc);
@@ -234,29 +277,37 @@ uint32_t HeathrowIC::mio_ctrl_read(uint32_t offset, int size) {
void HeathrowIC::mio_ctrl_write(uint32_t offset, uint32_t value, int size) {
switch (offset & 0xFC) {
case 0x10:
LOG_F(0, "write %x to MIO:Int_Events2 register \n", value);
this->update_reg(REG_ID::events2, value);
break;
case 0x14:
LOG_F(9, "write %x to MIO:Int_Mask2 register \n", value);
this->int_mask2 = value;
LOG_F(0, "write %x to MIO:Int_Mask2 register \n", value);
this->update_reg(REG_ID::mask2, value);
break;
case 0x18:
LOG_F(9, "write %x to MIO:Int_Clear2 register \n", value);
this->int_clear2 = value;
LOG_F(0, "write %x to MIO:Int_Clear2 register \n", value);
this->update_reg(REG_ID::clear2, value);
break;
case 0x1C:
LOG_F(9, "write %x to MIO:Int_Levels2 register \n", value);
this->int_levels2 = value;
LOG_F(0, "write %x to MIO:Int_Levels2 register \n", value);
this->update_reg(REG_ID::levels2, value);
break;
case 0x20:
LOG_F(0, "write %x to MIO:Int_Events1 register \n", value);
this->update_reg(REG_ID::events1, value);
break;
case 0x24:
LOG_F(9, "write %x to MIO:Int_Mask1 register \n", value);
this->int_mask1 = value;
LOG_F(0, "write %x to MIO:Int_Mask1 register \n", value);
this->update_reg(REG_ID::mask1, value);
break;
case 0x28:
LOG_F(9, "write %x to MIO:Int_Clear1 register \n", value);
this->int_clear1 = value;
LOG_F(0, "write %x to MIO:Int_Clear1 register \n", value);
this->update_reg(REG_ID::clear1, value);
break;
case 0x2C:
LOG_F(9, "write %x to MIO:Int_Levels1 register \n", value);
this->int_levels1 = value;
LOG_F(0, "write %x to MIO:Int_Levels1 register \n", value);
this->update_reg(REG_ID::levels1, value);
break;
case 0x34:
LOG_F(WARNING, "Attempted to write %x to MIO:ID at %x; Address : %x \n", value, offset, ppc_state.pc);
@@ -276,7 +327,7 @@ void HeathrowIC::mio_ctrl_write(uint32_t offset, uint32_t value, int size) {
void HeathrowIC::feature_control(const uint32_t value)
{
LOG_F(9, "write %x to MIO:Feat_Ctrl register \n", value);
LOG_F(0, "write %x to MIO:Feat_Ctrl register \n", value);
this->feat_ctrl = value;
+108
View File
@@ -0,0 +1,108 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-21 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <cpu/ppc/ppcemu.h>
#include <devices/ioctrl/interruptctrl.h>
#include <cinttypes>
#include <string>
#include <loguru.hpp>
using namespace std;
InterruptCtrl::InterruptCtrl() {
}
void InterruptCtrl::update_reg(REG_ID retrieve_reg, uint32_t bit_setting) {
switch (retrieve_reg) {
case mask1:
int_mask1 = bit_setting;
break;
case clear1:
int_clear1 = bit_setting;
int_events1 &= ~int_clear1;
break;
case events1:
int_events1 = bit_setting;
break;
case levels1:
int_levels1 = bit_setting;
break;
case mask2:
int_mask2 = bit_setting;
break;
case clear2:
int_clear2 = bit_setting;
int_events2 &= ~int_clear2;
break;
case events2:
int_events2 = bit_setting;
break;
case levels2:
int_levels2 = bit_setting;
break;
}
}
uint32_t InterruptCtrl::retrieve_reg(REG_ID retrieve_reg) {
switch (retrieve_reg) {
case mask1:
return int_mask1;
break;
case clear1:
return int_clear1;
break;
case events1:
return int_events1;
break;
case levels1:
return int_levels1;
break;
case mask2:
return int_mask2;
break;
case clear2:
return int_clear2;
break;
case events2:
return int_events2;
break;
case levels2:
return int_levels2;
break;
}
}
uint32_t InterruptCtrl::ack_interrupt(uint32_t device_bits) {
bool confirm_interrupt = false;
int_events1 |= device_bits;
if (int_events1 & int_mask1)
confirm_interrupt = true;
if (confirm_interrupt)
ack_cpu_interrupt();
return 0;
}
void InterruptCtrl::ack_cpu_interrupt() {
ppc_exception_handler(Except_Type::EXC_EXT_INT, 0x0);
}
+97
View File
@@ -0,0 +1,97 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-21 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef HWINTERRUPT_H
#define HWINTERRUPT_H
#include <devices/common/hwcomponent.h>
#include <cinttypes>
#include <memory>
enum DEV_ID {
SCSI_DMA = 0,
Swim3_DMA = 1,
IDE0_DMA = 2,
IDE1_DMA = 3,
SCC_A_DMA_OUT = 4,
SCC_A_DMA_IN = 5,
SCC_B_DMA_OUT = 6,
SCC_B_DMA_IN = 7,
SOUND_DMA_OUT = 8,
SOUND_DMA_IN = 9,
VIDEO_OUT = 10,
VIDEO_IN = 11,
SCSI0 = 12,
IDE0 = 13,
IDE1 = 14,
SCC_A = 15,
SCC_B = 16,
DAVBUS = 17,
VIA_CUDA = 18,
SWIM3 = 19,
NMI = 20,
PERCH_DMA = 21,
PERCH = 22,
ETHERNET_DMA_OUT = 23,
ETHERNET_DMA_IN = 24,
ETHERNET = 25,
SCSI1 = 26,
};
enum REG_ID {
mask1 = 0,
clear1 = 1,
events1 = 2,
levels1 = 3,
mask2 = 4,
clear2 = 5,
events2 = 6,
levels2 = 7,
};
class InterruptCtrl {
public:
InterruptCtrl();
~InterruptCtrl() = default;
uint32_t ack_interrupt(uint32_t device_bits);
virtual uint32_t register_device(DEV_ID dev_id){
return 0;
};
void update_reg(REG_ID retrieve_reg, uint32_t bit_setting);
uint32_t retrieve_reg(REG_ID retrieve_reg);
void ack_cpu_interrupt();
protected:
uint32_t int_events1 = 0;
uint32_t int_mask1 = 0;
uint32_t int_clear1 = 0;
uint32_t int_levels1 = 0;
uint32_t int_events2 = 0;
uint32_t int_mask2 = 0;
uint32_t int_clear2 = 0;
uint32_t int_levels2 = 0;
};
#endif /* HWINTERRUPT_H */
+9 -9
View File
@@ -59,6 +59,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/pci/pcihost.h>
#include <devices/common/scsi/mesh.h>
#include <devices/common/viacuda.h>
#include <devices/ioctrl/interruptctrl.h>
#include <devices/memctrl/memctrlbase.h>
#include <devices/serial/escc.h>
#include <devices/sound/awacs.h>
@@ -92,13 +93,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
VIA-CUDA register space: 0x00016000, size: 0x00002000
*/
class HeathrowIC : public PCIDevice {
class HeathrowIC : public PCIDevice,
public InterruptCtrl {
public:
HeathrowIC();
~HeathrowIC() = default;
bool supports_type(HWCompType type) {
return type == HWCompType::MMIO_DEV;
return (type == HWCompType::MMIO_DEV) || (type == HWCompType::INT_CTRL);
};
/* PCI device methods */
@@ -113,6 +116,9 @@ public:
uint32_t read(uint32_t reg_start, uint32_t offset, int size);
void write(uint32_t reg_start, uint32_t offset, uint32_t value, int size);
uint32_t register_device(DEV_ID dev_id);
void process_interrupt(uint32_t cookie);
protected:
uint32_t dma_read(uint32_t offset, int size);
void dma_write(uint32_t offset, uint32_t value, int size);
@@ -142,13 +148,7 @@ private:
0x00,
0x00 // unknown defaults
};
uint32_t int_mask2 = 0;
uint32_t int_clear2 = 0;
uint32_t int_levels2 = 0;
uint32_t int_mask1 = 0;
uint32_t int_clear1 = 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