2019-05-30 06:57:35 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-09-13 01:54:20 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016, Semihalf
|
|
|
|
* Author: Tomasz Nowicki <tn@semihalf.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ACPI_IORT_H__
|
|
|
|
#define __ACPI_IORT_H__
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
2016-09-13 01:32:21 +07:00
|
|
|
#include <linux/fwnode.h>
|
|
|
|
#include <linux/irqdomain.h>
|
2016-09-13 01:54:20 +07:00
|
|
|
|
2016-11-21 17:01:45 +07:00
|
|
|
#define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL)
|
|
|
|
#define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL)
|
|
|
|
|
2019-03-26 22:17:50 +07:00
|
|
|
/*
|
|
|
|
* PMCG model identifiers for use in smmu pmu driver. Please note
|
|
|
|
* that this is purely for the use of software and has nothing to
|
|
|
|
* do with hardware or with IORT specification.
|
|
|
|
*/
|
|
|
|
#define IORT_SMMU_V3_PMCG_GENERIC 0x00000000 /* Generic SMMUv3 PMCG */
|
2019-03-26 22:17:53 +07:00
|
|
|
#define IORT_SMMU_V3_PMCG_HISI_HIP08 0x00000001 /* HiSilicon HIP08 PMCG */
|
2019-03-26 22:17:50 +07:00
|
|
|
|
2018-02-13 22:20:50 +07:00
|
|
|
int iort_register_domain_token(int trans_id, phys_addr_t base,
|
|
|
|
struct fwnode_handle *fw_node);
|
2016-09-13 01:32:21 +07:00
|
|
|
void iort_deregister_domain_token(int trans_id);
|
|
|
|
struct fwnode_handle *iort_find_domain_token(int trans_id);
|
2016-09-13 01:54:20 +07:00
|
|
|
#ifdef CONFIG_ACPI_IORT
|
|
|
|
void acpi_iort_init(void);
|
2020-06-19 15:20:04 +07:00
|
|
|
u32 iort_msi_map_id(struct device *dev, u32 id);
|
2020-06-19 15:20:03 +07:00
|
|
|
struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
|
|
|
|
enum irq_domain_bus_token bus_token);
|
2017-03-07 19:40:06 +07:00
|
|
|
void acpi_configure_pmsi_domain(struct device *dev);
|
2017-03-07 19:40:05 +07:00
|
|
|
int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
|
2016-11-21 17:01:48 +07:00
|
|
|
/* IOMMU interface */
|
2017-08-07 17:29:49 +07:00
|
|
|
void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);
|
2020-06-19 15:20:06 +07:00
|
|
|
const struct iommu_ops *iort_iommu_configure_id(struct device *dev,
|
|
|
|
const u32 *id_in);
|
2018-02-13 22:20:50 +07:00
|
|
|
int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);
|
2016-09-13 01:54:20 +07:00
|
|
|
#else
|
|
|
|
static inline void acpi_iort_init(void) { }
|
2020-06-19 15:20:04 +07:00
|
|
|
static inline u32 iort_msi_map_id(struct device *dev, u32 id)
|
|
|
|
{ return id; }
|
2020-06-19 15:20:03 +07:00
|
|
|
static inline struct irq_domain *iort_get_device_domain(
|
|
|
|
struct device *dev, u32 id, enum irq_domain_bus_token bus_token)
|
2016-09-13 01:32:21 +07:00
|
|
|
{ return NULL; }
|
2017-03-07 19:40:06 +07:00
|
|
|
static inline void acpi_configure_pmsi_domain(struct device *dev) { }
|
2016-11-21 17:01:48 +07:00
|
|
|
/* IOMMU interface */
|
2017-08-07 17:29:49 +07:00
|
|
|
static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,
|
|
|
|
u64 *size) { }
|
2020-06-19 15:20:06 +07:00
|
|
|
static inline const struct iommu_ops *iort_iommu_configure_id(
|
|
|
|
struct device *dev, const u32 *id_in)
|
2016-11-21 17:01:48 +07:00
|
|
|
{ return NULL; }
|
2018-02-13 22:20:50 +07:00
|
|
|
static inline
|
|
|
|
int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
|
|
|
|
{ return 0; }
|
2016-09-13 01:54:20 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ACPI_IORT_H__ */
|