Changeset 5b0ae4be in mainline


Ignore:
Timestamp:
2009-02-22T15:51:40Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
691eb52
Parents:
f9f9a13
Message:

The kernel i8042 driver should be instance-neutral.

Location:
kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/amd64.c

    rf9f9a13 r5b0ae4be  
    175175{
    176176        /* keyboard controller */
    177         i8042_init(device_assign_devno(), IRQ_KBD, device_assign_devno(), IRQ_MOUSE);
     177        (void) i8042_init((i8042_t *) I8042_BASE, device_assign_devno(),
     178            IRQ_KBD);
    178179}
    179180
  • kernel/arch/ia32/src/ia32.c

    rf9f9a13 r5b0ae4be  
    126126{
    127127        devno_t kbd = device_assign_devno();
    128         devno_t mouse = device_assign_devno();
    129128        /* keyboard controller */
    130         i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE);
     129        (void) i8042_init((i8042_t *) I8042_BASE, kbd, IRQ_KBD);
    131130}
    132131
  • kernel/arch/ia64/src/ia64.c

    rf9f9a13 r5b0ae4be  
    167167             NULL);
    168168#else
    169         devno_t mouse = device_assign_devno();
    170         i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE);
     169        (void) i8042_init((i8042_t *)I8042_BASE, kbd, IRQ_KBD);
    171170#endif
    172171#endif
     
    223222#ifdef SKI
    224223        ski_kbd_grab();
    225 #else
    226 #ifdef CONFIG_NS16550
    227         ns16550_grab();
    228 #else
    229         i8042_grab();
    230 #endif
    231224#endif
    232225}
     
    239232#ifdef SKI
    240233        ski_kbd_release();
    241 #else
    242 #ifdef CONFIG_NS16550
    243         ns16550_release();
    244 #else
    245         i8042_release();
    246 #endif
    247234#endif
    248235}
  • kernel/genarch/include/kbd/i8042.h

    rf9f9a13 r5b0ae4be  
    3636#define KERN_I8042_H_
    3737
     38#include <ddi/irq.h>
    3839#include <arch/types.h>
    3940#include <typedefs.h>
     
    4748
    4849typedef struct i8042_instance {
     50        devno_t devno;
     51        irq_t irq;
    4952        i8042_t *i8042;
    5053} i8042_instance_t;
    5154
    52 extern void i8042_init(devno_t kbd_devno, inr_t kbd_inr, devno_t mouse_devno, inr_t mouse_inr);
     55extern bool i8042_init(i8042_t *, devno_t, inr_t);
    5356
    5457#endif
  • kernel/genarch/src/kbd/i8042.c

    rf9f9a13 r5b0ae4be  
    9090};
    9191
    92 /** Structure for i8042's IRQ. */
    93 static irq_t i8042_kbd_irq;
    94 static irq_t i8042_mouse_irq;
    95 
    9692static irq_ownership_t i8042_claim(irq_t *irq)
    9793{
     
    126122
    127123/** Initialize i8042. */
    128 void
    129 i8042_init(devno_t kbd_devno, inr_t kbd_inr, devno_t mouse_devno,
    130     inr_t mouse_inr)
     124bool
     125i8042_init(i8042_t *dev, devno_t devno, inr_t inr)
    131126{
    132         i8042_t *dev = lgcy_i8042_instance.i8042;
     127        i8042_instance_t *instance;
    133128
    134129        chardev_initialize("i8042_kbd", &kbrd, &ops);
    135130        stdin = &kbrd;
    136131       
    137         irq_initialize(&i8042_kbd_irq);
    138         i8042_kbd_irq.devno = kbd_devno;
    139         i8042_kbd_irq.inr = kbd_inr;
    140         i8042_kbd_irq.claim = i8042_claim;
    141         i8042_kbd_irq.handler = i8042_irq_handler;
    142         i8042_kbd_irq.instance = &lgcy_i8042_instance;
    143         irq_register(&i8042_kbd_irq);
     132        instance = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC);
     133        if (!instance)
     134                return false;
    144135       
    145         irq_initialize(&i8042_mouse_irq);
    146         i8042_mouse_irq.devno = mouse_devno;
    147         i8042_mouse_irq.inr = mouse_inr;
    148         i8042_mouse_irq.claim = i8042_claim;
    149         i8042_mouse_irq.handler = i8042_irq_handler;
    150         i8042_mouse_irq.instance = &lgcy_i8042_instance;
    151         irq_register(&i8042_mouse_irq);
     136        instance->devno = devno;
     137        instance->i8042 = dev;
    152138       
    153         trap_virtual_enable_irqs(1 << kbd_inr);
    154         trap_virtual_enable_irqs(1 << mouse_inr);
     139        irq_initialize(&instance->irq);
     140        instance->irq.devno = devno;
     141        instance->irq.inr = inr;
     142        instance->irq.claim = i8042_claim;
     143        instance->irq.handler = i8042_irq_handler;
     144        instance->irq.instance = instance;
     145        irq_register(&instance->irq);
     146       
     147        trap_virtual_enable_irqs(1 << inr);
    155148       
    156149        /*
     
    165158         */
    166159        sysinfo_set_item_val("kbd", NULL, true);
    167         sysinfo_set_item_val("kbd.devno", NULL, kbd_devno);
    168         sysinfo_set_item_val("kbd.inr", NULL, kbd_inr);
     160        sysinfo_set_item_val("kbd.devno", NULL, devno);
     161        sysinfo_set_item_val("kbd.inr", NULL, inr);
    169162#ifdef KBD_LEGACY
    170163        sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY);
    171164#endif
    172         sysinfo_set_item_val("mouse", NULL, true);
    173         sysinfo_set_item_val("mouse.devno", NULL, mouse_devno);
    174         sysinfo_set_item_val("mouse.inr", NULL, mouse_inr);
     165
     166        return true;
    175167}
    176168
Note: See TracChangeset for help on using the changeset viewer.