Ignore:
Timestamp:
2019-09-23T12:49:29Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9be2358
Parents:
9259d20 (diff), 1a4ec93f (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:
Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
git-committer:
Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
Message:

Merge changes from master, especially Meson build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/mach/malta/malta.c

    r9259d20 r3e828ea  
    4242#include <genarch/srln/srln.h>
    4343#include <arch/interrupt.h>
     44#include <stdbool.h>
     45#include <byteorder.h>
     46#include <sysinfo/sysinfo.h>
     47#include <log.h>
    4448
    4549static void malta_init(void);
     
    6872#endif
    6973
    70 #ifdef CONFIG_NS16550
    71 static void tty_clear_interrupt(void *arg, inr_t inr)
     74static void malta_isa_irq_handler(unsigned int i)
    7275{
    73         (void) pio_read_8((ioport8_t *) GT64120_PCI0_INTACK);
    74         pic_eoi();
     76        uint8_t isa_irq = host2uint32_t_le(pio_read_32(GT64120_PCI0_INTACK));
     77        if (i8259_is_spurious(isa_irq)) {
     78                i8259_handle_spurious(isa_irq);
     79#ifdef CONFIG_DEBUG
     80                log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u",
     81                    CPU->id, isa_irq);
     82                return;
     83#endif
     84        }
     85        irq_t *irq = irq_dispatch_and_lock(isa_irq);
     86        if (irq) {
     87                irq->handler(irq);
     88                irq_spinlock_unlock(&irq->lock, false);
     89        } else {
     90#ifdef CONFIG_DEBUG
     91                log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ (irq=%u)",
     92                    CPU->id, isa_irq);
     93#endif
     94        }
     95        i8259_eoi(isa_irq);
    7596}
    76 #endif
    7797
    7898void malta_init(void)
    7999{
    80         i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 2, 0, 8);
     100        irq_init(ISA_IRQ_COUNT, ISA_IRQ_COUNT);
     101
     102        i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 0);
     103        sysinfo_set_item_val("i8259", NULL, true);
     104
     105        int_handler[INT_HW0] = malta_isa_irq_handler;
     106        cp0_unmask_int(INT_HW0);
    81107
    82108#if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT))
     
    86112        outdev_t **tty_out_ptr = NULL;
    87113#endif
    88         tty_instance = ns16550_init((ioport8_t *) TTY_BASE, 0, TTY_CPU_INT,
    89             tty_clear_interrupt, NULL, tty_out_ptr);
     114        tty_instance = ns16550_init((ioport8_t *) TTY_BASE, 0, TTY_ISA_IRQ,
     115            NULL, NULL, tty_out_ptr);
    90116#endif
    91117}
     
    120146                        indev_t *srln = srln_wire(srln_instance, sink);
    121147                        ns16550_wire(tty_instance, srln);
    122                         pic_enable_irqs(1 << TTY_ISA_IRQ);
    123                         cp0_unmask_int(TTY_CPU_INT);
     148                        i8259_enable_irqs(1 << TTY_ISA_IRQ);
    124149                }
    125150        }
Note: See TracChangeset for help on using the changeset viewer.