2016-09-12 12:54:20 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016, Semihalf
|
|
|
|
* Author: Tomasz Nowicki <tn@semihalf.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ACPI_IORT_H__
|
|
|
|
#define __ACPI_IORT_H__
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
2016-09-12 12:32:21 -06:00
|
|
|
#include <linux/fwnode.h>
|
|
|
|
#include <linux/irqdomain.h>
|
2016-09-12 12:54:20 -06:00
|
|
|
|
2016-11-21 03:01:45 -07:00
|
|
|
#define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL)
|
|
|
|
#define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL)
|
|
|
|
|
2016-09-12 12:32:21 -06:00
|
|
|
int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node);
|
|
|
|
void iort_deregister_domain_token(int trans_id);
|
|
|
|
struct fwnode_handle *iort_find_domain_token(int trans_id);
|
2016-09-12 12:54:20 -06:00
|
|
|
#ifdef CONFIG_ACPI_IORT
|
|
|
|
void acpi_iort_init(void);
|
2016-09-12 12:32:21 -06:00
|
|
|
u32 iort_msi_map_rid(struct device *dev, u32 req_id);
|
|
|
|
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
|
2017-03-07 05:40:06 -07:00
|
|
|
void acpi_configure_pmsi_domain(struct device *dev);
|
2017-03-07 05:40:05 -07:00
|
|
|
int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
|
2016-11-21 03:01:48 -07:00
|
|
|
/* IOMMU interface */
|
2017-08-07 04:29:49 -06:00
|
|
|
void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);
|
2016-11-21 03:01:48 -07:00
|
|
|
const struct iommu_ops *iort_iommu_configure(struct device *dev);
|
2016-09-12 12:54:20 -06:00
|
|
|
#else
|
|
|
|
static inline void acpi_iort_init(void) { }
|
2016-09-12 12:32:21 -06:00
|
|
|
static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
|
|
|
|
{ return req_id; }
|
|
|
|
static inline struct irq_domain *iort_get_device_domain(struct device *dev,
|
|
|
|
u32 req_id)
|
|
|
|
{ return NULL; }
|
2017-03-07 05:40:06 -07:00
|
|
|
static inline void acpi_configure_pmsi_domain(struct device *dev) { }
|
2016-11-21 03:01:48 -07:00
|
|
|
/* IOMMU interface */
|
2017-08-07 04:29:49 -06:00
|
|
|
static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,
|
|
|
|
u64 *size) { }
|
2017-09-28 07:03:33 -06:00
|
|
|
static inline const struct iommu_ops *iort_iommu_configure(
|
|
|
|
struct device *dev)
|
2016-11-21 03:01:48 -07:00
|
|
|
{ return NULL; }
|
2016-09-12 12:54:20 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ACPI_IORT_H__ */
|