[POWERPC] Clean out a bunch of duplicate includes
[cascardo/linux.git] / arch / powerpc / platforms / pseries / lpar.c
index 7496005..ea327ca 100644 (file)
@@ -35,7 +35,6 @@
 #include <asm/tlbflush.h>
 #include <asm/tlb.h>
 #include <asm/prom.h>
-#include <asm/abs_addr.h>
 #include <asm/cputable.h>
 #include <asm/udbg.h>
 #include <asm/smp.h>
@@ -209,13 +208,13 @@ void __init find_udbg_vterm(void)
        /* find the boot console from /chosen/stdout */
        if (!of_chosen)
                return;
-       name = get_property(of_chosen, "linux,stdout-path", NULL);
+       name = of_get_property(of_chosen, "linux,stdout-path", NULL);
        if (name == NULL)
                return;
        stdout_node = of_find_node_by_path(name);
        if (!stdout_node)
                return;
-       name = get_property(stdout_node, "name", NULL);
+       name = of_get_property(stdout_node, "name", NULL);
        if (!name) {
                printk(KERN_WARNING "stdout node missing 'name' property!\n");
                goto out;
@@ -226,18 +225,18 @@ void __init find_udbg_vterm(void)
        /* Check if it's a virtual terminal */
        if (strncmp(name, "vty", 3) != 0)
                goto out;
-       termno = get_property(stdout_node, "reg", NULL);
+       termno = of_get_property(stdout_node, "reg", NULL);
        if (termno == NULL)
                goto out;
        vtermno = termno[0];
 
-       if (device_is_compatible(stdout_node, "hvterm1")) {
+       if (of_device_is_compatible(stdout_node, "hvterm1")) {
                udbg_putc = udbg_putcLP;
                udbg_getc = udbg_getcLP;
                udbg_getc_poll = udbg_getc_pollLP;
                if (add_console)
                        add_preferred_console("hvc", termno[0] & 0xff, NULL);
-       } else if (device_is_compatible(stdout_node, "hvterm-protocol")) {
+       } else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) {
                vtermno = termno[0];
                udbg_putc = udbg_hvsi_putc;
                udbg_getc = udbg_hvsi_getc;
@@ -373,12 +372,23 @@ static void pSeries_lpar_hptab_clear(void)
 {
        unsigned long size_bytes = 1UL << ppc64_pft_size;
        unsigned long hpte_count = size_bytes >> 4;
-       unsigned long dummy1, dummy2;
+       unsigned long dummy1, dummy2, dword0;
+       long lpar_rc;
        int i;
 
        /* TODO: Use bulk call */
-       for (i = 0; i < hpte_count; i++)
-               plpar_pte_remove(0, i, 0, &dummy1, &dummy2);
+       for (i = 0; i < hpte_count; i++) {
+               /* dont remove HPTEs with VRMA mappings */
+               lpar_rc = plpar_pte_remove_raw(H_ANDCOND, i, HPTE_V_1TB_SEG,
+                                               &dummy1, &dummy2);
+               if (lpar_rc == H_NOT_FOUND) {
+                       lpar_rc = plpar_pte_read_raw(0, i, &dword0, &dummy1);
+                       if (!lpar_rc && ((dword0 & HPTE_V_VRMA_MASK)
+                               != HPTE_V_VRMA_MASK))
+                               /* Can be hpte for 1TB Seg. So remove it */
+                               plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
+               }
+       }
 }
 
 /*