aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-09-17 11:14:27 -0400
committerIngo Molnar <mingo@elte.hu>2008-09-19 06:59:30 -0400
commitb514e55569855bbaab782a8ec073630ed4e99c68 (patch)
treeaf3a8371d5e1ad2cdb9f72dbc1b78000c6872f11 /arch/x86/kernel/amd_iommu_init.c
parent199d0d501202f077fe647a5c14fe046b17abc46b (diff)
AMD IOMMU: calculate IVHD size with a function
The current calculation of the IVHD entry size is hard to read. So move this code to a seperate function to make it more clear what this calculation does. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> 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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 505fc04e8969..80250e63bd07 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -297,6 +297,14 @@ static void __init iommu_unmap_mmio_space(struct amd_iommu *iommu)
297 ****************************************************************************/ 297 ****************************************************************************/
298 298
299/* 299/*
300 * This function calculates the length of a given IVHD entry
301 */
302static inline int ivhd_entry_length(u8 *ivhd)
303{
304 return 0x04 << (*ivhd >> 6);
305}
306
307/*
300 * This function reads the last device id the IOMMU has to handle from the PCI 308 * This function reads the last device id the IOMMU has to handle from the PCI
301 * capability header for this IOMMU 309 * capability header for this IOMMU
302 */ 310 */
@@ -340,7 +348,7 @@ static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
340 default: 348 default:
341 break; 349 break;
342 } 350 }
343 p += 0x04 << (*p >> 6); 351 p += ivhd_entry_length(p);
344 } 352 }
345 353
346 WARN_ON(p != end); 354 WARN_ON(p != end);
@@ -641,7 +649,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
641 break; 649 break;
642 } 650 }
643 651
644 p += 0x04 << (e->type >> 6); 652 p += ivhd_entry_length(p);
645 } 653 }
646} 654}
647 655