44 #include "debug/PciHost.hh"
47 #include "params/GenericPciHost.hh"
48 #include "params/PciHost.hh"
62 auto map_entry =
devices.emplace(bus_addr, device);
68 "%02x:%02x.%i: PCI bus ID collision\n",
77 auto device =
devices.find(addr);
78 return device !=
devices.end() ? device->second :
nullptr;
84 auto device =
devices.find(addr);
85 return device !=
devices.end() ? device->second :
nullptr;
92 busAddr(bus_addr), interruptPin(interrupt_pin)
99 return csprintf(
"%s.interface[%02x:%02x.%i]",
100 host.name(), busAddr.bus, busAddr.dev, busAddr.func);
108 host.postInt(busAddr, interruptPin);
116 host.clearInt(busAddr, interruptPin);
122 platform(*p->platform),
123 confBase(p->conf_base), confSize(p->conf_size),
124 confDeviceBits(p->conf_device_bits),
125 pciPioBase(p->pci_pio_base), pciMemBase(p->pci_mem_base),
126 pciDmaBase(p->pci_dma_base)
142 dev_addr.first.bus, dev_addr.first.dev, dev_addr.first.func,
152 uint8_t *pkt_data(pkt->
getPtr<uint8_t>());
165 dev_addr.first.bus, dev_addr.first.dev, dev_addr.first.func,
171 "%02x:%02x.%i: Write to config space on non-existent PCI device\n",
172 dev_addr.first.bus, dev_addr.first.dev, dev_addr.first.func);
177 return pci_dev->writeConfig(pkt);
192 return std::make_pair(
194 bits(bus_addr, 7, 3),
195 bits(bus_addr, 2, 0)),
224 GenericPciHostParams::create()
AddrRange RangeSize(Addr start, Addr size)
void postInt(const PciBusAddr &addr, PciIntPin pin) override
Post an interrupt to the CPU.
Configurable generic PCI host interface.
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
PCI device, base implementation is only config space.
PciDevice * getDevice(const PciBusAddr &addr)
Retrieve a PCI device from its bus address.
virtual DeviceInterface registerDevice(PciDevice *device, PciBusAddr bus_addr, PciIntPin pin)
Register a PCI device with the host.
panic_if(!root,"Invalid expression\n")
virtual uint32_t mapPciInterrupt(const PciBusAddr &bus_addr, PciIntPin pin) const
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
const std::string name() const
T * getPtr()
get a pointer to the data ptr.
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void clearInt(const PciBusAddr &addr, PciIntPin pin) override
Post an interrupt to the CPU.
std::string csprintf(const char *format, const Args &...args)
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
void clearInt()
Clear a posted PCI interrupt.
void makeAtomicResponse()
uint64_t Tick
Tick count type.
virtual Tick readConfig(PacketPtr pkt)
Read from the PCI config space data that is stored locally.
This device is the base class which all devices senstive to an address range inherit from...
PciHost(const PciHostParams *p)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
The PCI host describes the interface between PCI devices and a simulated system.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
uint8_t interruptLine() const
virtual std::pair< PciBusAddr, Addr > decodeAddress(Addr address)
Decode a configuration space address.
Callback interface from PCI devices to the host.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
GenericPciHost(const GenericPciHostParams *p)
const uint8_t confDeviceBits
fatal_if(p->js_features.size() > 16,"Too many job slot feature registers specified (%i)\n", p->js_features.size())
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
std::map< PciBusAddr, PciDevice * > devices
Currently registered PCI devices.
void postInt()
Post a PCI interrupt to the CPU.
virtual ~GenericPciHost()