Changeset 8565a42 in mainline for kernel/arch/ia32/src/smp/apic.c


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

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

    r3061bc1 r8565a42  
    164164{
    165165        l_apic_id_t idreg;
    166        
     166
    167167        idreg.value = l_apic[L_APIC_ID];
    168168        return idreg.apic_id;
     
    174174        exc_register(VECTOR_APIC_SPUR, "apic_spurious", false,
    175175            (iroutine_t) apic_spurious);
    176        
     176
    177177        enable_irqs_function = io_apic_enable_irqs;
    178178        disable_irqs_function = io_apic_disable_irqs;
    179179        eoi_function = l_apic_eoi;
    180180        irqs_info = "apic";
    181        
     181
    182182        /*
    183183         * Configure interrupt routing.
     
    186186         */
    187187        io_apic_disable_irqs(0xffffU);
    188        
     188
    189189        irq_initialize(&l_apic_timer_irq);
    190190        l_apic_timer_irq.preack = true;
     
    193193        l_apic_timer_irq.handler = l_apic_timer_irq_handler;
    194194        irq_register(&l_apic_timer_irq);
    195        
     195
    196196        uint8_t i;
    197197        for (i = 0; i < IRQ_COUNT; i++) {
    198198                int pin;
    199                
     199
    200200                if ((pin = smp_irq_to_pin(i)) != -1)
    201201                        io_apic_change_ioredtbl((uint8_t) pin, DEST_ALL, (uint8_t) (IVT_IRQBASE + i), LOPRI);
    202202        }
    203        
     203
    204204        /*
    205205         * Ensure that io_apic has unique ID.
    206206         */
    207207        io_apic_id_t idreg;
    208        
     208
    209209        idreg.value = io_apic_read(IOAPICID);
    210210        if ((1 << idreg.apic_id) & apic_id_mask) {  /* See if IO APIC ID is used already */
     
    217217                }
    218218        }
    219        
     219
    220220        /*
    221221         * Configure the BSP's lapic.
     
    223223        l_apic_init();
    224224        l_apic_debug();
    225        
     225
    226226        bsp_l_apic = l_apic_id();
    227227}
     
    237237{
    238238        esr_t esr;
    239        
     239
    240240        esr.value = l_apic[ESR];
    241        
     241
    242242        if (esr.err_bitmap) {
    243243                log_begin(LF_ARCH, LVL_ERROR);
     
    259259                log_end();
    260260        }
    261        
     261
    262262        return !esr.err_bitmap;
    263263}
     
    267267{
    268268        icr_t icr;
    269        
     269
    270270        do {
    271271                icr.lo = l_apic[ICRlo];
     
    286286        /* Wait for a destination cpu to accept our previous ipi. */
    287287        l_apic_wait_for_delivery();
    288        
     288
    289289        icr.lo = l_apic[ICRlo];
    290290        icr.hi = l_apic[ICRhi];
    291        
     291
    292292        icr.delmod = DELMOD_FIXED;
    293293        icr.destmod = DESTMOD_PHYS;
     
    301301        l_apic[ICRhi] = icr.hi;
    302302        l_apic[ICRlo] = icr.lo;
    303        
     303
    304304        return apic_poll_errors();
    305305}
     
    318318        /* Wait for a destination cpu to accept our previous ipi. */
    319319        l_apic_wait_for_delivery();
    320        
     320
    321321        icr.lo = l_apic[ICRlo];
    322322        icr.delmod = DELMOD_FIXED;
     
    326326        icr.trigger_mode = TRIGMOD_LEVEL;
    327327        icr.vector = vector;
    328        
     328
    329329        l_apic[ICRlo] = icr.lo;
    330        
     330
    331331        return apic_poll_errors();
    332332}
     
    345345         */
    346346        icr_t icr;
    347        
     347
    348348        icr.lo = l_apic[ICRlo];
    349349        icr.hi = l_apic[ICRhi];
    350        
     350
    351351        icr.delmod = DELMOD_INIT;
    352352        icr.destmod = DESTMOD_PHYS;
     
    356356        icr.vector = 0;
    357357        icr.dest = apicid;
    358        
     358
    359359        l_apic[ICRhi] = icr.hi;
    360360        l_apic[ICRlo] = icr.lo;
    361        
     361
    362362        /*
    363363         * According to MP Specification, 20us should be enough to
     
    365365         */
    366366        delay(20);
    367        
     367
    368368        if (!apic_poll_errors())
    369369                return 0;
    370        
     370
    371371        l_apic_wait_for_delivery();
    372372
     
    379379        icr.vector = 0;
    380380        l_apic[ICRlo] = icr.lo;
    381        
     381
    382382        /*
    383383         * Wait 10ms as MP Specification specifies.
    384384         */
    385385        delay(10000);
    386        
     386
    387387        if (!is_82489DX_apic(l_apic[LAVR])) {
    388388                /*
     
    402402                }
    403403        }
    404        
     404
    405405        return apic_poll_errors();
    406406}
     
    411411        /* Initialize LVT Error register. */
    412412        lvt_error_t error;
    413        
     413
    414414        error.value = l_apic[LVT_Err];
    415415        error.masked = true;
    416416        l_apic[LVT_Err] = error.value;
    417        
     417
    418418        /* Initialize LVT LINT0 register. */
    419419        lvt_lint_t lint;
    420        
     420
    421421        lint.value = l_apic[LVT_LINT0];
    422422        lint.masked = true;
    423423        l_apic[LVT_LINT0] = lint.value;
    424        
     424
    425425        /* Initialize LVT LINT1 register. */
    426426        lint.value = l_apic[LVT_LINT1];
    427427        lint.masked = true;
    428428        l_apic[LVT_LINT1] = lint.value;
    429        
     429
    430430        /* Task Priority Register initialization. */
    431431        tpr_t tpr;
    432        
     432
    433433        tpr.value = l_apic[TPR];
    434434        tpr.pri_sc = 0;
    435435        tpr.pri = 0;
    436436        l_apic[TPR] = tpr.value;
    437        
     437
    438438        /* Spurious-Interrupt Vector Register initialization. */
    439439        svr_t svr;
    440        
     440
    441441        svr.value = l_apic[SVR];
    442442        svr.vector = VECTOR_APIC_SPUR;
     
    444444        svr.focus_checking = true;
    445445        l_apic[SVR] = svr.value;
    446        
     446
    447447        if (CPU->arch.family >= 6)
    448448                enable_l_apic_in_msr();
    449        
     449
    450450        /* Interrupt Command Register initialization. */
    451451        icr_t icr;
    452        
     452
    453453        icr.lo = l_apic[ICRlo];
    454454        icr.delmod = DELMOD_INIT;
     
    458458        icr.trigger_mode = TRIGMOD_LEVEL;
    459459        l_apic[ICRlo] = icr.lo;
    460        
     460
    461461        /* Timer Divide Configuration Register initialization. */
    462462        tdcr_t tdcr;
    463        
     463
    464464        tdcr.value = l_apic[TDCR];
    465465        tdcr.div_value = DIVIDE_1;
    466466        l_apic[TDCR] = tdcr.value;
    467        
     467
    468468        /* Program local timer. */
    469469        lvt_tm_t tm;
    470        
     470
    471471        tm.value = l_apic[LVT_Tm];
    472472        tm.vector = VECTOR_CLK;
     
    474474        tm.masked = false;
    475475        l_apic[LVT_Tm] = tm.value;
    476        
     476
    477477        /*
    478478         * Measure and configure the timer to generate timer
     
    481481        uint32_t t1 = l_apic[CCRT];
    482482        l_apic[ICRT] = 0xffffffff;
    483        
     483
    484484        while (l_apic[CCRT] == t1);
    485        
     485
    486486        t1 = l_apic[CCRT];
    487487        delay(1000000 / HZ);
    488488        uint32_t t2 = l_apic[CCRT];
    489        
     489
    490490        l_apic[ICRT] = t1 - t2;
    491        
     491
    492492        /* Program Logical Destination Register. */
    493493        assert(CPU->id < 8);
    494494        ldr_t ldr;
    495        
     495
    496496        ldr.value = l_apic[LDR];
    497497        ldr.id = (uint8_t) (1 << CPU->id);
    498498        l_apic[LDR] = ldr.value;
    499        
     499
    500500        /* Program Destination Format Register for Flat mode. */
    501501        dfr_t dfr;
    502        
     502
    503503        dfr.value = l_apic[DFR];
    504504        dfr.model = MODEL_FLAT;
     
    519519        log_printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n",
    520520            CPU->id, l_apic_id());
    521        
     521
    522522        lvt_tm_t tm;
    523523        tm.value = l_apic[LVT_Tm];
     
    525525            tm.vector, delivs_str[tm.delivs], mask_str[tm.masked],
    526526            tm_mode_str[tm.mode]);
    527        
     527
    528528        lvt_lint_t lint;
    529529        lint.value = l_apic[LVT_LINT0];
     
    532532            intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
    533533            mask_str[lint.masked]);
    534        
     534
    535535        lint.value = l_apic[LVT_LINT1];
    536536        log_printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
     
    538538            intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
    539539            mask_str[lint.masked]);
    540        
     540
    541541        lvt_error_t error;
    542542        error.value = l_apic[LVT_Err];
     
    557557{
    558558        io_regsel_t regsel;
    559        
     559
    560560        regsel.value = io_apic[IOREGSEL];
    561561        regsel.reg_addr = address;
     
    573573{
    574574        io_regsel_t regsel;
    575        
     575
    576576        regsel.value = io_apic[IOREGSEL];
    577577        regsel.reg_addr = address;
     
    592592{
    593593        unsigned int dlvr;
    594        
     594
    595595        if (flags & LOPRI)
    596596                dlvr = DELMOD_LOWPRI;
    597597        else
    598598                dlvr = DELMOD_FIXED;
    599        
     599
    600600        io_redirection_reg_t reg;
    601601        reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
    602602        reg.hi = io_apic_read((uint8_t) (IOREDTBL + pin * 2 + 1));
    603        
     603
    604604        reg.dest = dest;
    605605        reg.destmod = DESTMOD_LOGIC;
     
    608608        reg.delmod = dlvr;
    609609        reg.intvec = vec;
    610        
     610
    611611        io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
    612612        io_apic_write((uint8_t) (IOREDTBL + pin * 2 + 1), reg.hi);
     
    630630                        if (pin != -1) {
    631631                                io_redirection_reg_t reg;
    632                                
     632
    633633                                reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
    634634                                reg.masked = true;
    635635                                io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
    636636                        }
    637                        
     637
    638638                }
    639639        }
     
    657657                        if (pin != -1) {
    658658                                io_redirection_reg_t reg;
    659                                
     659
    660660                                reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
    661661                                reg.masked = false;
    662662                                io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
    663663                        }
    664                        
     664
    665665                }
    666666        }
Note: See TracChangeset for help on using the changeset viewer.