blob: db5fc2f2262d8de2b2a430291e0f0eb3b0886e6a [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Olof Johanssonc707ffc2005-09-20 13:45:41 +10002/*
3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
4 * Rewrite, cleanup:
Olof Johansson91f14482005-11-21 02:12:32 -06005 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
Olof Johanssonc707ffc2005-09-20 13:45:41 +10006 */
7
David Gibson8882a4d2005-11-09 13:38:01 +11008#ifndef _ASM_POWERPC_TCE_H
9#define _ASM_POWERPC_TCE_H
Arnd Bergmann88ced032005-12-16 22:43:46 +010010#ifdef __KERNEL__
Olof Johanssonc707ffc2005-09-20 13:45:41 +100011
Linas Vepstas5d2efba2006-10-30 16:15:59 +110012#include <asm/iommu.h>
13
Olof Johanssonc707ffc2005-09-20 13:45:41 +100014/*
15 * Tces come in two formats, one for the virtual bus and a different
Milton Miller8d3d5892011-06-29 20:58:33 +000016 * format for PCI. PCI TCEs can have hardware or software maintianed
17 * coherency.
Olof Johanssonc707ffc2005-09-20 13:45:41 +100018 */
Milton Miller8d3d5892011-06-29 20:58:33 +000019#define TCE_VB 0
20#define TCE_PCI 1
Olof Johanssonc707ffc2005-09-20 13:45:41 +100021
Olof Johanssond0035c622005-09-20 13:46:44 +100022/* TCE page size is 4096 bytes (1 << 12) */
23
24#define TCE_SHIFT 12
25#define TCE_PAGE_SIZE (1 << TCE_SHIFT)
Olof Johanssond0035c622005-09-20 13:46:44 +100026
Olof Johanssonbc97ce92006-04-28 22:51:59 -050027#define TCE_ENTRY_SIZE 8 /* each TCE is 64 bits */
Olof Johanssond0035c622005-09-20 13:46:44 +100028
Olof Johanssonbc97ce92006-04-28 22:51:59 -050029#define TCE_RPN_MASK 0xfffffffffful /* 40-bit RPN (4K pages) */
30#define TCE_RPN_SHIFT 12
31#define TCE_VALID 0x800 /* TCE valid */
32#define TCE_ALLIO 0x400 /* TCE valid for all lpars */
33#define TCE_PCI_WRITE 0x2 /* write from PCI allowed */
34#define TCE_PCI_READ 0x1 /* read from PCI allowed */
35#define TCE_VB_WRITE 0x1 /* write from VB allowed */
Olof Johanssonc707ffc2005-09-20 13:45:41 +100036
Arnd Bergmann88ced032005-12-16 22:43:46 +010037#endif /* __KERNEL__ */
David Gibson8882a4d2005-11-09 13:38:01 +110038#endif /* _ASM_POWERPC_TCE_H */