Merge tag 'devicetree-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh...
[linux-2.6-block.git] / arch / x86 / include / asm / calgary.h
CommitLineData
1a59d1b8 1/* SPDX-License-Identifier: GPL-2.0-or-later */
e465058d
JM
2/*
3 * Derived from include/asm-powerpc/iommu.h
4 *
ff297b8c 5 * Copyright IBM Corporation, 2006-2007
aa0a9f37
MBY
6 *
7 * Author: Jon Mason <jdmason@us.ibm.com>
8 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
e465058d
JM
9 */
10
1965aae3
PA
11#ifndef _ASM_X86_CALGARY_H
12#define _ASM_X86_CALGARY_H
e465058d 13
e465058d
JM
14#include <linux/spinlock.h>
15#include <linux/device.h>
16#include <linux/dma-mapping.h>
e8edc6e0 17#include <linux/timer.h>
e465058d
JM
18#include <asm/types.h>
19
20struct iommu_table {
d6b56b0b 21 const struct cal_chipset_ops *chip_ops; /* chipset specific funcs */
e465058d
JM
22 unsigned long it_base; /* mapped address of tce table */
23 unsigned long it_hint; /* Hint for next alloc */
24 unsigned long *it_map; /* A simple allocation bitmap for now */
5f4a7a93
MBY
25 void __iomem *bbar; /* Bridge BAR */
26 u64 tar_val; /* Table Address Register */
27 struct timer_list watchdog_timer;
e465058d
JM
28 spinlock_t it_lock; /* Protects it_map */
29 unsigned int it_size; /* Size of iommu table in entries */
30 unsigned char it_busno; /* Bus number this table belongs to */
e465058d
JM
31};
32
ff297b8c
MBY
33struct cal_chipset_ops {
34 void (*handle_quirks)(struct iommu_table *tbl, struct pci_dev *dev);
35 void (*tce_cache_blast)(struct iommu_table *tbl);
8cb32dc7 36 void (*dump_error_regs)(struct iommu_table *tbl);
ff297b8c
MBY
37};
38
e465058d
JM
39#define TCE_TABLE_SIZE_UNSPECIFIED ~0
40#define TCE_TABLE_SIZE_64K 0
41#define TCE_TABLE_SIZE_128K 1
42#define TCE_TABLE_SIZE_256K 2
43#define TCE_TABLE_SIZE_512K 3
44#define TCE_TABLE_SIZE_1M 4
45#define TCE_TABLE_SIZE_2M 5
46#define TCE_TABLE_SIZE_4M 6
47#define TCE_TABLE_SIZE_8M 7
48
bff6547b
MBY
49extern int use_calgary;
50
e465058d 51#ifdef CONFIG_CALGARY_IOMMU
480125ba 52extern int detect_calgary(void);
e465058d 53#else
480125ba 54static inline int detect_calgary(void) { return -ENODEV; }
e465058d
JM
55#endif
56
1965aae3 57#endif /* _ASM_X86_CALGARY_H */