2
0

gpex.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * QEMU Generic PCI Express Bridge Emulation
  3. *
  4. * Copyright (C) 2015 Alexander Graf <agraf@suse.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, see <http://www.gnu.org/licenses/>
  18. */
  19. #ifndef HW_GPEX_H
  20. #define HW_GPEX_H
  21. #include "hw/hw.h"
  22. #include "hw/sysbus.h"
  23. #include "hw/pci/pci.h"
  24. #include "hw/pci/pcie_host.h"
  25. #define TYPE_GPEX_HOST "gpex-pcihost"
  26. #define GPEX_HOST(obj) \
  27. OBJECT_CHECK(GPEXHost, (obj), TYPE_GPEX_HOST)
  28. #define TYPE_GPEX_ROOT_DEVICE "gpex-root"
  29. #define MCH_PCI_DEVICE(obj) \
  30. OBJECT_CHECK(GPEXRootState, (obj), TYPE_GPEX_ROOT_DEVICE)
  31. #define GPEX_NUM_IRQS 4
  32. typedef struct GPEXRootState {
  33. /*< private >*/
  34. PCIDevice parent_obj;
  35. /*< public >*/
  36. } GPEXRootState;
  37. typedef struct GPEXHost {
  38. /*< private >*/
  39. PCIExpressHost parent_obj;
  40. /*< public >*/
  41. GPEXRootState gpex_root;
  42. MemoryRegion io_ioport;
  43. MemoryRegion io_mmio;
  44. qemu_irq irq[GPEX_NUM_IRQS];
  45. int irq_num[GPEX_NUM_IRQS];
  46. } GPEXHost;
  47. int gpex_set_irq_num(GPEXHost *s, int index, int gsi);
  48. #endif /* HW_GPEX_H */