RFD: m68k console driver integration

Geert Uytterhoeven (geert@cs.kuleuven.ac.be)
Thu, 23 Jan 1997 10:03:37 +0100 (MET)


This is an attempt in merging the Linux/m68k console driver
(arch/m68k/kernel/console.c) with drivers/char/console.c. Before I try to get
it integrated in the official kernel sources, I'd like to discuss it here.

Interested kernel hackers, read on...

Background
----------

Because Amigas and Ataris don't have a native text mode, they have a bitmapped
console that's provided by the frame buffer device. This means that we couldn't
use the standard console driver which is heavily tied to the VGA text
architecture.

Unlike the Sparc and TGA console, where characters are written to the screen in
a modified scr_writew() routine, Linux/m68k uses a more complex (and more
performant) scheme to implement a text console: the abstract console driver.

The abstract console driver provides a generic interface for a non-VGA
compatible text console. It can be used for machines that don't have a text
mode at all or that have a special graphics processor that's only accessible
through some registers (e.g. a TMS340x0 GSP).

The abstract console driver also allows all virtual consoles to have a
potentially different size.

Implementation
--------------

Most text console operations in the abstract console driver can be split in two
parts:

- the operation on a `shadow screen' memory (for virtual consoles)
- the actual operation on the `screen image'.

The first step is very similar to the VGA console: instead of accessing the
video text memory, the operation is performed on a separate block of memory.
This means that in most cases, the abstract console driver only differs by the
addition of the second step.

The actual operation on the screen image is performed through a call of one of
the following function pointers, provided by a specific hardware driver:

int con_clear(struct vc_data *conp, int sy, int sx, int height, int width);
int con_putc(struct vc_data *conp, int c, int y, int x);
int con_putcs(struct vc_data *conp, const char *s, int count, int y,
int x);
int con_cursor(struct vc_data *conp, int mode);
int con_scroll(struct vc_data *conp, int t, int b, int dir, int count);
int con_bmove(struct vc_data *conp, int sy, int sx, int dy, int dx,
int height, int width);
int con_switch(struct vc_data *conp);
int con_blank(int blank);
int con_get_font(struct vc_data *conp, int *w, int *h, char *data);
int con_set_font(struct vc_data *conp, int w, int h, char *data);

Changes
-------

Most important changes:

- arch/m68k/kernel/console.c: removed.

- drivers/char/console_struct.h: split into include/linux/console.h (used
by some other low-level parts too) and drivers/char/console_macros.h.

- drivers/char/console.c: addition of the `second step' for the abstract
console driver (CONFIG_ABSTRACT_CONSOLE) and other changes.

- drivers/char/abscon.c: abstract console driver specific functions that
are not static inline in drivers/char/console.c.

- video_num_columns, video_num_lines, video_size_row, video_screen_size
and can_do_color depend on the VC(!) for the abstract console driver.

- drivers/char/[tv]ga.c: extra parameter to hide_cursor().

Patches
-------

The patches (relative to 2.1.21) can be found at

http://www.cs.kuleuven.ac.be/~geert/bin/abscon-2.1.21.diff.gz

If you want them by Email (uuencoded), just let me know.

All comments are welcome!

Greetings,

Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/m68k on Amiga          http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium