From 88e467f38e60cbf45bd372832102bb0503886aa3 Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Fri, 13 Jun 2003 16:54:40 +0000 Subject: PPC cpu stuff git-svn-id: svn://svn.coreboot.org/coreboot/trunk@872 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/ppc/lib/cpu.c | 36 ++++++++++++++++++++++++++++++ src/arch/ppc/lib/cpuid.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/arch/ppc/lib/cpu.c create mode 100644 src/arch/ppc/lib/cpuid.c (limited to 'src/arch/ppc') diff --git a/src/arch/ppc/lib/cpu.c b/src/arch/ppc/lib/cpu.c new file mode 100644 index 0000000000..49b230c871 --- /dev/null +++ b/src/arch/ppc/lib/cpu.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include +#include + +static void cache_on(struct mem_range *mem) +{ +} + +static void interrupts_on() +{ +} + +unsigned long cpu_initialize(struct mem_range *mem) +{ + /* Because we busy wait at the printk spinlock. + * It is important to keep the number of printed messages + * from secondary cpus to a minimum, when debugging is + * disabled. + */ + unsigned long processor_id = this_processors_id(); + printk_notice("Initializing CPU #%d\n", processor_id); + + /* Turn on caching if we haven't already */ + cache_on(mem); + + display_cpuid(); + + interrupts_on(); + + printk_info("CPU #%d Initialized\n", processor_id); + return processor_id; +} + diff --git a/src/arch/ppc/lib/cpuid.c b/src/arch/ppc/lib/cpuid.c new file mode 100644 index 0000000000..ff4e3cccad --- /dev/null +++ b/src/arch/ppc/lib/cpuid.c @@ -0,0 +1,58 @@ +/* $Id$ */ +/* Copyright 2000 AG Electronics Ltd. */ +/* This code is distributed without warranty under the GPL v2 (see COPYING) */ + +#include "ppc.h" +#include "ppcreg.h" +#include + +void display_cpuid(void) +{ + unsigned type = __getpvr() >> 16; + unsigned version = __getpvr() & 0xffff; + const char *cpu_string = 0; + switch(type) { + case 1: + cpu_string = "601"; + break; + case 3: + cpu_string = "603"; + break; + case 4: + cpu_string = "604"; + break; + case 6: + cpu_string = "603e"; + break; + case 7: + cpu_string = "603ev"; + break; + case 8: + cpu_string = "750"; + break; + case 9: + cpu_string = "604e"; + break; + case 10: + cpu_string = "604ev5 (MachV)"; + break; + case 12: + cpu_string = "7400"; + break; + case 50: + cpu_string = "821"; + break; + case 80: + cpu_string = "860"; + break; + case 0x800c: + cpu_string = "7410"; + break; + } + if (cpu_string) + printk_info("PowerPC %s", cpu_string); + else + printk_info("PowerPC unknown (0x%x)", type); + printk_info(" CPU, version %d.%d\n", version >> 8, version & 0xff); +} + -- cgit v1.2.3