Commit 3b6dbf19 authored by James Simmons's avatar James Simmons

Made it modular.

parent f6b8b167
......@@ -12,7 +12,7 @@ obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o
# All of the (potential) objects that export symbols.
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
export-objs := busmouse.o vt.o generic_serial.o ip2main.o \
export-objs := busmouse.o vt.o generic_serial.o ip2main.o consolemap.o\
ite_gpio.o keyboard.o misc.o nvram.o random.o rtc.o \
selection.o sonypi.o sysrq.o tty_io.o tty_ioctl.o
......
......@@ -11,6 +11,8 @@
* Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kd.h>
#include <linux/errno.h>
#include <linux/mm.h>
......@@ -680,3 +682,5 @@ console_map_init(void)
if (vc_cons_allocated(i) && !*vc_cons[i].d->vc_uni_pagedir_loc)
con_set_default_unimap(i);
}
EXPORT_SYMBOL(con_copy_unimap);
......@@ -3020,9 +3020,13 @@ EXPORT_SYMBOL(default_grn);
EXPORT_SYMBOL(default_blu);
EXPORT_SYMBOL(video_font_height);
EXPORT_SYMBOL(video_scan_lines);
EXPORT_SYMBOL(vc_cons_allocated);
EXPORT_SYMBOL(update_region);
EXPORT_SYMBOL(redraw_screen);
EXPORT_SYMBOL(vc_resize);
EXPORT_SYMBOL(fg_console);
EXPORT_SYMBOL(console_blank_hook);
EXPORT_SYMBOL(console_blanked);
EXPORT_SYMBOL(vt_cons);
EXPORT_SYMBOL(vc_cons);
#ifndef VT_SINGLE_DRIVER
......
......@@ -400,6 +400,9 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
}
}
int init_module(void) { return 0; };
void cleanup_module(void) {};
EXPORT_SYMBOL(cfb_copyarea);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
......@@ -443,6 +443,9 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
}
}
int init_module(void) { return 0; };
void cleanup_module(void) {};
EXPORT_SYMBOL(cfb_fillrect);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
......@@ -342,6 +342,9 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
color_imageblit(image, p, dst1, start_index, pitch_index);
}
int init_module(void) { return 0; };
void cleanup_module(void) {};
EXPORT_SYMBOL(cfb_imageblit);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
......@@ -5,7 +5,7 @@
# All of the (potential) objects that export symbols.
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
export-objs := fbcon.o
export-objs := fbcon.o fonts.o
# Each configuration option enables a list of files.
......@@ -15,8 +15,7 @@ obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o
obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o
obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
obj-$(CONFIG_MDA_CONSOLE) += mdacon.o
obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o fonts.o
obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o font.o
obj-$(CONFIG_FONT_SUN8x16) += font_sun8x16.o
obj-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o
......@@ -27,6 +26,9 @@ obj-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o
obj-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o
obj-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o
font-objs := fonts.o font_sun8x16.o font_sun12x22.o font_8x8.o font_8x16.o \
font_6x11.o font_pearl_8x8.o font_acorn_8x8.o font_mini_4x6.o
# Generic Low Level Drivers
obj-$(CONFIG_FBCON_STI) += fbcon-sti.o
......
......@@ -122,6 +122,10 @@ static unsigned long softback_buf, softback_curr;
static unsigned long softback_in;
static unsigned long softback_top, softback_end;
static int softback_lines;
/* console mappings */
static int first_fb_vc;
static int last_fb_vc = MAX_NR_CONSOLES - 1;
static int fbcon_is_default = 1;
#define REFCOUNT(fd) (((int *)(fd))[-1])
#define FNTSIZE(fd) (((int *)(fd))[-2])
......@@ -220,9 +224,8 @@ static void fbcon_vbl_detect(int irq, void *dummy, struct pt_regs *fp)
static void cursor_timer_handler(unsigned long dev_addr);
static struct timer_list cursor_timer =
TIMER_INITIALIZER(cursor_timer_handler, 0, 0);
TIMER_INITIALIZER(cursor_timer_handler, 0, 0);
static void cursor_timer_handler(unsigned long dev_addr)
{
......@@ -231,20 +234,57 @@ static void cursor_timer_handler(unsigned long dev_addr)
add_timer(&cursor_timer);
}
static int __init fbconsole_setup(char *options)
static int __init fbconsole_setup(char *this_opt)
{
char *this_opt;
int unit;
int unit, i, j;
char *options;
if (!options || !*options)
if (!this_opt || !*this_opt)
return 0;
while ((this_opt = strsep(&options, ",")) != NULL) {
if (!strncmp(this_opt, "font:", 5)) {
while ((options = strsep(&this_opt, ",")) != NULL) {
if (!strncmp(options, "font:", 5)) {
for (unit = 0; unit < MAX_NR_CONSOLES; unit++)
strcpy(fb_display[unit].fontname,
this_opt + 5);
options + 5);
}
if (!strncmp(options, "scrollback:", 11)) {
options += 11;
if (*options) {
fbcon_softback_size = simple_strtoul(options, &options, 0);
if (*options == 'k' || *options == 'K') {
fbcon_softback_size *= 1024;
options++;
}
if (*options != ',')
return 0;
options++;
} else
return 0;
}
if (!strncmp(options, "map:", 4)) {
options += 4;
if (*options)
for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
if (!options[j])
j = 0;
con2fb_map[i] = (options[j++]-'0') % FB_MAX;
}
return 0;
}
if (!strncmp(options, "vc:", 3)) {
options += 3;
if (*options)
first_fb_vc = simple_strtoul(options, &options, 10) - 1;
if (first_fb_vc < 0)
first_fb_vc = 0;
if (*options++ == '-')
last_fb_vc = simple_strtoul(options, &options, 10) - 1;
fbcon_is_default = 0;
}
}
return 0;
}
......@@ -510,7 +550,7 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy)
static const char *fbcon_startup(void)
{
const char *display_desc = "frame buffer device";
struct fbcon_font_desc *font = NULL;
struct font_desc *font = NULL;
struct fb_info *info;
struct vc_data *vc;
static int done = 0;
......@@ -552,7 +592,7 @@ static const char *fbcon_startup(void)
softback_lines = 0;
}
font = fbcon_get_default_font(info->var.xres, info->var.yres);
font = get_default_font(info->var.xres, info->var.yres);
vc = (struct vc_data *) kmalloc(sizeof(struct vc_data), GFP_ATOMIC);
......@@ -690,7 +730,7 @@ static int fbcon_changevar(int con)
int old_rows, old_cols;
unsigned short *save = NULL, *q;
int i, charcnt = 256;
struct fbcon_font_desc *font;
struct font_desc *font;
info->var.xoffset = info->var.yoffset = p->yscroll = 0; /* reset wrap/pan */
......@@ -720,11 +760,9 @@ static int fbcon_changevar(int con)
}
if (!p->fontdata) {
if (!p->fontname[0] ||
!(font = fbcon_find_font(p->fontname)))
font =
fbcon_get_default_font(info->var.xres,
info->var.yres);
if (!p->fontname[0] || !(font = find_font(p->fontname)))
font = get_default_font(info->var.xres,
info->var.yres);
vc->vc_font.width = font->width;
vc->vc_font.height = font->height;
p->fontdata = font->data;
......@@ -832,7 +870,7 @@ static void fbcon_set_display(int con, int init, int logo)
int old_rows, old_cols;
unsigned short *save = NULL, *r, *q;
int i, charcnt = 256;
struct fbcon_font_desc *font;
struct font_desc *font;
if (con != fg_console || (info->flags & FBINFO_FLAG_MODULE) ||
info->fix.type == FB_TYPE_TEXT)
......@@ -866,10 +904,8 @@ static void fbcon_set_display(int con, int init, int logo)
}
if (!p->fontdata) {
if (!p->fontname[0] ||
!(font = fbcon_find_font(p->fontname)))
font =
fbcon_get_default_font(info->var.xres,
if (!p->fontname[0] || !(font = find_font(p->fontname)))
font = get_default_font(info->var.xres,
info->var.yres);
vc->vc_font.width = font->width;
vc->vc_font.height = font->height;
......@@ -2229,17 +2265,17 @@ static inline int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
static inline int fbcon_set_def_font(struct vc_data *vc, struct console_font_op *op)
{
char name[MAX_FONT_NAME];
struct fbcon_font_desc *f;
struct font_desc *f;
struct display *p = &fb_display[vc->vc_num];
struct fb_info *info = p->fb_info;
if (!op->data)
f = fbcon_get_default_font(info->var.xres, info->var.yres);
f = get_default_font(info->var.xres, info->var.yres);
else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
return -EFAULT;
else {
name[MAX_FONT_NAME - 1] = 0;
if (!(f = fbcon_find_font(name)))
if (!(f = find_font(name)))
return -ENOENT;
}
op->width = f->width;
......@@ -2629,18 +2665,18 @@ const struct consw fb_con = {
.con_getxy = fbcon_getxy,
};
#ifdef MODULE
MODULE_LICENSE("GPL");
int init_module(void)
static int __init fbconsole_init(void)
{
take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
return 0;
}
void cleanup_module(void)
static void __exit fbconsole_exit(void)
{
}
#endif
}
module_init(fbconsole_init);
module_exit(fbconsole_exit);
/*
* Visible symbols for modules
......
......@@ -13,7 +13,7 @@
#include <linux/types.h>
struct fbcon_font_desc {
struct font_desc {
int idx;
char *name;
int width, height;
......@@ -30,22 +30,22 @@ struct fbcon_font_desc {
#define ACORN8x8_IDX 6
#define MINI4x6_IDX 7
extern struct fbcon_font_desc font_vga_8x8,
font_vga_8x16,
font_pearl_8x8,
font_vga_6x11,
font_sun_8x16,
font_sun_12x22,
font_acorn_8x8,
font_mini_4x6;
extern struct font_desc font_vga_8x8,
font_vga_8x16,
font_pearl_8x8,
font_vga_6x11,
font_sun_8x16,
font_sun_12x22,
font_acorn_8x8,
font_mini_4x6;
/* Find a font with a specific name */
extern struct fbcon_font_desc *fbcon_find_font(char *name);
extern struct font_desc *find_font(char *name);
/* Get the default font for a specific screen size */
extern struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres);
extern struct font_desc *get_default_font(int xres, int yres);
/* Max. length for the name of a predefined font */
#define MAX_FONT_NAME 32
......
......@@ -3341,7 +3341,7 @@ static unsigned char fontdata_6x11[FONTDATAMAX] = {
};
struct fbcon_font_desc font_vga_6x11 = {
struct font_desc font_vga_6x11 = {
VGA6x11_IDX,
"ProFont6x11",
6,
......
......@@ -4621,7 +4621,7 @@ static unsigned char fontdata_8x16[FONTDATAMAX] = {
};
struct fbcon_font_desc font_vga_8x16 = {
struct font_desc font_vga_8x16 = {
VGA8x16_IDX,
"VGA8x16",
8,
......
......@@ -2573,7 +2573,7 @@ static unsigned char fontdata_8x8[FONTDATAMAX] = {
};
struct fbcon_font_desc font_vga_8x8 = {
struct font_desc font_vga_8x8 = {
VGA8x8_IDX,
"VGA8x8",
8,
......
......@@ -263,7 +263,7 @@ static unsigned char acorndata_8x8[] = {
/* FF */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
struct fbcon_font_desc font_acorn_8x8 = {
struct font_desc font_acorn_8x8 = {
ACORN8x8_IDX,
"Acorn8x8",
8,
......
......@@ -2147,7 +2147,7 @@ static unsigned char fontdata_mini_4x6[FONTDATAMAX] = {
/*}*/
};
struct fbcon_font_desc font_mini_4x6 = {
struct font_desc font_mini_4x6 = {
MINI4x6_IDX,
"MINI4x6",
4,
......
......@@ -2577,7 +2577,7 @@ static unsigned char fontdata_pearl8x8[FONTDATAMAX] = {
};
struct fbcon_font_desc font_pearl_8x8 = {
struct font_desc font_pearl_8x8 = {
PEARL8x8_IDX,
"PEARL8x8",
8,
......
......@@ -6206,7 +6206,7 @@ static unsigned char fontdata_sun12x22[FONTDATAMAX] = {
};
struct fbcon_font_desc font_sun_12x22 = {
struct font_desc font_sun_12x22 = {
SUN12x22_IDX,
"SUN12x22",
12,
......
......@@ -261,7 +261,7 @@ static unsigned char fontdata_sun8x16[FONTDATAMAX] = {
/* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
struct fbcon_font_desc font_sun_8x16 = {
struct font_desc font_sun_8x16 = {
SUN8x16_IDX,
"SUN8x16",
8,
......
......@@ -12,8 +12,8 @@
* for more details.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#if defined(__mc68000__) || defined(CONFIG_APUS)
......@@ -23,7 +23,7 @@
#define NO_FONTS
static struct fbcon_font_desc *fbcon_fonts[] = {
static struct font_desc *fonts[] = {
#ifdef CONFIG_FONT_8x8
#undef NO_FONTS
&font_vga_8x8,
......@@ -58,7 +58,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
#endif
};
#define num_fonts (sizeof(fbcon_fonts)/sizeof(*fbcon_fonts))
#define num_fonts (sizeof(fonts)/sizeof(*fonts))
#ifdef NO_FONTS
#error No fonts configured.
......@@ -66,7 +66,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
/**
* fbcon_find_font - find a font
* find_font - find a font
* @name: string name of a font
*
* Find a specified font with string name @name.
......@@ -76,19 +76,19 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
*
*/
struct fbcon_font_desc *fbcon_find_font(char *name)
struct font_desc *find_font(char *name)
{
unsigned int i;
for (i = 0; i < num_fonts; i++)
if (!strcmp(fbcon_fonts[i]->name, name))
return fbcon_fonts[i];
if (!strcmp(fonts[i]->name, name))
return fonts[i];
return NULL;
}
/**
* fbcon_get_default_font - get default font
* get_default_font - get default font
* @xres: screen size of X
* @yres: screen size of Y
*
......@@ -100,15 +100,15 @@ struct fbcon_font_desc *fbcon_find_font(char *name)
*
*/
struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres)
struct font_desc *get_default_font(int xres, int yres)
{
int i, c, cc;
struct fbcon_font_desc *f, *g;
struct font_desc *f, *g;
g = NULL;
cc = -10000;
for(i=0; i<num_fonts; i++) {
f = fbcon_fonts[i];
f = fonts[i];
c = f->pref;
#if defined(__mc68000__) || defined(CONFIG_APUS)
#ifdef CONFIG_FONT_PEARL_8x8
......@@ -129,3 +129,14 @@ struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres)
}
return g;
}
int init_module(void) { return 0; };
void cleanup_module(void) {};
EXPORT_SYMBOL(fonts);
EXPORT_SYMBOL(find_font);
EXPORT_SYMBOL(get_default_font);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
MODULE_DESCRIPTION("Console Fonts");
MODULE_LICENSE("GPL");
......@@ -34,7 +34,7 @@
#define LOGO_W 80
#define LOGO_H 80
extern struct fbcon_font_desc font_vga_8x16;
extern struct font_desc font_vga_8x16;
#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
......
......@@ -41,10 +41,6 @@
#include <asm/pgtable.h>
#include <linux/fb.h>
#ifdef CONFIG_VT
#include <linux/console.h>
#include "console/fbcon.h"
#endif
/*
* Frame buffer device initialization and setup routines
......@@ -359,14 +355,6 @@ static int num_pref_init_funcs __initdata = 0;
struct fb_info *registered_fb[FB_MAX];
int num_registered_fb;
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
extern int fbcon_softback_size;
static int first_fb_vc;
static int last_fb_vc = MAX_NR_CONSOLES-1;
static int fbcon_is_default = 1;
#endif
#ifdef CONFIG_FB_OF
static int ofonly __initdata = 0;
#endif
......@@ -797,7 +785,6 @@ register_framebuffer(struct fb_info *fb_info)
{
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
static int fb_ever_opened[FB_MAX];
static int first = 1;
int j;
#endif
char name_buf[8];
......@@ -832,11 +819,6 @@ register_framebuffer(struct fb_info *fb_info)
}
fb_ever_opened[i] = 1;
}
if (first) {
first = 0;
take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
}
#endif
sprintf (name_buf, "%d", i);
fb_info->devfs_handle =
......@@ -938,45 +920,6 @@ int __init video_setup(char *options)
if (!options || !*options)
return 0;
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
if (!strncmp(options, "scrollback:", 11)) {
options += 11;
if (*options) {
fbcon_softback_size = simple_strtoul(options, &options, 0);
if (*options == 'k' || *options == 'K') {
fbcon_softback_size *= 1024;
options++;
}
if (*options != ',')
return 0;
options++;
} else
return 0;
}
if (!strncmp(options, "map:", 4)) {
options += 4;
if (*options)
for (i = 0, j = 0; i < MAX_NR_CONSOLES; i++) {
if (!options[j])
j = 0;
con2fb_map[i] = (options[j++]-'0') % FB_MAX;
}
return 0;
}
if (!strncmp(options, "vc:", 3)) {
options += 3;
if (*options)
first_fb_vc = simple_strtoul(options, &options, 10) - 1;
if (first_fb_vc < 0)
first_fb_vc = 0;
if (*options++ == '-')
last_fb_vc = simple_strtoul(options, &options, 10) - 1;
fbcon_is_default = 0;
}
#endif
#ifdef CONFIG_FB_OF
if (!strcmp(options, "ofonly")) {
ofonly = 1;
......
......@@ -560,6 +560,7 @@ void console_conditional_schedule(void)
schedule();
}
}
EXPORT_SYMBOL(console_conditional_schedule);
void console_print(const char *s)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment