Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2016, Semihalf
0004  *  Author: Tomasz Nowicki <tn@semihalf.com>
0005  */
0006 
0007 #ifndef __ACPI_IORT_H__
0008 #define __ACPI_IORT_H__
0009 
0010 #include <linux/acpi.h>
0011 #include <linux/fwnode.h>
0012 #include <linux/irqdomain.h>
0013 
0014 #define IORT_IRQ_MASK(irq)      (irq & 0xffffffffULL)
0015 #define IORT_IRQ_TRIGGER_MASK(irq)  ((irq >> 32) & 0xffffffffULL)
0016 
0017 /*
0018  * PMCG model identifiers for use in smmu pmu driver. Please note
0019  * that this is purely for the use of software and has nothing to
0020  * do with hardware or with IORT specification.
0021  */
0022 #define IORT_SMMU_V3_PMCG_GENERIC        0x00000000 /* Generic SMMUv3 PMCG */
0023 #define IORT_SMMU_V3_PMCG_HISI_HIP08     0x00000001 /* HiSilicon HIP08 PMCG */
0024 
0025 int iort_register_domain_token(int trans_id, phys_addr_t base,
0026                    struct fwnode_handle *fw_node);
0027 void iort_deregister_domain_token(int trans_id);
0028 struct fwnode_handle *iort_find_domain_token(int trans_id);
0029 #ifdef CONFIG_ACPI_IORT
0030 void acpi_iort_init(void);
0031 u32 iort_msi_map_id(struct device *dev, u32 id);
0032 struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
0033                       enum irq_domain_bus_token bus_token);
0034 void acpi_configure_pmsi_domain(struct device *dev);
0035 int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
0036 void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode,
0037                struct list_head *head);
0038 void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode,
0039                struct list_head *head);
0040 /* IOMMU interface */
0041 int iort_dma_get_ranges(struct device *dev, u64 *size);
0042 int iort_iommu_configure_id(struct device *dev, const u32 *id_in);
0043 void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head);
0044 phys_addr_t acpi_iort_dma_get_max_cpu_address(void);
0045 #else
0046 static inline void acpi_iort_init(void) { }
0047 static inline u32 iort_msi_map_id(struct device *dev, u32 id)
0048 { return id; }
0049 static inline struct irq_domain *iort_get_device_domain(
0050     struct device *dev, u32 id, enum irq_domain_bus_token bus_token)
0051 { return NULL; }
0052 static inline void acpi_configure_pmsi_domain(struct device *dev) { }
0053 static inline
0054 void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { }
0055 static inline
0056 void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { }
0057 /* IOMMU interface */
0058 static inline int iort_dma_get_ranges(struct device *dev, u64 *size)
0059 { return -ENODEV; }
0060 static inline int iort_iommu_configure_id(struct device *dev, const u32 *id_in)
0061 { return -ENODEV; }
0062 static inline
0063 void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head)
0064 { }
0065 
0066 static inline phys_addr_t acpi_iort_dma_get_max_cpu_address(void)
0067 { return PHYS_ADDR_MAX; }
0068 #endif
0069 
0070 #endif /* __ACPI_IORT_H__ */