Changeset 49e6c6b4 in mainline
- Timestamp:
- 2012-06-30T23:54:42Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2ee1ccc
- Parents:
- 1f092d9
- Location:
- kernel
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/cpu.h
r1f092d9 r49e6c6b4 73 73 tss_t *tss; 74 74 75 unsigned int id; /** CPU's local, ie physical, APIC ID. */ 76 75 77 size_t iomapver_copy; /** Copy of TASK's I/O Permission bitmap generation count. */ 76 78 } cpu_arch_t; -
kernel/arch/amd64/src/amd64.c
r1f092d9 r49e6c6b4 171 171 } 172 172 173 void arch_post_cpu_init( )173 void arch_post_cpu_init(void) 174 174 { 175 175 #ifdef CONFIG_SMP -
kernel/arch/amd64/src/cpu/cpu.c
r1f092d9 r49e6c6b4 158 158 void cpu_print_report(cpu_t* m) 159 159 { 160 printf("cpu%d: (%s family=%d model=%d stepping=%d ) %dMHz\n",160 printf("cpu%d: (%s family=%d model=%d stepping=%d apicid=%u) %dMHz\n", 161 161 m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, 162 m->arch.stepping, m-> frequency_mhz);162 m->arch.stepping, m->arch.id, m->frequency_mhz); 163 163 } 164 164 -
kernel/arch/ia32/include/cpu.h
r1f092d9 r49e6c6b4 60 60 unsigned int stepping; 61 61 cpuid_feature_info fi; 62 63 unsigned int id; /** CPU's local, ie physical, APIC ID. */ 62 64 63 65 tss_t *tss; -
kernel/arch/ia32/include/smp/apic.h
r1f092d9 r49e6c6b4 353 353 extern void l_apic_init(void); 354 354 extern void l_apic_eoi(void); 355 extern int l_apic_send_custom_ipi(uint8_t, uint8_t); 355 356 extern int l_apic_broadcast_custom_ipi(uint8_t); 356 357 extern int l_apic_send_init_ipi(uint8_t); -
kernel/arch/ia32/src/cpu/cpu.c
r1f092d9 r49e6c6b4 160 160 void cpu_print_report(cpu_t* cpu) 161 161 { 162 printf("cpu%u: (%s family=%u model=%u stepping=%u ) %" PRIu16 " MHz\n",163 cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family,164 cpu->arch.model, cpu->arch.stepping, cpu-> frequency_mhz);162 printf("cpu%u: (%s family=%u model=%u stepping=%u apicid=%u) %" PRIu16 163 " MHz\n", cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family, 164 cpu->arch.model, cpu->arch.stepping, cpu->arch.id, cpu->frequency_mhz); 165 165 } 166 166 -
kernel/arch/ia32/src/ia32.c
r1f092d9 r49e6c6b4 125 125 } 126 126 127 void arch_post_cpu_init( )127 void arch_post_cpu_init(void) 128 128 { 129 129 #ifdef CONFIG_SMP -
kernel/arch/ia32/src/smp/apic.c
r1f092d9 r49e6c6b4 259 259 } 260 260 261 static void ipi_wait_for_idle(void) 262 { 263 icr_t icr; 264 265 /* Wait for the destination cpu to accept the previous ipi. */ 266 do { 267 icr.lo = l_apic[ICRlo]; 268 } while (icr.delivs != DELIVS_IDLE); 269 } 270 271 /** Send one CPU an IPI vector. 272 * 273 * @param apicid Physical APIC ID of the destination CPU. 274 * @param vector Interrupt vector to be sent. 275 * 276 * @return 0 on failure, 1 on success. 277 */ 278 int l_apic_send_custom_ipi(uint8_t apicid, uint8_t vector) 279 { 280 icr_t icr; 281 282 /* Wait for a destination cpu to accept our previous ipi. */ 283 ipi_wait_for_idle(); 284 285 icr.lo = l_apic[ICRlo]; 286 icr.hi = l_apic[ICRhi]; 287 288 icr.delmod = DELMOD_FIXED; 289 icr.destmod = DESTMOD_PHYS; 290 icr.level = LEVEL_ASSERT; 291 icr.shorthand = SHORTHAND_NONE; 292 icr.trigger_mode = TRIGMOD_LEVEL; 293 icr.vector = vector; 294 icr.dest = apicid; 295 296 /* Send the IPI by writing to l_apic[ICRlo]. */ 297 l_apic[ICRhi] = icr.hi; 298 l_apic[ICRlo] = icr.lo; 299 300 #ifdef CONFIG_DEBUG 301 icr.lo = l_apic[ICRlo]; 302 if (icr.delivs == DELIVS_PENDING) { 303 printf("IPI is pending.\n"); 304 } 305 #endif 306 307 return apic_poll_errors(); 308 } 309 261 310 /** Send all CPUs excluding CPU IPI vector. 262 311 * … … 269 318 { 270 319 icr_t icr; 320 321 /* Wait for a destination cpu to accept our previous ipi. */ 322 ipi_wait_for_idle(); 271 323 272 324 icr.lo = l_apic[ICRlo]; … … 466 518 dfr.model = MODEL_FLAT; 467 519 l_apic[DFR] = dfr.value; 520 521 if (CPU->arch.id != l_apic_id()) { 522 #ifdef CONFIG_DEBUG 523 printf("lapic error: LAPIC ID (%" PRIu8 ") and hw ID assigned by BSP" 524 " (%u) differ. Correcting to LAPIC ID.\n", l_apic_id(), 525 CPU->arch.id); 526 #endif 527 CPU->arch.id = l_apic_id(); 528 } 529 468 530 } 469 531 -
kernel/arch/ia32/src/smp/smp.c
r1f092d9 r49e6c6b4 55 55 #include <memstr.h> 56 56 #include <arch/drivers/i8259.h> 57 #include <cpu.h> 57 58 58 59 #ifdef CONFIG_SMP … … 77 78 io_apic = (uint32_t *) km_map((uintptr_t) io_apic, PAGE_SIZE, 78 79 PAGE_WRITE | PAGE_NOT_CACHEABLE); 80 } 81 } 82 83 static void cpu_arch_id_init(void) 84 { 85 ASSERT(ops != NULL); 86 ASSERT(cpus != NULL); 87 88 for (unsigned int i = 0; i < config.cpu_count; ++i) { 89 cpus[i].arch.id = ops->cpu_apic_id(i); 79 90 } 80 91 } … … 92 103 93 104 ASSERT(ops != NULL); 105 106 /* 107 * SMP initialized, cpus array allocated. Assign each CPU its 108 * physical APIC ID. 109 */ 110 cpu_arch_id_init(); 94 111 95 112 /* -
kernel/generic/src/main/main.c
r1f092d9 r49e6c6b4 244 244 245 245 cpu_init(); 246 247 246 calibrate_delay_loop(); 247 arch_post_cpu_init(); 248 248 249 clock_counter_init(); 249 250 timeout_init();
Note:
See TracChangeset
for help on using the changeset viewer.