Changeset 02f441c0 in mainline


Ignore:
Timestamp:
2006-02-27T17:10:04Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30ab05f
Parents:
481c520
Message:

Move i8042 driver to genarch as it might be used by more architectures.

Files:
2 added
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • arch/amd64/Makefile.inc

    r481c520 r02f441c0  
    6464CONFIG_PAGE_PT = y
    6565
     66## Compile with i8042 support.
     67#
     68
     69CONFIG_I8042 = y
     70
    6671## Accepted configuration directives
    6772#
     
    8590        arch/$(ARCH)/src/context.S \
    8691        arch/$(ARCH)/src/drivers/ega.c \
    87         arch/$(ARCH)/src/drivers/i8042.c \
    8892        arch/$(ARCH)/src/drivers/i8254.c \
    8993        arch/$(ARCH)/src/drivers/i8259.c \
  • arch/amd64/src/amd64.c

    r481c520 r02f441c0  
    3434
    3535#include <arch/ega.h>
    36 #include <arch/i8042.h>
     36#include <genarch/i8042/i8042.h>
    3737#include <arch/i8254.h>
    3838#include <arch/i8259.h>
     
    149149void arch_post_smp_init(void)
    150150{
    151                 i8042_init();   /* keyboard controller */
     151        i8042_init();   /* keyboard controller */
    152152}
    153153
  • arch/ia32/Makefile.inc

    r481c520 r02f441c0  
    8383CONFIG_PAGE_PT = y
    8484
     85## Compile with i8042 controller support
     86#
     87
     88CONFIG_I8042 = y
     89
     90
    8591## Accepted configuration directives
    8692#
     
    119125        arch/$(ARCH)/src/mm/page.c \
    120126        arch/$(ARCH)/src/mm/tlb.c \
    121         arch/$(ARCH)/src/drivers/i8042.c \
    122127        arch/$(ARCH)/src/drivers/i8254.c \
    123128        arch/$(ARCH)/src/drivers/i8259.c \
  • arch/ia32/src/ia32.c

    r481c520 r02f441c0  
    3535
    3636#include <arch/ega.h>
    37 #include <arch/i8042.h>
     37#include <genarch/i8042/i8042.h>
    3838#include <arch/i8254.h>
    3939#include <arch/i8259.h>
  • arch/sparc64/src/console.c

    r481c520 r02f441c0  
    3232#include <genarch/fb/fb.h>
    3333#include <arch/drivers/fb.h>
     34#include <arch/drivers/keyboard.h>
    3435#include <genarch/ofw/ofw.h>
    3536#include <console/chardev.h>
  • arch/sparc64/src/mm/tlb.c

    r481c520 r02f441c0  
    4141#include <arch/asm.h>
    4242#include <symtab.h>
     43
    4344#include <arch/drivers/fb.h>
     45#include <arch/drivers/keyboard.h>
    4446
    4547char *context_encoding[] = {
     
    123125        data.v = true;
    124126        data.size = PAGESIZE_4M;
     127        data.pfn = fr.pfn;
     128        data.l = true;
     129        data.cp = 0;
     130        data.cv = 0;
     131        data.p = true;
     132        data.w = true;
     133        data.g = true;
     134
     135        dtlb_data_in_write(data.value);
     136       
     137        /*
     138         * Quick hack: map keyboard
     139         */
     140        fr.address = KBD_PHYS_ADDRESS;
     141        pg.address = KBD_VIRT_ADDRESS;
     142
     143        tag.value = ASID_KERNEL;
     144        tag.vpn = pg.vpn;
     145
     146        dtlb_tag_access_write(tag.value);
     147
     148        data.value = 0;
     149        data.v = true;
     150        data.size = PAGESIZE_8K;
    125151        data.pfn = fr.pfn;
    126152        data.l = true;
  • genarch/Makefile.inc

    r481c520 r02f441c0  
    6969        DEFS += -DCONFIG_FB
    7070endif
     71
     72## i8042 controller
     73ifeq ($(CONFIG_I8042),y)
     74        GENARCH_SOURCES += \
     75                genarch/src/i8042/i8042.c
     76endif
  • genarch/include/i8042/i8042.h

    r481c520 r02f441c0  
    3030#define __I8042_H__
    3131
    32 #include <arch/types.h>
    33 
    3432/** Scancodes. */
    3533#define SC_ESC          0x01
  • genarch/src/i8042/i8042.c

    r481c520 r02f441c0  
    2727 */
    2828
    29 #include <arch/i8042.h>
    30 #include <arch/i8259.h>
     29#include <genarch/i8042/i8042.h>
     30#include <arch/drivers/i8042.h>
    3131#include <arch/interrupt.h>
    3232#include <cpu.h>
     
    4646 */
    4747
    48 #define i8042_DATA                      0x60
    49 #define i8042_STATUS                    0x64
    50 #define i8042_BUFFER_FULL_MASK          0x01
    51 
    5248/** Keyboard commands. */
    5349#define KBD_ENABLE      0xf4
     
    7268#define i8042_SET_COMMAND       0x60
    7369#define i8042_COMMAND           0x49
     70
     71#define i8042_BUFFER_FULL_MASK  0x01
    7472#define i8042_WAIT_MASK         0x02
    7573
     
    8583#define LOCKED_CAPSLOCK         (1<<0)
    8684
    87 #define ACTIVE_READ_BUFF_SIZE 16 /*Must be power of 2*/
    88 
    89 __u8 active_read_buff[ACTIVE_READ_BUFF_SIZE]={0};
     85#define ACTIVE_READ_BUFF_SIZE 16        /* Must be power of 2 */
     86
     87static __u8 active_read_buff[ACTIVE_READ_BUFF_SIZE];
    9088
    9189SPINLOCK_INITIALIZE(keylock);           /**< keylock protects keyflags and lockflags. */
     
    269267{
    270268        exc_register(VECTOR_KBD, "i8042_interrupt", i8042_interrupt);
    271         while (inb(i8042_STATUS)&i8042_WAIT_MASK) {
     269        while (i8042_status_read() & i8042_WAIT_MASK) {
    272270                /* wait */
    273271        }
    274         outb(i8042_STATUS,i8042_SET_COMMAND);
    275         while (inb(i8042_STATUS)&i8042_WAIT_MASK) {
     272        i8042_command_write(i8042_SET_COMMAND);
     273        while (i8042_status_read() & i8042_WAIT_MASK) {
    276274                /* wait */
    277275        }
    278         outb(i8042_DATA,i8042_COMMAND);
     276        i8042_data_write(i8042_COMMAND);
    279277
    280278        trap_virtual_enable_irqs(1<<IRQ_KBD);
     
    293291
    294292        trap_virtual_eoi();
    295         x = inb(i8042_DATA);
     293        x = i8042_data_read();
    296294        if (x & KEY_RELEASE)
    297295                key_released(x ^ KEY_RELEASE);
     
    410408{
    411409        static int i=0;
    412         i&=(ACTIVE_READ_BUFF_SIZE-1);
    413         if(!active_read_buff[i])
    414         {
     410        i &= (ACTIVE_READ_BUFF_SIZE-1);
     411        if(!active_read_buff[i]) {
    415412                return 0;
    416413        }
     
    421418{
    422419        static int i=0;
    423         active_read_buff[i]=ch;
     420        active_read_buff[i] = ch;
    424421        i++;
    425         i&=(ACTIVE_READ_BUFF_SIZE-1);
     422        i &= (ACTIVE_READ_BUFF_SIZE-1);
    426423        active_read_buff[i]=0;
    427424}
     
    501498        char ch;       
    502499
    503         while(!(ch=active_read_buff_read()))
    504         {
     500        while(!(ch = active_read_buff_read())) {
    505501                __u8 x;
    506                 while (!((x=inb(i8042_STATUS))&i8042_BUFFER_FULL_MASK));
    507                 x = inb(i8042_DATA);
     502                while (!((x=i8042_status_read() & i8042_BUFFER_FULL_MASK)))
     503                        ;
     504                x = i8042_data_read();
    508505                if (x & KEY_RELEASE)
    509506                        key_released(x ^ KEY_RELEASE);
Note: See TracChangeset for help on using the changeset viewer.