calgary.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Derived from include/asm-powerpc/iommu.h
  3. *
  4. * Copyright IBM Corporation, 2006-2007
  5. *
  6. * Author: Jon Mason <jdmason@us.ibm.com>
  7. * Author: Muli Ben-Yehuda <muli@il.ibm.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #ifndef _ASM_X86_CALGARY_H
  24. #define _ASM_X86_CALGARY_H
  25. #include <linux/spinlock.h>
  26. #include <linux/device.h>
  27. #include <linux/dma-mapping.h>
  28. #include <linux/timer.h>
  29. #include <asm/types.h>
  30. struct iommu_table {
  31. struct cal_chipset_ops *chip_ops; /* chipset specific funcs */
  32. unsigned long it_base; /* mapped address of tce table */
  33. unsigned long it_hint; /* Hint for next alloc */
  34. unsigned long *it_map; /* A simple allocation bitmap for now */
  35. void __iomem *bbar; /* Bridge BAR */
  36. u64 tar_val; /* Table Address Register */
  37. struct timer_list watchdog_timer;
  38. spinlock_t it_lock; /* Protects it_map */
  39. unsigned int it_size; /* Size of iommu table in entries */
  40. unsigned char it_busno; /* Bus number this table belongs to */
  41. };
  42. struct cal_chipset_ops {
  43. void (*handle_quirks)(struct iommu_table *tbl, struct pci_dev *dev);
  44. void (*tce_cache_blast)(struct iommu_table *tbl);
  45. void (*dump_error_regs)(struct iommu_table *tbl);
  46. };
  47. #define TCE_TABLE_SIZE_UNSPECIFIED ~0
  48. #define TCE_TABLE_SIZE_64K 0
  49. #define TCE_TABLE_SIZE_128K 1
  50. #define TCE_TABLE_SIZE_256K 2
  51. #define TCE_TABLE_SIZE_512K 3
  52. #define TCE_TABLE_SIZE_1M 4
  53. #define TCE_TABLE_SIZE_2M 5
  54. #define TCE_TABLE_SIZE_4M 6
  55. #define TCE_TABLE_SIZE_8M 7
  56. extern int use_calgary;
  57. #ifdef CONFIG_CALGARY_IOMMU
  58. extern int detect_calgary(void);
  59. #else
  60. static inline int detect_calgary(void) { return -ENODEV; }
  61. #endif
  62. #endif /* _ASM_X86_CALGARY_H */