Merge to Fedora Core 2 kernel-2.6.8-1.521
[linux-2.6.git] / arch / i386 / mm / init.c
index 5cd4a39..a008d43 100644 (file)
@@ -55,7 +55,7 @@ static inline int page_kills_ppro(unsigned long pagenr)
 
 extern int is_available_memory(efi_memory_desc_t *);
 
-int page_is_ram(unsigned long pagenr)
+static inline int page_is_ram(unsigned long pagenr)
 {
        int i;
        unsigned long addr, end;
@@ -100,6 +100,26 @@ int pfn_is_ram(unsigned long pfn)
 }
 
 
+/*
+ * devmem_is_allowed() checks to see if /dev/mem access to a certain address is
+ * valid. The argument is a physical page number.
+ *
+ *
+ * On x86, access has to be given to the first megabyte of ram because that area
+ * contains bios code and data regions used by X and dosemu and similar apps.
+ * 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 pagenr)
+{
+       if (pagenr <= 256)
+               return 1;
+       if (!page_is_ram(pagenr))
+               return 1;
+       return 0;
+}
+
+
 pte_t *kmap_pte;
 
 EXPORT_SYMBOL(kmap_pte);