pbm.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* pbm.h: UltraSparc PCI controller software state.
  2. *
  3. * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net)
  4. */
  5. #ifndef __SPARC64_PBM_H
  6. #define __SPARC64_PBM_H
  7. #include <linux/types.h>
  8. #include <linux/pci.h>
  9. #include <linux/ioport.h>
  10. #include <linux/spinlock.h>
  11. #include <linux/msi.h>
  12. #include <asm/io.h>
  13. #include <asm/page.h>
  14. #include <asm/oplib.h>
  15. #include <asm/prom.h>
  16. #include <asm/of_device.h>
  17. #include <asm/iommu.h>
  18. /* The abstraction used here is that there are PCI controllers,
  19. * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules
  20. * underneath. Each PCI bus module uses an IOMMU (shared by both
  21. * PBMs of a controller, or per-PBM), and if a streaming buffer
  22. * is present, each PCI bus module has it's own. (ie. the IOMMU
  23. * might be shared between PBMs, the STC is never shared)
  24. * Furthermore, each PCI bus module controls it's own autonomous
  25. * PCI bus.
  26. */
  27. extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
  28. #define PCI_STC_FLUSHFLAG_INIT(STC) \
  29. (*((STC)->strbuf_flushflag) = 0UL)
  30. #define PCI_STC_FLUSHFLAG_SET(STC) \
  31. (*((STC)->strbuf_flushflag) != 0UL)
  32. /* There can be quite a few ranges and interrupt maps on a PCI
  33. * segment. Thus...
  34. */
  35. #define PROM_PCIRNG_MAX 64
  36. #define PROM_PCIIMAP_MAX 64
  37. struct pci_controller_info;
  38. struct pci_pbm_info {
  39. /* PCI controller we sit under. */
  40. struct pci_controller_info *parent;
  41. /* Physical address base of controller registers. */
  42. unsigned long controller_regs;
  43. /* Physical address base of PBM registers. */
  44. unsigned long pbm_regs;
  45. /* Physical address of DMA sync register, if any. */
  46. unsigned long sync_reg;
  47. /* Opaque 32-bit system bus Port ID. */
  48. u32 portid;
  49. /* Opaque 32-bit handle used for hypervisor calls. */
  50. u32 devhandle;
  51. /* Chipset version information. */
  52. int chip_type;
  53. #define PBM_CHIP_TYPE_SABRE 1
  54. #define PBM_CHIP_TYPE_PSYCHO 2
  55. #define PBM_CHIP_TYPE_SCHIZO 3
  56. #define PBM_CHIP_TYPE_SCHIZO_PLUS 4
  57. #define PBM_CHIP_TYPE_TOMATILLO 5
  58. int chip_version;
  59. int chip_revision;
  60. /* Name used for top-level resources. */
  61. char *name;
  62. /* OBP specific information. */
  63. struct device_node *prom_node;
  64. u64 ino_bitmap;
  65. /* PBM I/O and Memory space resources. */
  66. struct resource io_space;
  67. struct resource mem_space;
  68. /* Base of PCI Config space, can be per-PBM or shared. */
  69. unsigned long config_space;
  70. /* State of 66MHz capabilities on this PBM. */
  71. int is_66mhz_capable;
  72. int all_devs_66mhz;
  73. #ifdef CONFIG_PCI_MSI
  74. /* MSI info. */
  75. u32 msiq_num;
  76. u32 msiq_ent_count;
  77. u32 msiq_first;
  78. u32 msiq_first_devino;
  79. u32 msi_num;
  80. u32 msi_first;
  81. u32 msi_data_mask;
  82. u32 msix_data_width;
  83. u64 msi32_start;
  84. u64 msi64_start;
  85. u32 msi32_len;
  86. u32 msi64_len;
  87. void *msi_queues;
  88. unsigned long *msi_bitmap;
  89. #endif /* !(CONFIG_PCI_MSI) */
  90. /* This PBM's streaming buffer. */
  91. struct strbuf stc;
  92. /* IOMMU state, potentially shared by both PBM segments. */
  93. struct iommu *iommu;
  94. /* Now things for the actual PCI bus probes. */
  95. unsigned int pci_first_busno;
  96. unsigned int pci_last_busno;
  97. struct pci_bus *pci_bus;
  98. };
  99. struct pci_controller_info {
  100. /* List of all PCI controllers. */
  101. struct pci_controller_info *next;
  102. /* Each controller gets a unique index, used mostly for
  103. * error logging purposes.
  104. */
  105. int index;
  106. /* The PCI bus modules controlled by us. */
  107. struct pci_pbm_info pbm_A;
  108. struct pci_pbm_info pbm_B;
  109. /* Operations which are controller specific. */
  110. void (*scan_bus)(struct pci_controller_info *);
  111. #ifdef CONFIG_PCI_MSI
  112. int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev,
  113. struct msi_desc *entry);
  114. void (*teardown_msi_irq)(unsigned int virt_irq, struct pci_dev *pdev);
  115. #endif
  116. /* Now things for the actual PCI bus probes. */
  117. struct pci_ops *pci_ops;
  118. };
  119. #endif /* !(__SPARC64_PBM_H) */