Changeset 508 for Whitix/branches/smp

Show
Ignore:
Timestamp:
05/18/08 18:04:29 (4 years ago)
Author:
mwhitworth
Message:

Add APIC framework.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/smp/arch/i386/kernel/smp.c

    r507 r508  
    2626 
    2727int numProcessors=0; 
     28DWORD apicAddr; 
    2829 
    2930struct MpConfig; 
     
    158159void SmpReadProcessorConfig(struct MpProcessorConfig* config) 
    159160{ 
    160         printf("SMP: CPU%d present\n", numProcessors); 
     161        printf("SMP: CPU%d present\n", config->apicId); 
    161162         
    162163        numProcessors++; 
     
    207208         
    208209        printf("SMP: APIC at %#X\n", mpConfig->apicAddress); 
     210        apicAddr=mpConfig->apicAddress; 
    209211         
    210212        /* Now process the blocks after the structure. */ 
    211213        while (offset < mpConfig->length) 
    212214        { 
    213                 printf("(%#X %u %u %u) ", tables, offset, *tables, mpConfig->length); 
     215//              printf("(%#X %u %u %u) ", tables, offset, *tables, mpConfig->length); 
    214216                switch (*tables) 
    215217                { 
     
    247249} 
    248250 
     251void ApicMap() 
     252{ 
     253        /* Do a one-to-one physical mapping of the APIC. */ 
     254        VirtMemMapPage(apicAddr, apicAddr, 3); 
     255} 
     256 
     257int ApicVerify() 
     258{ 
     259        /* TODO */ 
     260        return 0; 
     261} 
     262 
    249263int SmpInit() 
    250264{ 
     
    257271        printf("SMP: Intel MultiProcessor Specification V1.%u\n", floatingTable->version); 
    258272         
    259         return SmpReadConfig(floatingTable->config); 
    260 } 
     273        if (SmpReadConfig(floatingTable->config)) 
     274        { 
     275                printf("SMP: Failed to read configuration.\n"); 
     276                return 0; 
     277        } 
     278         
     279        ApicMap(); 
     280         
     281        /* Verify the local APIC of the boot processor exists. */ 
     282        ApicVerify(); 
     283         
     284         
     285         
     286        return 0; 
     287}