aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-07-11 11:14:24 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-11 12:01:11 -0400
commit208ec8c94d818a3def0b424958493728871716d1 (patch)
tree593b573ef78aeb7ff79d0509ed5c54ec97983380 /arch/x86/kernel/amd_iommu_init.c
parent8ea80d783efd0c50577ec8d69757ae54c408eacd (diff)
x86, AMD IOMMU: replace UPDATE_LAST_BDF macro with a function
This patch replaces the UPDATE_LAST_BDF macro in the init code with the update_last_devid function. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org Cc: bhavna.sarathy@amd.com Cc: robert.richter@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.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 9ddb46d7c524..6e1c8ffc0c5b 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -30,11 +30,6 @@
30/* 30/*
31 * definitions for the ACPI scanning code 31 * definitions for the ACPI scanning code
32 */ 32 */
33#define UPDATE_LAST_BDF(x) do {\
34 if ((x) > amd_iommu_last_bdf) \
35 amd_iommu_last_bdf = (x); \
36 } while (0);
37
38#define DEVID(bus, devfn) (((bus) << 8) | (devfn)) 33#define DEVID(bus, devfn) (((bus) << 8) | (devfn))
39#define PCI_BUS(x) (((x) >> 8) & 0xff) 34#define PCI_BUS(x) (((x) >> 8) & 0xff)
40#define IVRS_HEADER_LENGTH 48 35#define IVRS_HEADER_LENGTH 48
@@ -169,6 +164,12 @@ static u32 dev_table_size; /* size of the device table */
169static u32 alias_table_size; /* size of the alias table */ 164static u32 alias_table_size; /* size of the alias table */
170static u32 rlookup_table_size; /* size if the rlookup table */ 165static u32 rlookup_table_size; /* size if the rlookup table */
171 166
167static inline void update_last_devid(u16 devid)
168{
169 if (devid > amd_iommu_last_bdf)
170 amd_iommu_last_bdf = devid;
171}
172
172/**************************************************************************** 173/****************************************************************************
173 * 174 *
174 * AMD IOMMU MMIO register space handling functions 175 * AMD IOMMU MMIO register space handling functions
@@ -287,7 +288,7 @@ static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr)
287 u32 cap; 288 u32 cap;
288 289
289 cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET); 290 cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
290 UPDATE_LAST_BDF(DEVID(MMIO_GET_BUS(cap), MMIO_GET_LD(cap))); 291 update_last_devid(DEVID(MMIO_GET_BUS(cap), MMIO_GET_LD(cap)));
291 292
292 return 0; 293 return 0;
293} 294}
@@ -317,7 +318,7 @@ static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
317 case IVHD_DEV_ALIAS: 318 case IVHD_DEV_ALIAS:
318 case IVHD_DEV_EXT_SELECT: 319 case IVHD_DEV_EXT_SELECT:
319 /* all the above subfield types refer to device ids */ 320 /* all the above subfield types refer to device ids */
320 UPDATE_LAST_BDF(dev->devid); 321 update_last_devid(dev->devid);
321 break; 322 break;
322 default: 323 default:
323 break; 324 break;