| 1 | #!/bin/sh |
| 2 | # |
| 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 |
| 8 | # |
| 9 | # This archive contains: |
| 10 | # |
| 11 | # ./aperture |
| 12 | # |
| 13 | # ./aperture/Makefile |
| 14 | # ./aperture/Makefile.amd64 |
| 15 | # ./aperture/Makefile.sparcv9 |
| 16 | # ./aperture/README |
| 17 | # ./aperture/aperture.c |
| 18 | # ./aperture/aperture.conf |
| 19 | # ./aperture/devlink.tab |
| 20 | # |
| 21 | echo c - ./aperture |
| 22 | mkdir -p ./aperture > /dev/null 2>&1 |
| 23 | # |
| 24 | echo x - ./aperture/Makefile |
| 25 | sed 's/^X//' >./aperture/Makefile << 'END-of-./aperture/Makefile' |
| 26 | X# |
| 27 | X# File: makefile for aperture Framebuffer Driver |
| 28 | X# Author: Doug Anson (danson@lgc.com) |
| 29 | X# Date: 2/15/94 |
| 30 | X# Modified: David Holland (davidh@use.com) |
| 31 | X# Date: 2/23/94 |
| 32 | X# - Changed name, and debugging structure |
| 33 | X# Modified: Marc Aurele La France (tsi@xfree86.org) |
| 34 | X# Date: 2001.06.08 |
| 35 | X# - SPARC support, cleanup and turf aptest. |
| 36 | X# |
| 37 | X# >>NOTE<< Have a look at Makefile.sparcv9 for specifics. |
| 38 | X# |
| 39 | X# Modified: Martin Bochnig (martin@martux.org) |
| 40 | X# Date: 2006.06.24 |
| 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 |
| 44 | X# |
| 45 | X# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics. |
| 46 | X# |
| 47 | X# GNU gcc compiler |
| 48 | XCC=gcc |
| 49 | XCFLGS=-fno-builtin -Wall -O3 |
| 50 | X |
| 51 | X# |
| 52 | X# SUNWspro compiler |
| 53 | X#CC=/opt/SUNWspro/bin/cc |
| 54 | X#CFLGS=-Xa -xnolib -xO3 |
| 55 | X |
| 56 | X# |
| 57 | X# Debug error reporting |
| 58 | X#DEBUG_FLG= |
| 59 | X#DEBUG_FLG=-DAPERTURE_DEBUG |
| 60 | X |
| 61 | X# |
| 62 | X# Files and object declarations |
| 63 | XKERNEL_FLGS=-D_KERNEL -DSUNDDI |
| 64 | XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) |
| 65 | XCFILES= aperture.c |
| 66 | XOBJS= aperture.o |
| 67 | XDRIVER= aperture |
| 68 | X |
| 69 | X# |
| 70 | X# Make rules |
| 71 | Xall: $(DRIVER) |
| 72 | X |
| 73 | X$(DRIVER): $(OBJS) |
| 74 | X @if [ -f "Makefile.`isainfo -k`" ]; then \ |
| 75 | X make -f Makefile.`isainfo -k` $(DRIVER); \ |
| 76 | X else \ |
| 77 | X rm -f $(DRIVER); \ |
| 78 | X ld -r -o $(DRIVER) $(OBJS); \ |
| 79 | X fi |
| 80 | X |
| 81 | Xinstall: $(DRIVER) |
| 82 | X @if [ -f "Makefile.`isainfo -k`" ]; then \ |
| 83 | X make -f Makefile.`isainfo -k` install; \ |
| 84 | X else \ |
| 85 | X cp aperture.conf /kernel/drv; \ |
| 86 | X cp $(DRIVER) /kernel/drv; \ |
| 87 | X fi |
| 88 | X |
| 89 | Xadd_drv: |
| 90 | X @if [ -f "Makefile.`isainfo -k`" ]; then \ |
| 91 | X make -f Makefile.`isainfo -k` add_drv; \ |
| 92 | X else \ |
| 93 | X add_drv aperture; \ |
| 94 | X fi |
| 95 | X |
| 96 | Xclean: |
| 97 | X rm -f *% *.BAK $(OBJS) $(DRIVER) core |
| 98 | X |
| 99 | X.SUFFIXES: .i |
| 100 | X |
| 101 | X.c.i: |
| 102 | X $(CC) -E $(CFLAGS) $*.c > $@ |
| 103 | X |
| 104 | X.c.o: |
| 105 | X @if [ -f "Makefile.`isainfo -k`" ]; then \ |
| 106 | X make -f Makefile.`isainfo -k` $@; \ |
| 107 | X else \ |
| 108 | X rm -f $@; \ |
| 109 | X $(CC) -c $(CFLAGS) $*.c -o $@; \ |
| 110 | X fi |
| 111 | END-of-./aperture/Makefile |
| 112 | echo x - ./aperture/Makefile.amd64 |
| 113 | sed 's/^X//' >./aperture/Makefile.amd64 << 'END-of-./aperture/Makefile.amd64' |
| 114 | X# |
| 115 | X# File: Makefile for aperture Framebuffer Driver |
| 116 | X# Author: Doug Anson (danson@lgc.com) |
| 117 | X# Date: 2/15/94 |
| 118 | X# Modified: David Holland (davidh@use.com) |
| 119 | X# Date: 2/23/94 |
| 120 | X# - Changed name, and debugging structure |
| 121 | X# Modified: Marc Aurele La France (tsi@xfree86.org) |
| 122 | X# Date: 2001.06.08 |
| 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 |
| 128 | X# - Changed name |
| 129 | X# |
| 130 | X |
| 131 | X# |
| 132 | X# GNU gcc compiler, version 3.2 or later |
| 133 | X# |
| 134 | XCC=gcc |
| 135 | XCFLGS=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel |
| 136 | X |
| 137 | X# |
| 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 |
| 141 | X |
| 142 | X# |
| 143 | X# Debug error reporting |
| 144 | X#DEBUG_FLG= |
| 145 | X#DEBUG_FLG=-DAPERTURE_DEBUG |
| 146 | X |
| 147 | X# |
| 148 | X# Files and object declarations |
| 149 | XKERNEL_FLGS=-D_KERNEL -DSUNDDI |
| 150 | XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) |
| 151 | XCFILES= aperture.c |
| 152 | XOBJS= aperture.o |
| 153 | XDRIVER= aperture |
| 154 | X |
| 155 | X# |
| 156 | X# Make rules |
| 157 | Xall: $(DRIVER) |
| 158 | X |
| 159 | X$(DRIVER): $(OBJS) |
| 160 | X rm -f $(DRIVER) |
| 161 | X ld -r -o $(DRIVER) $(OBJS) |
| 162 | X |
| 163 | Xinstall: $(DRIVER) |
| 164 | X cp aperture.conf /kernel/drv |
| 165 | X cp $(DRIVER) /kernel/drv/amd64 |
| 166 | X |
| 167 | Xadd_drv: |
| 168 | X add_drv aperture |
| 169 | X |
| 170 | Xclean: |
| 171 | X rm -f *% *.BAK $(OBJS) $(DRIVER) core |
| 172 | X |
| 173 | X.SUFFIXES: .i |
| 174 | X |
| 175 | X.c.i: |
| 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' |
| 180 | X# |
| 181 | X# File: makefile for aperture Framebuffer Driver |
| 182 | X# Author: Doug Anson (danson@lgc.com) |
| 183 | X# Date: 2/15/94 |
| 184 | X# Modified: David Holland (davidh@use.com) |
| 185 | X# Date: 2/23/94 |
| 186 | X# - Changed name, and debugging structure |
| 187 | X# Modified: Marc Aurele La France (tsi@xfree86.org) |
| 188 | X# Date: 2001.06.08 |
| 189 | X# - SPARC support, cleanup and turf aptest. |
| 190 | X# Modified: Martin Bochnig (martin@martux.org) |
| 191 | X# Date: 2006.06.24 |
| 192 | X# - Changed name for generic sparcv9 support |
| 193 | X# - updated to better work with Solaris 10 and 11 |
| 194 | X# |
| 195 | X |
| 196 | X# |
| 197 | X# GNU gcc compiler, version 3.2 or later |
| 198 | X# |
| 199 | XCC=gcc |
| 200 | XCFLGS=-fno-builtin -Wall -O3 -m64 |
| 201 | X |
| 202 | X# |
| 203 | X# SUNWspro compiler |
| 204 | X#CC=/opt/SUNWspro/bin/cc |
| 205 | X#CFLGS=-Xa -xarch=v9 -xnolib -xO3 |
| 206 | X |
| 207 | X# |
| 208 | X# Debug error reporting |
| 209 | X#DEBUG_FLG= |
| 210 | X#DEBUG_FLG=-DAPERTURE_DEBUG |
| 211 | X |
| 212 | X# |
| 213 | X# Files and object declarations |
| 214 | XKERNEL_FLGS=-D_KERNEL -DSUNDDI |
| 215 | XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG) |
| 216 | XCFILES= aperture.c |
| 217 | XOBJS= aperture.o |
| 218 | XDRIVER= aperture |
| 219 | X |
| 220 | X# |
| 221 | X# Make rules |
| 222 | Xall: $(DRIVER) |
| 223 | X |
| 224 | X$(DRIVER): $(OBJS) |
| 225 | X rm -f $(DRIVER) |
| 226 | X ld -r -o $(DRIVER) $(OBJS) |
| 227 | X |
| 228 | Xinstall: $(DRIVER) |
| 229 | X cp aperture.conf /kernel/drv |
| 230 | X cp $(DRIVER) /kernel/drv/sparcv9 |
| 231 | X |
| 232 | Xadd_drv: |
| 233 | X add_drv aperture |
| 234 | X |
| 235 | Xclean: |
| 236 | X rm -f *% *.BAK $(OBJS) $(DRIVER) core |
| 237 | X |
| 238 | X.SUFFIXES: .i |
| 239 | X |
| 240 | X.c.i: |
| 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. |
| 246 | X |
| 247 | XThis driver was written to provide a device that, unlike /dev/mem, allows |
| 248 | Xmmap()'ing of ranges beyond installed memory. |
| 249 | X |
| 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. |
| 255 | X |
| 256 | X |
| 257 | XInstallation instructions: |
| 258 | X |
| 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... |
| 262 | X |
| 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. |
| 265 | X |
| 266 | X3) Become 'root'. |
| 267 | X |
| 268 | X4) Type 'make install' and 'make add_drv'. The screen should look something |
| 269 | X like this: |
| 270 | X |
| 271 | X # make install |
| 272 | X cp aperture aperture.conf /kernel/drv |
| 273 | X # make add_drv |
| 274 | X add_drv aperture |
| 275 | X |
| 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. |
| 278 | X |
| 279 | X This installs the driver to the system. |
| 280 | X |
| 281 | X5) While as root modify the file /etc/devlink.tab, adding these lines: |
| 282 | X |
| 283 | X# The following entry is for the framebuffer driver |
| 284 | Xtype=ddi_pseudo;name=aperture fbs/\M0 |
| 285 | X |
| 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) |
| 290 | X |
| 291 | X6) Perform a reconfiguration boot of the system. |
| 292 | X |
| 293 | X # touch /reconfigure |
| 294 | X # init 6 |
| 295 | X |
| 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' |
| 300 | X/* |
| 301 | X * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. |
| 302 | X * |
| 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: |
| 309 | X * |
| 310 | X * The above copyright notice and this permission notice shall be included in |
| 311 | X * all copies or substantial portions of the Software. |
| 312 | X * |
| 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. |
| 319 | X * |
| 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 |
| 323 | X * XFree86 Project. |
| 324 | X */ |
| 325 | X |
| 326 | X/* |
| 327 | X * Aperture driver for Solaris. |
| 328 | X */ |
| 329 | X |
| 330 | X/* |
| 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 |
| 335 | X */ |
| 336 | X |
| 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> |
| 343 | X |
| 344 | X#define DEV_IDENT "aperture" |
| 345 | X#define DEV_BANNER "XFree86 aperture driver" |
| 346 | X |
| 347 | X#ifndef D_64BIT |
| 348 | X#define D_64BIT 0 |
| 349 | X#endif |
| 350 | X |
| 351 | X#ifndef NULL |
| 352 | X#define NULL ((void *)0) |
| 353 | X#endif |
| 354 | X |
| 355 | X/* |
| 356 | X * open(9E) |
| 357 | X */ |
| 358 | X/*ARGSUSED*/ |
| 359 | Xstatic int |
| 360 | Xaperture_open |
| 361 | X( |
| 362 | X#ifdef __STDC__ |
| 363 | X dev_t *devp, |
| 364 | X int flag, |
| 365 | X int typ, |
| 366 | X struct cred *cred |
| 367 | X#endif |
| 368 | X) |
| 369 | X#ifndef __STDC__ |
| 370 | X dev_t *devp; |
| 371 | X int flag; |
| 372 | X int typ; |
| 373 | X struct cred *cred; |
| 374 | X#endif |
| 375 | X{ |
| 376 | X int error; |
| 377 | X |
| 378 | X#ifdef APERTURE_DEBUG |
| 379 | X |
| 380 | X cmn_err(CE_CONT, DEV_IDENT ": entering open()\n"); |
| 381 | X |
| 382 | X#endif |
| 383 | X |
| 384 | X if ((typ != OTYP_CHR) || (getminor(*devp))) |
| 385 | X error = EINVAL; |
| 386 | X else |
| 387 | X error = 0; |
| 388 | X |
| 389 | X#ifdef APERTURE_DEBUG |
| 390 | X |
| 391 | X cmn_err(CE_CONT, DEV_IDENT ": leaving open() = %d\n", error); |
| 392 | X |
| 393 | X#endif |
| 394 | X |
| 395 | X return error; |
| 396 | X} |
| 397 | X |
| 398 | X/* |
| 399 | X * mmap(9E) |
| 400 | X */ |
| 401 | X/*ARGSUSED*/ |
| 402 | Xstatic int |
| 403 | Xaperture_mmap |
| 404 | X( |
| 405 | X#ifdef __STDC__ |
| 406 | X dev_t dev, |
| 407 | X off_t off, |
| 408 | X int prot |
| 409 | X#endif |
| 410 | X) |
| 411 | X#ifndef __STDC__ |
| 412 | X dev_t dev; |
| 413 | X off_t off; |
| 414 | X int prot; |
| 415 | X#endif |
| 416 | X{ |
| 417 | X pfn_t pf; |
| 418 | X int error; |
| 419 | X |
| 420 | X#ifdef APERTURE_DEBUG |
| 421 | X |
| 422 | X cmn_err(CE_CONT, DEV_IDENT ": entering mmap(0x%016lx)\n", off); |
| 423 | X |
| 424 | X#endif |
| 425 | X |
| 426 | X pf = btop((unsigned long)off); |
| 427 | X |
| 428 | X /* Deal with mmap(9E) interface limits */ |
| 429 | X error = (int)pf; |
| 430 | X if ((error < 0) || (pf != (pfn_t)error)) |
| 431 | X error = -1; |
| 432 | X |
| 433 | X#ifdef APERTURE_DEBUG |
| 434 | X |
| 435 | X cmn_err(CE_CONT, DEV_IDENT ": leaving mmap() = 0x%08lx", error); |
| 436 | X |
| 437 | X#endif |
| 438 | X |
| 439 | X return error; |
| 440 | X} |
| 441 | X |
| 442 | Xstatic struct cb_ops aperture_cb_ops = |
| 443 | X{ |
| 444 | X aperture_open, /* open */ |
| 445 | X nulldev, /* close */ |
| 446 | X nodev, /* strategy */ |
| 447 | X nodev, /* print */ |
| 448 | X nodev, /* dump */ |
| 449 | X nodev, /* read */ |
| 450 | X nodev, /* write */ |
| 451 | X nodev, /* ioctl */ |
| 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 */ |
| 457 | X 0, /* streamtab */ |
| 458 | X D_NEW | D_MP | D_64BIT /* Driver compatibility flag */ |
| 459 | X}; |
| 460 | X |
| 461 | X |
| 462 | Xstatic dev_info_t *aperture_dip; /* private copy of devinfo pointer */ |
| 463 | X |
| 464 | X/* |
| 465 | X * getinfo(9E) |
| 466 | X */ |
| 467 | X/*ARGSUSED*/ |
| 468 | Xstatic int |
| 469 | Xaperture_getinfo |
| 470 | X( |
| 471 | X#ifdef __STDC__ |
| 472 | X dev_info_t *dip, |
| 473 | X ddi_info_cmd_t infocmd, |
| 474 | X void *arg, |
| 475 | X void **result |
| 476 | X#endif |
| 477 | X) |
| 478 | X#ifndef __STDC__ |
| 479 | X dev_info_t *dip; |
| 480 | X ddi_info_cmd_t infocmd; |
| 481 | X void *arg; |
| 482 | X void **result; |
| 483 | X#endif |
| 484 | X{ |
| 485 | X int error; |
| 486 | X |
| 487 | X#ifdef APERTURE_DEBUG |
| 488 | X |
| 489 | X cmn_err(CE_CONT, DEV_IDENT ": entering getinfo()\n"); |
| 490 | X |
| 491 | X#endif |
| 492 | X |
| 493 | X switch (infocmd) { |
| 494 | X case DDI_INFO_DEVT2DEVINFO: |
| 495 | X *result = aperture_dip; |
| 496 | X error = DDI_SUCCESS; |
| 497 | X break; |
| 498 | X case DDI_INFO_DEVT2INSTANCE: |
| 499 | X *result = NULL; |
| 500 | X error = DDI_SUCCESS; |
| 501 | X break; |
| 502 | X default: |
| 503 | X error = DDI_FAILURE; |
| 504 | X } |
| 505 | X |
| 506 | X#ifdef APERTURE_DEBUG |
| 507 | X |
| 508 | X cmn_err(CE_CONT, DEV_IDENT ": leaving getinfo() = %d\n", error); |
| 509 | X |
| 510 | X#endif |
| 511 | X |
| 512 | X return error; |
| 513 | X} |
| 514 | X |
| 515 | X/* |
| 516 | X * identify(9E) |
| 517 | X */ |
| 518 | X/*ARGSUSED*/ |
| 519 | Xstatic int |
| 520 | Xaperture_identify |
| 521 | X( |
| 522 | X#ifdef __STDC__ |
| 523 | X dev_info_t *dip |
| 524 | X#endif |
| 525 | X) |
| 526 | X#ifndef __STDC__ |
| 527 | X dev_info_t *dip; |
| 528 | X#endif |
| 529 | X{ |
| 530 | X int error; |
| 531 | X |
| 532 | X#ifdef APERTURE_DEBUG |
| 533 | X |
| 534 | X cmn_err(CE_CONT, DEV_IDENT ": entering identify()\n"); |
| 535 | X |
| 536 | X#endif |
| 537 | X |
| 538 | X if (strcmp(ddi_get_name(dip), DEV_IDENT)) |
| 539 | X error = 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS 5.10 */ ; |
| 540 | X else |
| 541 | X error = 2 /* DDI_IDENTIFIED obsolete since SunOS 5.10 */ ; |
| 542 | X |
| 543 | X#ifdef APERTURE_DEBUG |
| 544 | X |
| 545 | X cmn_err(CE_CONT, DEV_IDENT ": leaving identify() = %d\n", error); |
| 546 | X |
| 547 | X#endif |
| 548 | X |
| 549 | X return error; |
| 550 | X} |
| 551 | X |
| 552 | X/* |
| 553 | X * attach(9E) |
| 554 | X */ |
| 555 | X/*ARGSUSED*/ |
| 556 | Xstatic int |
| 557 | Xaperture_attach |
| 558 | X( |
| 559 | X#ifdef __STDC__ |
| 560 | X dev_info_t *dip, |
| 561 | X ddi_attach_cmd_t cmd |
| 562 | X#endif |
| 563 | X) |
| 564 | X#ifndef __STDC__ |
| 565 | X dev_info_t *dip; |
| 566 | X ddi_attach_cmd_t cmd; |
| 567 | X#endif |
| 568 | X{ |
| 569 | X int error; |
| 570 | X |
| 571 | X#ifdef APERTURE_DEBUG |
| 572 | X |
| 573 | X cmn_err(CE_CONT, DEV_IDENT ": entering attach()\n"); |
| 574 | X |
| 575 | X#endif |
| 576 | X |
| 577 | X if (cmd != DDI_ATTACH) |
| 578 | X { |
| 579 | X |
| 580 | X#ifdef APERTURE_DEBUG |
| 581 | X |
| 582 | X cmn_err(CE_CONT, DEV_IDENT ": not attach(, DDI_ATTACH)\n"); |
| 583 | X |
| 584 | X#endif |
| 585 | X |
| 586 | X error = DDI_FAILURE; |
| 587 | X } |
| 588 | X else |
| 589 | X { |
| 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 */ ); |
| 593 | X |
| 594 | X if (error == DDI_SUCCESS) |
| 595 | X { |
| 596 | X aperture_dip = dip; |
| 597 | X ddi_report_dev(dip); |
| 598 | X } |
| 599 | X } |
| 600 | X |
| 601 | X#ifdef APERTURE_DEBUG |
| 602 | X |
| 603 | X cmn_err(CE_CONT, DEV_IDENT ": leaving attach() = %d\n", error); |
| 604 | X |
| 605 | X#endif |
| 606 | X |
| 607 | X return error; |
| 608 | X} |
| 609 | X |
| 610 | X/* |
| 611 | X * detach(9E) |
| 612 | X */ |
| 613 | Xstatic int |
| 614 | Xaperture_detach |
| 615 | X( |
| 616 | X#ifdef __STDC__ |
| 617 | X dev_info_t *dip, |
| 618 | X ddi_detach_cmd_t cmd |
| 619 | X#endif |
| 620 | X) |
| 621 | X#ifndef __STDC__ |
| 622 | X dev_info_t *dip; |
| 623 | X ddi_detach_cmd_t cmd; |
| 624 | X#endif |
| 625 | X{ |
| 626 | X int error; |
| 627 | X |
| 628 | X#ifdef APERTURE_DEBUG |
| 629 | X |
| 630 | X cmn_err(CE_CONT, DEV_IDENT ": entering detach()\n"); |
| 631 | X |
| 632 | X#endif |
| 633 | X |
| 634 | X if (cmd != DDI_DETACH) |
| 635 | X { |
| 636 | X error = DDI_FAILURE; |
| 637 | X } |
| 638 | X else |
| 639 | X { |
| 640 | X ddi_remove_minor_node(dip, NULL); |
| 641 | X aperture_dip = NULL; |
| 642 | X error = DDI_SUCCESS; |
| 643 | X } |
| 644 | X |
| 645 | X#if APERTURE_DEBUG |
| 646 | X |
| 647 | X cmn_err(CE_CONT, DEV_IDENT ": leaving detach() = %d\n", error); |
| 648 | X |
| 649 | X#endif |
| 650 | X |
| 651 | X return error; |
| 652 | X} |
| 653 | X |
| 654 | X |
| 655 | Xstatic struct dev_ops aperture_ops = |
| 656 | X{ |
| 657 | X DEVO_REV, /* revision */ |
| 658 | X 0, /* refcnt */ |
| 659 | X aperture_getinfo, /* getinfo */ |
| 660 | X aperture_identify, /* identify */ |
| 661 | X nulldev, /* probe */ |
| 662 | X aperture_attach, /* attach */ |
| 663 | X aperture_detach, /* detach */ |
| 664 | X nodev, /* reset */ |
| 665 | X &aperture_cb_ops, /* driver operations */ |
| 666 | X NULL /* bus operations */ |
| 667 | X}; |
| 668 | X |
| 669 | X |
| 670 | Xstatic struct modldrv modldrv = |
| 671 | X{ |
| 672 | X &mod_driverops, /* mod_ops structure pointer */ |
| 673 | X DEV_BANNER, /* driver banner string */ |
| 674 | X &aperture_ops, /* dev_ops structure pointer */ |
| 675 | X}; |
| 676 | X |
| 677 | X |
| 678 | Xstatic struct modlinkage modlinkage = |
| 679 | X{ |
| 680 | X MODREV_1, /* module API revision */ |
| 681 | X { |
| 682 | X &modldrv, /* module driver structure pointer */ |
| 683 | X NULL /* list termination */ |
| 684 | X } |
| 685 | X}; |
| 686 | X |
| 687 | X |
| 688 | X/* |
| 689 | X * _init(9E) |
| 690 | X */ |
| 691 | Xint |
| 692 | X_init |
| 693 | X( |
| 694 | X#ifdef __STDC__ |
| 695 | X void |
| 696 | X#endif |
| 697 | X) |
| 698 | X{ |
| 699 | X int error; |
| 700 | X |
| 701 | X#ifdef APERTURE_DEBUG |
| 702 | X |
| 703 | X cmn_err(CE_CONT, DEV_IDENT ": entering _init()\n"); |
| 704 | X |
| 705 | X#endif |
| 706 | X |
| 707 | X error = mod_install(&modlinkage); |
| 708 | X |
| 709 | X#ifdef APERTURE_DEBUG |
| 710 | X |
| 711 | X cmn_err(CE_CONT, DEV_IDENT ": leaving _init() = %d\n", error); |
| 712 | X |
| 713 | X#endif |
| 714 | X |
| 715 | X return error; |
| 716 | X} |
| 717 | X |
| 718 | X/* |
| 719 | X * _info(9E) |
| 720 | X */ |
| 721 | Xint |
| 722 | X_info |
| 723 | X( |
| 724 | X#ifdef __STDC__ |
| 725 | X struct modinfo *modinfop |
| 726 | X#endif |
| 727 | X) |
| 728 | X#ifndef __STDC__ |
| 729 | X struct modinfo *modinfop; |
| 730 | X#endif |
| 731 | X{ |
| 732 | X int error; |
| 733 | X |
| 734 | X#ifdef APERTURE_DEBUG |
| 735 | X |
| 736 | X cmn_err(CE_CONT, DEV_IDENT ": entering _info()\n"); |
| 737 | X |
| 738 | X#endif |
| 739 | X |
| 740 | X error = mod_info(&modlinkage, modinfop); |
| 741 | X |
| 742 | X#ifdef APERTURE_DEBUG |
| 743 | X |
| 744 | X cmn_err(CE_CONT, DEV_IDENT ": leaving _info() = %d\n", error); |
| 745 | X |
| 746 | X#endif |
| 747 | X |
| 748 | X return error; |
| 749 | X} |
| 750 | X |
| 751 | X/* |
| 752 | X * _fini(9E) |
| 753 | X */ |
| 754 | Xint |
| 755 | X_fini |
| 756 | X( |
| 757 | X#ifdef __STDC__ |
| 758 | X void |
| 759 | X#endif |
| 760 | X) |
| 761 | X{ |
| 762 | X int error; |
| 763 | X |
| 764 | X#ifdef APERTURE_DEBUG |
| 765 | X |
| 766 | X cmn_err(CE_CONT, DEV_IDENT ": entering _fini()\n"); |
| 767 | X |
| 768 | X#endif |
| 769 | X |
| 770 | X error = mod_remove(&modlinkage); |
| 771 | X |
| 772 | X#ifdef APERTURE_DEBUG |
| 773 | X |
| 774 | X cmn_err(CE_CONT, DEV_IDENT ": leaving _fini() = %d\n", error); |
| 775 | X |
| 776 | X#endif |
| 777 | X |
| 778 | X return error; |
| 779 | X} |
| 780 | END-of-./aperture/aperture.c |
| 781 | echo x - ./aperture/aperture.conf |
| 782 | sed 's/^X//' >./aperture/aperture.conf << 'END-of-./aperture/aperture.conf' |
| 783 | X# |
| 784 | X# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com |
| 785 | X# |
| 786 | X# File: aperture.conf |
| 787 | X# Author: Doug Anson (danson@lgc.com) |
| 788 | X# |
| 789 | X# Modified: David Holland (davidh@use.com) |
| 790 | X# Log: Change comments 02/23/94 |
| 791 | X# Change defaults/comments 09/25/94 |
| 792 | X# |
| 793 | X# Modified: Marc Aurele La France (tsi@xfree86.org) |
| 794 | X# Log: SPARC changes 2001.09 |
| 795 | X# |
| 796 | X# Purpose: This conf file is used by the aperture driver. |
| 797 | X# |
| 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 |
| 805 | exit |
| 806 | |