This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvd_unicon-kernel-20050104-2.6.10.patch
4260 lines (4217 loc) · 133 KB
/
vd_unicon-kernel-20050104-2.6.10.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -urN linux-2.6.10.orig/drivers/char/consolemap.c linux-2.6.10.unicon/drivers/char/consolemap.c
--- linux-2.6.10.orig/drivers/char/consolemap.c 2004-12-25 06:35:23.000000000 +0900
+++ linux-2.6.10.unicon/drivers/char/consolemap.c 2004-12-29 21:29:30.000000000 +0900
@@ -23,7 +23,11 @@
#include <linux/consolemap.h>
#include <linux/vt_kern.h>
+#ifdef CONFIG_UNICON
+unsigned short translations[][256] = {
+#else
static unsigned short translations[][256] = {
+#endif
/* 8-bit Latin-1 mapped to Unicode -- trivial mapping */
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
diff -urN linux-2.6.10.orig/drivers/char/selection.c linux-2.6.10.unicon/drivers/char/selection.c
--- linux-2.6.10.orig/drivers/char/selection.c 2004-12-25 06:35:39.000000000 +0900
+++ linux-2.6.10.unicon/drivers/char/selection.c 2004-12-29 21:30:12.000000000 +0900
@@ -162,6 +162,31 @@
switch (sel_mode)
{
case TIOCL_SELCHAR: /* character-by-character selection */
+#ifdef CONFIG_UNICON
+ {
+ unsigned char c;
+ int num = 0;
+ int ps1 = ps;
+
+ while(1)
+ {
+ c = sel_pos(ps1);
+ if(!(c & 0x80))
+ break;
+
+ num++;
+ if (!(ps1 % video_size_row))
+ break;
+ ps1 -= 2;
+ }
+ if(num != 0)
+ {
+ if(num%2)
+ pe += 2;
+ else ps -= 2;
+ }
+ }
+#endif
new_sel_start = ps;
new_sel_end = pe;
break;
@@ -170,7 +195,11 @@
for (new_sel_start = ps; ; ps -= 2)
{
if ((spc && !isspace(sel_pos(ps))) ||
+#ifdef CONFIG_UNICON
+ (!spc && !inword(sel_pos(ps))&& !(sel_pos(ps)&0x80)))
+#else
(!spc && !inword(sel_pos(ps))))
+#endif
break;
new_sel_start = ps;
if (!(ps % video_size_row))
@@ -180,7 +209,12 @@
for (new_sel_end = pe; ; pe += 2)
{
if ((spc && !isspace(sel_pos(pe))) ||
+#ifdef CONFIG_UNICON
+ (!spc && !inword(sel_pos(pe))&& !(sel_pos(pe) & 0x80)))
+#else
+
(!spc && !inword(sel_pos(pe))))
+#endif
break;
new_sel_end = pe;
if (!((pe + 2) % video_size_row))
diff -urN linux-2.6.10.orig/drivers/char/vt.c linux-2.6.10.unicon/drivers/char/vt.c
--- linux-2.6.10.orig/drivers/char/vt.c 2004-12-25 06:35:25.000000000 +0900
+++ linux-2.6.10.unicon/drivers/char/vt.c 2004-12-29 21:30:12.000000000 +0900
@@ -102,6 +102,7 @@
#include <linux/pm.h>
#include <linux/font.h>
#include <linux/bitops.h>
+#include <linux/version.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -109,6 +110,11 @@
#include "console_macros.h"
+#ifdef CONFIG_UNICON
+#include <linux/fb_doublebyte.h>
+#define video_erase_char_ext ((video_erase_char)&0xff)
+ extern unsigned short translations[][256];
+#endif
const struct consw *conswitchp;
@@ -248,6 +254,21 @@
return p;
}
+#ifdef CONFIG_UNICON
+static inline unsigned short *screenpos_ext(int currcons, int offset, int viewed)
+{
+ unsigned short *p;
+
+ if (!viewed)
+ p = (unsigned short *)(origin + offset + screenbuf_size);
+ else if (!sw->con_screen_pos)
+ p = (unsigned short *)(visible_origin + offset + screenbuf_size);
+ else
+ p = sw->con_screen_pos(vc_cons[currcons].d, -offset-1);
+ return p;
+}
+#endif
+
static inline void scrolldelta(int lines)
{
scrollback_delta += lines;
@@ -273,6 +294,12 @@
s = (unsigned short *) (origin+video_size_row*(t+nr));
scr_memmovew(d, s, (b-t-nr) * video_size_row);
scr_memsetw(d + (b-t-nr) * video_num_columns, video_erase_char, video_size_row*nr);
+#ifdef CONFIG_UNICON
+ d += (screenbuf_size>>1);
+ s += (screenbuf_size>>1);
+ scr_memcpyw(d, s, (b-t-nr) * video_size_row);
+ scr_memsetw(d + (b-t-nr) * video_num_columns, video_erase_char_ext, video_size_row*nr);
+#endif
}
static void
@@ -291,6 +318,11 @@
step = video_num_columns * nr;
scr_memmovew(s + step, s, (b-t-nr)*video_size_row);
scr_memsetw(s, video_erase_char, 2*step);
+#ifdef CONFIG_UNICON
+ s += (screenbuf_size>>1);
+ scr_memmovew(s + step, s, (b-t-nr)*video_size_row);
+ scr_memsetw(s, video_erase_char_ext, 2*step);
+#endif
}
static void do_update_region(int currcons, unsigned long start, int count)
@@ -314,6 +346,10 @@
int startx = xx;
u16 *q = p;
while (xx < video_num_columns && count) {
+#ifdef CONFIG_UNICON
+ //line by line, so the following putcs will be assured to
+ //handle only in-line string.
+#endif
if (attrib != (scr_readw(p) & 0xff00)) {
if (p > q)
sw->con_putcs(vc_cons[currcons].d, q, p-q, yy, startx);
@@ -446,6 +482,40 @@
do_update_region(currcons, (unsigned long) p, count);
}
+#ifdef CONFIG_UNICON
+/* used by selection: complement pointer position */
+void complement_pos(int currcons, int offset)
+{
+ static unsigned short *p = NULL;
+ static unsigned short old = 0;
+ static unsigned short oldx = 0, oldy = 0;
+ static unsigned short *p_ext = NULL;
+ static unsigned short old_ext = 0;
+
+ if (p) {
+ scr_writew(old, p);
+ //scr_writew(old_ext, p_ext);
+ if (DO_UPDATE)
+ sw->con_putc(vc_cons[currcons].d, (old_ext<<16)| old, oldy, oldx);
+ }
+ if (offset == -1)
+ p = NULL;
+ else {
+ unsigned short new;
+ p = screenpos(currcons, offset, 1);
+ p_ext = screenpos_ext(currcons, offset, 1);
+ old = scr_readw(p);
+ old_ext = scr_readw(p_ext);
+ new = old ^ complement_mask;
+ scr_writew(new, p);
+ if (DO_UPDATE) {
+ oldx = (offset >> 1) % video_num_columns;
+ oldy = (offset >> 1) / video_num_columns;
+ sw->con_putc(vc_cons[currcons].d, (old_ext<<16) | new, oldy, oldx);
+ }
+ }
+}
+#else
/* used by selection: complement pointer position */
void complement_pos(int currcons, int offset)
{
@@ -475,15 +545,23 @@
}
}
}
+#endif
static void insert_char(int currcons, unsigned int nr)
{
unsigned short *p, *q = (unsigned short *) pos;
p = q + video_num_columns - nr - x;
- while (--p >= q)
+ while (--p >= q) {
scr_writew(scr_readw(p), p + nr);
+#ifdef CONFIG_UNICON
+ scr_writew(scr_readw(p+(screenbuf_size>>1)),p+(screenbuf_size>>1)+nr);
+#endif
+ }
scr_memsetw(q, video_erase_char, nr*2);
+#ifdef CONFIG_UNICON
+ scr_memsetw(q+(screenbuf_size>>1),video_erase_char_ext,nr*2);
+#endif
need_wrap = 0;
if (DO_UPDATE) {
unsigned short oldattr = attr;
@@ -504,9 +582,15 @@
while (++i <= video_num_columns - nr) {
scr_writew(scr_readw(p+nr), p);
+#ifdef CONFIG_UNICON
+ scr_writew(scr_readw(p+nr+(screenbuf_size>>1)),p+(screenbuf_size>>1));
+#endif
p++;
}
scr_memsetw(p, video_erase_char, nr*2);
+#ifdef CONFIG_UNICON
+ scr_memsetw(p+(screenbuf_size>>1), video_erase_char_ext, nr*2);
+#endif
need_wrap = 0;
if (DO_UPDATE) {
unsigned short oldattr = attr;
@@ -537,7 +621,11 @@
if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700;
scr_writew(i, (u16 *) pos);
if (DO_UPDATE)
+#ifdef CONFIG_UNICON
+ sw->con_putc(vc_cons[currcons].d, scr_readw((u16 *) pos+ (screenbuf_size>>1))<<16 | (i & 0xffff), y, x);
+#else
sw->con_putc(vc_cons[currcons].d, i, y, x);
+#endif
}
static void hide_softcursor(int currcons)
@@ -545,7 +633,11 @@
if (softcursor_original != -1) {
scr_writew(softcursor_original,(u16 *) pos);
if (DO_UPDATE)
+#ifdef CONFIG_UNICON
+ sw->con_putc(vc_cons[currcons].d, scr_readw((u16 *) pos+ (screenbuf_size>>1))<<16 | softcursor_original, y, x);
+#else
sw->con_putc(vc_cons[currcons].d, softcursor_original, y, x);
+#endif
softcursor_original = -1;
}
}
@@ -733,7 +825,11 @@
visual_init(currcons, 1);
if (!*vc_cons[currcons].d->vc_uni_pagedir_loc)
con_set_default_unimap(currcons);
+#ifdef CONFIG_UNICON
+ q = (long)kmalloc(screenbuf_size*2,GFP_KERNEL);
+#else
q = (long)kmalloc(screenbuf_size, GFP_KERNEL);
+#endif
if (!q) {
kfree((char *) p);
vc_cons[currcons].d = NULL;
@@ -793,7 +889,11 @@
if (new_cols == video_num_columns && new_rows == video_num_lines)
return 0;
+#ifdef CONFIG_UNICON
+ newscreen = (unsigned short *) kmalloc(new_screen_size*2, GFP_USER);
+#else
newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
+#endif
if (!newscreen)
return -ENOMEM;
@@ -825,13 +925,24 @@
while (old_origin < scr_end) {
scr_memcpyw((unsigned short *) new_origin, (unsigned short *) old_origin, rlth);
- if (rrem)
+#ifdef CONFIG_UNICON
+ scr_memcpyw((unsigned short *) (new_origin + new_screen_size), (unsigned short*) (old_origin + old_screen_size), rlth);
+#endif
+ if (rrem) {
scr_memsetw((void *)(new_origin + rlth), video_erase_char, rrem);
+#ifdef CONFIG_UNICON
+ scr_memsetw((void *)(new_origin + rlth + new_screen_size), video_erase_char_ext, rrem);
+#endif
+ }
old_origin += old_row_size;
new_origin += new_row_size;
}
- if (new_scr_end > new_origin)
+ if (new_scr_end > new_origin) {
scr_memsetw((void *) new_origin, video_erase_char, new_scr_end - new_origin);
+#ifdef CONFIG_UNICON
+ scr_memsetw((void *) (new_origin + new_screen_size), video_erase_char_ext, new_scr_end - new_origin);
+#endif
+ }
if (kmalloced)
kfree(screenbuf);
screenbuf = newscreen;
@@ -1054,6 +1165,9 @@
return;
}
scr_memsetw(start, video_erase_char, 2*count);
+#ifdef CONFIG_UNICON
+ scr_memsetw(start + (screenbuf_size>>1), video_erase_char_ext, 2*count);
+#endif
need_wrap = 0;
}
@@ -1088,6 +1202,9 @@
return;
}
scr_memsetw(start, video_erase_char, 2 * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw(start + (screenbuf_size>>1), video_erase_char_ext, 2*count);
+#endif
need_wrap = 0;
}
@@ -1100,6 +1217,9 @@
count = (vpar > video_num_columns-x) ? (video_num_columns-x) : vpar;
scr_memsetw((unsigned short *) pos, video_erase_char, 2 * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw((unsigned short *) pos + (screenbuf_size>>1), video_erase_char_ext, 2*count);
+#endif
if (DO_UPDATE)
sw->con_clear(vc_cons[currcons].d, y, x, 1, count);
need_wrap = 0;
@@ -1697,7 +1817,12 @@
if (ques) {
clear_selection();
if (par[0])
+#ifdef CONFIG_UNICON
+ // force the low byte to be zero
+ complement_mask = par[0]<<8;
+#else
complement_mask = par[0]<<8 | par[1];
+#endif
else
complement_mask = s_complement_mask;
return;
@@ -1912,6 +2037,12 @@
u16 himask, charmask;
const unsigned char *orig_buf = NULL;
int orig_count;
+#ifdef CONFIG_UNICON
+ /* added by Arthur Ma, for multiple font support */
+ struct double_byte * doublebyte_default = NULL;
+#define GB_LEFT 0x8000
+#define GB_RIGHT 0xc000
+#endif
if (in_interrupt())
return count;
@@ -1926,6 +2057,12 @@
return 0;
}
+#ifdef CONFIG_UNICON
+ /* added by Arthur Ma, for multiple font support */
+ if (UniconFontManager != NULL)
+ doublebyte_default = UniconFontManager->getfont (vt->vc_num);
+#endif
+
currcons = vt->vc_num;
if (!vc_cons_allocated(currcons)) {
/* could this happen? */
@@ -2061,6 +2198,55 @@
((attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
(attr << 8) + tc,
(u16 *) pos);
+#ifdef CONFIG_UNICON
+#define HIGH_WORD ((u16 *) ((long)pos + screenbuf_size))
+#define HIGH_WORD_PREV ((u16 *) ((long)pos - 2 + screenbuf_size))
+#define HIGH_WORD_NEXT ((u16 *) ((long)pos + 2 + screenbuf_size))
+ /*
+ * following condiction we do not tread the char as
+ * double byte.
+ * 1. default encoding is NULL. The encode module not
+ * install yet.
+ * 2. Current char set is not the default one. We are
+ * possible drawing a table lines right now.
+ * -Chris
+ */
+ if (doublebyte_default && translate == translations[0]
+ && (pos==origin||!(scr_readw(HIGH_WORD_PREV)&DB_HALF_MASK))
+ && doublebyte_default->is_left(tc)){
+ /*possible the left char of the Double Byte
+ , but we don't know yet, because the right
+ char is unknow right now. So mark it as
+ Half char, the possible candidate
+ -Chris
+ */
+ scr_writew(DB_HALF_MASK,HIGH_WORD);
+
+ } else if(doublebyte_default&& translate == translations[0]
+ && scr_readw(HIGH_WORD_PREV)==DB_HALF_MASK
+ && doublebyte_default->is_right(tc)) {
+ scr_writew(DB_LEFT|(tc & 0xff),HIGH_WORD_PREV);
+ scr_writew(DB_RIGHT|(scr_readw((u16*)(pos-2))&0xff),HIGH_WORD);
+ if (DO_UPDATE && draw_x < 0) {
+ draw_from = pos-2 ;
+ if (x>0) {
+ draw_x = x-1;
+ } else {
+ draw_to = pos;
+ draw_x = video_num_columns -1;
+ y--;
+ FLUSH
+ y++;
+ draw_x = 0;
+ draw_from = pos;
+ }
+ }
+ } else if(doublebyte_default) {
+ /*normal ASCII or table lines, clean hight byte*/
+ scr_writew(0,HIGH_WORD);
+ }
+
+#endif
if (DO_UPDATE && draw_x < 0) {
draw_x = x;
draw_from = pos;
@@ -2102,6 +2288,11 @@
if (want_console >= 0) {
if (want_console != fg_console &&
vc_cons_allocated(want_console)) {
+#ifdef CONFIG_UNICON
+ extern void (*Unicon_TtyChangeUpdate) (int nTty);
+ if (Unicon_TtyChangeUpdate != NULL)
+ (*Unicon_TtyChangeUpdate) (want_console);
+#endif
hide_cursor(fg_console);
change_console(want_console);
/* we only changed when the console had already
@@ -2208,6 +2399,9 @@
continue;
}
scr_writew((attr << 8) + c, (unsigned short *) pos);
+#ifdef CONFIG_UNICON
+ scr_writew(0,(unsigned short *) pos + (screenbuf_size>>1));
+#endif
cnt++;
if (myx == video_num_columns - 1) {
need_wrap = 1;
@@ -2564,7 +2758,11 @@
vt_cons[currcons] = (struct vt_struct *)
alloc_bootmem(sizeof(struct vt_struct));
visual_init(currcons, 1);
+#ifdef CONFIG_UNICON
+ screenbuf = (unsigned short *) alloc_bootmem( 2 * screenbuf_size);
+#else
screenbuf = (unsigned short *) alloc_bootmem(screenbuf_size);
+#endif
kmalloced = 0;
vc_init(currcons, video_num_lines, video_num_columns,
currcons || !sw->con_save_screen);
@@ -3212,6 +3410,12 @@
set_cursor(currcons);
}
+#ifdef CONFIG_UNICON
+/*
+ Now, the unicon doesn't support vcs!
+ To support it, first change the vc_screen.c!
+*/
+#endif
u16 vcs_scr_readw(int currcons, const u16 *org)
{
if ((unsigned long)org == pos && softcursor_original != -1)
@@ -3250,6 +3454,18 @@
* Visible symbols for modules
*/
+#ifdef CONFIG_UNICON
+int (*Unicon_fnKeyHook)
+ (struct tty_struct *tty, unsigned char ch, char flag) = NULL;
+int (*Unicon_fnLowerKeyHook) (unsigned char ch) = NULL;
+void (*Unicon_TtyChangeUpdate) (int nTty) = NULL;
+EXPORT_SYMBOL(Unicon_fnLowerKeyHook);
+EXPORT_SYMBOL(Unicon_fnKeyHook);
+EXPORT_SYMBOL(Unicon_TtyChangeUpdate);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
+EXPORT_SYMBOL(vc_cons);
+#endif
+#endif
EXPORT_SYMBOL(color_table);
EXPORT_SYMBOL(default_red);
EXPORT_SYMBOL(default_grn);
diff -urN linux-2.6.10.orig/drivers/video/Kconfig linux-2.6.10.unicon/drivers/video/Kconfig
--- linux-2.6.10.orig/drivers/video/Kconfig 2004-12-25 06:33:49.000000000 +0900
+++ linux-2.6.10.unicon/drivers/video/Kconfig 2004-12-29 21:29:30.000000000 +0900
@@ -67,6 +67,17 @@
This is particularly important to one driver, matroxfb. If
unsure, say N.
+config UNICON
+ bool "UNICON console support (EXPERIMENTAL)"
+ depends on FB && EXPERIMENTAL
+ select FRAMEBUFFER_CONSOLE
+ help
+ This is UNICON CJK display system lower level driver and API.
+ Unikey and CJK font modules are included in the UNICON package.
+ If you want to use UNICON, say Y here. If unsure, say N.
+
+ source "drivers/video/unicon/Kconfig"
+
config FB_CIRRUS
tristate "Cirrus Logic support"
depends on FB && (ZORRO || PCI)
diff -urN linux-2.6.10.orig/drivers/video/Makefile linux-2.6.10.unicon/drivers/video/Makefile
--- linux-2.6.10.orig/drivers/video/Makefile 2004-12-25 06:33:59.000000000 +0900
+++ linux-2.6.10.unicon/drivers/video/Makefile 2004-12-29 21:29:30.000000000 +0900
@@ -7,6 +7,10 @@
obj-$(CONFIG_VT) += console/
obj-$(CONFIG_LOGO) += logo/
+ifeq ($(CONFIG_UNICON),y)
+subdir-m += unicon
+endif
+
obj-$(CONFIG_FB) += fbmem.o fbmon.o fbcmap.o fbsysfs.o modedb.o softcursor.o
# Only include macmodes.o if we have FB support and are PPC
ifeq ($(CONFIG_FB),y)
diff -urN linux-2.6.10.orig/drivers/video/console/bitblit.c linux-2.6.10.unicon/drivers/video/console/bitblit.c
--- linux-2.6.10.orig/drivers/video/console/bitblit.c 2004-12-25 06:35:49.000000000 +0900
+++ linux-2.6.10.unicon/drivers/video/console/bitblit.c 2004-12-29 21:30:12.000000000 +0900
@@ -18,7 +18,10 @@
#include <linux/console.h>
#include <asm/types.h>
#include "fbcon.h"
-
+#ifdef CONFIG_UNICON
+#include "unicon.c"
+extern struct display fb_display[MAX_NR_CONSOLES];
+#endif
/*
* Accelerated handlers.
*/
@@ -202,7 +205,206 @@
if (buf)
kfree(buf);
}
+#ifdef CONFIG_UNICON
+static void bit_putcs_tl(struct vc_data *vc, struct fb_info *info,
+ const unsigned short *s, int count, int yy, int xx,
+ int fg, int bg, struct double_byte * doublebyte_default)
+{
+ void (*move_unaligned)(struct fb_info *info, struct fb_pixmap *buf,
+ u8 *dst, u32 d_pitch, u8 *src, u32 idx,
+ u32 height, u32 shift_high, u32 shift_low,
+ u32 mod);
+ void (*move_aligned)(struct fb_info *info, struct fb_pixmap *buf,
+ u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
+ u32 height);
+ unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+ unsigned int width = (vc->vc_font.width + 7) >> 3;
+ unsigned int cellsize = vc->vc_font.height * width;
+ unsigned int maxcnt = info->pixmap.size/cellsize;
+ unsigned int scan_align = info->pixmap.scan_align - 1;
+ unsigned int buf_align = info->pixmap.buf_align - 1;
+ unsigned int shift_low = 0, mod = vc->vc_font.width % 8;
+ unsigned int shift_high = 8, pitch, cnt, size, k;
+ unsigned int idx = vc->vc_font.width >> 3;
+ unsigned int attribute = get_attribute(info, scr_readw(s));
+ struct fb_image image;
+ u8 *src, *dst, *buf = NULL;
+ u_char * fontdata_save;
+ int index, c,i;
+ int extendedchar;
+ fontdata_save = vc->vc_font.data;
+
+ if (attribute) {
+ buf = kmalloc(cellsize, GFP_KERNEL);
+ if (!buf)
+ return;
+ }
+
+ image.fg_color = fg;
+ image.bg_color = bg;
+
+ image.dx = xx * vc->vc_font.width;
+ image.dy = yy * vc->vc_font.height;
+ image.height = vc->vc_font.height;
+ image.depth = 1;
+
+ if (info->pixmap.outbuf && info->pixmap.inbuf) {
+ move_aligned = fb_iomove_buf_aligned;
+ move_unaligned = fb_iomove_buf_unaligned;
+ } else {
+ move_aligned = fb_sysmove_buf_aligned;
+ move_unaligned = fb_sysmove_buf_unaligned;
+ }
+ while (count) {
+ if (count > maxcnt)
+ cnt = k = maxcnt;
+ else
+ cnt = k = count;
+
+ image.width = vc->vc_font.width * cnt;
+ pitch = ((image.width + 7) >> 3) + scan_align;
+ pitch &= ~scan_align;
+ size = pitch * image.height + buf_align;
+ size &= ~buf_align;
+ dst = fb_get_buffer_offset(info, &info->pixmap, size);
+ image.data = dst;
+ if (mod) {
+ for(i = 0; i < k; s++, i++){
+ c = (scr_readw (hibyte_pos (vc, s)) << 16) | scr_readw (s);
+ extendedchar = c & (DB_VALIDATE<<16);
+ if (extendedchar){
+ if ( c & (DB_RIGHT_MASK << 16) ) // right half
+ index = doublebyte_default->font_index((c>>16)&0xff, (c&0xff)) + 16;
+ else
+ index = doublebyte_default->font_index((c&0xff),(c>>16)&0xff);
+ }
+ if (extendedchar && index >=0 && index < doublebyte_default->charcount){
+ vc->vc_font.data = doublebyte_default->font_data +index;
+ c = (c & 0xff00);
+ }else{
+ c = c & 0xffff;
+ vc->vc_font.data = fontdata_save;
+ }
+ src = vc->vc_font.data + (c&charmask)*cellsize;
+
+ if (attribute) {
+ update_attr(buf, src, attribute, vc);
+ src = buf;
+ }
+
+ move_unaligned(info, &info->pixmap, dst, pitch,
+ src, idx, image.height,
+ shift_high, shift_low, mod);
+ shift_low += mod;
+ dst += (shift_low >= 8) ? width : width - 1;
+ shift_low &= 7;
+ shift_high = 8 - shift_low;
+ }
+ } else {
+ for(i = 0; i < k; s++, i++){
+ c = (scr_readw (hibyte_pos (vc, s)) << 16) | scr_readw (s);
+ extendedchar = c & (DB_VALIDATE<<16);
+ if (extendedchar){
+ if ( c & (DB_RIGHT_MASK << 16) ) // right half
+ index = doublebyte_default->font_index((c>>16)&0xff, (c&0xff)) + 16;
+ else
+ index = doublebyte_default->font_index((c&0xff),(c>>16)&0xff);
+ }
+ if (extendedchar && index >=0 && index < doublebyte_default->charcount){
+ vc->vc_font.data = doublebyte_default->font_data +index;
+ c = (c & 0xff00);
+ }else{
+ c = c & 0xffff;
+ vc->vc_font.data = fontdata_save;
+ }
+ src = vc->vc_font.data + (c&charmask)*cellsize;
+
+ if (attribute) {
+ update_attr(buf, src, attribute, vc);
+ src = buf;
+ }
+
+ move_aligned(info, &info->pixmap, dst, pitch,
+ src, idx, image.height);
+ dst += width;
+ }
+ }
+ info->fbops->fb_imageblit(info, &image);
+ image.dx += cnt * vc->vc_font.width;
+ count -= cnt;
+ }
+
+ if (buf)
+ kfree(buf);
+
+ vc->vc_font.data = fontdata_save;
+}
+static void bit_putcs_wrap(struct vc_data *vc, struct fb_info *info,
+ const unsigned short *s, int count, int ypos, int xpos,
+ int fg, int bg)
+{
+ int n,yy;
+ struct display *p = &fb_display[vc->vc_num];
+ const unsigned short * str = s;
+ struct double_byte * doublebyte_default = NULL;
+
+ yy = real_y(p, ypos);
+
+ if (UniconFontManager != NULL)
+ doublebyte_default = UniconFontManager->getfont (vc->vc_num);
+
+ if (!doublebyte_default)
+ {
+ bit_putcs(vc, info, s, count, yy, xpos, fg, bg);
+ return;
+ }
+
+ if(count == 1)
+ {
+ int extendedchar, index;
+ u_char * fontdata_save;
+ int c = *(int*)s;
+
+ extendedchar = c & (DB_VALIDATE<<16);
+ if (extendedchar) {
+ fontdata_save = vc->vc_font.data;
+ if ( c & (DB_RIGHT_MASK << 16)) {// right half
+ index = doublebyte_default->font_index((c>>16)&0xff, (c&0xff)) + 16;
+ } else {
+ index = doublebyte_default->font_index((c&0xff),(c>>16)&0xff);
+ }
+
+ if (index >=0 && index < doublebyte_default->charcount) {
+ vc->vc_font.data = doublebyte_default->font_data +index;
+ c = (c & 0xff00);
+ }else c = c & 0xffff;
+ bit_putcs(vc, info, &c, 1, yy, xpos, fg, bg);
+ vc->vc_font.data = fontdata_save;
+ } else {
+ c = c & 0xffff;
+ bit_putcs(vc, info, &c, 1, yy, xpos ,fg ,bg);
+ }
+ return;
+ }
+
+ while (count > 0) {
+ n = fbcon_get_dchar_len (vc, p, str, count);
+ if (n != 0)
+ bit_putcs_tl(vc, info, str, n, yy, xpos,
+ fg, bg, doublebyte_default);
+ str += n;
+ xpos += n;
+ count -= n;
+ n = fbcon_get_schar_len (vc, p, str, count);
+ if (n != 0)
+ bit_putcs(vc, info, str, n, yy, xpos ,fg ,bg);
+ str += n;
+ xpos += n;
+ count -= n;
+ }
+}
+#endif
static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
int bottom_only)
{
@@ -245,10 +447,40 @@
int y = real_y(p, vc->vc_y);
int attribute, use_sw = (vc->vc_cursor_type & 0x10);
char *src;
+#ifdef CONFIG_UNICON
+ int extendedchar = 0;
+ u_char * fontdata_save;
+ struct double_byte * doublebyte_default = NULL;
+#endif
cursor.set = 0;
-
+#ifdef CONFIG_UNICON
+ if (UniconFontManager != NULL)
+ doublebyte_default = UniconFontManager->getfont (vc->vc_num);
+
+ fontdata_save = vc->vc_font.data;
+ if(doublebyte_default != NULL){
+ c = (scr_readw (hibyte_pos (vc, (u16 *) vc->vc_pos)) << 16) |
+ scr_readw((u16 *) vc->vc_pos);
+ extendedchar = c & (DB_VALIDATE<<16);
+ if (extendedchar) {
+ int index;
+ if ( c & (DB_RIGHT_MASK << 16)) {// right half
+ index = doublebyte_default->font_index((c>>16)&0xff, (c&0xff)) + 16;
+ } else {
+ index = doublebyte_default->font_index((c&0xff),(c>>16)&0xff);
+ }
+ if (index >=0 && index < doublebyte_default->charcount) {
+ vc->vc_font.data = doublebyte_default->font_data +index;
+ c = (c & 0xff00);
+ }else c = c & 0xffff;
+ } else {
+ c = c & 0xffff;
+ }
+ }else c = scr_readw((u16 *) vc->vc_pos);
+#else
c = scr_readw((u16 *) vc->vc_pos);
+#endif
attribute = get_attribute(info, c);
src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
@@ -376,13 +608,21 @@
info->fbops->fb_cursor(info, &cursor);
ops->cursor_reset = 0;
+#ifdef CONFIG_UNICON
+ if (doublebyte_default != NULL && extendedchar)
+ vc->vc_font.data = fontdata_save;
+#endif
}
void fbcon_set_bitops(struct fbcon_ops *ops)
{
ops->bmove = bit_bmove;
ops->clear = bit_clear;
+#ifdef CONFIG_UNICON
+ ops->putcs = bit_putcs_wrap;
+#else
ops->putcs = bit_putcs;
+#endif
ops->clear_margins = bit_clear_margins;
ops->cursor = bit_cursor;
}
diff -urN linux-2.6.10.orig/drivers/video/console/fbcon.c linux-2.6.10.unicon/drivers/video/console/fbcon.c
--- linux-2.6.10.orig/drivers/video/console/fbcon.c 2004-12-25 06:35:21.000000000 +0900
+++ linux-2.6.10.unicon/drivers/video/console/fbcon.c 2005-01-04 17:00:35.000000000 +0900
@@ -187,6 +187,11 @@
static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
int line, int count, int dy);
+#ifdef CONFIG_UNICON
+#include <linux/fb_doublebyte.h>
+extern inline const unsigned short * hibyte_pos(struct vc_data *vc, const unsigned short *p);
+#endif
+
#ifdef CONFIG_MAC
/*
* On the Macintoy, there may or may not be a working VBL int. We need to probe
@@ -769,7 +774,11 @@
if (!softback_buf) {
softback_buf =
(unsigned long)
+#ifdef CONFIG_UNICON
+ kmalloc(fbcon_softback_size * 2,
+#else
kmalloc(fbcon_softback_size,
+#endif
GFP_KERNEL);
if (!softback_buf) {
fbcon_softback_size = 0;
@@ -1054,11 +1063,17 @@
int count, int ypos, int xpos)
{
struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+#ifndef CONFIG_UNICON
struct display *p = &fb_display[vc->vc_num];
+#endif
struct fbcon_ops *ops = info->fbcon_par;
if (!fbcon_is_inactive(vc, info))
+#ifdef CONFIG_UNICON
+ ops->putcs(vc, info, s, count, ypos, xpos,
+#else
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
+#endif
get_color(vc, info, scr_readw(s), 1),
get_color(vc, info, scr_readw(s), 0));
}
@@ -1068,7 +1083,11 @@
unsigned short chr;
scr_writew(c, &chr);
+#ifdef CONFIG_UNICON
+ fbcon_putcs(vc, &c, 1, ypos, xpos);
+#else
fbcon_putcs(vc, &chr, 1, ypos, xpos);
+#endif
}
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
@@ -1195,6 +1214,7 @@
}
}
}
+
}
static __inline__ void ywrap_up(struct vc_data *vc, int count)
@@ -1331,6 +1351,9 @@
static void fbcon_redraw_softback(struct vc_data *vc, struct display *p,
long delta)
{
+#ifndef CONFIG_UNICON
+ struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
+#endif
int count = vc->vc_rows;
unsigned short *d, *s;
unsigned long n;
@@ -1379,11 +1402,17 @@
unsigned short c;
int x = 0;
unsigned short attr = 1;
+#ifdef CONFIG_UNICON
+ unsigned short c_ext;
+#endif
start = s;
le = advance_row(s, 1);
do {
c = scr_readw(s);
+#ifdef CONFIG_UNICON
+ c_ext = scr_readw(hibyte_pos(vc,s));
+#endif
if (attr != (c & 0xff00)) {
attr = c & 0xff00;
if (s > start) {
@@ -1393,7 +1422,11 @@
start = s;
}
}
+#ifdef CONFIG_UNICON
+ if (c == scr_readw(d) && c_ext == scr_readw(hibyte_pos(vc,d))) {
+#else
if (c == scr_readw(d)) {
+#endif
if (s > start) {
fbcon_putcs(vc, start, s - start,
line, x);
@@ -1460,6 +1493,9 @@
{
unsigned short *d = (unsigned short *)
(vc->vc_origin + vc->vc_size_row * line);
+#ifndef CONFIG_UNICON
+ struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
+#endif
unsigned short *s = d + offset;
while (count--) {
@@ -1468,9 +1504,15 @@
unsigned short c;
int x = 0;
unsigned short attr = 1;
+#ifdef CONFIG_UNICON
+ unsigned short c_ext;
+#endif
do {
c = scr_readw(s);
+#ifdef CONFIG_UNICON
+ c_ext = scr_readw(hibyte_pos(vc,s));
+#endif
if (attr != (c & 0xff00)) {
attr = c & 0xff00;
if (s > start) {
@@ -1480,7 +1522,11 @@
start = s;
}
}
+#ifdef CONFIG_UNICON
+ if (c == scr_readw(d) && c_ext == scr_readw(hibyte_pos(vc,d))) {
+#else
if (c == scr_readw(d)) {
+#endif
if (s > start) {
fbcon_putcs(vc, start, s - start,
line, x);
@@ -1492,6 +1538,9 @@
}
}
scr_writew(c, d);
+#ifdef CONFIG_UNICON
+ scr_writew(scr_readw(s+(vc->vc_screenbuf_size>>1)),d+(vc->vc_screenbuf_size>>1));
+#endif
console_conditional_schedule();
s++;
d++;
@@ -1521,6 +1570,9 @@
while (count) {
scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row);
+#ifdef CONFIG_UNICON
+ scr_memcpyw((u16 *)softback_in+(fbcon_softback_size>>1),p+(vc->vc_screenbuf_size>>1),vc->vc_size_row);
+#endif
count--;
p = advance_row(p, 1);
softback_in += vc->vc_size_row;
@@ -1639,6 +1691,14 @@
(b - count)),
vc->vc_video_erase_char,
vc->vc_size_row * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw((unsigned short *) (vc->vc_origin +
+ vc->vc_size_row *
+ (b-count) +
+ vc->vc_screenbuf_size),
+ vc->vc_video_erase_char & 0xff,
+ vc->vc_size_row * count);
+#endif