ropes.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #ifndef _ASM_PARISC_ROPES_H_
  2. #define _ASM_PARISC_ROPES_H_
  3. #ifdef CONFIG_64BIT
  4. /* "low end" PA8800 machines use ZX1 chipset: PAT PDC and only run 64-bit */
  5. #define ZX1_SUPPORT
  6. #endif
  7. #ifdef CONFIG_PROC_FS
  8. /* depends on proc fs support. But costs CPU performance */
  9. #undef SBA_COLLECT_STATS
  10. #endif
  11. /*
  12. ** The number of pdir entries to "free" before issueing
  13. ** a read to PCOM register to flush out PCOM writes.
  14. ** Interacts with allocation granularity (ie 4 or 8 entries
  15. ** allocated and free'd/purged at a time might make this
  16. ** less interesting).
  17. */
  18. #define DELAYED_RESOURCE_CNT 16
  19. #define MAX_IOC 2 /* per Ike. Pluto/Astro only have 1. */
  20. #define ROPES_PER_IOC 8 /* per Ike half or Pluto/Astro */
  21. struct ioc {
  22. void __iomem *ioc_hpa; /* I/O MMU base address */
  23. char *res_map; /* resource map, bit == pdir entry */
  24. u64 *pdir_base; /* physical base address */
  25. unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */
  26. unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */
  27. #ifdef ZX1_SUPPORT
  28. unsigned long iovp_mask; /* help convert IOVA to IOVP */
  29. #endif
  30. unsigned long *res_hint; /* next avail IOVP - circular search */
  31. spinlock_t res_lock;
  32. unsigned int res_bitshift; /* from the LEFT! */
  33. unsigned int res_size; /* size of resource map in bytes */
  34. #ifdef SBA_HINT_SUPPORT
  35. /* FIXME : DMA HINTs not used */
  36. unsigned long hint_mask_pdir; /* bits used for DMA hints */
  37. unsigned int hint_shift_pdir;
  38. #endif
  39. #if DELAYED_RESOURCE_CNT > 0
  40. int saved_cnt;
  41. struct sba_dma_pair {
  42. dma_addr_t iova;
  43. size_t size;
  44. } saved[DELAYED_RESOURCE_CNT];
  45. #endif
  46. #ifdef SBA_COLLECT_STATS
  47. #define SBA_SEARCH_SAMPLE 0x100
  48. unsigned long avg_search[SBA_SEARCH_SAMPLE];
  49. unsigned long avg_idx; /* current index into avg_search */
  50. unsigned long used_pages;
  51. unsigned long msingle_calls;
  52. unsigned long msingle_pages;
  53. unsigned long msg_calls;
  54. unsigned long msg_pages;
  55. unsigned long usingle_calls;
  56. unsigned long usingle_pages;
  57. unsigned long usg_calls;
  58. unsigned long usg_pages;
  59. #endif
  60. /* STUFF We don't need in performance path */
  61. unsigned int pdir_size; /* in bytes, determined by IOV Space size */
  62. };
  63. struct sba_device {
  64. struct sba_device *next; /* list of SBA's in system */
  65. struct parisc_device *dev; /* dev found in bus walk */
  66. const char *name;
  67. void __iomem *sba_hpa; /* base address */
  68. spinlock_t sba_lock;
  69. unsigned int flags; /* state/functionality enabled */
  70. unsigned int hw_rev; /* HW revision of chip */
  71. struct resource chip_resv; /* MMIO reserved for chip */
  72. struct resource iommu_resv; /* MMIO reserved for iommu */
  73. unsigned int num_ioc; /* number of on-board IOC's */
  74. struct ioc ioc[MAX_IOC];
  75. };
  76. #define ASTRO_RUNWAY_PORT 0x582
  77. #define IKE_MERCED_PORT 0x803
  78. #define REO_MERCED_PORT 0x804
  79. #define REOG_MERCED_PORT 0x805
  80. #define PLUTO_MCKINLEY_PORT 0x880
  81. static inline int IS_ASTRO(struct parisc_device *d) {
  82. return d->id.hversion == ASTRO_RUNWAY_PORT;
  83. }
  84. static inline int IS_IKE(struct parisc_device *d) {
  85. return d->id.hversion == IKE_MERCED_PORT;
  86. }
  87. static inline int IS_PLUTO(struct parisc_device *d) {
  88. return d->id.hversion == PLUTO_MCKINLEY_PORT;
  89. }
  90. #define SBA_IOMMU_COOKIE 0x0000badbadc0ffeeUL
  91. /*
  92. ** lba_device: Per instance Elroy data structure
  93. */
  94. struct lba_device {
  95. struct pci_hba_data hba;
  96. spinlock_t lba_lock;
  97. void *iosapic_obj;
  98. #ifdef CONFIG_64BIT
  99. void __iomem *iop_base; /* PA_VIEW - for IO port accessor funcs */
  100. #endif
  101. int flags; /* state/functionality enabled */
  102. int hw_rev; /* HW revision of chip */
  103. };
  104. #define ELROY_HVERS 0x782
  105. #define MERCURY_HVERS 0x783
  106. #define QUICKSILVER_HVERS 0x784
  107. static inline int IS_ELROY(struct parisc_device *d) {
  108. return (d->id.hversion == ELROY_HVERS);
  109. }
  110. static inline int IS_MERCURY(struct parisc_device *d) {
  111. return (d->id.hversion == MERCURY_HVERS);
  112. }
  113. static inline int IS_QUICKSILVER(struct parisc_device *d) {
  114. return (d->id.hversion == QUICKSILVER_HVERS);
  115. }
  116. /*
  117. ** I/O SAPIC init function
  118. ** Caller knows where an I/O SAPIC is. LBA has an integrated I/O SAPIC.
  119. ** Call setup as part of per instance initialization.
  120. ** (ie *not* init_module() function unless only one is present.)
  121. ** fixup_irq is to initialize PCI IRQ line support and
  122. ** virtualize pcidev->irq value. To be called by pci_fixup_bus().
  123. */
  124. extern void *iosapic_register(unsigned long hpa);
  125. extern int iosapic_fixup_irq(void *obj, struct pci_dev *pcidev);
  126. #endif /*_ASM_PARISC_ROPES_H_*/