Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
[pandora-kernel.git] / drivers / pci / dmar.c
index 5dfdfda..8bf86ae 100644 (file)
  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  * Place - Suite 330, Boston, MA 02111-1307 USA.
  *
- *     Copyright (C) Ashok Raj <ashok.raj@intel.com>
- *     Copyright (C) Shaohua Li <shaohua.li@intel.com>
- *     Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+ * Copyright (C) 2006-2008 Intel Corporation
+ * Author: Ashok Raj <ashok.raj@intel.com>
+ * Author: Shaohua Li <shaohua.li@intel.com>
+ * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
  *
- *     This file implements early detection/parsing of DMA Remapping Devices
+ * This file implements early detection/parsing of DMA Remapping Devices
  * reported to OS through BIOS via DMA remapping reporting (DMAR) ACPI
  * tables.
  */
 
 #include <linux/pci.h>
 #include <linux/dmar.h>
+#include "iova.h"
+#include "intel-iommu.h"
 
 #undef PREFIX
 #define PREFIX "DMAR:"
@@ -263,8 +266,8 @@ parse_dmar_table(void)
        if (!dmar)
                return -ENODEV;
 
-       if (!dmar->width) {
-               printk (KERN_WARNING PREFIX "Zero: Invalid DMAR haw\n");
+       if (dmar->width < PAGE_SHIFT_4K - 1) {
+               printk(KERN_WARNING PREFIX "Invalid DMAR haw\n");
                return -EINVAL;
        }
 
@@ -301,11 +304,22 @@ parse_dmar_table(void)
 int __init dmar_table_init(void)
 {
 
-       parse_dmar_table();
+       int ret;
+
+       ret = parse_dmar_table();
+       if (ret) {
+               printk(KERN_INFO PREFIX "parse DMAR table failure.\n");
+               return ret;
+       }
+
        if (list_empty(&dmar_drhd_units)) {
                printk(KERN_INFO PREFIX "No DMAR devices found\n");
                return -ENODEV;
        }
+
+       if (list_empty(&dmar_rmrr_units))
+               printk(KERN_INFO PREFIX "No RMRR found\n");
+
        return 0;
 }