Changes in kernel/generic/src/cpu/cpu.c [e3ee9b9:9dae191e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/cpu/cpu.c
re3ee9b9 r9dae191e 33 33 /** 34 34 * @file 35 * @brief 35 * @brief CPU subsystem initialization and listing. 36 36 */ 37 37 38 38 #include <cpu.h> 39 39 #include <arch.h> … … 49 49 #include <print.h> 50 50 #include <sysinfo/sysinfo.h> 51 #include <arch/cycle.h>52 51 53 52 cpu_t *cpus; … … 59 58 */ 60 59 void cpu_init(void) { 60 unsigned int i, j; 61 61 62 #ifdef CONFIG_SMP 62 63 if (config.cpu_active == 1) { 63 64 #endif /* CONFIG_SMP */ 64 65 65 cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count, 66 66 FRAME_ATOMIC); 67 67 if (!cpus) 68 68 panic("Cannot allocate CPU structures."); 69 70 /* Initialize everything */69 70 /* initialize everything */ 71 71 memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0); 72 73 size_t i; 72 74 73 for (i = 0; i < config.cpu_count; i++) { 75 cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, 76 FRAME_KA | FRAME_ATOMIC);74 cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_ATOMIC); 75 77 76 cpus[i].id = i; 78 77 79 irq_spinlock_initialize(&cpus[i].lock, "cpus[].lock"); 80 81 unsigned int j; 78 spinlock_initialize(&cpus[i].lock, "cpu_t.lock"); 79 82 80 for (j = 0; j < RQ_COUNT; j++) { 83 irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock");81 spinlock_initialize(&cpus[i].rq[j].lock, "rq_t.lock"); 84 82 list_initialize(&cpus[i].rq[j].rq_head); 85 83 } … … 89 87 } 90 88 #endif /* CONFIG_SMP */ 91 89 92 90 CPU = &cpus[config.cpu_active - 1]; 93 91 94 CPU->active = true; 95 CPU->tlb_active = true; 96 97 CPU->idle = false; 98 CPU->last_cycle = get_cycle(); 99 CPU->idle_cycles = 0; 100 CPU->busy_cycles = 0; 92 CPU->active = 1; 93 CPU->tlb_active = 1; 101 94 102 95 cpu_identify(); … … 107 100 void cpu_list(void) 108 101 { 109 size_t i;110 102 unsigned int i; 103 111 104 for (i = 0; i < config.cpu_count; i++) { 112 105 if (cpus[i].active) … … 119 112 /** @} 120 113 */ 114
Note:
See TracChangeset
for help on using the changeset viewer.