Changeset da1bafb in mainline for kernel/arch/ia64/src/drivers/it.c


Ignore:
Timestamp:
2010-05-24T18:57:31Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0095368
Parents:
666f492
Message:

major code revision

  • replace spinlocks taken with interrupts disabled with irq_spinlocks
  • change spacing (not indendation) to be tab-size independent
  • use unsigned integer types where appropriate (especially bit flags)
  • visual separation
  • remove argument names in function prototypes
  • string changes
  • correct some formating directives
  • replace various cryptic single-character variables (t, a, m, c, b, etc.) with proper identifiers (thread, task, timeout, as, itm, itc, etc.)
  • unify some assembler constructs
  • unused page table levels are now optimized out in compile time
  • replace several ints (with boolean semantics) with bools
  • use specifically sized types instead of generic types where appropriate (size_t, uint32_t, btree_key_t)
  • improve comments
  • split asserts with conjuction into multiple independent asserts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/drivers/it.c

    r666f492 rda1bafb  
    3434
    3535/** Interval Timer driver. */
    36  
     36
    3737#include <arch/drivers/it.h>
    3838#include <arch/interrupt.h>
     
    4545#include <arch.h>
    4646
    47 #define IT_SERVICE_CLOCKS       64
     47#define IT_SERVICE_CLOCKS  64
    4848
    49 #define FREQ_NUMERATOR_SHIFT    32
    50 #define FREQ_NUMERATOR_MASK     0xffffffff00000000ULL
     49#define FREQ_NUMERATOR_SHIFT  32
     50#define FREQ_NUMERATOR_MASK   0xffffffff00000000ULL
    5151
    52 #define FREQ_DENOMINATOR_SHIFT  0
    53 #define FREQ_DENOMINATOR_MASK   0xffffffffULL
     52#define FREQ_DENOMINATOR_SHIFT  0
     53#define FREQ_DENOMINATOR_MASK   0xffffffffULL
    5454
    5555uint64_t it_delta;
     
    6363void it_init(void)
    6464{
    65         cr_itv_t itv;
    66        
    6765        if (config.cpu_active == 1) {
    6866                irq_initialize(&it_irq);
     
    8381        }
    8482       
    85         /* initialize Interval Timer external interrupt vector */
     83        /* Initialize Interval Timer external interrupt vector */
     84        cr_itv_t itv;
     85       
    8686        itv.value = itv_read();
    8787        itv.vector = INTERRUPT_TIMER;
    8888        itv.m = 0;
    8989        itv_write(itv.value);
    90 
    91         /* set Interval Timer Counter to zero */
     90       
     91        /* Set Interval Timer Counter to zero */
    9292        itc_write(0);
    9393       
    94         /* generate first Interval Timer interrupt in IT_DELTA ticks */
     94        /* Generate first Interval Timer interrupt in IT_DELTA ticks */
    9595        itm_write(IT_DELTA);
    96 
    97         /* propagate changes */
     96       
     97        /* Propagate changes */
    9898        srlz_d();
    9999}
     
    104104 *
    105105 * @return Always IRQ_ACCEPT.
     106 *
    106107 */
    107108irq_ownership_t it_claim(irq_t *irq)
     
    113114void it_interrupt(irq_t *irq)
    114115{
    115         int64_t c;
    116         int64_t m;
    117        
    118116        eoi_write(EOI);
    119117       
    120         m = itm_read();
     118        int64_t itm = itm_read();
    121119       
    122         while (1) {
    123                 c = itc_read();
    124                 c += IT_SERVICE_CLOCKS;
    125 
    126                 m += IT_DELTA;
    127                 if (m - c < 0)
     120        while (true) {
     121                int64_t itc = itc_read();
     122                itc += IT_SERVICE_CLOCKS;
     123               
     124                itm += IT_DELTA;
     125                if (itm - itc < 0)
    128126                        CPU->missed_clock_ticks++;
    129127                else
     
    131129        }
    132130       
    133         itm_write(m);
    134         srlz_d();                               /* propagate changes */
    135 
     131        itm_write(itm);
     132        srlz_d();  /* Propagate changes */
     133       
    136134        /*
    137135         * We are holding a lock which prevents preemption.
    138136         * Release the lock, call clock() and reacquire the lock again.
    139137         */
    140         spinlock_unlock(&irq->lock);   
     138        irq_spinlock_unlock(&irq->lock, false);
    141139        clock();
    142         spinlock_lock(&irq->lock);
     140        irq_spinlock_lock(&irq->lock, false);
    143141}
    144142
Note: See TracChangeset for help on using the changeset viewer.