tce.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2006 Muli Ben-Yehuda <muli@il.ibm.com>, IBM Corporation
  3. * Copyright (C) 2006 Jon Mason <jdmason@us.ibm.com>, IBM Corporation
  4. *
  5. * This file is derived from asm-powerpc/tce.h.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef _ASM_X86_64_TCE_H
  22. #define _ASM_X86_64_TCE_H
  23. extern void* tce_table_kva[];
  24. extern unsigned int specified_table_size;
  25. struct iommu_table;
  26. #define TCE_ENTRY_SIZE 8 /* in bytes */
  27. #define TCE_READ_SHIFT 0
  28. #define TCE_WRITE_SHIFT 1
  29. #define TCE_HUBID_SHIFT 2 /* unused */
  30. #define TCE_RSVD_SHIFT 8 /* unused */
  31. #define TCE_RPN_SHIFT 12
  32. #define TCE_UNUSED_SHIFT 48 /* unused */
  33. #define TCE_RPN_MASK 0x0000fffffffff000ULL
  34. extern void tce_build(struct iommu_table *tbl, unsigned long index,
  35. unsigned int npages, unsigned long uaddr, int direction);
  36. extern void tce_free(struct iommu_table *tbl, long index, unsigned int npages);
  37. extern void* alloc_tce_table(void);
  38. extern void free_tce_table(void *tbl);
  39. extern int build_tce_table(struct pci_dev *dev, void __iomem *bbar);
  40. #endif /* _ASM_X86_64_TCE_H */