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
|
diff --git a/configure.ac b/configure.ac
index 86c6ac5..725d6cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,49 +20,48 @@
#
# Process this file with autoconf to produce a configure script
-AC_PREREQ(2.57)
+# Initialize Autoconf
+AC_PREREQ([2.60])
AC_INIT([xf86-video-sisusb],
- 0.9.4,
+ [0.9.4],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
- xf86-video-sisusb)
-
+ [xf86-video-sisusb])
AC_CONFIG_SRCDIR([Makefile.am])
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR(.)
+# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
-
AM_MAINTAINER_MODE
-# Require xorg-macros: XORG_DEFAULT_OPTIONS
+# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.3)
+ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
-# Checks for programs.
+# Initialize libtool
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
-AC_PROG_CC
-XORG_PROG_RAWCPP
AH_TOP([#include "xorg-server.h"])
+# Define a configure option for an alternate module directory
AC_ARG_WITH(xorg-module-dir,
- AC_HELP_STRING([--with-xorg-module-dir=DIR],
+ AS_HELP_STRING([--with-xorg-module-dir=DIR],
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
-# Checks for extensions
+# Store the list of server defined optional extensions in REQUIRED_MODULES
XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto)
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
XORG_DRIVER_CHECK_EXT(XV, videoproto)
XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
-# Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
+# Obtain compiler/linker options for the driver dependencies
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto pciaccess $REQUIRED_MODULES])
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
HAVE_XEXTPROTO_71="no")
@@ -70,17 +69,14 @@ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
# Checks for libraries.
-# Checks for header files.
-AC_HEADER_STDC
-
-AC_SUBST([XORG_CFLAGS])
AC_SUBST([moduledir])
DRIVER_NAME=sisusb
AC_SUBST([DRIVER_NAME])
-AC_OUTPUT([
- Makefile
- src/Makefile
- man/Makefile
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ man/Makefile
])
+AC_OUTPUT
diff --git a/man/Makefile.am b/man/Makefile.am
index 1b26ac2..9ceb36f 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -31,39 +31,9 @@ EXTRA_DIST = @DRIVER_NAME@.man
CLEANFILES = $(driverman_DATA)
-SED = sed
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
- XORGMANNAME = X Version 11
-
-MANDEFS = \
- -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
- -D__appmansuffix__=$(APP_MAN_SUFFIX) \
- -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
- -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
- -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
- -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
- -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
- -D__xconfigfile__=xorg.conf \
- -D__xservername__=Xorg
-
-# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
-# to cpp, because that trick does not work on all ANSI C preprocessors.
-# Delete line numbers from the cpp output (-P is not portable, I guess).
-# Allow XCOMM to be preceded by whitespace and provide a means of generating
-# output lines with trailing backslashes.
-# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
-
-CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
- -e '/^\#line *[0-9][0-9]* *.*$$/d' \
- -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
- -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
- -e '/^[ ]*XHASH/s/XHASH/\#/' \
- -e '/\@\@$$/s/\@\@$$/\\/'
-
SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
.man.$(DRIVER_MAN_SUFFIX):
- $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/man/sisusb.man b/man/sisusb.man
index 7817cb5..6eafb8e 100644
--- a/man/sisusb.man
+++ b/man/sisusb.man
@@ -1,17 +1,5 @@
-.\" $XFree86$
-.\" $XdotOrg$
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
-#ifdef __xservername__
-#define __myservername__ __xservername__
-#else
-#define __myservername__ XFree86
-#endif
-#ifdef __xconfigfile__
-#define __myxconfigfile__ __xconfigfile__
-#else
-#define __myxconfigfile__ XF86Config
-#endif
.TH SISUSB __drivermansuffix__ __vendorversion__
.SH NAME
sisusb \- SiS USB video driver
@@ -25,7 +13,7 @@ sisusb \- SiS USB video driver
.fi
.SH DESCRIPTION
.B sisusb
-is an __myservername__ driver for SiS (Silicon Integrated Systems) video chips that
+is an __xservername__ driver for SiS (Silicon Integrated Systems) video chips that
are connected via a Net2280-based USB dongle. The driver is not accelerated, but
provides support for colordepths of 8, 16 and 24 bpp as well as Render and other
extensions.
@@ -39,7 +27,7 @@ driver supports USB video cards based on the following chipsets:
The SiS315E/PRO features two CRT controllers. However, in its USB version, only
the first output, referred to as "CRT1", is being used.
.SH CONFIGURATION DETAILS
-Please refer to __myxconfigfile__(__filemansuffix__) for general configuration
+Please refer to __xconfigfile__(__filemansuffix__) for general configuration
details and to sis(__drivermansuffix__) for more information. This manpage only
covers a subset of the supported options.
.PP
@@ -81,11 +69,7 @@ for device reconnection).
.SH "KNOWN BUGS"
none.
.SH "SEE ALSO"
-#ifdef __xservername__
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__), sis(__drivermansuffix__)
-#else
-XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), sis(__drivermansuffix__)
-#endif
.PP
.B "http://www.winischhofer.at/linuxsisvga.shtml"
for more information and updates
diff --git a/src/sisusb.h b/src/sisusb.h
index b9992ac..82ed509 100644
--- a/src/sisusb.h
+++ b/src/sisusb.h
@@ -113,6 +113,14 @@
#include <X11/extensions/Xv.h>
#endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+#define _swapl(x, n) swapl(x,n)
+#define _swaps(x, n) swaps(x,n)
+#else
+#define _swapl(x, n) swapl(x)
+#define _swaps(x, n) swaps(x)
+#endif
+
/* Platform/architecture related definitions: */
#undef SIS_PC_PLATFORM
@@ -141,7 +149,6 @@
#define UNLOCK_ALWAYS /* Always unlock the registers (should be set!) */
/* Need that for SiSCtrl */
-#define NEED_REPLIES /* ? */
#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h" /* required */
#include <X11/extensions/panoramiXproto.h> /* required */
@@ -732,7 +739,7 @@ typedef struct {
Bool skipswitchcheck;
ULong VBFlagsInit;
DisplayModePtr currentModeLast;
- IOADDRESS MyPIOOffset;
+ unsigned long MyPIOOffset;
char messagebuffer[64];
unsigned int VGAMapSize; /* SiSVGA stuff */
diff --git a/src/sisusb_dac.c b/src/sisusb_dac.c
index 5e3eb7f..b5c4dce 100644
--- a/src/sisusb_dac.c
+++ b/src/sisusb_dac.c
@@ -672,7 +672,7 @@ SiSUSBMemCopyToVideoRam(SISUSBPtr pSiSUSB, UChar *to, UChar *from, int size)
int num, retry = 3;
if(pSiSUSB->sisusbfatalerror) return;
do {
- lseek(pSiSUSB->sisusbdev, (int)to, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)to, SEEK_SET);
num = write(pSiSUSB->sisusbdev, from, size);
} while((num != size) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -958,7 +958,7 @@ void sisclearvram(SISUSBPtr pSiSUSB, UChar *where, unsigned int howmuch)
if(pSiSUSB->sisusbfatalerror) return;
do {
x.operation = SUCMD_CLRSCR;
- x.data3 = (CARD32)where;
+ x.data3 = (CARD32)(uintptr_t)where;
x.data0 = (howmuch >> 16) & 0xff;
x.data1 = (howmuch >> 8) & 0xff;
x.data2 = howmuch & 0xff;
@@ -990,7 +990,7 @@ void SIS_MMIO_OUT8(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD8 va
int num, retry = 3;
if(pSiSUSB->sisusbfatalerror) return;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = write(pSiSUSB->sisusbdev, &val, 1);
} while((num != 1) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -1002,7 +1002,7 @@ void SIS_MMIO_OUT16(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD16
CARD16 buf = sisusb_cpu_to_le16(val);
if(pSiSUSB->sisusbfatalerror) return;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = write(pSiSUSB->sisusbdev, &buf, 2);
} while((num != 2) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -1014,7 +1014,7 @@ void SIS_MMIO_OUT32(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset, CARD32
CARD32 buf = sisusb_cpu_to_le32(val);
if(pSiSUSB->sisusbfatalerror) return;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = write(pSiSUSB->sisusbdev, &buf, 4);
} while((num != 4) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -1026,7 +1026,7 @@ CARD8 SIS_MMIO_IN8(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
CARD8 tmp;
if(pSiSUSB->sisusbfatalerror) return 0;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = read(pSiSUSB->sisusbdev, &tmp, 1);
} while((num != 1) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -1039,7 +1039,7 @@ CARD16 SIS_MMIO_IN16(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
CARD16 tmp;
if(pSiSUSB->sisusbfatalerror) return 0;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = read(pSiSUSB->sisusbdev, &tmp, 2);
} while((num != 2) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
@@ -1052,7 +1052,7 @@ CARD32 SIS_MMIO_IN32(SISUSBPtr pSiSUSB, UChar *base, unsigned int offset)
CARD32 tmp;
if(pSiSUSB->sisusbfatalerror) return 0;
do {
- lseek(pSiSUSB->sisusbdev, (int)base + offset, SEEK_SET);
+ lseek(pSiSUSB->sisusbdev, (uintptr_t)base + offset, SEEK_SET);
num = read(pSiSUSB->sisusbdev, &tmp, 4);
} while((num != 4) && --retry);
if(!retry) SiSLostConnection(pSiSUSB);
diff --git a/src/sisusb_driver.c b/src/sisusb_driver.c
index 8ba2c33..032225c 100644
--- a/src/sisusb_driver.c
+++ b/src/sisusb_driver.c
@@ -186,12 +186,12 @@ SISUSBFreeRec(ScrnInfoPtr pScrn)
/* Just to make sure... */
if(!pSiSUSB) return;
- if(pSiSUSB->pstate) xfree(pSiSUSB->pstate);
+ if(pSiSUSB->pstate) free(pSiSUSB->pstate);
pSiSUSB->pstate = NULL;
- if(pSiSUSB->fonts) xfree(pSiSUSB->fonts);
+ if(pSiSUSB->fonts) free(pSiSUSB->fonts);
pSiSUSB->fonts = NULL;
- if(pSiSUSB->SiS_Pr) xfree(pSiSUSB->SiS_Pr);
+ if(pSiSUSB->SiS_Pr) free(pSiSUSB->SiS_Pr);
pSiSUSB->SiS_Pr = NULL;
if(pSiSUSB->sisusbdevopen) {
@@ -200,12 +200,12 @@ SISUSBFreeRec(ScrnInfoPtr pScrn)
}
if(pScrn->chipset) {
- xfree(pScrn->chipset);
+ free(pScrn->chipset);
pScrn->chipset = NULL;
}
if(pScrn->driverPrivate) {
- xfree(pScrn->driverPrivate);
+ free(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
}
}
@@ -217,14 +217,14 @@ SISUSBErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
static const char *str = "**************************************************\n";
va_start(ap, format);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
" ERROR:\n");
xf86VDrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, format, ap);
va_end(ap);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
" END OF MESSAGE\n");
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
}
static int
@@ -248,7 +248,7 @@ SiSUSBCheckForUSBDongle(char *filename, SISUSBPtr pSiSUSB, int *filehandle)
if((myfile = open(filename, O_RDWR, 0)) != -1) {
if(!ioctl(myfile, SISUSB_GET_CONFIG_SIZE, &sisusbinfosize)) {
- if((mysisusbinfo = xalloc(sisusbinfosize))) {
+ if((mysisusbinfo = malloc(sisusbinfosize))) {
if(!ioctl(myfile, (SISUSB_GET_CONFIG | (sisusbinfosize << 16)), mysisusbinfo)) {
if(mysisusbinfo->sisusb_id == SISUSB_ID) {
sisusbversion = (mysisusbinfo->sisusb_version << 16) |
@@ -280,7 +280,7 @@ SiSUSBCheckForUSBDongle(char *filename, SISUSBPtr pSiSUSB, int *filehandle)
retval = mysisusbinfo->sisusb_minor;
}
}
- xfree(mysisusbinfo);
+ free(mysisusbinfo);
mysisusbinfo = NULL;
}
}
@@ -307,13 +307,13 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
}
if((p) && (*p) && (*p == '/')) {
gotdev = 1;
- *nameptr = xalloc(strlen(p) + 1);
+ *nameptr = malloc(strlen(p) + 1);
strcpy(*nameptr, p);
retval = SiSUSBCheckForUSBDongle(*nameptr, NULL, NULL);
} else if((p) && (*p) && (sscanf(p, "%d", &i) == 1)) {
if(i >= 0 && i <= 31) {
gotdev = 1;
- *nameptr = xalloc(32);
+ *nameptr = malloc(32);
sprintf(*nameptr, "/dev/sisusbvga%d", i);
retval = SiSUSBCheckForUSBDongle(*nameptr, NULL, NULL);
if(retval < 0) {
@@ -324,7 +324,7 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
}
}
if(!gotdev) {
- *nameptr = xalloc(32);
+ *nameptr = malloc(32);
for(i = 0; i < 64; i++) {
if(i < 32) sprintf(*nameptr, "/dev/sisusbvga%d", i);
else sprintf(*nameptr, "/dev/usb/sisusbvga%d", i);
@@ -338,7 +338,7 @@ SiSUSBFindUSBDongle(GDevPtr dev, int *minorArray, int numDevSections, char **nam
if(retval >= 0) {
xf86Msg(X_INFO, "Found SiSUSB dongle (node %s, minor %d)\n", *nameptr, retval);
} else if((*nameptr)) {
- xfree(*nameptr);
+ free(*nameptr);
*nameptr = NULL;
}
@@ -401,14 +401,14 @@ SISUSBProbe(DriverPtr drv, int flags)
*/
/* Allocate and initialize an array of ints for storing the minors */
- if(!(minorArray = (int *)xalloc(numDevSections * sizeof(int)))) {
+ if(!(minorArray = (int *)malloc(numDevSections * sizeof(int)))) {
return FALSE;
}
for(i = 0; i < numDevSections; i++) minorArray[i] = -1;
/* Allocate an array of char ptrs for storing the device node names */
- if(!(devnameArray = (char **)xalloc(numDevSections * sizeof(char *)))) {
- xfree(minorArray);
+ if(!(devnameArray = (char **)malloc(numDevSections * sizeof(char *)))) {
+ free(minorArray);
return FALSE;
}
@@ -420,20 +420,20 @@ SISUSBProbe(DriverPtr drv, int flags)
if((myminor = SiSUSBFindUSBDongle(devSections[i], minorArray, numDevSections, &nameptr)) >= 0) {
if(!SiSUSBFindDuplicate(myminor, minorArray, numDevSections)) {
minorArray[numUsed] = myminor;
- devnameArray[numUsed] = xalloc(strlen(nameptr) + 1);
+ devnameArray[numUsed] = malloc(strlen(nameptr) + 1);
strcpy(devnameArray[numUsed], nameptr);
numUsed++;
}
- xfree(nameptr);
+ free(nameptr);
}
}
/* Free the minor array, we don't need it anymore */
- xfree(minorArray);
+ free(minorArray);
if(numUsed <= 0) {
- xfree(devSections);
- xfree(devnameArray);
+ free(devSections);
+ free(devnameArray);
return FALSE;
}
@@ -470,8 +470,8 @@ SISUSBProbe(DriverPtr drv, int flags)
}
- xfree(devSections);
- xfree(devnameArray);
+ free(devSections);
+ free(devnameArray);
return foundScreen;
}
@@ -622,10 +622,10 @@ SISUSBCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
if(!(nramp = xf86GetGammaRampSize(pScreen))) return;
for(i=0; i<3; i++) {
- ramp[i] = (UShort *)xalloc(nramp * sizeof(UShort));
+ ramp[i] = (UShort *)malloc(nramp * sizeof(UShort));
if(!ramp[i]) {
- if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
- if(ramp[1]) { xfree(ramp[1]); ramp[1] = NULL; }
+ if(ramp[0]) { free(ramp[0]); ramp[0] = NULL; }
+ if(ramp[1]) { free(ramp[1]); ramp[1] = NULL; }
return;
}
}
@@ -685,9 +685,9 @@ SISUSBCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
xf86ChangeGammaRamp(pScreen, nramp, ramp[0], ramp[1], ramp[2]);
- xfree(ramp[0]);
- xfree(ramp[1]);
- xfree(ramp[2]);
+ free(ramp[0]);
+ free(ramp[1]);
+ free(ramp[2]);
ramp[0] = ramp[1] = ramp[2] = NULL;
}
#endif
@@ -906,11 +906,11 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
Bool gotit = FALSE;
if(!ioctl(fd, SISUSBFB_GET_INFO_SIZE, &sisfbinfosize)) {
- if((mysisfbinfo = xalloc(sisfbinfosize))) {
+ if((mysisfbinfo = malloc(sisfbinfosize))) {
if(!ioctl(fd, (SISUSBFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) {
gotit = TRUE;
} else {
- xfree(mysisfbinfo);
+ free(mysisfbinfo);
mysisfbinfo = NULL;
}
}
@@ -944,7 +944,7 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- xfree(mysisfbinfo);
+ free(mysisfbinfo);
mysisfbinfo = NULL;
}
close (fd);
@@ -1147,7 +1147,7 @@ SISUSBPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiSUSB->HWCursor) {
- if(!(pSiSUSB->USBCursorBuf = xcalloc(pSiSUSB->CursorSize * 4, 1))) pSiSUSB->HWCursor = FALSE;
+ if(!(pSiSUSB->USBCursorBuf = calloc(pSiSUSB->CursorSize * 4, 1))) pSiSUSB->HWCursor = FALSE;
pSiSUSB->availMem -= (pSiSUSB->CursorSize * 2);
if(pSiSUSB->OptUseColorCursor) pSiSUSB->availMem -= (pSiSUSB->CursorSize * 2);
@@ -1456,8 +1456,8 @@ SISUSBMapMem(ScrnInfoPtr pScrn)
{
SISUSBPtr pSiSUSB = SISUSBPTR(pScrn);
- pSiSUSB->FbBase = (UChar *)pSiSUSB->FbAddress;
- pSiSUSB->IOBase = (UChar *)pSiSUSB->IOAddress;
+ pSiSUSB->FbBase = (UChar *)(uintptr_t)pSiSUSB->FbAddress;
+ pSiSUSB->IOBase = (UChar *)(uintptr_t)pSiSUSB->IOAddress;
return TRUE;
}
@@ -1811,7 +1811,7 @@ SISUSBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if(pSiSUSB->ShadowFB) {
pSiSUSB->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * displayWidth);
- pSiSUSB->ShadowPtr = xalloc(pSiSUSB->ShadowPitch * height);
+ pSiSUSB->ShadowPtr = malloc(pSiSUSB->ShadowPitch * height);
if(!(FBStart = pSiSUSB->ShadowPtr)) {
SISUSBSaveScreen(pScreen, SCREEN_SAVER_OFF);
SISUSBErrorLog(pScrn, "Failed to allocate shadow framebuffer\n");
@@ -1820,7 +1820,7 @@ SISUSBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#if X_BYTE_ORDER == X_BIG_ENDIAN
if(pScrn->bitsPerPixel == 16) {
/* For 16bpp, we need to swap the bytes in the framebuffer */
- if(!(pSiSUSB->ShadowPtrSwap = xalloc(pSiSUSB->ShadowPitch * height))) {
+ if(!(pSiSUSB->ShadowPtrSwap = malloc(pSiSUSB->ShadowPitch * height))) {
SISUSBSaveScreen(pScreen, SCREEN_SAVER_OFF);
SISUSBErrorLog(pScrn, "Failed to allocate swap buffer for shadow framebuffer\n");
return FALSE;
@@ -2238,24 +2238,24 @@ SISUSBCloseScreen(int scrnIndex, ScreenPtr pScreen)
}
if(pSiSUSB->USBCursorBuf) {
- xfree(pSiSUSB->USBCursorBuf);
+ free(pSiSUSB->USBCursorBuf);
pSiSUSB->USBCursorBuf = NULL;
}
if(pSiSUSB->ShadowPtr) {
- xfree(pSiSUSB->ShadowPtr);
+ free(pSiSUSB->ShadowPtr);
pSiSUSB->ShadowPtr = NULL;
}
#if 0
if(pSiSUSB->PreAllocMem) {
- xfree(pSiSUSB->PreAllocMem);
+ free(pSiSUSB->PreAllocMem);
pSiSUSB->PreAllocMem = NULL;
}
#endif
if(pSiSUSB->adaptor) {
- xfree(pSiSUSB->adaptor);
+ free(pSiSUSB->adaptor);
pSiSUSB->adaptor = NULL;
pSiSUSB->ResetXv = pSiSUSB->ResetXvGamma = NULL;
}
diff --git a/src/sisusb_init.c b/src/sisusb_init.c
index ba44431..99ec519 100644
--- a/src/sisusb_init.c
+++ b/src/sisusb_init.c
@@ -1301,10 +1301,10 @@ SiSUSBBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN i
}
}
- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
+ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
memset(new, 0, sizeof(DisplayModeRec));
- if(!(new->name = xalloc(10))) {
- xfree(new);
+ if(!(new->name = malloc(10))) {
+ free(new);
return first;
}
if(!first) first = new;
diff --git a/src/sisusb_opt.c b/src/sisusb_opt.c
index d4612b0..4d5cfa3 100644
--- a/src/sisusb_opt.c
+++ b/src/sisusb_opt.c
@@ -228,7 +228,7 @@ SiSUSBOptions(ScrnInfoPtr pScrn)
xf86CollectOptions(pScrn, NULL);
/* Process the options */
- if(!(pSiSUSB->Options = xalloc(sizeof(SISUSBOptions)))) return;
+ if(!(pSiSUSB->Options = malloc(sizeof(SISUSBOptions)))) return;
memcpy(pSiSUSB->Options, SISUSBOptions, sizeof(SISUSBOptions));
diff --git a/src/sisusb_osdef.h b/src/sisusb_osdef.h
index 2d938ad..500bffb 100644
--- a/src/sisusb_osdef.h
+++ b/src/sisusb_osdef.h
@@ -77,11 +77,11 @@
#define SIS315H
-#define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v))
-#define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v))
-#define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v))
-#define InPortByte(p) inSISREG((IOADDRESS)(p))
-#define InPortWord(p) inSISREGW((IOADDRESS)(p))
-#define InPortLong(p) inSISREGL((IOADDRESS)(p))
+#define OutPortByte(p,v) outSISREG((unsigned long)(p),(CARD8)(v))
+#define OutPortWord(p,v) outSISREGW((unsigned long)(p),(CARD16)(v))
+#define OutPortLong(p,v) outSISREGL((unsigned long)(p),(CARD32)(v))
+#define InPortByte(p) inSISREG((unsigned long)(p))
+#define InPortWord(p) inSISREGW((unsigned long)(p))
+#define InPortLong(p) inSISREGL((unsigned long)(p))
#endif /* _SISUSB_OSDEF_H_ */
diff --git a/src/sisusb_types.h b/src/sisusb_types.h
index 04c7a7a..9fc6b41 100644
--- a/src/sisusb_types.h
+++ b/src/sisusb_types.h
@@ -51,6 +51,8 @@
#ifndef _VGATYPES_
#define _VGATYPES_
+#include <xf86Pci.h>
+
#ifndef FALSE
#define FALSE 0
#endif
@@ -93,7 +95,7 @@ typedef unsigned char BOOLEAN;
#define SISIOMEMTYPE
-typedef IOADDRESS SISIOADDRESS;
+typedef unsigned long SISIOADDRESS;
typedef enum _SIS_CHIP_TYPE {
SIS_VGALegacy = 0,
diff --git a/src/sisusb_utility.c b/src/sisusb_utility.c
index 8c03d63..a9c1ee1 100644
--- a/src/sisusb_utility.c
+++ b/src/sisusb_utility.c
@@ -34,8 +34,6 @@
#endif
#include "sisusb.h"
-#define NEED_REPLIES
-#define NEED_EVENTS
#include <X11/X.h>
#include "dixstruct.h"
@@ -789,10 +787,10 @@ SiSUSBProcSiSCtrlQueryVersion(ClientPtr client)
rep.majorVersion = SISCTRL_MAJOR_VERSION;
rep.minorVersion = SISCTRL_MINOR_VERSION;
if(client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
+ _swaps(&rep.sequenceNumber, n);
+ _swapl(&rep.length, n);
+ _swaps(&rep.majorVersion, n);
+ _swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xSiSCtrlQueryVersionReply), (char *)&rep);
return (client->noClientException);
@@ -834,15 +832,15 @@ SiSUSBProcSiSCtrlCommand(ClientPtr client)
rep.sequenceNumber = client->sequence;
if(client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.screen, n);
- swapl(&rep.sdc_id, n);
- swapl(&rep.sdc_command, n);
- swapl(&rep.sdc_result_header, n);
+ _swaps(&rep.sequenceNumber, n);
+ _swapl(&rep.length, n);
+ _swapl(&rep.screen, n);
+ _swapl(&rep.sdc_id, n);
+ _swapl(&rep.sdc_command, n);
+ _swapl(&rep.sdc_result_header, n);
for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
- swapl(&rep.sdc_parm[i], n);
- swapl(&rep.sdc_result[i], n);
+ _swapl(&rep.sdc_parm[i], n);
+ _swapl(&rep.sdc_result[i], n);
}
}
WriteToClient(client, sizeof(xSiSCtrlCommandReply), (char *)&rep);
@@ -869,7 +867,7 @@ SiSUSBSProcSiSCtrlQueryVersion(ClientPtr client)
{
REQUEST(xSiSCtrlQueryVersionReq);
register int n;
- swaps(&stuff->length, n);
+ _swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSiSCtrlQueryVersionReq);
return SiSUSBProcSiSCtrlQueryVersion(client);
}
@@ -880,14 +878,14 @@ SiSUSBSProcSiSCtrlCommand(ClientPtr client)
REQUEST(xSiSCtrlCommandReq);
register int n;
int i;
- swaps(&stuff->length, n);
- swapl(&stuff->screen, n);
- swapl(&stuff->sdc_id, n);
- swapl(&stuff->sdc_command, n);
- swapl(&stuff->sdc_result_header, n);
+ _swaps(&stuff->length, n);
+ _swapl(&stuff->screen, n);
+ _swapl(&stuff->sdc_id, n);
+ _swapl(&stuff->sdc_command, n);
+ _swapl(&stuff->sdc_result_header, n);
for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
- swapl(&stuff->sdc_parm[i], n);
- swapl(&stuff->sdc_result[i], n);
+ _swapl(&stuff->sdc_parm[i], n);
+ _swapl(&stuff->sdc_result[i], n);
}
REQUEST_SIZE_MATCH(xSiSCtrlCommandReq);
return SiSUSBProcSiSCtrlCommand(client);
@@ -911,7 +909,7 @@ SiSUSBCtrlResetProc(ExtensionEntry* extEntry)
{
/* Called by CloseDownExtensions() */
if(extEntry->extPrivate) {
- xfree(extEntry->extPrivate);
+ free(extEntry->extPrivate);
extEntry->extPrivate = NULL;
}
}
@@ -928,7 +926,7 @@ SiSUSBCtrlExtInit(ScrnInfoPtr pScrn)
if(!(myext = CheckExtension(SISCTRL_PROTOCOL_NAME))) {
- if(!(myctrl = xcalloc(sizeof(xSiSCtrlScreenTable), 1)))
+ if(!(myctrl = calloc(sizeof(xSiSCtrlScreenTable), 1)))
return;
if(!(myext = AddExtension(SISCTRL_PROTOCOL_NAME, 0, 0,
@@ -938,7 +936,7 @@ SiSUSBCtrlExtInit(ScrnInfoPtr pScrn)
StandardMinorOpcode))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to add SISCTRL extension\n");
- xfree(myctrl);
+ free(myctrl);
return;
}
diff --git a/src/sisusb_video.c b/src/sisusb_video.c
index bc469b0..1dbf4f1 100644
--- a/src/sisusb_video.c
+++ b/src/sisusb_video.c
@@ -216,7 +216,7 @@ void SISUSBInitVideo(ScreenPtr pScreen)
if(newAdaptor) size++;
- newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*));
+ newAdaptors = malloc(size * sizeof(XF86VideoAdaptorPtr*));
if(newAdaptors) {
if(num_adaptors) {
memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
@@ -234,7 +234,7 @@ void SISUSBInitVideo(ScreenPtr pScreen)
}
if(newAdaptors) {
- xfree(newAdaptors);
+ free(newAdaptors);
}
}
@@ -377,7 +377,7 @@ SISUSBSetupImageVideo(ScreenPtr pScreen)
XF86VideoAdaptorPtr adapt;
SISUSBPortPrivPtr pPriv;
- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
sizeof(SISUSBPortPrivRec) +
sizeof(DevUnion))))
return NULL;
|