Re: [Intel IOMMU 01/10] DMAR detection and parsing logic

From: Peter Zijlstra
Date: Wed Jul 04 2007 - 05:19:20 EST


On Tue, 2007-06-19 at 14:37 -0700, Keshavamurthy, Anil S wrote:
> plain text document attachment (dmar_detection.patch)

> +/**
> + * parse_dmar_table - parses the DMA reporting table
> + */
> +static int __init
> +parse_dmar_table(void)
> +{
> + struct acpi_table_dmar *dmar;
> + struct acpi_dmar_header *entry_header;
> + int ret = 0;
> +
> + dmar = (struct acpi_table_dmar *)dmar_tbl;
> +
> + if (!dmar->width) {
^^^^^^^^^^^^^^^^^^^

That goes *splat* on my opteron box.

> + printk (KERN_WARNING PREFIX "Zero: Invalid DMAR haw\n");
> + return -EINVAL;
> + }
> +
> + printk (KERN_INFO PREFIX "Host address width %d\n",
> + dmar->width + 1);
> +
> + entry_header = (struct acpi_dmar_header *)(dmar + 1);
> + while (((unsigned long)entry_header) <
> + (((unsigned long)dmar) + dmar_tbl->length)) {
> + dmar_table_print_dmar_entry(entry_header);
> +
> + switch (entry_header->type) {
> + case ACPI_DMAR_TYPE_HARDWARE_UNIT:
> + ret = dmar_parse_one_drhd(entry_header);
> + break;
> + case ACPI_DMAR_TYPE_RESERVED_MEMORY:
> + ret = dmar_parse_one_rmrr(entry_header);
> + break;
> + default:
> + printk(KERN_WARNING PREFIX
> + "Unknown DMAR structure type\n");
> + ret = 0; /* for forward compatibility */
> + break;
> + }
> + if (ret)
> + break;
> +
> + entry_header = ((void *)entry_header + entry_header->length);
> + }
> + return ret;
> +}
> +

-
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/