Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Derived from include/asm-powerpc/iommu.h |
| 3 | * |
Muli Ben-Yehuda | aa0a9f3 | 2006-07-10 17:06:15 +0200 | [diff] [blame] | 4 | * Copyright (C) IBM Corporation, 2006 |
| 5 | * |
| 6 | * Author: Jon Mason <jdmason@us.ibm.com> |
| 7 | * Author: Muli Ben-Yehuda <muli@il.ibm.com> |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef _ASM_X86_64_CALGARY_H |
| 25 | #define _ASM_X86_64_CALGARY_H |
| 26 | |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/device.h> |
| 29 | #include <linux/dma-mapping.h> |
Alexey Dobriyan | e8edc6e | 2007-05-21 01:22:52 +0400 | [diff] [blame] | 30 | #include <linux/timer.h> |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 31 | #include <asm/types.h> |
| 32 | |
| 33 | struct iommu_table { |
| 34 | unsigned long it_base; /* mapped address of tce table */ |
| 35 | unsigned long it_hint; /* Hint for next alloc */ |
| 36 | unsigned long *it_map; /* A simple allocation bitmap for now */ |
Muli Ben-Yehuda | 5f4a7a9 | 2006-09-26 10:52:31 +0200 | [diff] [blame] | 37 | void __iomem *bbar; /* Bridge BAR */ |
| 38 | u64 tar_val; /* Table Address Register */ |
| 39 | struct timer_list watchdog_timer; |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 40 | spinlock_t it_lock; /* Protects it_map */ |
| 41 | unsigned int it_size; /* Size of iommu table in entries */ |
| 42 | unsigned char it_busno; /* Bus number this table belongs to */ |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | #define TCE_TABLE_SIZE_UNSPECIFIED ~0 |
| 46 | #define TCE_TABLE_SIZE_64K 0 |
| 47 | #define TCE_TABLE_SIZE_128K 1 |
| 48 | #define TCE_TABLE_SIZE_256K 2 |
| 49 | #define TCE_TABLE_SIZE_512K 3 |
| 50 | #define TCE_TABLE_SIZE_1M 4 |
| 51 | #define TCE_TABLE_SIZE_2M 5 |
| 52 | #define TCE_TABLE_SIZE_4M 6 |
| 53 | #define TCE_TABLE_SIZE_8M 7 |
| 54 | |
Muli Ben-Yehuda | bff6547 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 55 | extern int use_calgary; |
| 56 | |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 57 | #ifdef CONFIG_CALGARY_IOMMU |
| 58 | extern int calgary_iommu_init(void); |
| 59 | extern void detect_calgary(void); |
| 60 | #else |
| 61 | static inline int calgary_iommu_init(void) { return 1; } |
| 62 | static inline void detect_calgary(void) { return; } |
| 63 | #endif |
| 64 | |
Jon Mason | e465058 | 2006-06-26 13:58:14 +0200 | [diff] [blame] | 65 | #endif /* _ASM_X86_64_CALGARY_H */ |