diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-06-26 15:27:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-27 04:12:07 -0400 |
commit | f6e2e6b6fc465bc3cc4eae8d53fcf573ca1cfa14 (patch) | |
tree | be832c3042ad9428f28bf48f1e3f77bfc150de7c /arch/x86/kernel/amd_iommu_init.c | |
parent | 8d283c35a293e6091fdf7ef86842c1174c48a941 (diff) |
x86, AMD IOMMU: add defines and structures for ACPI scanning code
This patch adds the required data structures and constants required to parse
the ACPI table for the AMD IOMMU.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Cc: iommu@lists.linux-foundation.org
Cc: bhavna.sarathy@amd.com
Cc: Sebastian.Biemueller@amd.com
Cc: robert.richter@amd.com
Cc: joro@8bytes.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/amd_iommu_init.c')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c new file mode 100644 index 000000000000..6fce5ab683d8 --- /dev/null +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2008 Advanced Micro Devices, Inc. | ||
3 | * Author: Joerg Roedel <joerg.roedel@amd.com> | ||
4 | * Leo Duran <leo.duran@amd.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published | ||
8 | * by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/pci.h> | ||
21 | #include <linux/acpi.h> | ||
22 | #include <linux/gfp.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <asm/pci-direct.h> | ||
25 | #include <asm/amd_iommu_types.h> | ||
26 | #include <asm/gart.h> | ||
27 | |||
28 | /* | ||
29 | * definitions for the ACPI scanning code | ||
30 | */ | ||
31 | #define UPDATE_LAST_BDF(x) do {\ | ||
32 | if ((x) > amd_iommu_last_bdf) \ | ||
33 | amd_iommu_last_bdf = (x); \ | ||
34 | } while (0); | ||
35 | |||
36 | #define DEVID(bus, devfn) (((bus) << 8) | (devfn)) | ||
37 | #define PCI_BUS(x) (((x) >> 8) & 0xff) | ||
38 | #define IVRS_HEADER_LENGTH 48 | ||
39 | #define TBL_SIZE(x) (1 << (PAGE_SHIFT + get_order(amd_iommu_last_bdf * (x)))) | ||
40 | |||
41 | #define ACPI_IVHD_TYPE 0x10 | ||
42 | #define ACPI_IVMD_TYPE_ALL 0x20 | ||
43 | #define ACPI_IVMD_TYPE 0x21 | ||
44 | #define ACPI_IVMD_TYPE_RANGE 0x22 | ||
45 | |||
46 | #define IVHD_DEV_ALL 0x01 | ||
47 | #define IVHD_DEV_SELECT 0x02 | ||
48 | #define IVHD_DEV_SELECT_RANGE_START 0x03 | ||
49 | #define IVHD_DEV_RANGE_END 0x04 | ||
50 | #define IVHD_DEV_ALIAS 0x42 | ||
51 | #define IVHD_DEV_ALIAS_RANGE 0x43 | ||
52 | #define IVHD_DEV_EXT_SELECT 0x46 | ||
53 | #define IVHD_DEV_EXT_SELECT_RANGE 0x47 | ||
54 | |||
55 | #define IVHD_FLAG_HT_TUN_EN 0x00 | ||
56 | #define IVHD_FLAG_PASSPW_EN 0x01 | ||
57 | #define IVHD_FLAG_RESPASSPW_EN 0x02 | ||
58 | #define IVHD_FLAG_ISOC_EN 0x03 | ||
59 | |||
60 | #define IVMD_FLAG_EXCL_RANGE 0x08 | ||
61 | #define IVMD_FLAG_UNITY_MAP 0x01 | ||
62 | |||
63 | #define ACPI_DEVFLAG_INITPASS 0x01 | ||
64 | #define ACPI_DEVFLAG_EXTINT 0x02 | ||
65 | #define ACPI_DEVFLAG_NMI 0x04 | ||
66 | #define ACPI_DEVFLAG_SYSMGT1 0x10 | ||
67 | #define ACPI_DEVFLAG_SYSMGT2 0x20 | ||
68 | #define ACPI_DEVFLAG_LINT0 0x40 | ||
69 | #define ACPI_DEVFLAG_LINT1 0x80 | ||
70 | #define ACPI_DEVFLAG_ATSDIS 0x10000000 | ||
71 | |||
72 | struct ivhd_header { | ||
73 | u8 type; | ||
74 | u8 flags; | ||
75 | u16 length; | ||
76 | u16 devid; | ||
77 | u16 cap_ptr; | ||
78 | u64 mmio_phys; | ||
79 | u16 pci_seg; | ||
80 | u16 info; | ||
81 | u32 reserved; | ||
82 | } __attribute__((packed)); | ||
83 | |||
84 | struct ivhd_entry { | ||
85 | u8 type; | ||
86 | u16 devid; | ||
87 | u8 flags; | ||
88 | u32 ext; | ||
89 | } __attribute__((packed)); | ||
90 | |||
91 | struct ivmd_header { | ||
92 | u8 type; | ||
93 | u8 flags; | ||
94 | u16 length; | ||
95 | u16 devid; | ||
96 | u16 aux; | ||
97 | u64 resv; | ||
98 | u64 range_start; | ||
99 | u64 range_length; | ||
100 | } __attribute__((packed)); | ||
101 | |||