Re: [PATCH 11/34] AMD IOMMU: add functions for IOMMU hardwareinitialization from ACPI

From: Andrew Morton
Date: Wed Jul 09 2008 - 21:55:21 EST


On Thu, 26 Jun 2008 21:27:47 +0200 Joerg Roedel <joerg.roedel@xxxxxxx> wrote:

> This patch adds functions to initialize the IOMMU hardware with information
> from ACPI and PCI.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
> ---
> arch/x86/kernel/amd_iommu_init.c | 125 ++++++++++++++++++++++++++++++++++++++
> 1 files changed, 125 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
> index 4c37abb..8ec48f1 100644
> --- a/arch/x86/kernel/amd_iommu_init.c
> +++ b/arch/x86/kernel/amd_iommu_init.c
> @@ -353,3 +353,128 @@ static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
> }
> }
>
> +static void __init init_iommu_from_pci(struct amd_iommu *iommu)
> +{
> + int bus = PCI_BUS(iommu->devid);
> + int dev = PCI_SLOT(iommu->devid);
> + int fn = PCI_FUNC(iommu->devid);
> + int cap_ptr = iommu->cap_ptr;
> + u32 range;
> +
> + iommu->cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_CAP_HDR_OFFSET);
> +
> + range = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
> + iommu->first_device = DEVID(MMIO_GET_BUS(range), MMIO_GET_FD(range));
> + iommu->last_device = DEVID(MMIO_GET_BUS(range), MMIO_GET_LD(range));
> +}
> +
> +static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
> + struct ivhd_header *h)
> +{
> + u8 *p = (u8 *)h;
> + u8 *end = p, flags = 0;
> + u16 dev_i, devid = 0, devid_start = 0, devid_to = 0;
> + u32 ext_flags = 0;
> + bool alias = 0;

Using `false' would be more conventional.

> + alias = 1;

`true'.

etc.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/