Changeset f245145 in mainline


Ignore:
Timestamp:
2009-01-04T14:07:27Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a45752d
Parents:
44ff4fb
Message:

Only one kernel EGA driver to rule them all.

Location:
kernel
Files:
1 added
1 deleted
15 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/Makefile.inc

    r44ff4fb rf245145  
    7676DEFS += -DCONFIG_I8042
    7777
     78## Compile with EGA support
     79#
     80
     81CONFIG_EGA = y
     82DEFS += -DCONFIG_EGA
     83
    7884## Accepted configuration directives
    7985#
     
    97103        arch/$(ARCH)/src/context.S \
    98104        arch/$(ARCH)/src/ddi/ddi.c \
    99         arch/$(ARCH)/src/drivers/ega.c \
    100105        arch/$(ARCH)/src/drivers/vesa.c \
    101106        arch/$(ARCH)/src/drivers/i8254.c \
  • kernel/arch/amd64/include/types.h

    r44ff4fb rf245145  
    5858typedef int64_t native_t;
    5959
     60typedef uintptr_t ioport_t;
     61
    6062/**< Formats for uintptr_t, size_t, count_t and index_t */
    6163#define PRIp "llx"
  • kernel/arch/amd64/src/amd64.c

    r44ff4fb rf245145  
    4141#include <proc/thread.h>
    4242#include <arch/drivers/ega.h>
     43#include <genarch/drivers/ega/ega.h>
    4344#include <arch/drivers/vesa.h>
    4445#include <genarch/kbd/i8042.h>
     
    140141                else
    141142#endif
    142                         ega_init();     /* video */
     143                        ega_init(EGA_BASE, EGA_VIDEORAM);       /* video */
    143144               
    144145                /* Enable debugger */
  • kernel/arch/ia32/Makefile.inc

    r44ff4fb rf245145  
    111111DEFS += -DCONFIG_I8042
    112112
     113## Compile with EGA support
     114#
     115
     116CONFIG_EGA = y
     117DEFS += -DCONFIG_EGA
     118
    113119## Accepted configuration directives
    114120#
     
    156162        arch/$(ARCH)/src/drivers/i8254.c \
    157163        arch/$(ARCH)/src/drivers/i8259.c \
    158         arch/$(ARCH)/src/drivers/ega.c \
    159164        arch/$(ARCH)/src/drivers/vesa.c \
    160165        arch/$(ARCH)/src/boot/boot.S \
  • kernel/arch/ia32/include/drivers/ega.h

    r44ff4fb rf245145  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
     2 * Copyright (c) 2008 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup ia32   
     29/** @addtogroup ia32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_ia32_EGA_H_
    36 #define KERN_ia32_EGA_H_
     35#ifndef KERN_ia32_EGA_H
     36#define KERN_ia32_EGA_H
    3737
    38 #define VIDEORAM        0xb8000
    39 #define ROW             80
    40 #define ROWS            25
    41 #define SCREEN          (ROW * ROWS)
    42 
    43 extern void ega_redraw(void);
    44 extern void ega_init(void);
     38#define EGA_VIDEORAM    0xb8000
     39#define EGA_BASE        0x3d4
    4540
    4641#endif
  • kernel/arch/ia32/include/types.h

    r44ff4fb rf245145  
    5858typedef int32_t native_t;
    5959
     60typedef uintptr_t ioport_t;
     61
    6062#define PRIp "x"        /**< Format for uintptr_t. */
    6163#define PRIs "u"        /**< Format for size_t. */
  • kernel/arch/ia32/src/ia32.c

    r44ff4fb rf245145  
    4040
    4141#include <arch/drivers/ega.h>
     42#include <genarch/drivers/ega/ega.h>
    4243#include <arch/drivers/vesa.h>
    4344#include <genarch/kbd/i8042.h>
     
    9495                else
    9596#endif
    96                         ega_init(); /* video */
     97                        ega_init(EGA_BASE, EGA_VIDEORAM);       /* video */
    9798               
    9899                /* Enable debugger */
  • kernel/arch/ia64/Makefile.inc

    r44ff4fb rf245145  
    6060CONFIG_ASID_FIFO = y
    6161
    62 
    6362## Compile with support for software integer division.
    6463#
     
    9392
    9493ifeq ($(MACHINE),i460GX)
    95         ARCH_SOURCES += arch/$(ARCH)/src/drivers/ega.c
    9694        CONFIG_I8042 = y
    97         DEFS += -DI460GX -DCONFIG_I8042
     95        CONFIG_EGA = y
     96        DEFS += -DI460GX -DCONFIG_I8042 -DCONFIG_EGA
    9897        BFD = binary
    9998endif
  • kernel/arch/ia64/include/asm.h

    r44ff4fb rf245145  
    4040#include <arch/register.h>
    4141
    42 typedef uint64_t ioport_t;
    43 
    4442#define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
    4543
  • kernel/arch/ia64/include/drivers/ega.h

    r44ff4fb rf245145  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
    3  * 2007 Jakub Vana
     2 * Copyright (c) 2008 Jakub Jermar
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup ia32   
     29/** @addtogroup ia64
    3130 * @{
    3231 */
     
    3736#define KERN_ia64_EGA_H
    3837
    39 #define VIDEORAM (0xe0020000000B8000LL)
    40 
    41 #define ROW             80
    42 #define ROWS            25
    43 #define SCREEN          (ROW * ROWS)
    44 
    45 extern void ega_init(void);
     38#define EGA_VIDEORAM    0xb8000
     39#define EGA_BASE        0x3d4
    4640
    4741#endif
  • kernel/arch/ia64/include/types.h

    r44ff4fb rf245145  
    6666typedef int64_t native_t;
    6767
     68typedef uintptr_t ioport_t;
     69
    6870#define PRIp "lx"       /**< Format for uintptr_t. */
    6971#define PRIs "lu"       /**< Format for size_t. */
  • kernel/arch/ia64/src/asm.S

    r44ff4fb rf245145  
    129129        br _memsetb
    130130
     131.global memsetw
     132memsetw:
     133        br _memsetw
     134
    131135.global cpu_halt
    132136cpu_halt:
  • kernel/arch/ia64/src/ia64.c

    r44ff4fb rf245145  
    5252#include <ddi/irq.h>
    5353#include <ddi/device.h>
     54#include <arch/bootinfo.h>
    5455#include <arch/drivers/ega.h>
    55 #include <arch/bootinfo.h>
     56#include <genarch/drivers/ega/ega.h>
    5657#include <genarch/kbd/i8042.h>
    5758#include <genarch/kbd/ns16550.h>
     
    133134                ski_init_console();
    134135#else   
    135                 ega_init();
     136                ega_init(EGA_BASE, EGA_VIDEORAM);
    136137#endif 
    137138        }
  • kernel/arch/sparc64/include/types.h

    r44ff4fb rf245145  
    5555typedef uint64_t ipl_t;
    5656
    57 typedef uint64_t ioport_t;
    58 
    5957typedef uint64_t unative_t;
    6058typedef int64_t native_t;
     59
     60typedef uintptr_t ioport_t;
    6161
    6262/**< Formats for uintptr_t, size_t, count_t and index_t */
  • kernel/genarch/Makefile.inc

    r44ff4fb rf245145  
    104104                genarch/src/ofw/upa.c
    105105endif
     106
     107## EGA
     108ifeq ($(CONFIG_EGA), y)
     109        GENARCH_SOURCES += \
     110                genarch/src/drivers/ega/ega.c
     111endif
  • kernel/genarch/src/drivers/ega/ega.c

    r44ff4fb rf245145  
    2727 */
    2828
    29 /** @addtogroup ia32   
     29/** @addtogroup genarch_drivers
    3030 * @{
    3131 */
     
    3535 */
    3636
    37 #include <arch/drivers/ega.h>
     37#include <genarch/drivers/ega/ega.h>
    3838#include <putchar.h>
    3939#include <mm/page.h>
     
    6161static uint8_t *videoram;
    6262static uint8_t *backbuf;
     63static ioport_t ega_base;
    6364
    6465static void ega_putchar(chardev_t *d, const char ch);
     
    7172static void ega_move_cursor(void);
    7273
    73 void ega_init(void)
     74void ega_init(ioport_t base, uintptr_t videoram_phys)
    7475{
    75         uint8_t hi, lo;
     76        /* Initialize the software structure. */       
     77        ega_base = base;
    7678
    7779        backbuf = (uint8_t *) malloc(SCREEN * 2, 0);
     
    7981                panic("Unable to allocate backbuffer.\n");
    8082       
    81         videoram = (uint8_t *) hw_map(VIDEORAM, SCREEN * 2);
    82         outb(0x3d4, 0xe);
    83         hi = inb(0x3d5);
    84         outb(0x3d4, 0xf);
    85         lo = inb(0x3d5);
    86         ega_cursor = (hi << 8) | lo;
     83        videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2);
     84       
     85        /* Clear the screen and set the cursor position. */
     86        memsetw(videoram, SCREEN, 0x0720);
     87        memsetw(backbuf, SCREEN, 0x0720);
     88        ega_move_cursor();
    8789
    8890        chardev_initialize("ega_out", &ega_console, &ega_ops);
    8991        stdout = &ega_console;
    9092       
    91         ega_parea.pbase = VIDEORAM;
     93        ega_parea.pbase = videoram_phys;
    9294        ega_parea.vbase = (uintptr_t) videoram;
    9395        ega_parea.frames = 1;
     
    99101        sysinfo_set_item_val("fb.width", NULL, ROW);
    100102        sysinfo_set_item_val("fb.height", NULL, ROWS);
    101         sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM);
     103        sysinfo_set_item_val("fb.blinking", NULL, true);
     104        sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys);
    102105}
    103106
     
    116119                return;
    117120
    118         memmove((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
    119         memmove((void *) backbuf, (void *) (backbuf + ROW * 2), (SCREEN - ROW) * 2);
     121        memmove((void *) videoram, (void *) (videoram + ROW * 2),
     122            (SCREEN - ROW) * 2);
     123        memmove((void *) backbuf, (void *) (backbuf + ROW * 2),
     124            (SCREEN - ROW) * 2);
    120125        memsetw(videoram + (SCREEN - ROW) * 2, ROW, 0x0720);
    121126        memsetw(backbuf + (SCREEN - ROW) * 2, ROW, 0x0720);
     
    155160void ega_move_cursor(void)
    156161{
    157         outb(0x3d4, 0xe);
    158         outb(0x3d5, (uint8_t) ((ega_cursor >> 8) & 0xff));
    159         outb(0x3d4, 0xf);
    160         outb(0x3d5, (uint8_t) (ega_cursor & 0xff));     
     162        outb(ega_base + EGA_INDEX_REG, 0xe);
     163        outb(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff));
     164        outb(ega_base + EGA_INDEX_REG, 0xf);
     165        outb(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff));   
    161166}
    162167
Note: See TracChangeset for help on using the changeset viewer.