aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-06-26 15:27:46 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-27 04:12:11 -0400
commit3566b7786afd7c14c62726f359df3c827054670b (patch)
tree0d7f9e184ebcfc4b589ceb8b78cca0f6abe091a5 /arch/x86/kernel
parentb36ca91e1d2d7e846844820784d57d20ad73dbd8 (diff)
x86, AMD IOMMU: add device table initialization functions
This patch adds functions necessary to initialize the device table from the ACPI definitions. 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')
-rw-r--r--arch/x86/kernel/amd_iommu_init.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index c2be3adee87..4c37abb3435 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -308,3 +308,48 @@ static void __init free_command_buffer(struct amd_iommu *iommu)
308 get_order(CMD_BUFFER_SIZE)); 308 get_order(CMD_BUFFER_SIZE));
309} 309}
310 310
311static void set_dev_entry_bit(u16 devid, u8 bit)
312{
313 int i = (bit >> 5) & 0x07;
314 int _bit = bit & 0x1f;
315
316 amd_iommu_dev_table[devid].data[i] |= (1 << _bit);
317}
318
319static void __init set_dev_entry_from_acpi(u16 devid, u32 flags, u32 ext_flags)
320{
321 if (flags & ACPI_DEVFLAG_INITPASS)
322 set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS);
323 if (flags & ACPI_DEVFLAG_EXTINT)
324 set_dev_entry_bit(devid, DEV_ENTRY_EINT_PASS);
325 if (flags & ACPI_DEVFLAG_NMI)
326 set_dev_entry_bit(devid, DEV_ENTRY_NMI_PASS);
327 if (flags & ACPI_DEVFLAG_SYSMGT1)
328 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1);
329 if (flags & ACPI_DEVFLAG_SYSMGT2)
330 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2);
331 if (flags & ACPI_DEVFLAG_LINT0)
332 set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS);
333 if (flags & ACPI_DEVFLAG_LINT1)
334 set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS);
335}
336
337static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid)
338{
339 amd_iommu_rlookup_table[devid] = iommu;
340}
341
342static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
343{
344 struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
345
346 if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
347 return;
348
349 if (iommu) {
350 set_dev_entry_bit(m->devid, DEV_ENTRY_EX);
351 iommu->exclusion_start = m->range_start;
352 iommu->exclusion_length = m->range_length;
353 }
354}
355