[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XenPPC] [xenppc-unstable] [ppc] get more info about the machine for the xend



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID ae59d00d1acd8d6c47f852018d2dd3907fd417ee
# Parent  1263c0f17bd09f1f3af00c94f1042aa1280fa6a1
[ppc] get more info about the machine for the xend

This patch:
  - Moves timbase_freq to time.c where it belongs
  - Gets the CPU clock frequency
  - Sets total_pages (= max_page right now)

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/arch/ppc/boot_of.c   |   16 +++++++++++++++-
 xen/arch/ppc/mm.c        |    1 +
 xen/arch/ppc/setup.c     |    3 ++-
 xen/arch/ppc/time.c      |    2 ++
 xen/include/asm-ppc/mm.h |    1 +
 5 files changed, 21 insertions(+), 2 deletions(-)

diff -r 1263c0f17bd0 -r ae59d00d1acd xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c    Wed Jun 14 14:08:21 2006 -0400
+++ b/xen/arch/ppc/boot_of.c    Wed Jun 14 18:30:41 2006 -0400
@@ -24,6 +24,7 @@
 #include <xen/compile.h>
 #include <xen/spinlock.h>
 #include <xen/serial.h>
+#include <xen/time.h>
 #include <asm/page.h>
 #include <asm/io.h>
 #include "exceptions.h"
@@ -939,6 +940,7 @@ static int __init boot_of_cpus(void)
     int cpus;
     int cpu;
     int result;
+    u32 cpu_clock[2];
 
     cpus = of_finddevice("/cpus");
     cpu = of_getchild(cpus);
@@ -947,7 +949,19 @@ static int __init boot_of_cpus(void)
     if (result == OF_FAILURE) {
         of_panic("Couldn't get timebase frequency!\n");
     }
-    of_printf("OF: timebase-frequency = 0x%x\n", timebase_freq);
+    of_printf("OF: timebase-frequency = %d Hz\n", timebase_freq);
+
+    result = of_getprop(cpu, "clock-frequency", &cpu_clock, sizeof(cpu_clock));
+    if (result == OF_FAILURE || (result !=4 && result != 8)) {
+        of_panic("Couldn't get clock frequency!\n");
+    }
+    cpu_khz = cpu_clock[0];
+    if (result == 8) {
+        cpu_khz <<= 32;
+        cpu_khz |= cpu_clock[1];
+    }
+    cpu_khz /= 1000;
+    of_printf("OF: clock-frequency = %ld KHz\n", cpu_khz);
 
     /* FIXME: should not depend on the boot CPU bring the first child */
     cpu = of_getpeer(cpu);
diff -r 1263c0f17bd0 -r ae59d00d1acd xen/arch/ppc/mm.c
--- a/xen/arch/ppc/mm.c Wed Jun 14 14:08:21 2006 -0400
+++ b/xen/arch/ppc/mm.c Wed Jun 14 18:30:41 2006 -0400
@@ -29,6 +29,7 @@ struct page_info *frame_table;
 struct page_info *frame_table;
 unsigned long frame_table_size;
 unsigned long max_page;
+unsigned long total_pages;
 
 int create_grant_host_mapping(
     unsigned long addr, unsigned long frame, unsigned int flags)
diff -r 1263c0f17bd0 -r ae59d00d1acd xen/arch/ppc/setup.c
--- a/xen/arch/ppc/setup.c      Wed Jun 14 14:08:21 2006 -0400
+++ b/xen/arch/ppc/setup.c      Wed Jun 14 18:30:41 2006 -0400
@@ -54,7 +54,6 @@ u32 tlbflush_time[NR_CPUS];
 
 unsigned int watchdog_on;
 unsigned long wait_init_idle;
-unsigned int timebase_freq;
 ulong oftree;
 ulong oftree_len;
 
@@ -223,6 +222,8 @@ static void __init __start_xen(multiboot
     printk("System RAM: %luMB (%lukB)\n", eomem >> 20, eomem >> 10);
 
     max_page = PFN_DOWN(ALIGN_DOWN(eomem, PAGE_SIZE));
+    total_pages = max_page;
+
     /* skip the exception handlers */
     heap_start = init_boot_allocator(4 << PAGE_SHIFT);
 
diff -r 1263c0f17bd0 -r ae59d00d1acd xen/arch/ppc/time.c
--- a/xen/arch/ppc/time.c       Wed Jun 14 14:08:21 2006 -0400
+++ b/xen/arch/ppc/time.c       Wed Jun 14 18:30:41 2006 -0400
@@ -29,6 +29,8 @@
 
 static int cpu_has_hdec = 1;
 ulong ticks_per_usec;
+unsigned long cpu_khz;
+unsigned int timebase_freq;
 
 u64 get_timebase(void)
 {
diff -r 1263c0f17bd0 -r ae59d00d1acd xen/include/asm-ppc/mm.h
--- a/xen/include/asm-ppc/mm.h  Wed Jun 14 14:08:21 2006 -0400
+++ b/xen/include/asm-ppc/mm.h  Wed Jun 14 18:30:41 2006 -0400
@@ -184,6 +184,7 @@ extern struct page_info *frame_table;
 extern struct page_info *frame_table;
 extern unsigned long frame_table_size;
 extern unsigned long max_page;
+extern unsigned long total_pages;
 void init_frametable(void);
 
 /* hope that accesses to this will fail spectacularly */

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.