PPC: More coherent startup messages

KDB: Improve printing of TIDs
This commit is contained in:
Jan Stoess 2010-07-01 13:15:32 +02:00
parent 75811bec07
commit de23a4de92
5 changed files with 31 additions and 33 deletions

View File

@ -73,7 +73,7 @@ int print_tid (word_t val, word_t width, word_t precision, bool adjleft)
addr_to_tcb((addr_t) val) == get_idle_tcb() || addr_to_tcb((addr_t) val) == get_idle_tcb() ||
addr_to_tcb((addr_t) val) == get_kdebug_tcb()) addr_to_tcb((addr_t) val) == get_kdebug_tcb())
{ {
tcb = addr_to_tcb ((addr_t) val); tcb = addr_to_tcb ((addr_t) val);
tid = tcb->get_global_id (); tid = tcb->get_global_id ();
} }
else else
@ -88,15 +88,12 @@ int print_tid (word_t val, word_t width, word_t precision, bool adjleft)
threadid_t ktid; threadid_t ktid;
ktid.set_global_id (get_kip ()->thread_info.get_system_base (), 1); ktid.set_global_id (get_kip ()->thread_info.get_system_base (), 1);
if (tcb->get_global_id() == ktid) if (tid == ktid)
return print_string ("KRN_THRD", width, precision); return print_string ("KRN_THRD", width, precision);
if (tcb == get_idle_tcb ()) if (tid == IDLETHREAD)
return print_string ("IDLETHRD", width, precision); return print_string ("IDLETHRD", width, precision);
if (tcb == get_kdebug_tcb())
return print_string ("KDBTHRD", width, precision);
if (tid.is_nilthread ()) if (tid.is_nilthread ())
return print_string ("NIL_THRD", width, precision); return print_string ("NIL_THRD", width, precision);
@ -115,6 +112,10 @@ int print_tid (word_t val, word_t width, word_t precision, bool adjleft)
const char *names[3] = { "SIGMA0", "SIGMA1", "ROOTTASK" }; const char *names[3] = { "SIGMA0", "SIGMA1", "ROOTTASK" };
return print_string (names[base_id], width, precision); return print_string (names[base_id], width, precision);
} }
if (tcb == get_kdebug_tcb())
return print_string ("KDBTHRD", width, precision);
} }
// We're dealing with something which is not a special thread ID. // We're dealing with something which is not a special thread ID.

View File

