From: Ralf Baechle Make the driver for Newport aka XL work in 2.6. --- 25-akpm/drivers/video/console/Makefile | 2 25-akpm/drivers/video/console/newport_con.c | 123 ++++++++++++---------------- 2 files changed, 55 insertions(+), 70 deletions(-) diff -puN drivers/video/console/Makefile~mips-newport-driver-fixes drivers/video/console/Makefile --- 25/drivers/video/console/Makefile~mips-newport-driver-fixes Thu Apr 29 15:45:51 2004 +++ 25-akpm/drivers/video/console/Makefile Thu Apr 29 15:45:51 2004 @@ -19,7 +19,7 @@ font-objs += $(font-objs-y) # Each configuration option enables a list of files. obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o -obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o +obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o font.o obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o obj-$(CONFIG_VGA_CONSOLE) += vgacon.o diff -puN drivers/video/console/newport_con.c~mips-newport-driver-fixes drivers/video/console/newport_con.c --- 25/drivers/video/console/newport_con.c~mips-newport-driver-fixes Thu Apr 29 15:45:51 2004 +++ 25-akpm/drivers/video/console/newport_con.c Thu Apr 29 15:45:51 2004 @@ -32,6 +32,7 @@ extern struct font_desc font_vga_8x16; +extern unsigned long sgi_gfxaddr; #define FONT_DATA ((unsigned char *)font_vga_8x16.data) @@ -43,7 +44,7 @@ extern struct font_desc font_vga_8x16; static unsigned char *font_data[MAX_NR_CONSOLES]; -extern struct newport_regs *npregs; +static struct newport_regs *npregs; static int logo_active; static int topscan; @@ -51,6 +52,8 @@ static int xcurs_correction = 29; static int newport_xsize; static int newport_ysize; +static int newport_set_def_font(int unit, struct console_font_op *op); + #define BMASK(c) (c << 24) #define RENDER(regs, cp) do { \ @@ -95,11 +98,33 @@ static inline void newport_init_cmap(voi } } +static void newport_show_logo(void) +{ #ifdef CONFIG_LOGO_SGI_CLUT224 -static void newport_show_logo(void); -#else -#define newport_show_logo() do { } while (0) -#endif + const struct linux_logo *logo = fb_find_logo(8); + const unsigned char *clut = logo->clut; + const unsigned char *data = logo->data; + unsigned long i; + + for (i = 0; i < logo->clutsize; i++) { + newport_bfwait(); + newport_cmap_setaddr(npregs, i + 0x20); + newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]); + clut += 3; + } + + newport_wait(); + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + NPORT_DMODE0_CHOST); + + npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0); + npregs->set.xyendi = ((newport_xsize - 1) << 16); + newport_wait(); + + for (i = 0; i < logo->width*logo->height; i++) + npregs->go.hostrw0 = *data++ << 24; +#endif /* CONFIG_LOGO_SGI_CLUT224 */ +} static inline void newport_clear_screen(int xstart, int ystart, int xend, int yend, int ci) @@ -258,26 +283,22 @@ static void newport_get_revisions(void) xcurs_correction = 21; } -#ifdef MODULE +/* Can't be __init, take_over_console may call it later */ static const char *newport_startup(void) -#else -static const char *__init newport_startup(void) -#endif { int i; - struct newport_regs *p; - npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000); - - p = npregs; - p->cset.config = NPORT_CFG_GD0; + if (!sgi_gfxaddr) + return NULL; + npregs = (struct newport_regs *) (KSEG1 + sgi_gfxaddr); + npregs->cset.config = NPORT_CFG_GD0; if (newport_wait()) { return NULL; } - p->set.xstarti = TESTVAL; - if (p->set._xstart.word != XSTI_TO_FXSTART(TESTVAL)) + npregs->set.xstarti = TESTVAL; + if (npregs->set._xstart.word != XSTI_TO_FXSTART(TESTVAL)) return NULL; for (i = 0; i < MAX_NR_CONSOLES; i++) @@ -287,8 +308,6 @@ static const char *__init newport_startu newport_get_revisions(); newport_get_screensize(); - /* gfx_init (display_desc); */ - return "SGI Newport"; } @@ -299,6 +318,15 @@ static void newport_init(struct vc_data vc->vc_can_do_color = 1; } +static void newport_deinit(struct vc_data *c) +{ + int i; + + /* free memory used by user font */ + for (i = 0; i < MAX_NR_CONSOLES; i++) + newport_set_def_font(i, NULL); +} + static void newport_clear(struct vc_data *vc, int sy, int sx, int height, int width) { @@ -679,7 +707,7 @@ static int newport_dummy(struct vc_data const struct consw newport_con = { .con_startup = newport_startup, .con_init = newport_init, - .con_deinit = DUMMY, + .con_deinit = newport_deinit, .con_clear = newport_clear, .con_putc = newport_putc, .con_putcs = newport_putcs, @@ -696,63 +724,20 @@ const struct consw newport_con = { }; #ifdef MODULE -MODULE_LICENSE("GPL"); - -int init_module(void) +static int __init newport_console_init(void) { - if (!newport_startup()) - printk("Error loading SGI Newport Console driver\n"); - else - printk("Loading SGI Newport Console Driver\n"); take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); return 0; } -int cleanup_module(void) +static void __exit newport_console_exit(void) { - int i; - - printk("Unloading SGI Newport Console Driver\n"); - /* free memory used by user font */ - for (i = 0; i < MAX_NR_CONSOLES; i++) - newport_set_def_font(i, NULL); - - return 0; + give_up_console(&newport_con); } -#endif - - -#ifdef CONFIG_LOGO_SGI_CLUT224 - -#undef __initdata -#define __initdata -#include "../logo/logo_sgi_clut224.c" - -static void newport_show_logo(void) -{ - const struct linux_logo *logo = &logo_sgi_clut224; - const unsigned char *clut = logo->clut; - const unsigned char *data = logo->data; - unsigned long i; - - for (i = 0; i < logo->clutsize; i++) { - newport_bfwait(); - newport_cmap_setaddr(npregs, i + 0x20); - newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]); - clut += 3; - } - - newport_wait(); - npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | - NPORT_DMODE0_CHOST); - npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0); - npregs->set.xyendi = ((newport_xsize - 1) << 16); - newport_wait(); - - for (i = 0; i < logo->width*logo->height; i++) - npregs->go.hostrw0 = *data++ << 24; -} -#endif /* CONFIG_LOGO_SGI_CLUT224 */ +module_init(newport_console_init); +module_exit(newport_console_exit); +#endif +MODULE_LICENSE("GPL"); _