blob: 6ed2deacf1d0edae1ab5315cce42106c61129608 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-or-later */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * This file is derived from asm-powerpc/tce.h.
4 *
5 * Copyright (C) IBM Corporation, 2006
6 *
7 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
8 * Author: Jon Mason <jdmason@us.ibm.com>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009 */
10
11#ifndef _ASM_X86_TCE_H
12#define _ASM_X86_TCE_H
13
14extern unsigned int specified_table_size;
15struct iommu_table;
16
17#define TCE_ENTRY_SIZE 8 /* in bytes */
18
19#define TCE_READ_SHIFT 0
20#define TCE_WRITE_SHIFT 1
21#define TCE_HUBID_SHIFT 2 /* unused */
22#define TCE_RSVD_SHIFT 8 /* unused */
23#define TCE_RPN_SHIFT 12
24#define TCE_UNUSED_SHIFT 48 /* unused */
25
26#define TCE_RPN_MASK 0x0000fffffffff000ULL
27
28extern void tce_build(struct iommu_table *tbl, unsigned long index,
29 unsigned int npages, unsigned long uaddr, int direction);
30extern void tce_free(struct iommu_table *tbl, long index, unsigned int npages);
31extern void * __init alloc_tce_table(void);
32extern void __init free_tce_table(void *tbl);
33extern int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar);
34
35#endif /* _ASM_X86_TCE_H */