Changeset 3e35fd7 in mainline


Ignore:
Timestamp:
2006-10-29T12:40:26Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
14de0dd8
Parents:
410ed0d
Message:

use new IRQ scheme in l_apic_timer_interrupt()

File:
1 edited

Legend:

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

    r410ed0d r3e35fd7  
    4545#include <arch/asm.h>
    4646#include <arch.h>
     47#include <ddi/irq.h>
     48#include <ddi/device.h>
    4749
    4850#ifdef CONFIG_SMP
     
    7274
    7375uint32_t apic_id_mask = 0;
     76static irq_t l_apic_timer_irq;
    7477
    7578static int apic_poll_errors(void);
     
    118121#endif /* LAPIC_VERBOSE */
    119122
    120 
    121 static void apic_spurious(int n, istate_t *istate);
    122 static void l_apic_timer_interrupt(int n, istate_t *istate);
     123/** APIC spurious interrupt handler.
     124 *
     125 * @param n Interrupt vector.
     126 * @param istate Interrupted state.
     127 */
     128static void apic_spurious(int n, istate_t *istate)
     129{
     130#ifdef CONFIG_DEBUG
     131        printf("cpu%d: APIC spurious interrupt\n", CPU->id);
     132#endif
     133}
     134
     135static irq_ownership_t l_apic_timer_claim(void)
     136{
     137        return IRQ_ACCEPT;
     138}
     139
     140static void l_apic_timer_irq_handler(irq_t *irq, void *arg, ...)
     141{
     142        clock();
     143}
    123144
    124145/** Initialize APIC on BSP. */
     
    140161         */
    141162        io_apic_disable_irqs(0xffff);
    142         exc_register(VECTOR_CLK, "l_apic_timer", (iroutine) l_apic_timer_interrupt);
     163       
     164        irq_initialize(&l_apic_timer_irq);
     165        l_apic_timer_irq.devno = device_assign_devno();
     166        l_apic_timer_irq.inr = IRQ_CLK;
     167        l_apic_timer_irq.claim = l_apic_timer_claim;
     168        l_apic_timer_irq.handler = l_apic_timer_irq_handler;
     169        irq_register(&l_apic_timer_irq);
     170       
    143171        for (i = 0; i < IRQ_COUNT; i++) {
    144172                int pin;
    145173       
    146                 if ((pin = smp_irq_to_pin(i)) != -1) {
     174                if ((pin = smp_irq_to_pin(i)) != -1)
    147175                        io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI);
    148                 }
    149176        }
    150177       
     
    153180         */
    154181        idreg.value = io_apic_read(IOAPICID);
    155         if ((1<<idreg.apic_id) & apic_id_mask) {        /* see if IO APIC ID is used already */
     182        if ((1 << idreg.apic_id) & apic_id_mask) {      /* see if IO APIC ID is used already */
    156183                for (i = 0; i < APIC_ID_COUNT; i++) {
    157                         if (!((1<<i) & apic_id_mask)) {
     184                        if (!((1 << i) & apic_id_mask)) {
    158185                                idreg.apic_id = i;
    159186                                io_apic_write(IOAPICID, idreg.value);
     
    169196
    170197        l_apic_debug();
    171 }
    172 
    173 /** APIC spurious interrupt handler.
    174  *
    175  * @param n Interrupt vector.
    176  * @param istate Interrupted state.
    177  */
    178 void apic_spurious(int n, istate_t *istate)
    179 {
    180 #ifdef CONFIG_DEBUG
    181         printf("cpu%d: APIC spurious interrupt\n", CPU->id);
    182 #endif
    183198}
    184199
     
    441456}
    442457
    443 /** Local APIC Timer Interrupt.
    444  *
    445  * @param n Interrupt vector number.
    446  * @param istate Interrupted state.
    447  */
    448 void l_apic_timer_interrupt(int n, istate_t *istate)
    449 {
    450         l_apic_eoi();
    451         clock();
    452 }
    453 
    454458/** Get Local APIC ID.
    455459 *
Note: See TracChangeset for help on using the changeset viewer.