2
0

pci_internals.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef QEMU_PCI_INTERNALS_H
  2. #define QEMU_PCI_INTERNALS_H
  3. /*
  4. * This header files is private to pci.c and pci_bridge.c
  5. * So following structures are opaque to others and shouldn't be
  6. * accessed.
  7. *
  8. * For pci-to-pci bridge needs to include this header file to embed
  9. * PCIBridge in its structure or to get sizeof(PCIBridge),
  10. * However, they shouldn't access those following members directly.
  11. * Use accessor function in pci.h, pci_bridge.h
  12. */
  13. #define TYPE_PCI_BUS "PCI"
  14. #define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS)
  15. struct PCIBus {
  16. BusState qbus;
  17. PCIDMAContextFunc dma_context_fn;
  18. void *dma_context_opaque;
  19. uint8_t devfn_min;
  20. pci_set_irq_fn set_irq;
  21. pci_map_irq_fn map_irq;
  22. pci_route_irq_fn route_intx_to_irq;
  23. pci_hotplug_fn hotplug;
  24. DeviceState *hotplug_qdev;
  25. void *irq_opaque;
  26. PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
  27. PCIDevice *parent_dev;
  28. MemoryRegion *address_space_mem;
  29. MemoryRegion *address_space_io;
  30. QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
  31. QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
  32. /* The bus IRQ state is the logical OR of the connected devices.
  33. Keep a count of the number of devices with raised IRQs. */
  34. int nirq;
  35. int *irq_count;
  36. };
  37. struct PCIBridge {
  38. PCIDevice dev;
  39. /* private member */
  40. PCIBus sec_bus;
  41. /*
  42. * Memory regions for the bridge's address spaces. These regions are not
  43. * directly added to system_memory/system_io or its descendants.
  44. * Bridge's secondary bus points to these, so that devices
  45. * under the bridge see these regions as its address spaces.
  46. * The regions are as large as the entire address space -
  47. * they don't take into account any windows.
  48. */
  49. MemoryRegion address_space_mem;
  50. MemoryRegion address_space_io;
  51. /*
  52. * Aliases for each of the address space windows that the bridge
  53. * can forward. Mapped into the bridge's parent's address space,
  54. * as subregions.
  55. */
  56. MemoryRegion alias_pref_mem;
  57. MemoryRegion alias_mem;
  58. MemoryRegion alias_io;
  59. pci_map_irq_fn map_irq;
  60. const char *bus_name;
  61. };
  62. #endif /* QEMU_PCI_INTERNALS_H */