diff options
Diffstat (limited to 'arch/x86/kernel/amd_iommu_init.c')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 9bf1b8111b08..7661b02d7208 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -426,11 +426,18 @@ static void set_dev_entry_bit(u16 devid, u8 bit) | |||
426 | amd_iommu_dev_table[devid].data[i] |= (1 << _bit); | 426 | amd_iommu_dev_table[devid].data[i] |= (1 << _bit); |
427 | } | 427 | } |
428 | 428 | ||
429 | /* Writes the specific IOMMU for a device into the rlookup table */ | ||
430 | static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) | ||
431 | { | ||
432 | amd_iommu_rlookup_table[devid] = iommu; | ||
433 | } | ||
434 | |||
429 | /* | 435 | /* |
430 | * This function takes the device specific flags read from the ACPI | 436 | * This function takes the device specific flags read from the ACPI |
431 | * table and sets up the device table entry with that information | 437 | * table and sets up the device table entry with that information |
432 | */ | 438 | */ |
433 | static void __init set_dev_entry_from_acpi(u16 devid, u32 flags, u32 ext_flags) | 439 | static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu, |
440 | u16 devid, u32 flags, u32 ext_flags) | ||
434 | { | 441 | { |
435 | if (flags & ACPI_DEVFLAG_INITPASS) | 442 | if (flags & ACPI_DEVFLAG_INITPASS) |
436 | set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS); | 443 | set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS); |
@@ -446,12 +453,8 @@ static void __init set_dev_entry_from_acpi(u16 devid, u32 flags, u32 ext_flags) | |||
446 | set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS); | 453 | set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS); |
447 | if (flags & ACPI_DEVFLAG_LINT1) | 454 | if (flags & ACPI_DEVFLAG_LINT1) |
448 | set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); | 455 | set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); |
449 | } | ||
450 | 456 | ||
451 | /* Writes the specific IOMMU for a device into the rlookup table */ | 457 | set_iommu_for_device(iommu, devid); |
452 | static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) | ||
453 | { | ||
454 | amd_iommu_rlookup_table[devid] = iommu; | ||
455 | } | 458 | } |
456 | 459 | ||
457 | /* | 460 | /* |
@@ -550,11 +553,12 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
550 | case IVHD_DEV_ALL: | 553 | case IVHD_DEV_ALL: |
551 | for (dev_i = iommu->first_device; | 554 | for (dev_i = iommu->first_device; |
552 | dev_i <= iommu->last_device; ++dev_i) | 555 | dev_i <= iommu->last_device; ++dev_i) |
553 | set_dev_entry_from_acpi(dev_i, e->flags, 0); | 556 | set_dev_entry_from_acpi(iommu, dev_i, |
557 | e->flags, 0); | ||
554 | break; | 558 | break; |
555 | case IVHD_DEV_SELECT: | 559 | case IVHD_DEV_SELECT: |
556 | devid = e->devid; | 560 | devid = e->devid; |
557 | set_dev_entry_from_acpi(devid, e->flags, 0); | 561 | set_dev_entry_from_acpi(iommu, devid, e->flags, 0); |
558 | break; | 562 | break; |
559 | case IVHD_DEV_SELECT_RANGE_START: | 563 | case IVHD_DEV_SELECT_RANGE_START: |
560 | devid_start = e->devid; | 564 | devid_start = e->devid; |
@@ -565,7 +569,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
565 | case IVHD_DEV_ALIAS: | 569 | case IVHD_DEV_ALIAS: |
566 | devid = e->devid; | 570 | devid = e->devid; |
567 | devid_to = e->ext >> 8; | 571 | devid_to = e->ext >> 8; |
568 | set_dev_entry_from_acpi(devid, e->flags, 0); | 572 | set_dev_entry_from_acpi(iommu, devid, e->flags, 0); |
569 | amd_iommu_alias_table[devid] = devid_to; | 573 | amd_iommu_alias_table[devid] = devid_to; |
570 | break; | 574 | break; |
571 | case IVHD_DEV_ALIAS_RANGE: | 575 | case IVHD_DEV_ALIAS_RANGE: |
@@ -577,7 +581,8 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
577 | break; | 581 | break; |
578 | case IVHD_DEV_EXT_SELECT: | 582 | case IVHD_DEV_EXT_SELECT: |
579 | devid = e->devid; | 583 | devid = e->devid; |
580 | set_dev_entry_from_acpi(devid, e->flags, e->ext); | 584 | set_dev_entry_from_acpi(iommu, devid, e->flags, |
585 | e->ext); | ||
581 | break; | 586 | break; |
582 | case IVHD_DEV_EXT_SELECT_RANGE: | 587 | case IVHD_DEV_EXT_SELECT_RANGE: |
583 | devid_start = e->devid; | 588 | devid_start = e->devid; |
@@ -590,7 +595,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
590 | for (dev_i = devid_start; dev_i <= devid; ++dev_i) { | 595 | for (dev_i = devid_start; dev_i <= devid; ++dev_i) { |
591 | if (alias) | 596 | if (alias) |
592 | amd_iommu_alias_table[dev_i] = devid_to; | 597 | amd_iommu_alias_table[dev_i] = devid_to; |
593 | set_dev_entry_from_acpi( | 598 | set_dev_entry_from_acpi(iommu, |
594 | amd_iommu_alias_table[dev_i], | 599 | amd_iommu_alias_table[dev_i], |
595 | flags, ext_flags); | 600 | flags, ext_flags); |
596 | } | 601 | } |