Deleted Added
full compact
tdfx_pci.c (183397) tdfx_pci.c (191056)
1/*-
2 * Copyright (c) 2000-2001 by Coleman Kane <cokane@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000-2001 by Coleman Kane <cokane@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 183397 2008-09-27 08:51:18Z ed $");
33__FBSDID("$FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 191056 2009-04-14 11:57:26Z ed $");
34
35/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET
36 *
37 * Copyright (C) 2000-2001, by Coleman Kane <cokane@FreeBSD.org>,
38 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor,
39 * and Jens Axboe, located at http://linux.3dfx.com.
40 */
41

--- 208 unchanged lines hidden (view full) ---

250 /*
251 * make_dev registers the cdev to access the 3dfx card from /dev
252 * use hex here for the dev num, simply to provide better support if > 10
253 * voodoo cards, for the mad. The user must set the link, or use MAKEDEV.
254 * Why would we want that many voodoo cards anyhow?
255 */
256 tdfx_info->devt = make_dev(&tdfx_cdev, device_get_unit(dev),
257 UID_ROOT, GID_WHEEL, 0600, "3dfx%x", device_get_unit(dev));
34
35/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET
36 *
37 * Copyright (C) 2000-2001, by Coleman Kane <cokane@FreeBSD.org>,
38 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor,
39 * and Jens Axboe, located at http://linux.3dfx.com.
40 */
41

--- 208 unchanged lines hidden (view full) ---

250 /*
251 * make_dev registers the cdev to access the 3dfx card from /dev
252 * use hex here for the dev num, simply to provide better support if > 10
253 * voodoo cards, for the mad. The user must set the link, or use MAKEDEV.
254 * Why would we want that many voodoo cards anyhow?
255 */
256 tdfx_info->devt = make_dev(&tdfx_cdev, device_get_unit(dev),
257 UID_ROOT, GID_WHEEL, 0600, "3dfx%x", device_get_unit(dev));
258 tdfx_info->devt->si_drv1 = tdfx_info;
258
259 return 0;
260}
261
262static int
263tdfx_detach(device_t dev) {
264 struct tdfx_softc* tdfx_info;
265 int retval;

--- 122 unchanged lines hidden (view full) ---

388
389static int
390tdfx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
391{
392 /*
393 * The open cdev method handles open(2) calls to /dev/3dfx[n]
394 * We can pretty much allow any opening of the device.
395 */
259
260 return 0;
261}
262
263static int
264tdfx_detach(device_t dev) {
265 struct tdfx_softc* tdfx_info;
266 int retval;

--- 122 unchanged lines hidden (view full) ---

389
390static int
391tdfx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
392{
393 /*
394 * The open cdev method handles open(2) calls to /dev/3dfx[n]
395 * We can pretty much allow any opening of the device.
396 */
396 struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
397 UNIT(dev2unit(dev)));
397 struct tdfx_softc *tdfx_info = dev->si_drv1;
398 if(tdfx_info->busy != 0) return EBUSY;
399#ifdef DEBUG
400 printf("3dfx: Opened by #%d\n", td->td_proc->p_pid);
401#endif
402 /* Set the driver as busy */
403 tdfx_info->busy++;
404 return 0;
405}
406
407static int
408tdfx_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
409{
410 /*
411 * The close cdev method handles close(2) calls to /dev/3dfx[n]
412 * We'll always want to close the device when it's called.
413 */
398 if(tdfx_info->busy != 0) return EBUSY;
399#ifdef DEBUG
400 printf("3dfx: Opened by #%d\n", td->td_proc->p_pid);
401#endif
402 /* Set the driver as busy */
403 tdfx_info->busy++;
404 return 0;
405}
406
407static int
408tdfx_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
409{
410 /*
411 * The close cdev method handles close(2) calls to /dev/3dfx[n]
412 * We'll always want to close the device when it's called.
413 */
414 struct tdfx_softc *tdfx_info = devclass_get_softc(tdfx_devclass,
415 UNIT(dev2unit(dev)));
414 struct tdfx_softc *tdfx_info = dev->si_drv1;
416 if(tdfx_info->busy == 0) return EBADF;
417 tdfx_info->busy = 0;
418#ifdef DEBUG
419 printf("Closed by #%d\n", td->td_proc->p_pid);
420#endif
421 return 0;
422}
423

--- 5 unchanged lines hidden (view full) ---

429 * associated with this device be mapped for the process to work with. Nprot
430 * holds the protections requested, PROT_READ, PROT_WRITE, or both.
431 */
432
433 /**** OLD GET CONFIG ****/
434 /* struct tdfx_softc* tdfx_info; */
435
436 /* Get the configuration for our card XXX*/
415 if(tdfx_info->busy == 0) return EBADF;
416 tdfx_info->busy = 0;
417#ifdef DEBUG
418 printf("Closed by #%d\n", td->td_proc->p_pid);
419#endif
420 return 0;
421}
422

--- 5 unchanged lines hidden (view full) ---

428 * associated with this device be mapped for the process to work with. Nprot
429 * holds the protections requested, PROT_READ, PROT_WRITE, or both.
430 */
431
432 /**** OLD GET CONFIG ****/
433 /* struct tdfx_softc* tdfx_info; */
434
435 /* Get the configuration for our card XXX*/
437 /*tdfx_info = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass,
438 UNIT(dev2unit(dev)));*/
436 /*tdfx_info = dev->si_drv1; */
439 /************************/
440
441 struct tdfx_softc* tdfx_info[2];
442
443 tdfx_info[0] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 0);
444
445 /* If, for some reason, its not configured, we bail out */
446 if(tdfx_info[0] == NULL) {

--- 381 unchanged lines hidden ---
437 /************************/
438
439 struct tdfx_softc* tdfx_info[2];
440
441 tdfx_info[0] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 0);
442
443 /* If, for some reason, its not configured, we bail out */
444 if(tdfx_info[0] == NULL) {

--- 381 unchanged lines hidden ---