Changeset c9b8c5c in mainline for arch/ia32/src/smp/apic.c


Ignore:
Timestamp:
2005-04-24T21:59:33Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad36bd6
Parents:
f07bba5
Message:

APIC changes and fixes.
Be more robust during MP configuration.

Do not use APIC ID as CPU_ID_ARCH anymore.
Changing APIC ID's is not a good idea.
Use dr0 register instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/smp/apic.c

    rf07bba5 rc9b8c5c  
    104104        }
    105105
    106 
    107 
    108106        /*
    109107         * Configure the BSP's lapic.
     
    184182        l_apic[ICRhi] = hi;
    185183        l_apic[ICRlo] = lo;
    186        
     184
    187185        /*
    188186         * According to MP Specification, 20us should be enough to
     
    196194        if (lo & SEND_PENDING)
    197195                printf("IPI is pending.\n");
    198        
     196
    199197        l_apic[ICRlo] = lo | DLVRMODE_INIT | DESTMODE_PHYS | LEVEL_DEASSERT | SHORTHAND_DEST | TRGRMODE_LEVEL;
    200198
     
    204202        delay(10000);
    205203
    206         /*
    207          * MP specification says this should not be done for 82489DX-based
    208          * l_apic's. However, everything is ok as long as STARTUP IPI is ignored
    209          * by 8249DX.
    210          */
    211         for (i = 0; i < 2; i++) {
    212                 lo = l_apic[ICRlo] & ICRloClear;
    213                 lo |= ((__address) ap_boot) / 4096; /* calculate the reset vector */
    214                 l_apic[ICRlo] = lo | DLVRMODE_STUP | DESTMODE_PHYS | LEVEL_ASSERT | SHORTHAND_DEST |  TRGRMODE_LEVEL;
    215                 delay(200);
    216         }
     204        if (!is_82489DX_apic(l_apic[LAVR])) {
     205                /*
     206                 * If this is not 82489DX-based l_apic we must send two STARTUP IPI's.
     207                 */
     208                for (i = 0; i<2; i++) {
     209                        lo = l_apic[ICRlo] & ICRloClear;
     210                        lo |= ((__address) ap_boot) / 4096; /* calculate the reset vector */
     211                        l_apic[ICRlo] = lo | DLVRMODE_STUP | DESTMODE_PHYS | LEVEL_ASSERT | SHORTHAND_DEST |  TRGRMODE_LEVEL;
     212                        delay(200);
     213                }
     214        }
     215       
    217216       
    218217        return apic_poll_errors();
     
    222221{
    223222        __u32 tmp, t1, t2;
    224         int cpu_id = config.cpu_active - 1;
    225        
    226 
    227         /*
    228          * Here we set local APIC ID's so that they match operating system's CPU ID's
    229          * This operation is dangerous as it is model specific.
    230          * TODO: some care should be taken.
    231          * NOTE: CPU may not be used to define APIC ID
    232          */
    233         if (l_apic_id() != cpu_id) {
    234                 l_apic[L_APIC_ID] &= L_APIC_IDClear;
    235                 l_apic[L_APIC_ID] |= (l_apic[L_APIC_ID]&L_APIC_IDClear)|((cpu_id)<<L_APIC_IDShift);
    236         }
    237223
    238224        l_apic[LVT_Err] |= (1<<16);
     
    245231        l_apic[TPR] &= TPRClear;
    246232
    247         if (CPU->arch.family >= 6)
    248                 enable_l_apic_in_msr();
     233//      if (CPU->arch.family >= 6)
     234//              enable_l_apic_in_msr();
    249235       
    250236        tmp = l_apic[ICRlo] & ICRloClear;
Note: See TracChangeset for help on using the changeset viewer.