mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
Improve SCSI bus registration.
This commit is contained in:
parent
586828b375
commit
f809124a2e
@ -34,7 +34,7 @@ using namespace MeshScsi;
|
||||
|
||||
int MeshController::device_postinit()
|
||||
{
|
||||
this->bus_obj = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("SCSI0"));
|
||||
this->bus_obj = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("Scsi0"));
|
||||
|
||||
this->int_ctrl = dynamic_cast<InterruptCtrl*>(
|
||||
gMachineObj->get_comp_by_type(HWCompType::INT_CTRL));
|
||||
|
@ -42,7 +42,7 @@ Sc53C94::Sc53C94(uint8_t chip_id, uint8_t my_id) : ScsiDevice(my_id)
|
||||
|
||||
int Sc53C94::device_postinit()
|
||||
{
|
||||
this->bus_obj = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("SCSI0"));
|
||||
this->bus_obj = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("Scsi0"));
|
||||
this->bus_obj->register_device(7, static_cast<ScsiDevice*>(this));
|
||||
|
||||
this->int_ctrl = dynamic_cast<InterruptCtrl*>(
|
||||
|
@ -196,9 +196,17 @@ protected:
|
||||
/** This class provides a higher level abstraction for the SCSI bus. */
|
||||
class ScsiBus : public HWComponent {
|
||||
public:
|
||||
ScsiBus();
|
||||
ScsiBus(const std::string name);
|
||||
~ScsiBus() = default;
|
||||
|
||||
static std::unique_ptr<HWComponent> create_first() {
|
||||
return std::unique_ptr<ScsiBus>(new ScsiBus("SCSIO"));
|
||||
}
|
||||
|
||||
static std::unique_ptr<HWComponent> create_second() {
|
||||
return std::unique_ptr<ScsiBus>(new ScsiBus("SCSI1"));
|
||||
}
|
||||
|
||||
// low-level state management
|
||||
void register_device(int id, ScsiDevice* dev_obj);
|
||||
int current_phase() { return this->cur_phase; };
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -23,12 +23,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <devices/common/hwcomponent.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/deviceregistry.h>
|
||||
#include <loguru.hpp>
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
ScsiBus::ScsiBus()
|
||||
ScsiBus::ScsiBus(const std::string name)
|
||||
{
|
||||
this->set_name(name);
|
||||
supports_types(HWCompType::SCSI_BUS);
|
||||
|
||||
for(int i = 0; i < SCSI_MAX_DEVS; i++) {
|
||||
@ -273,3 +275,14 @@ void ScsiBus::disconnect(int dev_id)
|
||||
change_bus_phase(dev_id);
|
||||
}
|
||||
}
|
||||
|
||||
static const DeviceDescription Scsi0_Descriptor = {
|
||||
ScsiBus::create_first, {}, {}
|
||||
};
|
||||
|
||||
static const DeviceDescription Scsi1_Descriptor = {
|
||||
ScsiBus::create_second, {}, {}
|
||||
};
|
||||
|
||||
REGISTER_DEVICE(Scsi0, Scsi0_Descriptor);
|
||||
REGISTER_DEVICE(Scsi1, Scsi1_Descriptor);
|
@ -625,7 +625,7 @@ DmaPullResult AmicScsiDma::pull_data(uint32_t req_len, uint32_t *avail_len,
|
||||
}
|
||||
|
||||
static vector<string> Amic_Subdevices = {
|
||||
"Sc53C94", "Escc", "Mace", "ViaCuda", "Swim3"
|
||||
"Scsi0", "Sc53C94", "Escc", "Mace", "ViaCuda", "Swim3"
|
||||
};
|
||||
|
||||
static const DeviceDescription Amic_Descriptor = {
|
||||
|
@ -323,7 +323,7 @@ void GrandCentral::ack_dma_int(uint32_t irq_id, uint8_t irq_line_state)
|
||||
}
|
||||
|
||||
static const vector<string> GCSubdevices = {
|
||||
"NVRAM", "ViaCuda", "Escc", "Sc53C94", "Mace", "Swim3"
|
||||
"NVRAM", "ViaCuda", "Escc", "Scsi0", "Sc53C94", "Mace", "Swim3"
|
||||
};
|
||||
|
||||
static const DeviceDescription GC_Descriptor = {
|
||||
|
@ -425,7 +425,7 @@ void HeathrowIC::clear_cpu_int()
|
||||
}
|
||||
|
||||
static const vector<string> Heathrow_Subdevices = {
|
||||
"NVRAM", "ViaCuda", "Mesh", "Escc", "Swim3", "Ide0", "Ide1"};
|
||||
"NVRAM", "ViaCuda", "Scsi0", "Mesh", "Escc", "Swim3", "Ide0", "Ide1"};
|
||||
|
||||
static const DeviceDescription Heathrow_Descriptor = {
|
||||
HeathrowIC::create, Heathrow_Subdevices, {}
|
||||
|
@ -226,7 +226,7 @@ void OHare::ack_dma_int(uint32_t irq_id, uint8_t irq_line_state)
|
||||
}
|
||||
|
||||
static const vector<string> OHare_Subdevices = {
|
||||
"NVRAM", "ViaCuda", "Mesh", "Escc", "Swim3"
|
||||
"NVRAM", "ViaCuda", "Scsi0", "Mesh", "Escc", "Swim3"
|
||||
};
|
||||
|
||||
static const DeviceDescription OHare_Descriptor = {
|
||||
|
@ -23,7 +23,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cpu/ppc/ppcemu.h>
|
||||
#include <devices/common/pci/bandit.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/ioctrl/macio.h>
|
||||
#include <devices/memctrl/platinum.h>
|
||||
#include <loguru.hpp>
|
||||
@ -61,9 +60,6 @@ int initialize_catalyst(std::string& id)
|
||||
// allocate and map physical RAM
|
||||
platinum_obj->map_phys_ram();
|
||||
|
||||
// add single SCSI bus
|
||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||
|
||||
// init virtual CPU and request MPC601
|
||||
ppc_cpu_init(platinum_obj, PPC_VER::MPC601, 7833600ULL);
|
||||
|
||||
|
@ -28,7 +28,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <devices/common/i2c/athens.h>
|
||||
#include <devices/common/i2c/i2cprom.h>
|
||||
#include <devices/common/machineid.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/ioctrl/macio.h>
|
||||
#include <devices/memctrl/mpc106.h>
|
||||
#include <devices/memctrl/spdram.h>
|
||||
@ -126,8 +125,6 @@ int initialize_gossamer(std::string& id)
|
||||
grackle_obj->pci_register_device(
|
||||
DEV_FUN(0x12,0), dynamic_cast<PCIDevice*>(gMachineObj->get_comp_by_name(id == "pmg3twr" ? "AtiRagePro" : "AtiRageGT")));
|
||||
|
||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||
|
||||
// add Athens clock generator device and register it with the I2C host
|
||||
gMachineObj->add_device("Athens", std::unique_ptr<AthensClocks>(new AthensClocks(0x28)));
|
||||
I2CBus* i2c_bus = dynamic_cast<I2CBus*>(gMachineObj->get_comp_by_type(HWCompType::I2C_HOST));
|
||||
|
@ -82,9 +82,8 @@ int initialize_pdm(std::string& id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// add internal SCSI bus
|
||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||
auto scsi_bus = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("SCSI0"));
|
||||
// get internal SCSI bus object
|
||||
auto scsi_bus = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("Scsi0"));
|
||||
|
||||
std::string hd_image_path = GET_STR_PROP("hdd_img");
|
||||
if (!hd_image_path.empty()) {
|
||||
|
@ -23,7 +23,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cpu/ppc/ppcemu.h>
|
||||
#include <devices/common/pci/bandit.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/ioctrl/macio.h>
|
||||
#include <devices/memctrl/hammerhead.h>
|
||||
#include <loguru.hpp>
|
||||
@ -68,9 +67,6 @@ int initialize_tnt(std::string& id)
|
||||
// allocate and map physical RAM
|
||||
memctrl_obj->map_phys_ram();
|
||||
|
||||
// add single SCSI bus
|
||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||
|
||||
// init virtual CPU and request MPC601
|
||||
ppc_cpu_init(memctrl_obj, PPC_VER::MPC601, 7833600ULL);
|
||||
|
||||
|
@ -23,7 +23,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cpu/ppc/ppcemu.h>
|
||||
#include <devices/common/pci/dec21154.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/memctrl/mpc106.h>
|
||||
#include <devices/memctrl/spdram.h>
|
||||
#include <machines/machinefactory.h>
|
||||
@ -65,9 +64,6 @@ int initialize_yosemite(std::string& id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// add internal SCSI bus
|
||||
gMachineObj->add_device("SCSI0", std::unique_ptr<ScsiBus>(new ScsiBus()));
|
||||
|
||||
// configure RAM slots
|
||||
setup_ram_slot("RAM_DIMM_1", 0x50, GET_INT_PROP("rambank1_size"));
|
||||
setup_ram_slot("RAM_DIMM_2", 0x51, GET_INT_PROP("rambank2_size"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user