|
@@ -585,3 +585,21 @@ static int add_system_ram_resources(void)
|
|
|
return 0;
|
|
|
}
|
|
|
subsys_initcall(add_system_ram_resources);
|
|
|
+
|
|
|
+#ifdef CONFIG_STRICT_DEVMEM
|
|
|
+/*
|
|
|
+ * devmem_is_allowed(): check to see if /dev/mem access to a certain address
|
|
|
+ * is valid. The argument is a physical page number.
|
|
|
+ *
|
|
|
+ * Access has to be given to non-kernel-ram areas as well, these contain the
|
|
|
+ * PCI mmio resources as well as potential bios/acpi data regions.
|
|
|
+ */
|
|
|
+int devmem_is_allowed(unsigned long pfn)
|
|
|
+{
|
|
|
+ if (iomem_is_exclusive(pfn << PAGE_SHIFT))
|
|
|
+ return 0;
|
|
|
+ if (!page_is_ram(pfn))
|
|
|
+ return 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif /* CONFIG_STRICT_DEVMEM */
|