@ -382,7 +382,7 @@ typedef void (*func_ptr_t) (void);
void SECTION(".init") scheduler_t::init( bool bootcpu ) void SECTION(".init") scheduler_t::init( bool bootcpu )
{ {
TRACE_INIT ("\tInitializing threading CPU %d\n", get_current_cpu()); TRACE_INIT ("\tInitializing threading (CPU %d)\n", get_current_cpu());
policy_scheduler_init(); policy_scheduler_init();

View File

@ -3,7 +3,7 @@
* Copyright (C) 1999-2010, Karlsruhe University * Copyright (C) 1999-2010, Karlsruhe University
* Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation * Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation
* *
* File path: src/generic/asid.h * File path: generic/asid.h
* Description: * Description:
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -83,8 +83,6 @@ public:
void init(word_t start, word_t end) void init(word_t start, word_t end)
{ {
TRACE_INIT("asid_manager init %x -> %x\n", start, end);
free_list = NULL; free_list = NULL;
timestamp = 0; timestamp = 0;

View File

@ -94,15 +94,15 @@ static void fatal( char *msg )
while( 1 ) ; while( 1 ) ;
} }
SECTION(SEC_INIT) void timer_init( word_t cpu_hz, word_t bus_hz ) SECTION(SEC_INIT) void timer_init( word_t cpu_hz, word_t bus_hz, word_t cpu )
{ {
word_t decrementer_hz; word_t decrementer_hz;
decrementer_hz = bus_hz / 1; decrementer_hz = bus_hz / 1;
decrementer_interval = TIMER_TICK_LENGTH * (decrementer_hz / 1000) / 1000; decrementer_interval = TIMER_TICK_LENGTH * (decrementer_hz / 1000) / 1000;
TRACE_INIT( "Decrementer %d (KHz), timer tick %d (us), " TRACE_INIT( "\tDecrementer %d KHz, timer tick %d us\n"
"decrementer ticks %d\n", decrementer_hz/1000, "\tDecrementer ticks %d (CPU %d)\n", decrementer_hz/1000,
TIMER_TICK_LENGTH, decrementer_interval ); TIMER_TICK_LENGTH, decrementer_interval, cpu );
} }
/***************************************************************************** /*****************************************************************************
@ -236,7 +236,8 @@ SECTION(SEC_INIT) static void kip_cpu_init( kernel_interface_page_t *kip )
// Invoked for each processor. // Invoked for each processor.
{ {
static word_t cpu_khz = 0, bus_khz = 0; static word_t cpu_khz = 0, bus_khz = 0;
word_t cpu = get_current_cpu();
if( cpu_khz == 0 ) if( cpu_khz == 0 )
{ {
word_t cpu_hz, bus_hz; word_t cpu_hz, bus_hz;
@ -251,10 +252,10 @@ SECTION(SEC_INIT) static void kip_cpu_init( kernel_interface_page_t *kip )
cpu_khz = cpu_hz / 1000; cpu_khz = cpu_hz / 1000;
bus_khz = bus_hz / 1000; bus_khz = bus_hz / 1000;
TRACE_INIT( "PowerPC cpu speed: %d (KHz)\n", cpu_khz ); TRACE_INIT( "\tPowerPC CPU speed: %d KHz (CPU %d)\n", cpu_khz, cpu);
TRACE_INIT( "Bus speed: %d (KHz)\n", bus_khz ); TRACE_INIT( "\tBus speed: %d KHz (CPU %d)\n", bus_khz, cpu);
timer_init( cpu_hz, bus_hz ); timer_init( cpu_hz, bus_hz, cpu );
} }
init_cpu( get_current_cpu(), bus_khz, cpu_khz ); init_cpu( get_current_cpu(), bus_khz, cpu_khz );
@ -314,7 +315,7 @@ SECTION(SEC_INIT) static void reclaim_cpu_kmem()
} }
#endif #endif
SECTION(SEC_INIT) static word_t do_kmem_init() SECTION(SEC_INIT) static word_t init_bootmem()
{ {
word_t bootmem_low, bootmem_high; word_t bootmem_low, bootmem_high;
word_t tot, size; word_t tot, size;
@ -328,7 +329,6 @@ SECTION(SEC_INIT) static word_t do_kmem_init()
#else #else
bootmem_high = bootmem_low + KB(512); bootmem_high = bootmem_low + KB(512);
#endif #endif
TRACE_INIT("kmem init %x-%x\n", bootmem_low, bootmem_high);
kmem.init( (addr_t)bootmem_low, (addr_t)bootmem_high ); kmem.init( (addr_t)bootmem_low, (addr_t)bootmem_high );
tot = bootmem_high - bootmem_low; tot = bootmem_high - bootmem_low;
@ -341,21 +341,20 @@ SECTION(SEC_INIT) static word_t do_kmem_init()
// Claim the memory between the end of the kernel data section and // Claim the memory between the end of the kernel data section and
// the start of the cpu data page. // the start of the cpu data page.
size = cpu_phys_area(0) - (word_t)memcfg_end_data_phys(); size = cpu_phys_area(0) - (word_t)memcfg_end_data_phys();
TRACE_INIT("kmem add %x/ %x\n", phys_to_virt(memcfg_end_data_phys()), size);
if( size ) if( size )
kmem.add( phys_to_virt(memcfg_end_data_phys()), size ); kmem.add( phys_to_virt(memcfg_end_data_phys()), size );
tot += size; tot += size;
TRACE_INIT( "Kernel boot mem: %d bytes\n", tot );
return virt_to_phys(bootmem_high); return virt_to_phys(bootmem_high);
} }
#elif defined(CONFIG_PPC_MMU_TLB) #elif defined(CONFIG_PPC_MMU_TLB)
#if defined(CONFIG_SMP)
SECTION(SEC_INIT) static void reclaim_cpu_kmem() SECTION(SEC_INIT) static void reclaim_cpu_kmem()
{ {
} }
#endif
SECTION(SEC_INIT) static word_t do_kmem_init() SECTION(SEC_INIT) static word_t init_bootmem()
{ {
addr_t bootmem_low, bootmem_high; addr_t bootmem_low, bootmem_high;
word_t tot; word_t tot;
@ -365,11 +364,9 @@ SECTION(SEC_INIT) static word_t do_kmem_init()
bootmem_low = phys_to_virt( memcfg_end_cpu_phys() ); bootmem_low = phys_to_virt( memcfg_end_cpu_phys() );
bootmem_high = addr_offset(bootmem_low, KB(3584)); bootmem_high = addr_offset(bootmem_low, KB(3584));
TRACE_INIT("kmem init %p-%p\n", bootmem_low, bootmem_high);
kmem.init( bootmem_low, bootmem_high ); kmem.init( bootmem_low, bootmem_high );
tot = (word_t)bootmem_high - (word_t)bootmem_low; tot = (word_t)bootmem_high - (word_t)bootmem_low;
TRACE_INIT( "Kernel boot mem: %d bytes\n", tot );
return virt_to_phys((word_t)bootmem_high); return virt_to_phys((word_t)bootmem_high);
} }
#endif #endif
@ -569,7 +566,6 @@ SECTION(SEC_INIT) static void finish_api_init( void )
cpu_t::add_cpu(0); cpu_t::add_cpu(0);
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
reclaim_cpu_kmem(); reclaim_cpu_kmem();
start_all_cpus(); start_all_cpus();
#endif #endif
@ -694,7 +690,7 @@ extern "C" void SECTION(SEC_INIT) startup_system ( word_t r3, word_t r4, word_t
/* Init all of our memory related stuff. /* Init all of our memory related stuff.
*/ */
word_t bootmem_phys_high = do_kmem_init(); word_t bootmem_phys_high = init_bootmem();
kip_mem_init( get_kip(), bootmem_phys_high ); kip_mem_init( get_kip(), bootmem_phys_high );
TRACE_INIT("Initializing kernel space\n"); TRACE_INIT("Initializing kernel space\n");
@ -719,9 +715,11 @@ extern "C" void SECTION(SEC_INIT) startup_system ( word_t r3, word_t r4, word_t
TRACE_INIT("Initializing mapping database\n"); TRACE_INIT("Initializing mapping database\n");
init_mdb(); init_mdb();
/* Initialize the idle tcb, and push notify frames for starting /* Initialize the idle tcb, and push notify frames for starting
* the idle thread. */ * the idle thread. */
get_current_scheduler()->init( true ); get_current_scheduler()->init( true );
/* Push a notify frame for the second stage of initialization, which /* Push a notify frame for the second stage of initialization, which
* executes in the context of the idle thread. This must execute * executes in the context of the idle thread. This must execute
* before the scheduler's notify frames. */ * before the scheduler's notify frames. */

View File

@ -146,9 +146,9 @@ void SECTION(".init.memory") space_t::init_cpu_mappings(cpuid_t cpu)
memcpy(page, phys_to_virt(_cpu_phys), 1 << log2size); memcpy(page, phys_to_virt(_cpu_phys), 1 << log2size);
} }
TRACE_INIT("mapping %p/%p -> %p, log2sz=%d, TLB entry: %d\n", TRACE_INIT("\tMapping %p/%p -> %p, log2sz=%d, TLB entry: %d (CPU %d)\n",
page, virt_to_phys(page), CPU_AREA_START, log2size, page, virt_to_phys(page), CPU_AREA_START, log2size,
swtlb_high_water); swtlb_high_water, cpu);
tlb0.init_vaddr_size(CPU_AREA_START, log2size); tlb0.init_vaddr_size(CPU_AREA_START, log2size);
tlb1.init_paddr((paddr_t)virt_to_phys(page)); tlb1.init_paddr((paddr_t)virt_to_phys(page));
@ -164,6 +164,7 @@ void SECTION(".init.memory") space_t::init_cpu_mappings(cpuid_t cpu)
/* /*
* CPU local mappings exist now * CPU local mappings exist now
*/ */
TRACE_INIT("\tASID manager init %x -> %x (CPU %d)\n", 1, CONFIG_MAX_NUM_ASIDS-1, cpu);
asid_manager.init(1, CONFIG_MAX_NUM_ASIDS - 1); asid_manager.init(1, CONFIG_MAX_NUM_ASIDS - 1);
ASSERT(this == get_kernel_space()); ASSERT(this == get_kernel_space());
this->cpu[cpu].asid.init_kernel(0); this->cpu[cpu].asid.init_kernel(0);
@ -178,7 +179,7 @@ void SECTION(".init.memory") space_t::init_cpu_mappings(cpuid_t cpu)
init_swtlb[idx].tlb0.read(idx); init_swtlb[idx].tlb0.read(idx);
init_swtlb[idx].tlb1.read(idx); init_swtlb[idx].tlb1.read(idx);
init_swtlb[idx].tlb2.read(idx); init_swtlb[idx].tlb2.read(idx);
TRACEF("TLB%d: %lx, %lx, %lx\n", idx, init_swtlb[idx].tlb0.raw, TRACEF("\tTLB%d: %lx, %lx, %lx\n", idx, init_swtlb[idx].tlb0.raw,
init_swtlb[idx].tlb1.raw, init_swtlb[idx].tlb2.raw); init_swtlb[idx].tlb1.raw, init_swtlb[idx].tlb2.raw);
} }
} }
@ -493,8 +494,8 @@ SECTION(".init") void setup_kernel_mappings( void )
ppc_tlbsx((u32_t)&init_paging, entry); ppc_tlbsx((u32_t)&init_paging, entry);
tlb0.read(entry); tlb0.read(entry);
TRACE_INIT("flush boot mapping %x, vaddr=%x, size=%x (%x)\n", TRACE_INIT("Flush boot mapping %x, vaddr=%x, size=%x (%x)\n",
entry, tlb0.get_vaddr(), tlb0.get_size(), tlb0.raw); entry, tlb0.get_vaddr(), tlb0.get_size(), tlb0.raw);
ppc_tlb0_t::invalid().write(entry); ppc_tlb0_t::invalid().write(entry);
} }