3 # This is a shell archive. Save it in a file, remove anything before
4 # this line, and then unpack it by entering "sh file". Note, it may
5 # create directories; files and directories will be owned by you and
6 # have default permissions.
7 # Made on Sun Jun 25 20:24:59 CEST 2006 by Martin Bochnig at martux.org
9 # This archive contains:
14 # ./aperture/Makefile.amd64
15 # ./aperture/Makefile.sparcv9
17 # ./aperture/aperture.c
18 # ./aperture/aperture.conf
19 # ./aperture/devlink.tab
22 mkdir
-p .
/aperture
> /dev
/null
2>&1
24 echo x
- .
/aperture
/Makefile
25 sed 's/^X//' >.
/aperture
/Makefile
<< 'END-of-./aperture/Makefile'
27 X
# File: makefile for aperture Framebuffer Driver
28 X
# Author: Doug Anson (danson@lgc.com)
30 X
# Modified: David Holland (davidh@use.com)
32 X
# - Changed name, and debugging structure
33 X
# Modified: Marc Aurele La France (tsi@xfree86.org)
35 X
# - SPARC support, cleanup and turf aptest.
37 X
# >>NOTE<< Have a look at Makefile.sparcv9 for specifics.
39 X
# Modified: Martin Bochnig (martin@martux.org)
41 X
# - Slightly modified to also build on Solaris 10 and 11.
42 X
# - amd64 64 bit kernel support
43 X
# - cosmetical changes to also support sun4v, not only sun4u
45 X
# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics.
49 XCFLGS
=-fno-builtin -Wall -O3
53 X
#CC=/opt/SUNWspro/bin/cc
54 X
#CFLGS=-Xa -xnolib -xO3
57 X
# Debug error reporting
59 X
#DEBUG_FLG=-DAPERTURE_DEBUG
62 X
# Files and object declarations
63 XKERNEL_FLGS
=-D_KERNEL -DSUNDDI
64 XCFLAGS
= $
(CFLGS
) $
(KERNEL_FLGS
) $
(DEBUG_FLG
)
74 X @
if [ -f "Makefile.`isainfo -k`" ]; then \
75 X
make -f Makefile.
`isainfo -k` $
(DRIVER
); \
78 X ld
-r -o $
(DRIVER
) $
(OBJS
); \
82 X @
if [ -f "Makefile.`isainfo -k`" ]; then \
83 X
make -f Makefile.
`isainfo -k` install; \
85 X
cp aperture.conf
/kernel
/drv
; \
86 X
cp $
(DRIVER
) /kernel
/drv
; \
90 X @
if [ -f "Makefile.`isainfo -k`" ]; then \
91 X
make -f Makefile.
`isainfo -k` add_drv
; \
97 X
rm -f *% *.BAK $
(OBJS
) $
(DRIVER
) core
102 X $
(CC
) -E $
(CFLAGS
) $
*.c
> $@
105 X @
if [ -f "Makefile.`isainfo -k`" ]; then \
106 X
make -f Makefile.
`isainfo -k` $@
; \
109 X $
(CC
) -c $
(CFLAGS
) $
*.c
-o $@
; \
111 END-of-.
/aperture
/Makefile
112 echo x
- .
/aperture
/Makefile.amd64
113 sed 's/^X//' >.
/aperture
/Makefile.amd64
<< 'END-of-./aperture/Makefile.amd64'
115 X
# File: Makefile for aperture Framebuffer Driver
116 X
# Author: Doug Anson (danson@lgc.com)
118 X
# Modified: David Holland (davidh@use.com)
120 X
# - Changed name, and debugging structure
121 X
# Modified: Marc Aurele La France (tsi@xfree86.org)
123 X
# - SPARC support, cleanup and turf aptest.
124 X
# Modified: Martin Bochnig (martin@martux.org)
125 X
# - amd64 64 bit kernel support, cosmetics and also
126 X
# supporting sun4v (and arbitrary sparcv9) platforms
127 X
# as well as SunOS 5.10 or higher now
132 X
# GNU gcc compiler, version 3.2 or later
135 XCFLGS
=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel
138 X
# SUNWspro compiler (untested, might not properly work for amd64 here)
139 X
#CC=/opt/SUNWspro/bin/cc
140 X
#CFLGS=-Xa -xarch=v9 -xnolib -xO3
143 X
# Debug error reporting
145 X
#DEBUG_FLG=-DAPERTURE_DEBUG
148 X
# Files and object declarations
149 XKERNEL_FLGS
=-D_KERNEL -DSUNDDI
150 XCFLAGS
= $
(CFLGS
) $
(KERNEL_FLGS
) $
(DEBUG_FLG
)
161 X ld
-r -o $
(DRIVER
) $
(OBJS
)
164 X
cp aperture.conf
/kernel
/drv
165 X
cp $
(DRIVER
) /kernel
/drv
/amd64
171 X
rm -f *% *.BAK $
(OBJS
) $
(DRIVER
) core
176 X $
(CC
) -E $
(CFLAGS
) $
*.c
> $@
177 END-of-.
/aperture
/Makefile.amd64
178 echo x
- .
/aperture
/Makefile.sparcv9
179 sed 's/^X//' >.
/aperture
/Makefile.sparcv9
<< 'END-of-./aperture/Makefile.sparcv9'
181 X
# File: makefile for aperture Framebuffer Driver
182 X
# Author: Doug Anson (danson@lgc.com)
184 X
# Modified: David Holland (davidh@use.com)
186 X
# - Changed name, and debugging structure
187 X
# Modified: Marc Aurele La France (tsi@xfree86.org)
189 X
# - SPARC support, cleanup and turf aptest.
190 X
# Modified: Martin Bochnig (martin@martux.org)
192 X
# - Changed name for generic sparcv9 support
193 X
# - updated to better work with Solaris 10 and 11
197 X
# GNU gcc compiler, version 3.2 or later
200 XCFLGS
=-fno-builtin -Wall -O3 -m64
204 X
#CC=/opt/SUNWspro/bin/cc
205 X
#CFLGS=-Xa -xarch=v9 -xnolib -xO3
208 X
# Debug error reporting
210 X
#DEBUG_FLG=-DAPERTURE_DEBUG
213 X
# Files and object declarations
214 XKERNEL_FLGS
=-D_KERNEL -DSUNDDI
215 XCFLAGS
= $
(CFLGS
) $
(KERNEL_FLGS
) $
(DEBUG_FLG
)
226 X ld
-r -o $
(DRIVER
) $
(OBJS
)
229 X
cp aperture.conf
/kernel
/drv
230 X
cp $
(DRIVER
) /kernel
/drv
/sparcv9
236 X
rm -f *% *.BAK $
(OBJS
) $
(DRIVER
) core
241 X $
(CC
) -E $
(CFLAGS
) $
*.c
> $@
242 END-of-.
/aperture
/Makefile.sparcv9
243 echo x
- .
/aperture
/README
244 sed 's/^X//' >.
/aperture
/README
<< 'END-of-./aperture/README'
245 XFramebuffer aperture driver.
247 XThis driver was written to provide a device that
, unlike
/dev
/mem
, allows
248 Xmmap
()'ing of ranges beyond installed memory.
250 XThe original x86-based version of this driver was the collaborative work of
251 XDoug Anson (danson@lgc.com), and David Holland (davidh@use.com). It has since
252 Xbeen rewritten to also work on sparc machines and - later on - also on sparcv9
253 Xand recently amd64 64 bit kernels.
254 XIt flawlessly compiles and installs on Solaris 10 and 11 now.
257 XInstallation instructions:
259 X1) Check the Makefile, for appropriate CC, and CFLAGS definitions. Compiling
260 X with APERTURE_DEBUG defined means the driver will generate reams of
261 X debugging output. You'll probably want to leave this off...
263 X2
) Type
'make' (or
'gmake'). Both the driver and
test program should compile
264 X without any problems. No warning messages should be generated.
268 X4
) Type
'make install' and
'make add_drv'. The screen should
look something
272 X
cp aperture aperture.conf
/kernel
/drv
276 X On a sparcv9 machine this will mention the
/kernel
/drv
/sparcv9 directory
277 X instead of
/kernel
/drv. Similarily
/kernel
/drv
/amd64 should be used on amd64.
279 X This installs the driver to the system.
281 X5
) While as root modify the
file /etc
/devlink.tab
, adding these lines
:
283 X
# The following entry is for the framebuffer driver
284 Xtype
=ddi_pseudo
;name
=aperture fbs
/\M0
286 X Add that line exactly as shown. You may also simply add the
287 X contents of the devlink.tab
file supplied to
/etc
/devlink.tab.
288 X It contains the lines as well.
(Yes
, that is a tab between
289 X aperture and fbs
, not spaces
- very important
)
291 X6
) Perform a reconfiguration boot of the system.
293 X
# touch /reconfigure
296 XBug reports
, questions
, suggestions
, etc can be sent to xfree86@xfree86.org.
297 END-of-.
/aperture
/README
298 echo x
- .
/aperture
/aperture.c
299 sed 's/^X//' >.
/aperture
/aperture.c
<< 'END-of-./aperture/aperture.c'
301 X
* Copyright
(C
) 2001 The XFree86 Project
, Inc. All Rights Reserved.
303 X
* Permission is hereby granted
, free of charge
, to any person obtaining a copy
304 X
* of this software and associated documentation files
(the
"Software"), to
305 X
* deal
in the Software without restriction
, including without limitation the
306 X
* rights to use
, copy
, modify
, merge
, publish
, distribute
, sublicense
, and
/or
307 X
* sell copies of the Software
, and to permit persons to whom the Software is
308 X
* furnished to
do so
, subject to the following conditions
:
310 X
* The above copyright notice and this permission notice shall be included
in
311 X
* all copies or substantial portions of the Software.
313 X
* THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND
, EXPRESS OR
314 X
* IMPLIED
, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
,
315 X
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
316 X
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM
, DAMAGES OR OTHER LIABILITY
, WHETHER
317 X
* IN AN ACTION OF CONTRACT
, TORT OR OTHERWISE
, ARISING FROM
, OUT OF OR IN
318 X
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
320 X
* Except as contained
in this notice
, the name of the XFree86 Project shall
321 X
* not be used
in advertising or otherwise to promote the sale
, use or other
322 X
* dealings
in this Software without prior written authorization from the
327 X
* Aperture driver
for Solaris.
331 X
* Modified
: Martin Bochnig
(martin@martux.org
)
332 X
* Log
: Commented out obsolete kernel interfaces DDI_IDENTIFIED and DDI_NOT_IDENTIFIED
333 X
* not supported by SunOS
5.10 or higher anymore
,
334 X
* see http
://docs.sun.com
/app
/docs
/doc
/819-2255/6n4ibnffr?a
=view
337 X
#include <sys/conf.h>
338 X
#include <sys/ddi.h>
339 X
#include <sys/modctl.h>
340 X
#include <sys/open.h>
341 X
#include <sys/stat.h>
342 X
#include <sys/sunddi.h>
344 X
#define DEV_IDENT "aperture"
345 X
#define DEV_BANNER "XFree86 aperture driver"
352 X
#define NULL ((void *)0)
378 X
#ifdef APERTURE_DEBUG
380 X cmn_err
(CE_CONT
, DEV_IDENT
": entering open()\n");
384 X
if ((typ
!= OTYP_CHR
) ||
(getminor
(*devp
)))
389 X
#ifdef APERTURE_DEBUG
391 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving open() = %d\n", error
);
420 X
#ifdef APERTURE_DEBUG
422 X cmn_err
(CE_CONT
, DEV_IDENT
": entering mmap(0x%016lx)\n", off
);
426 X pf
= btop
((unsigned long
)off
);
428 X
/* Deal with mmap
(9E
) interface limits
*/
430 X
if ((error
< 0) ||
(pf
!= (pfn_t
)error
))
433 X
#ifdef APERTURE_DEBUG
435 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving mmap() = 0x%08lx", error
);
442 Xstatic struct cb_ops aperture_cb_ops
=
444 X aperture_open
, /* open
*/
445 X nulldev
, /* close
*/
446 X nodev
, /* strategy
*/
452 X nodev
, /* devmap
*/
453 X aperture_mmap
, /* mmap
*/
454 X ddi_segmap
, /* segmap
*/
455 X nochpoll
, /* poll
*/
456 X ddi_prop_op
, /* cb_prop_op
*/
458 X D_NEW | D_MP | D_64BIT
/* Driver compatibility flag
*/
462 Xstatic dev_info_t
*aperture_dip
; /* private copy of devinfo pointer
*/
473 X ddi_info_cmd_t infocmd
,
480 X ddi_info_cmd_t infocmd
;
487 X
#ifdef APERTURE_DEBUG
489 X cmn_err
(CE_CONT
, DEV_IDENT
": entering getinfo()\n");
494 X
case DDI_INFO_DEVT2DEVINFO
:
495 X
*result
= aperture_dip
;
496 X error
= DDI_SUCCESS
;
498 X
case DDI_INFO_DEVT2INSTANCE
:
500 X error
= DDI_SUCCESS
;
503 X error
= DDI_FAILURE
;
506 X
#ifdef APERTURE_DEBUG
508 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving getinfo() = %d\n", error
);
532 X
#ifdef APERTURE_DEBUG
534 X cmn_err
(CE_CONT
, DEV_IDENT
": entering identify()\n");
538 X
if (strcmp
(ddi_get_name
(dip
), DEV_IDENT
))
539 X error
= 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS
5.10 */ ;
541 X error
= 2 /* DDI_IDENTIFIED obsolete since SunOS
5.10 */ ;
543 X
#ifdef APERTURE_DEBUG
545 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving identify() = %d\n", error
);
561 X ddi_attach_cmd_t cmd
566 X ddi_attach_cmd_t cmd
;
571 X
#ifdef APERTURE_DEBUG
573 X cmn_err
(CE_CONT
, DEV_IDENT
": entering attach()\n");
577 X
if (cmd
!= DDI_ATTACH
)
580 X
#ifdef APERTURE_DEBUG
582 X cmn_err
(CE_CONT
, DEV_IDENT
": not attach(, DDI_ATTACH)\n");
586 X error
= DDI_FAILURE
;
590 X error
= ddi_create_minor_node
(dip
, ddi_get_name
(dip
), S_IFCHR
,
591 X
(minor_t
)ddi_get_instance
(dip
),
592 X NULL
, 0 /* NODESPECIFIC_DEV obsolete since SunOS
5.10 */ );
594 X
if (error
== DDI_SUCCESS
)
596 X aperture_dip
= dip
;
597 X ddi_report_dev
(dip
);
601 X
#ifdef APERTURE_DEBUG
603 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving attach() = %d\n", error
);
618 X ddi_detach_cmd_t cmd
623 X ddi_detach_cmd_t cmd
;
628 X
#ifdef APERTURE_DEBUG
630 X cmn_err
(CE_CONT
, DEV_IDENT
": entering detach()\n");
634 X
if (cmd
!= DDI_DETACH
)
636 X error
= DDI_FAILURE
;
640 X ddi_remove_minor_node
(dip
, NULL
);
641 X aperture_dip
= NULL
;
642 X error
= DDI_SUCCESS
;
647 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving detach() = %d\n", error
);
655 Xstatic struct dev_ops aperture_ops
=
657 X DEVO_REV
, /* revision
*/
659 X aperture_getinfo
, /* getinfo
*/
660 X aperture_identify
, /* identify
*/
661 X nulldev
, /* probe
*/
662 X aperture_attach
, /* attach
*/
663 X aperture_detach
, /* detach
*/
665 X
&aperture_cb_ops
, /* driver operations
*/
666 X NULL
/* bus operations
*/
670 Xstatic struct modldrv modldrv
=
672 X
&mod_driverops
, /* mod_ops structure pointer
*/
673 X DEV_BANNER
, /* driver
banner string
*/
674 X
&aperture_ops
, /* dev_ops structure pointer
*/
678 Xstatic struct modlinkage modlinkage
=
680 X MODREV_1
, /* module API revision
*/
682 X
&modldrv
, /* module driver structure pointer
*/
683 X NULL
/* list termination
*/
701 X
#ifdef APERTURE_DEBUG
703 X cmn_err
(CE_CONT
, DEV_IDENT
": entering _init()\n");
707 X error
= mod_install
(&modlinkage
);
709 X
#ifdef APERTURE_DEBUG
711 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving _init() = %d\n", error
);
725 X struct modinfo
*modinfop
729 X struct modinfo
*modinfop
;
734 X
#ifdef APERTURE_DEBUG
736 X cmn_err
(CE_CONT
, DEV_IDENT
": entering _info()\n");
740 X error
= mod_info
(&modlinkage
, modinfop
);
742 X
#ifdef APERTURE_DEBUG
744 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving _info() = %d\n", error
);
764 X
#ifdef APERTURE_DEBUG
766 X cmn_err
(CE_CONT
, DEV_IDENT
": entering _fini()\n");
770 X error
= mod_remove
(&modlinkage
);
772 X
#ifdef APERTURE_DEBUG
774 X cmn_err
(CE_CONT
, DEV_IDENT
": leaving _fini() = %d\n", error
);
780 END-of-.
/aperture
/aperture.c
781 echo x
- .
/aperture
/aperture.conf
782 sed 's/^X//' >.
/aperture
/aperture.conf
<< 'END-of-./aperture/aperture.conf'
784 X
# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com
786 X
# File: aperture.conf
787 X
# Author: Doug Anson (danson@lgc.com)
789 X
# Modified: David Holland (davidh@use.com)
790 X
# Log: Change comments 02/23/94
791 X
# Change defaults/comments 09/25/94
793 X
# Modified: Marc Aurele La France (tsi@xfree86.org)
794 X
# Log: SPARC changes 2001.09
796 X
# Purpose: This conf file is used by the aperture driver.
798 Xname
="aperture" parent
="pseudo";
799 END-of-.
/aperture
/aperture.conf
800 echo x
- .
/aperture
/devlink.tab
801 sed 's/^X//' >.
/aperture
/devlink.tab
<< 'END-of-./aperture/devlink.tab'
802 X
# The following entry is for the aperture driver
803 Xtype
=ddi_pseudo
;name
=aperture fbs
/\M0
804 END-of-.
/aperture
/devlink.tab