dmar.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2006, Intel Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  15. * Place - Suite 330, Boston, MA 02111-1307 USA.
  16. *
  17. * Copyright (C) Ashok Raj <ashok.raj@intel.com>
  18. * Copyright (C) Shaohua Li <shaohua.li@intel.com>
  19. */
  20. #ifndef __DMAR_H__
  21. #define __DMAR_H__
  22. #include <linux/acpi.h>
  23. #include <linux/types.h>
  24. #include <linux/msi.h>
  25. #ifdef CONFIG_DMAR
  26. struct intel_iommu;
  27. /* Intel IOMMU detection and initialization functions */
  28. extern void detect_intel_iommu(void);
  29. extern int intel_iommu_init(void);
  30. extern int dmar_table_init(void);
  31. extern int early_dmar_detect(void);
  32. extern struct list_head dmar_drhd_units;
  33. extern struct list_head dmar_rmrr_units;
  34. struct dmar_drhd_unit {
  35. struct list_head list; /* list of drhd units */
  36. u64 reg_base_addr; /* register base address*/
  37. struct pci_dev **devices; /* target device array */
  38. int devices_cnt; /* target device count */
  39. u8 ignored:1; /* ignore drhd */
  40. u8 include_all:1;
  41. struct intel_iommu *iommu;
  42. };
  43. struct dmar_rmrr_unit {
  44. struct list_head list; /* list of rmrr units */
  45. u64 base_address; /* reserved base address*/
  46. u64 end_address; /* reserved end address */
  47. struct pci_dev **devices; /* target devices */
  48. int devices_cnt; /* target device count */
  49. };
  50. #define for_each_drhd_unit(drhd) \
  51. list_for_each_entry(drhd, &dmar_drhd_units, list)
  52. #define for_each_rmrr_units(rmrr) \
  53. list_for_each_entry(rmrr, &dmar_rmrr_units, list)
  54. #else
  55. static inline void detect_intel_iommu(void)
  56. {
  57. return;
  58. }
  59. static inline int intel_iommu_init(void)
  60. {
  61. return -ENODEV;
  62. }
  63. #endif /* !CONFIG_DMAR */
  64. #endif /* __DMAR_H__ */