/* info on what we think the IO hole is */
unsigned long io_hole_start;
unsigned long io_hole_size;
-unsigned long top_of_ram;
void show_mem(void)
{
* So we need some rough way to tell where your big IO hole
* is. On pmac, it's between 2G and 4G, on POWER3, it's around
* that area as well, on POWER4 we don't have one, etc...
- * We need that to implement something approx. decent for
- * page_is_ram() so that /dev/mem doesn't map cacheable IO space
- * when XFree resquest some IO regions witout using O_SYNC, we
- * also need that as a "hint" when sizing the TCE table on POWER3
+ * We need that as a "hint" when sizing the TCE table on POWER3
* So far, the simplest way that seem work well enough for us it
* to just assume that the first discontinuity in our physical
* RAM layout is the IO hole. That may not be correct in the future
* (and isn't on iSeries but then we don't care ;)
*/
- top_of_ram = lmb_end_of_DRAM();
#ifndef CONFIG_PPC_ISERIES
for (i = 1; i < lmb.memory.cnt; i++) {
ppc64_boot_msg(0x100, "MM Init Done");
}
-
/*
* This is called by /dev/mem to know if a given address has to
* be mapped non-cacheable or not
*/
-int page_is_ram(unsigned long physaddr)
+int page_is_ram(unsigned long pfn)
{
-#ifdef CONFIG_PPC_ISERIES
- return 1;
+ int i;
+ unsigned long paddr = (pfn << PAGE_SHIFT);
+
+ for (i=0; i < lmb.memory.cnt; i++) {
+ unsigned long base;
+
+#ifdef CONFIG_MSCHUNKS
+ base = lmb.memory.region[i].physbase;
+#else
+ base = lmb.memory.region[i].base;
#endif
- if (physaddr >= top_of_ram)
- return 0;
- return io_hole_start == 0 || physaddr < io_hole_start ||
- physaddr >= (io_hole_start + io_hole_size);
-}
+ if ((paddr >= base) &&
+ (paddr < (base + lmb.memory.region[i].size))) {
+ return 1;
+ }
+ }
+ return 0;
+}
+EXPORT_SYMBOL(page_is_ram);
/*
* Initialize the bootmem system and give it all the memory we
unsigned long zones_size[MAX_NR_ZONES];
unsigned long zholes_size[MAX_NR_ZONES];
unsigned long total_ram = lmb_phys_mem_size();
+ unsigned long top_of_ram = lmb_end_of_DRAM();
printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
top_of_ram, total_ram);