/* DingusPPC - The Experimental PowerPC Macintosh emulator Copyright (C) 2018-22 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 . */ /** Bandit ARBus-to-PCI bridge definitions. The Bandit ASIC is a custom ARBus-to-PCI bridge used in the second generation of the Power Macintosh computer equipped with the PCI bus. */ #ifndef BANDIT_PCI_H #define BANDIT_PCI_H #include #include #include #include #include #include #define BANDIT_DEV_NUM (1 << 11) #define BANDIT_CONFIG_SPACE 0x00800000 class Bandit : public MMIODevice, public PCIHost {//}, public PCIDevice { public: Bandit(int bridge_num, std::string name); ~Bandit() = default; bool supports_type(HWCompType type) { return (type == HWCompType::PCI_HOST || type == HWCompType::PCI_DEV); }; // MMIODevice methods 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); protected: uint32_t pci_cfg_read(uint32_t reg_offs, uint32_t size); void pci_cfg_write(uint32_t reg_offs, uint32_t value, uint32_t size); private: std::string name; uint32_t base_addr; uint32_t config_addr; uint8_t my_pci_cfg_hdr[256]; uint8_t my_cfg_mask[256]; }; #endif // BANDIT_PCI_H