Changeset da1bafb in mainline for kernel/generic/src/cpu/cpu.c
- Timestamp:
- 2010-05-24T18:57:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/cpu/cpu.c
r666f492 rda1bafb 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> … … 58 58 */ 59 59 void cpu_init(void) { 60 unsigned int i, j;61 62 60 #ifdef CONFIG_SMP 63 61 if (config.cpu_active == 1) { 64 62 #endif /* CONFIG_SMP */ 63 65 64 cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count, 66 65 FRAME_ATOMIC); 67 66 if (!cpus) 68 67 panic("Cannot allocate CPU structures."); 69 70 /* initialize everything */68 69 /* Initialize everything */ 71 70 memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0); 72 71 72 size_t i; 73 73 for (i = 0; i < config.cpu_count; i++) { 74 cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | FRAME_ATOMIC);75 74 cpus[i].stack = (uint8_t *) frame_alloc(STACK_FRAMES, 75 FRAME_KA | FRAME_ATOMIC); 76 76 cpus[i].id = i; 77 77 78 spinlock_initialize(&cpus[i].lock, "cpu_t.lock"); 79 78 irq_spinlock_initialize(&cpus[i].lock, "cpus[].lock"); 79 80 unsigned int j; 80 81 for (j = 0; j < RQ_COUNT; j++) { 81 spinlock_initialize(&cpus[i].rq[j].lock, "rq_t.lock");82 irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock"); 82 83 list_initialize(&cpus[i].rq[j].rq_head); 83 84 } … … 87 88 } 88 89 #endif /* CONFIG_SMP */ 89 90 90 91 CPU = &cpus[config.cpu_active - 1]; 91 92 92 CPU->active = 1;93 CPU->tlb_active = 1;93 CPU->active = true; 94 CPU->tlb_active = true; 94 95 95 96 cpu_identify(); … … 100 101 void cpu_list(void) 101 102 { 102 unsigned int i;103 103 size_t i; 104 104 105 for (i = 0; i < config.cpu_count; i++) { 105 106 if (cpus[i].active)
Note:
See TracChangeset
for help on using the changeset viewer.