2 * newport_con.c: Abscon for newport hardware
4 * (C) 1998 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
5 * (C) 1999 Ulf Carlsson (ulfc@thepuffingruop.com)
7 * This driver is based on sgicons.c and cons_newport.
9 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
10 * Copyright (C) 1997 Miguel de Icaza (miguel@nuclecu.unam.mx)
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/errno.h>
16 #include <linux/selection.h>
17 #include <linux/console.h>
18 #include <linux/vt_kern.h>
20 #include <linux/module.h>
21 #include <linux/slab.h>
24 #include <asm/uaccess.h>
25 #include <asm/system.h>
27 #include <asm/pgtable.h>
28 #include <asm/gio_device.h>
30 #include <video/newport.h>
32 #include <linux/linux_logo.h>
33 #include <linux/font.h>
35 #define FONT_DATA ((unsigned char *)font_vga_8x16.data)
37 /* borrowed from fbcon.c */
38 #define REFCOUNT(fd) (((int *)(fd))[-1])
39 #define FNTSIZE(fd) (((int *)(fd))[-2])
40 #define FNTCHARCNT(fd) (((int *)(fd))[-3])
41 #define FONT_EXTRA_WORDS 3
43 static unsigned char *font_data
[MAX_NR_CONSOLES
];
45 static struct newport_regs
*npregs
;
47 static int logo_active
;
49 static int xcurs_correction
= 29;
50 static int newport_xsize
;
51 static int newport_ysize
;
52 static int newport_has_init
;
54 static int newport_set_def_font(int unit
, struct console_font
*op
);
56 #define BMASK(c) (c << 24)
58 #define RENDER(regs, cp) do { \
59 (regs)->go.zpattern = BMASK((cp)[0x0]); (regs)->go.zpattern = BMASK((cp)[0x1]); \
60 (regs)->go.zpattern = BMASK((cp)[0x2]); (regs)->go.zpattern = BMASK((cp)[0x3]); \
61 (regs)->go.zpattern = BMASK((cp)[0x4]); (regs)->go.zpattern = BMASK((cp)[0x5]); \
62 (regs)->go.zpattern = BMASK((cp)[0x6]); (regs)->go.zpattern = BMASK((cp)[0x7]); \
63 (regs)->go.zpattern = BMASK((cp)[0x8]); (regs)->go.zpattern = BMASK((cp)[0x9]); \
64 (regs)->go.zpattern = BMASK((cp)[0xa]); (regs)->go.zpattern = BMASK((cp)[0xb]); \
65 (regs)->go.zpattern = BMASK((cp)[0xc]); (regs)->go.zpattern = BMASK((cp)[0xd]); \
66 (regs)->go.zpattern = BMASK((cp)[0xe]); (regs)->go.zpattern = BMASK((cp)[0xf]); \
69 #define TESTVAL 0xdeadbeef
70 #define XSTI_TO_FXSTART(val) (((val) & 0xffff) << 11)
72 static inline void newport_render_background(int xstart
, int ystart
,
73 int xend
, int yend
, int ci
)
76 npregs
->set
.wrmask
= 0xffffffff;
77 npregs
->set
.drawmode0
= (NPORT_DMODE0_DRAW
| NPORT_DMODE0_BLOCK
|
78 NPORT_DMODE0_DOSETUP
| NPORT_DMODE0_STOPX
79 | NPORT_DMODE0_STOPY
);
80 npregs
->set
.colori
= ci
;
81 npregs
->set
.xystarti
=
82 (xstart
<< 16) | ((ystart
+ topscan
) & 0x3ff);
84 ((xend
+ 7) << 16) | ((yend
+ topscan
+ 15) & 0x3ff);
87 static inline void newport_init_cmap(void)
91 for (i
= 0; i
< 16; i
++) {
92 newport_bfwait(npregs
);
93 newport_cmap_setaddr(npregs
, color_table
[i
]);
94 newport_cmap_setrgb(npregs
,
96 default_grn
[i
], default_blu
[i
]);
100 static const struct linux_logo
*newport_show_logo(void)
102 #ifdef CONFIG_LOGO_SGI_CLUT224
103 const struct linux_logo
*logo
= fb_find_logo(8);
104 const unsigned char *clut
;
105 const unsigned char *data
;
113 for (i
= 0; i
< logo
->clutsize
; i
++) {
114 newport_bfwait(npregs
);
115 newport_cmap_setaddr(npregs
, i
+ 0x20);
116 newport_cmap_setrgb(npregs
, clut
[0], clut
[1], clut
[2]);
120 newport_wait(npregs
);
121 npregs
->set
.drawmode0
= (NPORT_DMODE0_DRAW
| NPORT_DMODE0_BLOCK
|
124 npregs
->set
.xystarti
= ((newport_xsize
- logo
->width
) << 16) | (0);
125 npregs
->set
.xyendi
= ((newport_xsize
- 1) << 16);
126 newport_wait(npregs
);
128 for (i
= 0; i
< logo
->width
*logo
->height
; i
++)
129 npregs
->go
.hostrw0
= *data
++ << 24;
132 #endif /* CONFIG_LOGO_SGI_CLUT224 */
135 static inline void newport_clear_screen(int xstart
, int ystart
, int xend
,
141 newport_wait(npregs
);
142 npregs
->set
.wrmask
= 0xffffffff;
143 npregs
->set
.drawmode0
= (NPORT_DMODE0_DRAW
| NPORT_DMODE0_BLOCK
|
144 NPORT_DMODE0_DOSETUP
| NPORT_DMODE0_STOPX
145 | NPORT_DMODE0_STOPY
);
146 npregs
->set
.colori
= ci
;
147 npregs
->set
.xystarti
= (xstart
<< 16) | ystart
;
148 npregs
->go
.xyendi
= (xend
<< 16) | yend
;
151 static inline void newport_clear_lines(int ystart
, int yend
, int ci
)
153 ystart
= ((ystart
<< 4) + topscan
) & 0x3ff;
154 yend
= ((yend
<< 4) + topscan
+ 15) & 0x3ff;
155 newport_clear_screen(0, ystart
, 1280 + 63, yend
, ci
);
158 static void newport_reset(void)
163 newport_wait(npregs
);
164 treg
= newport_vc2_get(npregs
, VC2_IREG_CONTROL
);
165 newport_vc2_set(npregs
, VC2_IREG_CONTROL
,
166 (treg
| VC2_CTRL_EVIDEO
));
168 treg
= newport_vc2_get(npregs
, VC2_IREG_CENTRY
);
169 newport_vc2_set(npregs
, VC2_IREG_RADDR
, treg
);
170 npregs
->set
.dcbmode
= (NPORT_DMODE_AVC2
| VC2_REGADDR_RAM
|
171 NPORT_DMODE_W2
| VC2_PROTOCOL
);
172 for (i
= 0; i
< 128; i
++) {
173 newport_bfwait(npregs
);
174 if (i
== 92 || i
== 94)
175 npregs
->set
.dcbdata0
.byshort
.s1
= 0xff00;
177 npregs
->set
.dcbdata0
.byshort
.s1
= 0x0000;
182 /* turn off popup plane */
183 npregs
->set
.dcbmode
= (DCB_XMAP0
| R_DCB_XMAP9_PROTOCOL
|
184 XM9_CRS_CONFIG
| NPORT_DMODE_W1
);
185 npregs
->set
.dcbdata0
.bybytes
.b3
&= ~XM9_PUPMODE
;
186 npregs
->set
.dcbmode
= (DCB_XMAP1
| R_DCB_XMAP9_PROTOCOL
|
187 XM9_CRS_CONFIG
| NPORT_DMODE_W1
);
188 npregs
->set
.dcbdata0
.bybytes
.b3
&= ~XM9_PUPMODE
;
191 npregs
->cset
.topscan
= 0x3ff;
192 npregs
->cset
.xywin
= (4096 << 16) | 4096;
194 /* Clear the screen. */
195 newport_clear_screen(0, 0, 1280 + 63, 1024, 0);
199 * calculate the actual screen size by reading
200 * the video timing out of the VC2
202 static void newport_get_screensize(void)
205 unsigned short ventry
, treg
;
206 unsigned short linetable
[128]; /* should be enough */
208 ventry
= newport_vc2_get(npregs
, VC2_IREG_VENTRY
);
209 newport_vc2_set(npregs
, VC2_IREG_RADDR
, ventry
);
210 npregs
->set
.dcbmode
= (NPORT_DMODE_AVC2
| VC2_REGADDR_RAM
|
211 NPORT_DMODE_W2
| VC2_PROTOCOL
);
212 for (i
= 0; i
< 128; i
++) {
213 newport_bfwait(npregs
);
214 linetable
[i
] = npregs
->set
.dcbdata0
.byshort
.s1
;
217 newport_xsize
= newport_ysize
= 0;
218 for (i
= 0; i
< ARRAY_SIZE(linetable
) - 1 && linetable
[i
+ 1]; i
+= 2) {
220 newport_vc2_set(npregs
, VC2_IREG_RADDR
, linetable
[i
]);
221 npregs
->set
.dcbmode
= (NPORT_DMODE_AVC2
| VC2_REGADDR_RAM
|
222 NPORT_DMODE_W2
| VC2_PROTOCOL
);
224 newport_bfwait(npregs
);
225 treg
= npregs
->set
.dcbdata0
.byshort
.s1
;
227 cols
+= (treg
>> 7) & 0xfe;
228 if ((treg
& 0x80) == 0) {
229 newport_bfwait(npregs
);
230 treg
= npregs
->set
.dcbdata0
.byshort
.s1
;
232 } while ((treg
& 0x8000) == 0);
234 if (cols
> newport_xsize
)
235 newport_xsize
= cols
;
236 newport_ysize
+= linetable
[i
+ 1];
239 printk("NG1: Screensize %dx%d\n", newport_xsize
, newport_ysize
);
242 static void newport_get_revisions(void)
245 unsigned int board_rev
;
246 unsigned int rex3_rev
;
247 unsigned int vc2_rev
;
248 unsigned int cmap_rev
;
249 unsigned int xmap9_rev
;
250 unsigned int bt445_rev
;
251 unsigned int bitplanes
;
253 rex3_rev
= npregs
->cset
.status
& NPORT_STAT_VERS
;
255 npregs
->set
.dcbmode
= (DCB_CMAP0
| NCMAP_PROTOCOL
|
256 NCMAP_REGADDR_RREG
| NPORT_DMODE_W1
);
257 tmp
= npregs
->set
.dcbdata0
.bybytes
.b3
;
259 board_rev
= (tmp
>> 4) & 7;
260 bitplanes
= ((board_rev
> 1) && (tmp
& 0x80)) ? 8 : 24;
262 npregs
->set
.dcbmode
= (DCB_CMAP1
| NCMAP_PROTOCOL
|
263 NCMAP_REGADDR_RREG
| NPORT_DMODE_W1
);
264 tmp
= npregs
->set
.dcbdata0
.bybytes
.b3
;
265 if ((tmp
& 7) < cmap_rev
)
266 cmap_rev
= (tmp
& 7);
268 vc2_rev
= (newport_vc2_get(npregs
, VC2_IREG_CONFIG
) >> 5) & 7;
270 npregs
->set
.dcbmode
= (DCB_XMAP0
| R_DCB_XMAP9_PROTOCOL
|
271 XM9_CRS_REVISION
| NPORT_DMODE_W1
);
272 xmap9_rev
= npregs
->set
.dcbdata0
.bybytes
.b3
& 7;
274 npregs
->set
.dcbmode
= (DCB_BT445
| BT445_PROTOCOL
|
275 BT445_CSR_ADDR_REG
| NPORT_DMODE_W1
);
276 npregs
->set
.dcbdata0
.bybytes
.b3
= BT445_REVISION_REG
;
277 npregs
->set
.dcbmode
= (DCB_BT445
| BT445_PROTOCOL
|
278 BT445_CSR_REVISION
| NPORT_DMODE_W1
);
279 bt445_rev
= (npregs
->set
.dcbdata0
.bybytes
.b3
>> 4) - 0x0a;
281 #define L(a) (char)('A'+(a))
283 ("NG1: Revision %d, %d bitplanes, REX3 revision %c, VC2 revision %c, xmap9 revision %c, cmap revision %c, bt445 revision %c\n",
284 board_rev
, bitplanes
, L(rex3_rev
), L(vc2_rev
), L(xmap9_rev
),
285 L(cmap_rev
? (cmap_rev
+ 1) : 0), L(bt445_rev
));
288 if (board_rev
== 3) /* I don't know all affected revisions */
289 xcurs_correction
= 21;
292 static void newport_exit(void)
296 /* free memory used by user font */
297 for (i
= 0; i
< MAX_NR_CONSOLES
; i
++)
298 newport_set_def_font(i
, NULL
);
301 /* Can't be __init, take_over_console may call it later */
302 static const char *newport_startup(void)
306 npregs
->cset
.config
= NPORT_CFG_GD0
;
308 if (newport_wait(npregs
))
311 npregs
->set
.xstarti
= TESTVAL
;
312 if (npregs
->set
._xstart
.word
!= XSTI_TO_FXSTART(TESTVAL
))
315 for (i
= 0; i
< MAX_NR_CONSOLES
; i
++)
316 font_data
[i
] = FONT_DATA
;
319 newport_get_revisions();
320 newport_get_screensize();
321 newport_has_init
= 1;
323 return "SGI Newport";
329 static void newport_init(struct vc_data
*vc
, int init
)
331 vc
->vc_cols
= newport_xsize
/ 8;
332 vc
->vc_rows
= newport_ysize
/ 16;
333 vc
->vc_can_do_color
= 1;
336 static void newport_deinit(struct vc_data
*c
)
338 if (!con_is_bound(&newport_con
) && newport_has_init
) {
340 newport_has_init
= 0;
344 static void newport_clear(struct vc_data
*vc
, int sy
, int sx
, int height
,
347 int xend
= ((sx
+ width
) << 3) - 1;
348 int ystart
= ((sy
<< 4) + topscan
) & 0x3ff;
349 int yend
= (((sy
+ height
) << 4) + topscan
- 1) & 0x3ff;
355 newport_clear_screen(sx
<< 3, ystart
, xend
, yend
,
356 (vc
->vc_color
& 0xf0) >> 4);
358 newport_clear_screen(sx
<< 3, ystart
, xend
, 1023,
359 (vc
->vc_color
& 0xf0) >> 4);
360 newport_clear_screen(sx
<< 3, 0, xend
, yend
,
361 (vc
->vc_color
& 0xf0) >> 4);
365 static void newport_putc(struct vc_data
*vc
, int charattr
, int ypos
,
370 p
= &font_data
[vc
->vc_num
][(charattr
& 0xff) << 4];
371 charattr
= (charattr
>> 8) & 0xff;
375 newport_render_background(xpos
, ypos
, xpos
, ypos
,
376 (charattr
& 0xf0) >> 4);
378 /* Set the color and drawing mode. */
379 newport_wait(npregs
);
380 npregs
->set
.colori
= charattr
& 0xf;
381 npregs
->set
.drawmode0
= (NPORT_DMODE0_DRAW
| NPORT_DMODE0_BLOCK
|
382 NPORT_DMODE0_STOPX
| NPORT_DMODE0_ZPENAB
|
385 /* Set coordinates for bitmap operation. */
386 npregs
->set
.xystarti
= (xpos
<< 16) | ((ypos
+ topscan
) & 0x3ff);
387 npregs
->set
.xyendi
= ((xpos
+ 7) << 16);
388 newport_wait(npregs
);
390 /* Go, baby, go... */
394 static void newport_putcs(struct vc_data
*vc
, const unsigned short *s
,
395 int count
, int ypos
, int xpos
)
401 charattr
= (scr_readw(s
) >> 8) & 0xff;
407 /* Clear the area behing the string */
408 newport_render_background(xpos
, ypos
,
409 xpos
+ ((count
- 1) << 3), ypos
,
410 (charattr
& 0xf0) >> 4);
412 newport_wait(npregs
);
414 /* Set the color and drawing mode. */
415 npregs
->set
.colori
= charattr
& 0xf;
416 npregs
->set
.drawmode0
= (NPORT_DMODE0_DRAW
| NPORT_DMODE0_BLOCK
|
417 NPORT_DMODE0_STOPX
| NPORT_DMODE0_ZPENAB
|
420 for (i
= 0; i
< count
; i
++, xpos
+= 8) {
421 p
= &font_data
[vc
->vc_num
][(scr_readw(s
++) & 0xff) << 4];
423 newport_wait(npregs
);
425 /* Set coordinates for bitmap operation. */
426 npregs
->set
.xystarti
=
427 (xpos
<< 16) | ((ypos
+ topscan
) & 0x3ff);
428 npregs
->set
.xyendi
= ((xpos
+ 7) << 16);
430 /* Go, baby, go... */
435 static void newport_cursor(struct vc_data
*vc
, int mode
)
442 treg
= newport_vc2_get(npregs
, VC2_IREG_CONTROL
);
443 newport_vc2_set(npregs
, VC2_IREG_CONTROL
,
444 (treg
& ~(VC2_CTRL_ECDISP
)));
449 treg
= newport_vc2_get(npregs
, VC2_IREG_CONTROL
);
450 newport_vc2_set(npregs
, VC2_IREG_CONTROL
,
451 (treg
| VC2_CTRL_ECDISP
));
452 xcurs
= (vc
->vc_pos
- vc
->vc_visible_origin
) / 2;
453 ycurs
= ((xcurs
/ vc
->vc_cols
) << 4) + 31;
454 xcurs
= ((xcurs
% vc
->vc_cols
) << 3) + xcurs_correction
;
455 newport_vc2_set(npregs
, VC2_IREG_CURSX
, xcurs
);
456 newport_vc2_set(npregs
, VC2_IREG_CURSY
, ycurs
);
460 static int newport_switch(struct vc_data
*vc
)
462 static int logo_drawn
= 0;
465 npregs
->cset
.topscan
= 0x3ff;
468 if (newport_show_logo()) {
477 static int newport_blank(struct vc_data
*c
, int blank
, int mode_switch
)
482 /* unblank console */
483 treg
= newport_vc2_get(npregs
, VC2_IREG_CONTROL
);
484 newport_vc2_set(npregs
, VC2_IREG_CONTROL
,
485 (treg
| VC2_CTRL_EDISP
));
488 treg
= newport_vc2_get(npregs
, VC2_IREG_CONTROL
);
489 newport_vc2_set(npregs
, VC2_IREG_CONTROL
,
490 (treg
& ~(VC2_CTRL_EDISP
)));
495 static int newport_set_font(int unit
, struct console_font
*op
)
499 int size
= h
* op
->charcount
;
501 unsigned char *new_data
, *data
= op
->data
, *p
;
503 /* ladis: when I grow up, there will be a day... and more sizes will
504 * be supported ;-) */
505 if ((w
!= 8) || (h
!= 16)
506 || (op
->charcount
!= 256 && op
->charcount
!= 512))
509 if (!(new_data
= kmalloc(FONT_EXTRA_WORDS
* sizeof(int) + size
,
510 GFP_USER
))) return -ENOMEM
;
512 new_data
+= FONT_EXTRA_WORDS
* sizeof(int);
513 FNTSIZE(new_data
) = size
;
514 FNTCHARCNT(new_data
) = op
->charcount
;
515 REFCOUNT(new_data
) = 0; /* usage counter */
518 for (i
= 0; i
< op
->charcount
; i
++) {
524 /* check if font is already used by other console */
525 for (i
= 0; i
< MAX_NR_CONSOLES
; i
++) {
526 if (font_data
[i
] != FONT_DATA
527 && FNTSIZE(font_data
[i
]) == size
528 && !memcmp(font_data
[i
], new_data
, size
)) {
529 kfree(new_data
- FONT_EXTRA_WORDS
* sizeof(int));
530 /* current font is the same as the new one */
533 new_data
= font_data
[i
];
537 /* old font is user font */
538 if (font_data
[unit
] != FONT_DATA
) {
539 if (--REFCOUNT(font_data
[unit
]) == 0)
540 kfree(font_data
[unit
] -
541 FONT_EXTRA_WORDS
* sizeof(int));
543 REFCOUNT(new_data
)++;
544 font_data
[unit
] = new_data
;
549 static int newport_set_def_font(int unit
, struct console_font
*op
)
551 if (font_data
[unit
] != FONT_DATA
) {
552 if (--REFCOUNT(font_data
[unit
]) == 0)
553 kfree(font_data
[unit
] -
554 FONT_EXTRA_WORDS
* sizeof(int));
555 font_data
[unit
] = FONT_DATA
;
561 static int newport_font_default(struct vc_data
*vc
, struct console_font
*op
, char *name
)
563 return newport_set_def_font(vc
->vc_num
, op
);
566 static int newport_font_set(struct vc_data
*vc
, struct console_font
*font
, unsigned flags
)
568 return newport_set_font(vc
->vc_num
, font
);
571 static int newport_set_palette(struct vc_data
*vc
, unsigned char *table
)
576 static int newport_scrolldelta(struct vc_data
*vc
, int lines
)
578 /* there is (nearly) no off-screen memory, so we can't scroll back */
582 static int newport_scroll(struct vc_data
*vc
, int t
, int b
, int dir
,
586 unsigned short *s
, *d
;
587 unsigned short chattr
;
589 logo_active
= 0; /* it's time to disable the logo now.. */
591 if (t
== 0 && b
== vc
->vc_rows
) {
593 topscan
= (topscan
+ (lines
<< 4)) & 0x3ff;
594 newport_clear_lines(vc
->vc_rows
- lines
,
596 (vc
->vc_color
& 0xf0) >> 4);
598 topscan
= (topscan
+ (-lines
<< 4)) & 0x3ff;
599 newport_clear_lines(0, lines
- 1,
600 (vc
->vc_color
& 0xf0) >> 4);
602 npregs
->cset
.topscan
= (topscan
- 1) & 0x3ff;
606 count
= (b
- t
- lines
) * vc
->vc_cols
;
610 s
= (unsigned short *) (vc
->vc_origin
+
611 vc
->vc_size_row
* (t
+ lines
));
612 d
= (unsigned short *) (vc
->vc_origin
+
613 vc
->vc_size_row
* t
);
615 chattr
= scr_readw(s
++);
616 if (chattr
!= scr_readw(d
)) {
617 newport_putc(vc
, chattr
, y
, x
);
618 scr_writew(chattr
, d
);
621 if (++x
== vc
->vc_cols
) {
626 d
= (unsigned short *) (vc
->vc_origin
+
627 vc
->vc_size_row
* (b
- lines
));
630 for (count
= 0; count
< (lines
* vc
->vc_cols
); count
++) {
631 if (scr_readw(d
) != vc
->vc_video_erase_char
) {
632 newport_putc(vc
, vc
->vc_video_erase_char
,
634 scr_writew(vc
->vc_video_erase_char
, d
);
637 if (++x
== vc
->vc_cols
) {
645 s
= (unsigned short *) (vc
->vc_origin
+
646 vc
->vc_size_row
* (b
- lines
) - 2);
647 d
= (unsigned short *) (vc
->vc_origin
+
648 vc
->vc_size_row
* b
- 2);
650 chattr
= scr_readw(s
--);
651 if (chattr
!= scr_readw(d
)) {
652 newport_putc(vc
, chattr
, y
, x
);
653 scr_writew(chattr
, d
);
661 d
= (unsigned short *) (vc
->vc_origin
+
662 vc
->vc_size_row
* t
);
665 for (count
= 0; count
< (lines
* vc
->vc_cols
); count
++) {
666 if (scr_readw(d
) != vc
->vc_video_erase_char
) {
667 newport_putc(vc
, vc
->vc_video_erase_char
,
669 scr_writew(vc
->vc_video_erase_char
, d
);
672 if (++x
== vc
->vc_cols
) {
681 static void newport_bmove(struct vc_data
*vc
, int sy
, int sx
, int dy
,
682 int dx
, int h
, int w
)
684 short xs
, ys
, xe
, ye
, xoffs
, yoffs
, tmp
;
687 xe
= ((sx
+ w
) << 3) - 1;
689 * as bmove is only used to move stuff around in the same line
690 * (h == 1), we don't care about wrap arounds caused by topscan != 0
692 ys
= ((sy
<< 4) + topscan
) & 0x3ff;
693 ye
= (((sy
+ h
) << 4) - 1 + topscan
) & 0x3ff;
694 xoffs
= (dx
- sx
) << 3;
695 yoffs
= (dy
- sy
) << 4;
697 /* move to the right, exchange starting points */
702 newport_wait(npregs
);
703 npregs
->set
.drawmode0
= (NPORT_DMODE0_S2S
| NPORT_DMODE0_BLOCK
|
704 NPORT_DMODE0_DOSETUP
| NPORT_DMODE0_STOPX
705 | NPORT_DMODE0_STOPY
);
706 npregs
->set
.xystarti
= (xs
<< 16) | ys
;
707 npregs
->set
.xyendi
= (xe
<< 16) | ye
;
708 npregs
->go
.xymove
= (xoffs
<< 16) | yoffs
;
711 static int newport_dummy(struct vc_data
*c
)
716 #define DUMMY (void *) newport_dummy
718 const struct consw newport_con
= {
719 .owner
= THIS_MODULE
,
720 .con_startup
= newport_startup
,
721 .con_init
= newport_init
,
722 .con_deinit
= newport_deinit
,
723 .con_clear
= newport_clear
,
724 .con_putc
= newport_putc
,
725 .con_putcs
= newport_putcs
,
726 .con_cursor
= newport_cursor
,
727 .con_scroll
= newport_scroll
,
728 .con_bmove
= newport_bmove
,
729 .con_switch
= newport_switch
,
730 .con_blank
= newport_blank
,
731 .con_font_set
= newport_font_set
,
732 .con_font_default
= newport_font_default
,
733 .con_set_palette
= newport_set_palette
,
734 .con_scrolldelta
= newport_scrolldelta
,
735 .con_set_origin
= DUMMY
,
736 .con_save_screen
= DUMMY
739 static int newport_probe(struct gio_device
*dev
,
740 const struct gio_device_id
*id
)
742 unsigned long newport_addr
;
744 if (!dev
->resource
.start
)
748 return -EBUSY
; /* we only support one Newport as console */
750 newport_addr
= dev
->resource
.start
+ 0xF0000;
751 if (!request_mem_region(newport_addr
, 0x10000, "Newport"))
754 npregs
= (struct newport_regs
*)/* ioremap cannot fail */
755 ioremap(newport_addr
, sizeof(struct newport_regs
));
757 return take_over_console(&newport_con
, 0, MAX_NR_CONSOLES
- 1, 1);
760 static void newport_remove(struct gio_device
*dev
)
762 give_up_console(&newport_con
);
763 iounmap((void *)npregs
);
766 static struct gio_device_id newport_ids
[] = {
771 MODULE_ALIAS("gio:7e");
773 static struct gio_driver newport_driver
= {
775 .id_table
= newport_ids
,
776 .probe
= newport_probe
,
777 .remove
= newport_remove
,
780 int __init
newport_console_init(void)
782 return gio_register_driver(&newport_driver
);
785 void __exit
newport_console_exit(void)
787 gio_unregister_driver(&newport_driver
);
790 module_init(newport_console_init
);
791 module_exit(newport_console_exit
);
793 MODULE_LICENSE("GPL");