
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/arch/ppc64/kernel/pSeries_setup.c |   11 +++++----
 memhotplug-dave/arch/ppc64/kernel/setup.c         |   12 ++++++++++
 memhotplug-dave/arch/ppc64/mm/numa.c              |   26 ++++++++++++++++++----
 3 files changed, 40 insertions(+), 9 deletions(-)

diff -puN arch/ppc64/kernel/pSeries_setup.c~debug arch/ppc64/kernel/pSeries_setup.c
--- memhotplug/arch/ppc64/kernel/pSeries_setup.c~debug	2005-04-11 15:29:00.000000000 -0700
+++ memhotplug-dave/arch/ppc64/kernel/pSeries_setup.c	2005-04-11 15:29:00.000000000 -0700
@@ -65,11 +65,7 @@
 #include "mpic.h"
 #include "pci.h"
 
-#ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
 
 extern void pSeries_final_fixup(void);
 
@@ -349,13 +345,18 @@ static void __init pSeries_init_early(vo
 
 	fw_feature_init();
 	
-	if (systemcfg->platform & PLATFORM_LPAR)
+	DBG(" -> pSeries_init_early() 1\n");
+	if (systemcfg->platform & PLATFORM_LPAR) {
+	DBG(" -> pSeries_init_early() 2\n");
 		hpte_init_lpar();
+	DBG(" -> pSeries_init_early() 3\n");
+	}
 	else {
 		hpte_init_native();
 		iommu_off = (of_chosen &&
 			     get_property(of_chosen, "linux,iommu-off", NULL));
 	}
+	DBG(" -> pSeries_init_early() 4\n");
 
 	generic_find_legacy_serial_ports(&physport, &default_speed);
 
diff -puN arch/ppc64/kernel/setup.c~debug arch/ppc64/kernel/setup.c
--- memhotplug/arch/ppc64/kernel/setup.c~debug	2005-04-11 15:29:00.000000000 -0700
+++ memhotplug-dave/arch/ppc64/kernel/setup.c	2005-04-11 15:29:00.000000000 -0700
@@ -617,41 +617,51 @@ void __init setup_system(void)
 	 * related options that will be used by finish_device_tree()
 	 */
 	ppc_md.init_early();
+	udbg_printf("%s() 3\n", __func__);
 
 	/*
 	 * "Finish" the device-tree, that is do the actual parsing of
 	 * some of the properties like the interrupt map
 	 */
 	finish_device_tree();
+	udbg_printf("%s() 4\n", __func__);
 
 	/*
 	 * Initialize xmon
 	 */
 #ifdef CONFIG_XMON_DEFAULT
+	udbg_printf("%s() 5\n", __func__);
 	xmon_init();
 #endif
+	udbg_printf("%s() 6\n", __func__);
 	/*
 	 * Register early console
 	 */
 	early_console_initialized = 1;
+	udbg_printf("%s() 7\n", __func__);
 	register_console(&udbg_console);
+	udbg_printf("%s() 8\n", __func__);
 
 	/* Save unparsed command line copy for /proc/cmdline */
 	strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
+	udbg_printf("%s() 9\n", __func__);
 
 	parse_early_param();
 #endif /* !CONFIG_PPC_ISERIES */
+	udbg_printf("%s() 10\n", __func__);
 
 #if defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES)
 	/*
 	 * iSeries has already initialized the cpu maps at this point.
 	 */
 	setup_cpu_maps();
+	udbg_printf("%s() 11\n", __func__);
 
 	/* Release secondary cpus out of their spinloops at 0x60 now that
 	 * we can map physical -> logical CPU ids
 	 */
 	smp_release_cpus();
+	udbg_printf("%s() 12\n", __func__);
 #endif /* defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) */
 
 	printk("Starting Linux PPC64 %s\n", UTS_RELEASE);
@@ -672,7 +682,9 @@ void __init setup_system(void)
 	printk("htab_hash_mask                = 0x%lx\n", htab_hash_mask);
 	printk("-----------------------------------------------------\n");
 
+	udbg_printf("%s() 13\n", __func__);
 	mm_init_ppc64();
+	udbg_printf("%s() 14\n", __func__);
 
 	DBG(" <- setup_system()\n");
 }
diff -puN arch/ppc64/mm/numa.c~debug arch/ppc64/mm/numa.c
--- memhotplug/arch/ppc64/mm/numa.c~debug	2005-04-11 15:29:00.000000000 -0700
+++ memhotplug-dave/arch/ppc64/mm/numa.c	2005-04-11 15:29:00.000000000 -0700
@@ -23,8 +23,8 @@
 
 static int numa_enabled = 1;
 
-static int numa_debug;
-#define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
+static int numa_debug = 1;
+#define dbg(args...) { printk(args); udbg_printf(args); }
 
 #ifdef DEBUG_NUMA
 #define ARRAY_INITIALISER -1
@@ -530,15 +530,26 @@ static void __init dump_numa_topology(vo
 static unsigned long careful_allocation(int nid, unsigned long size,
 					unsigned long align, unsigned long end)
 {
-	unsigned long ret = lmb_alloc_base(size, align, end);
+	unsigned long ret;
+
+	udbg_printf("%s(%d, %016lx, %016lx, %016lx)\n", __func__, nid, size, align, end);
+
+	ret = lmb_alloc_base(size, align, end);
+
+	udbg_printf("%s() 1 ret: %016Lx\n", __func__, ret);
 
 	/* retry over all memory */
 	if (!ret)
 		ret = lmb_alloc_base(size, align, lmb_end_of_DRAM());
+	udbg_printf("%s() 2 ret: %016Lx\n", __func__, ret);
 
-	if (!ret)
+	if (!ret) {
+	udbg_printf("%s() 3 ret: %016Lx\n", __func__, ret);
 		panic("numa.c: cannot allocate %lu bytes on node %d",
 		      size, nid);
+	}
+	udbg_printf("%s() 4 ret: %016Lx pa_to_nid(ret): %d nid: %d\n", __func__,
+			ret, pa_to_nid(ret), nid);
 
 	/*
 	 * If the memory came from a previously allocated node, we must
@@ -546,18 +557,25 @@ static unsigned long careful_allocation(
 	 */
 	if (pa_to_nid(ret) < nid) {
 		nid = pa_to_nid(ret);
+		udbg_printf("%s() 5 ret: %016Lx nid: %d\n", __func__, ret, nid);
+		udbg_printf("%s() NODE_DATA(%d): %p\n", __func__, nid, NODE_DATA(nid));
 		ret = (unsigned long)__alloc_bootmem_node(NODE_DATA(nid),
 				size, align, 0);
+		udbg_printf("%s() 6 ret: %016Lx nid: %d\n", __func__, ret, nid);
 
 		if (!ret)
 			panic("numa.c: cannot allocate %lu bytes on node %d",
 			      size, nid);
+		udbg_printf("%s() 7 ret: %016Lx nid: %d\n", __func__, ret, nid);
 
 		ret = virt_to_abs(ret);
+		udbg_printf("%s() 8 ret: %016Lx nid: %d\n", __func__, ret, nid);
 
 		dbg("alloc_bootmem %lx %lx\n", ret, size);
+		udbg_printf("%s() 9 ret: %016Lx nid: %d\n", __func__, ret, nid);
 	}
 
+	udbg_printf("%s() 10 ret: %016Lx nid: %d\n", __func__, ret, nid);
 	return ret;
 }
 
_
