Deleted Added
full compact
tdfx_pci.c (151897) tdfx_pci.c (156260)
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 151897 2005-10-31 15:41:29Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 156260 2006-03-03 21:37:38Z yar $");
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

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

65#include <vm/pmap.h>
66#include <vm/vm_extern.h>
67
68/* rman.h depends on machine/bus.h */
69#include <machine/resource.h>
70#include <machine/bus.h>
71#include <sys/rman.h>
72
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

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

65#include <vm/pmap.h>
66#include <vm/vm_extern.h>
67
68/* rman.h depends on machine/bus.h */
69#include <machine/resource.h>
70#include <machine/bus.h>
71#include <sys/rman.h>
72
73/* This must come first */
74#include "opt_tdfx.h"
75#ifdef TDFX_LINUX
76#include <dev/tdfx/tdfx_linux.h>
77#endif
78
79#include <dev/tdfx/tdfx_io.h>
80#include <dev/tdfx/tdfx_vars.h>
81#include <dev/tdfx/tdfx_pci.h>
82
83
84static devclass_t tdfx_devclass;
85
86

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

93 DEVMETHOD(device_attach, tdfx_attach),
94 DEVMETHOD(device_detach, tdfx_detach),
95 DEVMETHOD(device_shutdown, tdfx_shutdown),
96 { 0, 0 }
97};
98
99MALLOC_DEFINE(M_TDFX,"tdfx_driver","3DFX Graphics[/2D]/3D Accelerator(s)");
100
73#include <dev/tdfx/tdfx_io.h>
74#include <dev/tdfx/tdfx_vars.h>
75#include <dev/tdfx/tdfx_pci.h>
76
77
78static devclass_t tdfx_devclass;
79
80

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

87 DEVMETHOD(device_attach, tdfx_attach),
88 DEVMETHOD(device_detach, tdfx_detach),
89 DEVMETHOD(device_shutdown, tdfx_shutdown),
90 { 0, 0 }
91};
92
93MALLOC_DEFINE(M_TDFX,"tdfx_driver","3DFX Graphics[/2D]/3D Accelerator(s)");
94
101#ifdef TDFX_LINUX
102MODULE_DEPEND(tdfx, linux, 1, 1, 1);
103LINUX_IOCTL_SET(tdfx, LINUX_IOCTL_TDFX_MIN, LINUX_IOCTL_TDFX_MAX);
104#endif
105
106/* Char. Dev. file operations structure */
107static struct cdevsw tdfx_cdev = {
108 .d_version = D_VERSION,
109 .d_flags = D_NEEDGIANT,
110 .d_open = tdfx_open,
111 .d_close = tdfx_close,
112 .d_ioctl = tdfx_ioctl,
113 .d_mmap = tdfx_mmap,

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

817 printf("Bad IOCTL from #%d\n", td->td_proc->p_pid);
818#endif
819 return ENXIO;
820 }
821
822 return 0;
823}
824
95/* Char. Dev. file operations structure */
96static struct cdevsw tdfx_cdev = {
97 .d_version = D_VERSION,
98 .d_flags = D_NEEDGIANT,
99 .d_open = tdfx_open,
100 .d_close = tdfx_close,
101 .d_ioctl = tdfx_ioctl,
102 .d_mmap = tdfx_mmap,

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

806 printf("Bad IOCTL from #%d\n", td->td_proc->p_pid);
807#endif
808 return ENXIO;
809 }
810
811 return 0;
812}
813
825#ifdef TDFX_LINUX
826/*
827 * Linux emulation IOCTL for /dev/tdfx
828 */
829static int
830linux_ioctl_tdfx(struct thread *td, struct linux_ioctl_args* args)
831{
832 int error = 0;
833 u_long cmd = args->cmd & 0xffff;
834
835 /* The structure passed to ioctl has two shorts, one int
836 and one void*. */
837 char d_pio[2*sizeof(short) + sizeof(int) + sizeof(void*)];
838
839 struct file *fp;
840
841 if ((error = fget(td, args->fd, &fp)) != 0)
842 return (error);
843 /* We simply copy the data and send it right to ioctl */
844 copyin((caddr_t)args->arg, &d_pio, sizeof(d_pio));
845 error = fo_ioctl(fp, cmd, (caddr_t)&d_pio, td->td_ucred, td);
846 fdrop(fp, td);
847 return error;
848}
849#endif /* TDFX_LINUX */
850
851
852/* This is the device driver struct. This is sent to the driver subsystem to
853 * register the method structure and the info strcut space for this particular
854 * instance of the driver.
855 */
856static driver_t tdfx_driver = {
857 "tdfx",
858 tdfx_methods,
859 sizeof(struct tdfx_softc),
860};
861
862/* Tell Mr. Kernel about us! */
863DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
814/* This is the device driver struct. This is sent to the driver subsystem to
815 * register the method structure and the info strcut space for this particular
816 * instance of the driver.
817 */
818static driver_t tdfx_driver = {
819 "tdfx",
820 tdfx_methods,
821 sizeof(struct tdfx_softc),
822};
823
824/* Tell Mr. Kernel about us! */
825DRIVER_MODULE(tdfx, pci, tdfx_driver, tdfx_devclass, 0, 0);
826MODULE_VERSION(tdfx, 1);