2021-10-23 19:00:31 +00:00
|
|
|
/*
|
|
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
2022-08-19 16:55:33 +00:00
|
|
|
Copyright (C) 2018-22 divingkatae and maximum
|
2021-10-23 19:00:31 +00:00
|
|
|
(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/>.
|
|
|
|
*/
|
|
|
|
|
2019-08-23 21:30:33 +00:00
|
|
|
#ifndef PCI_HOST_H
|
|
|
|
#define PCI_HOST_H
|
|
|
|
|
2022-08-19 16:55:33 +00:00
|
|
|
#include <devices/deviceregistry.h>
|
|
|
|
|
2019-08-23 21:30:33 +00:00
|
|
|
#include <cinttypes>
|
2022-08-19 16:55:33 +00:00
|
|
|
#include <string>
|
2022-01-16 20:30:43 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
2019-08-23 21:30:33 +00:00
|
|
|
|
2020-05-12 18:55:45 +00:00
|
|
|
class PCIDevice; // forward declaration to prevent errors
|
2019-08-23 21:30:33 +00:00
|
|
|
|
|
|
|
class PCIHost {
|
|
|
|
public:
|
2022-01-16 20:30:43 +00:00
|
|
|
PCIHost() {
|
|
|
|
this->dev_map.clear();
|
|
|
|
io_space_devs.clear();
|
|
|
|
};
|
|
|
|
~PCIHost() = default;
|
|
|
|
|
|
|
|
virtual bool pci_register_device(int dev_num, PCIDevice* dev_instance);
|
|
|
|
|
|
|
|
virtual bool pci_register_mmio_region(uint32_t start_addr, uint32_t size, PCIDevice* obj);
|
2022-12-12 08:16:59 +00:00
|
|
|
virtual bool pci_unregister_mmio_region(uint32_t start_addr, uint32_t size, PCIDevice* obj);
|
2022-01-16 20:30:43 +00:00
|
|
|
|
2022-08-19 16:55:33 +00:00
|
|
|
virtual void attach_pci_device(std::string& dev_name, int slot_id);
|
|
|
|
|
2022-01-16 20:30:43 +00:00
|
|
|
protected:
|
|
|
|
std::unordered_map<int, PCIDevice*> dev_map;
|
|
|
|
std::vector<PCIDevice*> io_space_devs;
|
2019-08-23 21:30:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PCI_HOST_H */
|