extern struct font_desc font_vga_8x16;
+extern unsigned long sgi_gfxaddr;
#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
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;
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 { \
}
}
+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)
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++)
newport_get_revisions();
newport_get_screensize();
- /* gfx_init (display_desc); */
-
return "SGI Newport";
}
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)
{
#define DUMMY (void *) newport_dummy
const struct consw newport_con = {
+ .owner = THIS_MODULE,
.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,
};
#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;
+ return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
}
-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");