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-20081019-2.6.27.patch
4246 lines (4200 loc) · 132 KB
/
vd_unicon-kernel-20081019-2.6.27.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 -urNp linux-2.6.27.ORIG/drivers/char/consolemap.c linux-2.6.27.UNICON/drivers/char/consolemap.c
--- linux-2.6.27.ORIG/drivers/char/consolemap.c 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/char/consolemap.c 2008-10-17 23:32:09.000000000 +0900
@@ -22,7 +22,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 -urNp linux-2.6.27.ORIG/drivers/char/selection.c linux-2.6.27.UNICON/drivers/char/selection.c
--- linux-2.6.27.ORIG/drivers/char/selection.c 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/char/selection.c 2008-10-17 23:32:09.000000000 +0900
@@ -189,6 +189,31 @@ int set_selection(const struct tiocl_sel
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 % vc->vc_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;
@@ -197,7 +222,11 @@ int set_selection(const struct tiocl_sel
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 % vc->vc_size_row))
@@ -207,7 +236,12 @@ int set_selection(const struct tiocl_sel
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) % vc->vc_size_row))
diff -urNp linux-2.6.27.ORIG/drivers/char/vt.c linux-2.6.27.UNICON/drivers/char/vt.c
--- linux-2.6.27.ORIG/drivers/char/vt.c 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/char/vt.c 2008-10-17 23:32:09.000000000 +0900
@@ -100,11 +100,17 @@
#include <linux/font.h>
#include <linux/bitops.h>
#include <linux/notifier.h>
+#include <linux/version.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/uaccess.h>
+#ifdef CONFIG_UNICON
+#include <linux/fb_doublebyte.h>
+extern unsigned short translations[][256];
+#endif
+
#define MAX_NR_CON_DRIVER 16
#define CON_DRIVER_FLAG_MODULE 1
@@ -277,6 +283,21 @@ static inline unsigned short *screenpos(
return p;
}
+#ifdef CONFIG_UNICON
+static inline unsigned short *screenpos_ext(struct vc_data *vc, int offset, int viewed)
+{
+ unsigned short *p;
+
+ if (!viewed)
+ p = (unsigned short *)(vc->vc_origin + offset + vc->vc_screenbuf_size);
+ else if (!vc->vc_sw->con_screen_pos)
+ p = (unsigned short *)(vc->vc_visible_origin + offset + vc->vc_screenbuf_size);
+ else
+ p = vc->vc_sw->con_screen_pos(vc, -offset-1);
+ return p;
+}
+#endif
+
static inline void scrolldelta(int lines)
{
scrollback_delta += lines;
@@ -303,6 +324,13 @@ static void scrup(struct vc_data *vc, un
scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_scrl_erase_char,
vc->vc_size_row * nr);
+#ifdef CONFIG_UNICON
+ d += (vc->vc_screenbuf_size>>1);
+ s += (vc->vc_screenbuf_size>>1);
+ scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
+ scr_memsetw(d + (b - t - nr) * vc->vc_cols, (vc->vc_video_erase_char & 0xff),
+ vc->vc_size_row * nr);
+#endif
}
static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
@@ -320,6 +348,11 @@ static void scrdown(struct vc_data *vc,
step = vc->vc_cols * nr;
scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
scr_memsetw(s, vc->vc_scrl_erase_char, 2 * step);
+#ifdef CONFIG_UNICON
+ s += (vc->vc_screenbuf_size>>1);
+ scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
+ scr_memsetw(s, (vc->vc_scrl_erase_char & 0xff), 2 * step);
+#endif
}
static void do_update_region(struct vc_data *vc, unsigned long start, int count)
@@ -343,6 +376,10 @@ static void do_update_region(struct vc_d
int startx = xx;
u16 *q = p;
while (xx < vc->vc_cols && 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)
vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
@@ -487,15 +524,26 @@ void complement_pos(struct vc_data *vc,
{
static int old_offset = -1;
static unsigned short old;
- static unsigned short oldx, oldy;
+ static unsigned short oldx = 0, oldy = 0;
+#ifdef CONFIG_UNICON
+ static unsigned short *p_ext = NULL;
+ static unsigned short old_ext = 0;
+#endif
WARN_CONSOLE_UNLOCKED();
if (old_offset != -1 && old_offset >= 0 &&
old_offset < vc->vc_screenbuf_size) {
scr_writew(old, screenpos(vc, old_offset, 1));
+#ifdef CONFIG_UNICON
+ //scr_writew(old_ext, screenpos_ext(vc, old_offset, 1));
+#endif
if (DO_UPDATE(vc))
+#ifdef CONFIG_UNICON
+ vc->vc_sw->con_putc(vc, (old_ext<<16) | old, oldy, oldx);
+#else
vc->vc_sw->con_putc(vc, old, oldy, oldx);
+#endif
}
old_offset = offset;
@@ -505,13 +553,23 @@ void complement_pos(struct vc_data *vc,
unsigned short new;
unsigned short *p;
p = screenpos(vc, offset, 1);
+#ifdef CONFIG_UNICON
+ p_ext = screenpos_ext(vc, offset, 1);
+#endif
old = scr_readw(p);
+#ifdef CONFIG_UNICON
+ old_ext = scr_readw(p_ext);
+#endif
new = old ^ vc->vc_complement_mask;
scr_writew(new, p);
if (DO_UPDATE(vc)) {
oldx = (offset >> 1) % vc->vc_cols;
oldy = (offset >> 1) / vc->vc_cols;
+#ifdef CONFIG_UNICON
+ vc->vc_sw->con_putc(vc, (old_ext<<16) | new, oldy, oldx);
+#else
vc->vc_sw->con_putc(vc, new, oldy, oldx);
+#endif
}
}
@@ -522,9 +580,16 @@ static void insert_char(struct vc_data *
unsigned short *p, *q = (unsigned short *)vc->vc_pos;
p = q + vc->vc_cols - nr - vc->vc_x;
- while (--p >= q)
+ while (--p >= q) {
scr_writew(scr_readw(p), p + nr);
+#ifdef CONFIG_UNICON
+ scr_writew(scr_readw(p + (vc->vc_screenbuf_size>>1)), p + (vc->vc_screenbuf_size>>1) + nr);
+#endif
+ }
scr_memsetw(q, vc->vc_video_erase_char, nr * 2);
+#ifdef CONFIG_UNICON
+ scr_memsetw(q + (vc->vc_screenbuf_size>>1), (vc->vc_video_erase_char & 0xff), nr * 2);
+#endif
vc->vc_need_wrap = 0;
if (DO_UPDATE(vc)) {
unsigned short oldattr = vc->vc_attr;
@@ -544,9 +609,15 @@ static void delete_char(struct vc_data *
while (++i <= vc->vc_cols - nr) {
scr_writew(scr_readw(p+nr), p);
+#ifdef CONFIG_UNICON
+ scr_writew(scr_readw(p+nr+(vc->vc_screenbuf_size>>1)), p+(vc->vc_screenbuf_size>>1));
+#endif
p++;
}
scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
+#ifdef CONFIG_UNICON
+ scr_memsetw(p+(vc->vc_screenbuf_size>>1), (vc->vc_video_erase_char & 0xff), nr * 2);
+#endif
vc->vc_need_wrap = 0;
if (DO_UPDATE(vc)) {
unsigned short oldattr = vc->vc_attr;
@@ -576,7 +647,11 @@ static void add_softcursor(struct vc_dat
if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700;
scr_writew(i, (u16 *) vc->vc_pos);
if (DO_UPDATE(vc))
+#ifdef CONFIG_UNICON
+ vc->vc_sw->con_putc(vc, scr_readw((u16 *) vc->vc_pos+ (vc->vc_screenbuf_size>>1))<<16 | (i & 0xffff), vc->vc_y, vc->vc_x);
+#else
vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x);
+#endif
}
static void hide_softcursor(struct vc_data *vc)
@@ -584,8 +659,13 @@ static void hide_softcursor(struct vc_da
if (softcursor_original != -1) {
scr_writew(softcursor_original, (u16 *)vc->vc_pos);
if (DO_UPDATE(vc))
+#ifdef CONFIG_UNICON
+ vc->vc_sw->con_putc(vc, scr_readw((u16 *) vc->vc_pos+ (vc->vc_screenbuf_size>>1))<<16 | softcursor_original,
+ vc->vc_y, vc->vc_x);
+#else
vc->vc_sw->con_putc(vc, softcursor_original,
vc->vc_y, vc->vc_x);
+#endif
softcursor_original = -1;
}
}
@@ -771,7 +851,11 @@ int vc_allocate(unsigned int currcons) /
if (!*vc->vc_uni_pagedir_loc)
con_set_default_unimap(vc);
if (!vc->vc_kmalloced)
+#ifdef CONFIG_UNICON
+ vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size*2, GFP_KERNEL);
+#else
vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
+#endif
if (!vc->vc_screenbuf) {
kfree(vc);
vc_cons[currcons].d = NULL;
@@ -848,7 +932,11 @@ static int vc_do_resize(struct tty_struc
if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
return 0;
+#ifdef CONFIG_UNICON
+ newscreen = kmalloc(new_screen_size*2, GFP_USER);
+#else
newscreen = kmalloc(new_screen_size, GFP_USER);
+#endif
if (!newscreen)
return -ENOMEM;
@@ -903,15 +991,32 @@ static int vc_do_resize(struct tty_struc
while (old_origin < 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) {
+#ifdef CONFIG_UNICON
+ scr_memsetw((void *)(new_origin + rlth + new_screen_size),
+ (vc->vc_video_erase_char & 0xff), rrem);
+#else
scr_memsetw((void *)(new_origin + rlth),
vc->vc_video_erase_char, rrem);
+#endif
+ }
old_origin += old_row_size;
new_origin += new_row_size;
}
- if (new_scr_end > new_origin)
+ if (new_scr_end > new_origin) {
+#ifdef CONFIG_UNICON
+ scr_memsetw((void *)(new_origin + new_screen_size), (vc->vc_video_erase_char & 0xff),
+ new_scr_end - new_origin);
+#else
scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
new_scr_end - new_origin);
+#endif
+ }
if (vc->vc_kmalloced)
kfree(vc->vc_screenbuf);
vc->vc_screenbuf = newscreen;
@@ -1184,6 +1289,9 @@ static void csi_J(struct vc_data *vc, in
return;
}
scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw(start + (vc->vc_screenbuf_size>>1), (vc->vc_video_erase_char & 0xff), 2 * count);
+#endif
vc->vc_need_wrap = 0;
}
@@ -1218,6 +1326,9 @@ static void csi_K(struct vc_data *vc, in
return;
}
scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw(start + (vc->vc_screenbuf_size>>1), (vc->vc_video_erase_char & 0xff), 2 * count);
+#endif
vc->vc_need_wrap = 0;
}
@@ -1230,6 +1341,9 @@ static void csi_X(struct vc_data *vc, in
count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar;
scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count);
+#ifdef CONFIG_UNICON
+ scr_memsetw((unsigned short *)vc->vc_pos + (vc->vc_screenbuf_size>>1), (vc->vc_video_erase_char & 0xff), 2 * count);
+#endif
if (DO_UPDATE(vc))
vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count);
vc->vc_need_wrap = 0;
@@ -1842,7 +1956,13 @@ static void do_con_trol(struct tty_struc
if (vc->vc_ques) {
clear_selection();
if (vc->vc_par[0])
+#ifdef CONFIG_UNICON
+ // force the low byte to be zero
+
+ vc->vc_complement_mask = vc->vc_par[0] << 8;
+#else
vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1];
+#endif
else
vc->vc_complement_mask = vc->vc_s_complement_mask;
return;
@@ -2111,6 +2231,12 @@ static int do_con_write(struct tty_struc
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;
@@ -2125,6 +2251,12 @@ static int do_con_write(struct tty_struc
return 0;
}
+#ifdef CONFIG_UNICON
+ /* added by Arthur Ma, for multiple font support */
+ if (UniconFontManager != NULL)
+ doublebyte_default = UniconFontManager->getfont (vc->vc_num);
+#endif
+
currcons = vc->vc_num;
if (!vc_cons_allocated(currcons)) {
/* could this happen? */
@@ -2332,6 +2464,58 @@ rescan_last_byte:
((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
(vc_attr << 8) + tc,
(u16 *) vc->vc_pos);
+#ifdef CONFIG_UNICON
+#define HIGH_WORD ((u16 *) ((long)vc->vc_pos + vc->vc_screenbuf_size))
+#define HIGH_WORD_PREV ((u16 *) ((long)vc->vc_pos - 2 + vc->vc_screenbuf_size))
+#define HIGH_WORD_NEXT ((u16 *) ((long)vc->vc_pos + 2 + vc->vc_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 && vc->vc_translate == translations[0]
+ && (vc->vc_pos==vc->vc_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&& vc->vc_translate == translations
+ && 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*)(vc->vc_pos-2))&0xff),HIGH_WORD);
+ if (DO_UPDATE(vc) && draw_x < 0) {
+ draw_from = vc->vc_pos-2;
+ if (vc->vc_x>0) {
+ draw_x = vc->vc_x-1;
+ } else {
+ draw_to = vc->vc_pos;
+ draw_x = vc->vc_cols -1;
+ vc->vc_y--;
+ FLUSH
+ vc->vc_y++;
+ draw_x = 0;
+ draw_from = vc->vc_pos;
+ }
+ }
+ } else if(doublebyte_default) {
+ /* normal ASCII or table lines,
+ clean hight byte */
+ scr_writew(0,HIGH_WORD);
+ }
+#endif
if (DO_UPDATE(vc) && draw_x < 0) {
draw_x = vc->vc_x;
draw_from = vc->vc_pos;
@@ -2393,6 +2577,11 @@ static void console_callback(struct work
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(vc_cons[fg_console].d);
change_console(vc_cons[want_console].d);
/* we only changed when the console had already
@@ -2520,6 +2709,9 @@ static void vt_console_print(struct cons
continue;
}
scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
+#ifdef CONFIG_UNICON
+ scr_writew(0, (unsigned short *)vc->vc_pos + (vc->vc_screenbuf_size>>1));
+#endif
notify_write(vc, c);
cnt++;
if (myx == vc->vc_cols - 1) {
@@ -2909,7 +3101,11 @@ static int __init con_init(void)
vc_cons[currcons].d = vc = alloc_bootmem(sizeof(struct vc_data));
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
visual_init(vc, currcons, 1);
+#ifdef CONFIG_UNICON
+ vc->vc_screenbuf = (unsigned short *)alloc_bootmem(2 * vc->vc_screenbuf_size);
+#else
vc->vc_screenbuf = (unsigned short *)alloc_bootmem(vc->vc_screenbuf_size);
+#endif
vc->vc_kmalloced = 0;
vc_init(vc, vc->vc_rows, vc->vc_cols,
currcons || !vc->vc_sw->con_save_screen);
@@ -4077,6 +4273,12 @@ void putconsxy(struct vc_data *vc, unsig
set_cursor(vc);
}
+#ifdef CONFIG_UNICON
+/*
+ Now, the unicon doesn't support vcs!
+ To support it, first change the vc_screen.c!
+*/
+#endif
u16 vcs_scr_readw(struct vc_data *vc, const u16 *org)
{
if ((unsigned long)org == vc->vc_pos && softcursor_original != -1)
@@ -4097,6 +4299,18 @@ void vcs_scr_writew(struct vc_data *vc,
* 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 -urNp linux-2.6.27.ORIG/drivers/video/Kconfig linux-2.6.27.UNICON/drivers/video/Kconfig
--- linux-2.6.27.ORIG/drivers/video/Kconfig 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/video/Kconfig 2008-10-17 23:32:09.000000000 +0900
@@ -234,6 +234,17 @@ config FB_TILEBLITTING
comment "Frame buffer hardware drivers"
depends on FB
+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 -urNp linux-2.6.27.ORIG/drivers/video/Makefile linux-2.6.27.UNICON/drivers/video/Makefile
--- linux-2.6.27.ORIG/drivers/video/Makefile 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/video/Makefile 2008-10-17 23:32:09.000000000 +0900
@@ -15,6 +15,10 @@ obj-$(CONFIG_VT) += console/
obj-$(CONFIG_LOGO) += logo/
obj-y += backlight/ display/
+ifeq ($(CONFIG_UNICON),y)
+subdir-m += unicon
+endif
+
obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
diff -urNp linux-2.6.27.ORIG/drivers/video/console/bitblit.c linux-2.6.27.UNICON/drivers/video/console/bitblit.c
--- linux-2.6.27.ORIG/drivers/video/console/bitblit.c 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/video/console/bitblit.c 2008-10-17 23:32:09.000000000 +0900
@@ -17,7 +17,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.
*/
@@ -200,7 +203,205 @@ static void bit_putcs(struct vc_data *vc
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;
+ }
+
+ fb_pad_unaligned_buffer(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;
+ }
+
+ fb_pad_aligned_buffer(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)
{
@@ -244,6 +445,11 @@ static void bit_cursor(struct vc_data *v
int attribute, use_sw = (vc->vc_cursor_type & 0x10);
int err = 1;
char *src;
+#ifdef CONFIG_UNICON
+ int extendedchar = 0;
+ u_char * fontdata_save;
+ struct double_byte * doublebyte_default = NULL;
+#endif
cursor.set = 0;
@@ -256,7 +462,33 @@ static void bit_cursor(struct vc_data *v
y += softback_lines;
}
+#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));
@@ -386,6 +618,10 @@ static void bit_cursor(struct vc_data *v
soft_cursor(info, &cursor);
ops->cursor_reset = 0;
+#ifdef CONFIG_UNICON
+ if (doublebyte_default != NULL && extendedchar)
+ vc->vc_font.data = fontdata_save;
+#endif
}
static int bit_update_start(struct fb_info *info)
@@ -404,7 +640,11 @@ void fbcon_set_bitops(struct fbcon_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;
ops->update_start = bit_update_start;
diff -urNp linux-2.6.27.ORIG/drivers/video/console/fbcon.c linux-2.6.27.UNICON/drivers/video/console/fbcon.c
--- linux-2.6.27.ORIG/drivers/video/console/fbcon.c 2008-10-10 07:13:53.000000000 +0900
+++ linux-2.6.27.UNICON/drivers/video/console/fbcon.c 2008-10-17 23:32:09.000000000 +0900
@@ -103,7 +103,11 @@ enum {
FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */
};
+#ifdef CONFIG_UNICON
+struct display fb_display[MAX_NR_CONSOLES];
+#else
static struct display fb_display[MAX_NR_CONSOLES];
+#endif
static signed char con2fb_map[MAX_NR_CONSOLES];
static signed char con2fb_map_boot[MAX_NR_CONSOLES];
@@ -113,7 +117,11 @@ static int logo_lines;
enums. */
static int logo_shown = FBCON_LOGO_CANSHOW;
/* Software scrollback */
+#ifdef CONFIG_UNICON
+int fbcon_softback_size = 32768;
+#else
static int fbcon_softback_size = 32768;
+#endif
static unsigned long softback_buf, softback_curr;
static unsigned long softback_in;
static unsigned long softback_top, softback_end;
@@ -210,6 +218,11 @@ static void fbcon_start(void);
static void fbcon_exit(void);
static struct device *fbcon_device;
+#ifdef CONFIG_UNICON
+#include <linux/fb_doublebyte.h>
+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
@@ -992,7 +1005,11 @@ static const char *fbcon_startup(void)
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;
@@ -1330,11 +1347,17 @@ static void fbcon_putcs(struct vc_data *
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));
}
@@ -1344,7 +1367,11 @@ static void fbcon_putc(struct vc_data *v
unsigned short chr;
scr_writew(c, &chr);
+#ifdef CONFIG_UNICON
+ fbcon_putcs(vc, (unsigned short *)&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)
@@ -1595,6 +1622,9 @@ static __inline__ void ypan_down_redraw(
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;
@@ -1643,11 +1673,17 @@ static void fbcon_redraw_softback(struct
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) {
@@ -1657,7 +1693,11 @@ static void fbcon_redraw_softback(struct
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);
@@ -1774,6 +1814,9 @@ static void fbcon_redraw(struct vc_data
{
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--) {
@@ -1782,9 +1825,15 @@ static void fbcon_redraw(struct vc_data
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) {
@@ -1794,7 +1843,11 @@ static void fbcon_redraw(struct vc_data
start = s;
}
}
+#ifdef CONFIG_UNICON
+ if (c == scr_readw(d) && c_ext == scr_readw(hibyte_pos(vc,d))) {
+#else