summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2009-11-17 09:46:56 -0500
committerKristian Høgsberg <krh@bitplanet.net>2009-11-17 10:54:11 -0500
commit9dd3613073aa2491cef440725fdfa0cf1e8f1a42 (patch)
tree956c84be2fae4b4e6de2840a94d30dffa6573066
parenta66cf9ce68bdf9bd887f91a38ced4b59c129b3c7 (diff)
Drop shared-core, bsd-core, linux-core and scripts subdirs
-rw-r--r--bsd-core/Makefile11
-rw-r--r--bsd-core/ati_pcigart.c219
l---------bsd-core/drm.h1
-rw-r--r--bsd-core/drm/Makefile41
-rw-r--r--bsd-core/drmP.h1019
-rw-r--r--bsd-core/drm_agpsupport.c466
-rw-r--r--bsd-core/drm_atomic.h88
-rw-r--r--bsd-core/drm_auth.c187
-rw-r--r--bsd-core/drm_bufs.c1110
-rw-r--r--bsd-core/drm_context.c320
-rw-r--r--bsd-core/drm_dma.c136
-rw-r--r--bsd-core/drm_drawable.c170
-rw-r--r--bsd-core/drm_drv.c839
-rw-r--r--bsd-core/drm_fops.c106
l---------bsd-core/drm_internal.h1
-rw-r--r--bsd-core/drm_ioctl.c282
-rw-r--r--bsd-core/drm_irq.c499
-rw-r--r--bsd-core/drm_linux_list.h75
-rw-r--r--bsd-core/drm_lock.c191
-rw-r--r--bsd-core/drm_memory.c110
l---------bsd-core/drm_mode.h1
-rw-r--r--bsd-core/drm_pci.c125
l---------bsd-core/drm_sarea.h1
-rw-r--r--bsd-core/drm_scatter.c190
-rw-r--r--bsd-core/drm_sysctl.c312
-rw-r--r--bsd-core/drm_vm.c124
-rw-r--r--bsd-core/i915/Makefile23
l---------bsd-core/i915_dma.c1
l---------bsd-core/i915_drm.h1
-rw-r--r--bsd-core/i915_drv.c158
l---------bsd-core/i915_drv.h1
l---------bsd-core/i915_irq.c1
l---------bsd-core/i915_mem.c1
l---------bsd-core/i915_reg.h1
l---------bsd-core/i915_suspend.c1
-rw-r--r--bsd-core/mach64/Makefile23
l---------bsd-core/mach64_dma.c1
l---------bsd-core/mach64_drm.h1
-rw-r--r--bsd-core/mach64_drv.c135
l---------bsd-core/mach64_drv.h1
l---------bsd-core/mach64_irq.c1
l---------bsd-core/mach64_state.c1
-rw-r--r--bsd-core/mga/Makefile23
l---------bsd-core/mga_dma.c1
l---------bsd-core/mga_drm.h1
-rw-r--r--bsd-core/mga_drv.c172
l---------bsd-core/mga_drv.h1
l---------bsd-core/mga_irq.c1
l---------bsd-core/mga_state.c1
l---------bsd-core/mga_ucode.h1
l---------bsd-core/mga_warp.c1
l---------bsd-core/nouveau/@1
-rw-r--r--bsd-core/nouveau/Makefile33
l---------bsd-core/nouveau/machine1
l---------bsd-core/nouveau_dma.c1
l---------bsd-core/nouveau_dma.h1
l---------bsd-core/nouveau_drm.h1
-rw-r--r--bsd-core/nouveau_drv.c148
l---------bsd-core/nouveau_drv.h1
l---------bsd-core/nouveau_fifo.c1
l---------bsd-core/nouveau_irq.c1
l---------bsd-core/nouveau_mem.c1
l---------bsd-core/nouveau_notifier.c1
l---------bsd-core/nouveau_object.c1
l---------bsd-core/nouveau_reg.h1
-rw-r--r--bsd-core/nouveau_sgdma.c357
l---------bsd-core/nouveau_state.c1
l---------bsd-core/nouveau_swmthd.c1
l---------bsd-core/nouveau_swmthd.h1
l---------bsd-core/nv04_fb.c1
l---------bsd-core/nv04_fifo.c1
l---------bsd-core/nv04_graph.c1
l---------bsd-core/nv04_instmem.c1
l---------bsd-core/nv04_mc.c1
l---------bsd-core/nv04_timer.c1
l---------bsd-core/nv10_fb.c1
l---------bsd-core/nv10_fifo.c1
l---------bsd-core/nv10_graph.c1
l---------bsd-core/nv20_graph.c1
l---------bsd-core/nv40_fb.c1
l---------bsd-core/nv40_fifo.c1
l---------bsd-core/nv40_graph.c1
l---------bsd-core/nv40_mc.c1
l---------bsd-core/nv50_fifo.c1
l---------bsd-core/nv50_graph.c1
l---------bsd-core/nv50_grctx.h1
l---------bsd-core/nv50_instmem.c1
l---------bsd-core/nv50_mc.c1
-rw-r--r--bsd-core/r128/Makefile23
l---------bsd-core/r128_cce.c1
l---------bsd-core/r128_drm.h1
-rw-r--r--bsd-core/r128_drv.c133
l---------bsd-core/r128_drv.h1
l---------bsd-core/r128_irq.c1
l---------bsd-core/r128_state.c1
l---------bsd-core/r300_cmdbuf.c1
l---------bsd-core/r300_reg.h1
-rw-r--r--bsd-core/radeon/Makefile28
l---------bsd-core/radeon_cp.c1
l---------bsd-core/radeon_drm.h1
-rw-r--r--bsd-core/radeon_drv.c132
l---------bsd-core/radeon_drv.h1
l---------bsd-core/radeon_irq.c1
l---------bsd-core/radeon_mem.c1
l---------bsd-core/radeon_microcode.h1
l---------bsd-core/radeon_state.c1
-rw-r--r--bsd-core/savage/Makefile23
l---------bsd-core/savage_bci.c1
l---------bsd-core/savage_drm.h1
-rw-r--r--bsd-core/savage_drv.c118
l---------bsd-core/savage_drv.h1
l---------bsd-core/savage_state.c1
-rw-r--r--bsd-core/sis/Makefile23
l---------bsd-core/sis_drm.h1
-rw-r--r--bsd-core/sis_drv.c112
l---------bsd-core/sis_drv.h1
l---------bsd-core/sis_ds.c1
l---------bsd-core/sis_ds.h1
l---------bsd-core/sis_mm.c1
-rw-r--r--bsd-core/tdfx/Makefile23
-rw-r--r--bsd-core/tdfx_drv.c114
l---------bsd-core/tdfx_drv.h1
-rw-r--r--bsd-core/via/Makefile24
l---------bsd-core/via_3d_reg.h1
l---------bsd-core/via_dma.c1
l---------bsd-core/via_drm.h1
-rw-r--r--bsd-core/via_drv.c121
l---------bsd-core/via_drv.h1
l---------bsd-core/via_ds.c1
l---------bsd-core/via_ds.h1
l---------bsd-core/via_irq.c1
l---------bsd-core/via_map.c1
l---------bsd-core/via_mm.c1
l---------bsd-core/via_mm.h1
l---------bsd-core/via_verifier.c1
l---------bsd-core/via_verifier.h1
l---------bsd-core/via_video.c1
-rw-r--r--linux-core/.gitignore1
-rw-r--r--linux-core/Config.in17
-rw-r--r--linux-core/Doxyfile1161
-rw-r--r--linux-core/Kconfig83
-rw-r--r--linux-core/Makefile336
-rw-r--r--linux-core/Makefile.kernel63
-rw-r--r--linux-core/README.drm25
-rw-r--r--linux-core/ati_pcigart.c199
-rw-r--r--linux-core/drm-gem.txt805
l---------linux-core/drm.h1
-rw-r--r--linux-core/drmP.h1480
-rw-r--r--linux-core/drm_agpsupport.c509
-rw-r--r--linux-core/drm_auth.c189
-rw-r--r--linux-core/drm_bufs.c1608
-rw-r--r--linux-core/drm_compat.c153
-rw-r--r--linux-core/drm_compat.h221
-rw-r--r--linux-core/drm_context.c472
-rw-r--r--linux-core/drm_core.h35
-rw-r--r--linux-core/drm_dma.c179
-rw-r--r--linux-core/drm_drawable.c192
-rw-r--r--linux-core/drm_drv.c655
-rw-r--r--linux-core/drm_fops.c497
-rw-r--r--linux-core/drm_gem.c444
-rw-r--r--linux-core/drm_hashtab.c202
-rw-r--r--linux-core/drm_hashtab.h67
l---------linux-core/drm_internal.h1
-rw-r--r--linux-core/drm_ioc32.c1073
-rw-r--r--linux-core/drm_ioctl.c351
-rw-r--r--linux-core/drm_irq.c769
-rw-r--r--linux-core/drm_lock.c389
-rw-r--r--linux-core/drm_memory.c366
-rw-r--r--linux-core/drm_memory.h61
-rw-r--r--linux-core/drm_memory_debug.c399
-rw-r--r--linux-core/drm_memory_debug.h379
-rw-r--r--linux-core/drm_mm.c298
l---------linux-core/drm_mode.h1
-rw-r--r--linux-core/drm_os_linux.h137
-rw-r--r--linux-core/drm_pci.c177
-rw-r--r--linux-core/drm_proc.c641
-rw-r--r--linux-core/drm_regman.c200
l---------linux-core/drm_sarea.h1
-rw-r--r--linux-core/drm_scatter.c228
-rw-r--r--linux-core/drm_sman.c353
-rw-r--r--linux-core/drm_sman.h176
-rw-r--r--linux-core/drm_stub.c375
-rw-r--r--linux-core/drm_sysfs.c216
-rw-r--r--linux-core/drm_vm.c672
-rw-r--r--linux-core/drm_vm_nopage_compat.c267
-rw-r--r--linux-core/ffb_context.c582
-rw-r--r--linux-core/ffb_drv.c329
-rw-r--r--linux-core/ffb_drv.h284
-rw-r--r--linux-core/i810_dma.c1301
-rw-r--r--linux-core/i810_drm.h263
-rw-r--r--linux-core/i810_drv.c104
-rw-r--r--linux-core/i810_drv.h242
-rw-r--r--linux-core/imagine_drv.c85
l---------linux-core/linux1
l---------linux-core/mach64_dma.c1
l---------linux-core/mach64_drm.h1
-rw-r--r--linux-core/mach64_drv.c105
l---------linux-core/mach64_drv.h1
l---------linux-core/mach64_irq.c1
l---------linux-core/mach64_state.c1
l---------linux-core/mga_dma.c1
l---------linux-core/mga_drm.h1
-rw-r--r--linux-core/mga_drv.c152
l---------linux-core/mga_drv.h1
-rw-r--r--linux-core/mga_ioc32.c234
l---------linux-core/mga_irq.c1
l---------linux-core/mga_state.c1
l---------linux-core/mga_ucode.h1
l---------linux-core/mga_warp.c1
-rw-r--r--linux-core/nouveau_backlight.c268
-rw-r--r--linux-core/nouveau_bo.c296
l---------linux-core/nouveau_dma.c1
l---------linux-core/nouveau_dma.h1
l---------linux-core/nouveau_drm.h1
-rw-r--r--linux-core/nouveau_drv.c120
l---------linux-core/nouveau_drv.h1
-rw-r--r--linux-core/nouveau_fence.c119
l---------linux-core/nouveau_fifo.c1
-rw-r--r--linux-core/nouveau_ioc32.c72
l---------linux-core/nouveau_irq.c1
l---------linux-core/nouveau_mem.c1
l---------linux-core/nouveau_notifier.c1
l---------linux-core/nouveau_object.c1
l---------linux-core/nouveau_reg.h1
-rw-r--r--linux-core/nouveau_sgdma.c345
l---------linux-core/nouveau_state.c1
l---------linux-core/nouveau_swmthd.c1
l---------linux-core/nouveau_swmthd.h1
l---------linux-core/nv04_fb.c1
l---------linux-core/nv04_fifo.c1
l---------linux-core/nv04_graph.c1
l---------linux-core/nv04_instmem.c1
l---------linux-core/nv04_mc.c1
l---------linux-core/nv04_timer.c1
l---------linux-core/nv10_fb.c1
l---------linux-core/nv10_fifo.c1
l---------linux-core/nv10_graph.c1
l---------linux-core/nv20_graph.c1
l---------linux-core/nv40_fb.c1
l---------linux-core/nv40_fifo.c1
l---------linux-core/nv40_graph.c1
l---------linux-core/nv40_mc.c1
l---------linux-core/nv50_fifo.c1
l---------linux-core/nv50_graph.c1
l---------linux-core/nv50_grctx.h1
l---------linux-core/nv50_instmem.c1
l---------linux-core/nv50_mc.c1
l---------linux-core/r128_cce.c1
l---------linux-core/r128_drm.h1
-rw-r--r--linux-core/r128_drv.c113
l---------linux-core/r128_drv.h1
-rw-r--r--linux-core/r128_ioc32.c222
l---------linux-core/r128_irq.c1
l---------linux-core/r128_state.c1
l---------linux-core/r300_cmdbuf.c1
l---------linux-core/r300_reg.h1
l---------linux-core/radeon_cp.c1
l---------linux-core/radeon_drm.h1
-rw-r--r--linux-core/radeon_drv.c157
l---------linux-core/radeon_drv.h1
-rw-r--r--linux-core/radeon_ioc32.c424
l---------linux-core/radeon_irq.c1
l---------linux-core/radeon_mem.c1
l---------linux-core/radeon_microcode.h1
l---------linux-core/radeon_state.c1
l---------linux-core/savage_bci.c1
l---------linux-core/savage_drm.h1
-rw-r--r--linux-core/savage_drv.c96
l---------linux-core/savage_drv.h1
l---------linux-core/savage_state.c1
l---------linux-core/sis_drm.h1
-rw-r--r--linux-core/sis_drv.c127
l---------linux-core/sis_drv.h1
-rw-r--r--linux-core/sis_mm.c332
-rw-r--r--linux-core/tdfx_drv.c93
l---------linux-core/tdfx_drv.h1
l---------linux-core/via_3d_reg.h1
l---------linux-core/via_dma.c1
-rw-r--r--linux-core/via_dmablit.c817
-rw-r--r--linux-core/via_dmablit.h140
l---------linux-core/via_drm.h1
l---------linux-core/via_drv.c1
l---------linux-core/via_drv.h1
l---------linux-core/via_irq.c1
l---------linux-core/via_map.c1
-rw-r--r--linux-core/via_mm.c196
l---------linux-core/via_verifier.c1
l---------linux-core/via_verifier.h1
l---------linux-core/via_video.c1
-rw-r--r--linux-core/xgi_cmdlist.c325
-rw-r--r--linux-core/xgi_cmdlist.h66
l---------linux-core/xgi_drm.h1
-rw-r--r--linux-core/xgi_drv.c430
-rw-r--r--linux-core/xgi_drv.h118
-rw-r--r--linux-core/xgi_fb.c130
-rw-r--r--linux-core/xgi_fence.c99
-rw-r--r--linux-core/xgi_ioc32.c140
-rw-r--r--linux-core/xgi_misc.c477
-rw-r--r--linux-core/xgi_misc.h37
-rw-r--r--linux-core/xgi_pcie.c127
-rw-r--r--linux-core/xgi_regs.h169
-rw-r--r--scripts/create_bsd_pci_lists.sh40
-rw-r--r--scripts/create_linux_pci_lists.sh40
-rwxr-xr-xscripts/create_lk_drm.sh37
-rwxr-xr-xscripts/create_lk_gpu.sh58
-rwxr-xr-xscripts/drm-scripts-gentree.pl254
-rw-r--r--shared-core/Makefile.am41
-rw-r--r--shared-core/drm.h887
-rw-r--r--shared-core/drm_internal.h40
-rw-r--r--shared-core/drm_mode.h273
-rw-r--r--shared-core/drm_pciids.txt594
-rw-r--r--shared-core/drm_sarea.h84
-rw-r--r--shared-core/i915_dma.c1030
-rw-r--r--shared-core/i915_drm.h817
-rw-r--r--shared-core/i915_drv.h667
-rw-r--r--shared-core/i915_irq.c534
-rw-r--r--shared-core/i915_mem.c386
-rw-r--r--shared-core/i915_reg.h1422
-rw-r--r--shared-core/i915_suspend.c520
-rw-r--r--shared-core/imagine_drv.h43
-rw-r--r--shared-core/mach64_dma.c1778
-rw-r--r--shared-core/mach64_drm.h256
-rw-r--r--shared-core/mach64_drv.h860
-rw-r--r--shared-core/mach64_irq.c159
-rw-r--r--shared-core/mach64_state.c910
-rw-r--r--shared-core/mga_dma.c1169
-rw-r--r--shared-core/mga_drm.h425
-rw-r--r--shared-core/mga_drv.h691
-rw-r--r--shared-core/mga_irq.c177
-rw-r--r--shared-core/mga_state.c1139
-rw-r--r--shared-core/mga_ucode.h11645
-rw-r--r--shared-core/mga_warp.c198
-rw-r--r--shared-core/nouveau_dma.c173
-rw-r--r--shared-core/nouveau_dma.h96
-rw-r--r--shared-core/nouveau_drm.h220
-rw-r--r--shared-core/nouveau_drv.h626
-rw-r--r--shared-core/nouveau_fifo.c602
-rw-r--r--shared-core/nouveau_irq.c588
-rw-r--r--shared-core/nouveau_mem.c910
-rw-r--r--shared-core/nouveau_notifier.c165
-rw-r--r--shared-core/nouveau_object.c1173
-rw-r--r--shared-core/nouveau_reg.h601
-rw-r--r--shared-core/nouveau_state.c897
-rw-r--r--shared-core/nouveau_swmthd.c191
-rw-r--r--shared-core/nouveau_swmthd.h33
-rw-r--r--shared-core/nv04_fb.c23
-rw-r--r--shared-core/nv04_fifo.c138
-rw-r--r--shared-core/nv04_graph.c516
-rw-r--r--shared-core/nv04_instmem.c159
-rw-r--r--shared-core/nv04_mc.c22
-rw-r--r--shared-core/nv04_timer.c53
-rw-r--r--shared-core/nv10_fb.c25
-rw-r--r--shared-core/nv10_fifo.c169
-rw-r--r--shared-core/nv10_graph.c914
-rw-r--r--shared-core/nv20_graph.c913
-rw-r--r--shared-core/nv40_fb.c62
-rw-r--r--shared-core/nv40_fifo.c209
-rw-r--r--shared-core/nv40_graph.c2190
-rw-r--r--shared-core/nv40_mc.c38
-rw-r--r--shared-core/nv50_fifo.c343
-rw-r--r--shared-core/nv50_graph.c338
-rw-r--r--shared-core/nv50_grctx.h20935
-rw-r--r--shared-core/nv50_instmem.c331
-rw-r--r--shared-core/nv50_mc.c43
-rw-r--r--shared-core/r128_cce.c933
-rw-r--r--shared-core/r128_drm.h326
-rw-r--r--shared-core/r128_drv.h526
-rw-r--r--shared-core/r128_irq.c116
-rw-r--r--shared-core/r128_state.c1681
-rw-r--r--shared-core/r300_cmdbuf.c1198
-rw-r--r--shared-core/r300_reg.h1778
-rw-r--r--shared-core/r600_microcode.h14275
-rw-r--r--shared-core/radeon_cp.c1793
-rw-r--r--shared-core/radeon_drm.h907
-rw-r--r--shared-core/radeon_drv.h1470
-rw-r--r--shared-core/radeon_irq.c415
-rw-r--r--shared-core/radeon_mem.c302
-rw-r--r--shared-core/radeon_microcode.h1844
-rw-r--r--shared-core/radeon_state.c3263
-rw-r--r--shared-core/savage_bci.c1092
-rw-r--r--shared-core/savage_drm.h209
-rw-r--r--shared-core/savage_drv.h575
-rw-r--r--shared-core/savage_state.c1165
-rw-r--r--shared-core/sis_drm.h67
-rw-r--r--shared-core/sis_drv.h90
-rw-r--r--shared-core/sis_ds.c299
-rw-r--r--shared-core/sis_ds.h146
-rw-r--r--shared-core/sis_mm.c386
-rw-r--r--shared-core/tdfx_drv.h47
-rw-r--r--shared-core/via_3d_reg.h1650
-rw-r--r--shared-core/via_dma.c763
-rw-r--r--shared-core/via_drm.h282
-rw-r--r--shared-core/via_drv.c117
-rw-r--r--shared-core/via_drv.h197
-rw-r--r--shared-core/via_ds.c274
-rw-r--r--shared-core/via_ds.h104
-rw-r--r--shared-core/via_irq.c402
-rw-r--r--shared-core/via_map.c139
-rw-r--r--shared-core/via_mm.c347
-rw-r--r--shared-core/via_mm.h40
-rw-r--r--shared-core/via_verifier.c1121
-rw-r--r--shared-core/via_verifier.h62
-rw-r--r--shared-core/via_video.c93
-rw-r--r--shared-core/xgi_drm.h137
404 files changed, 0 insertions, 137098 deletions
diff --git a/bsd-core/Makefile b/bsd-core/Makefile
deleted file mode 100644
index 0e0332df..00000000
--- a/bsd-core/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-SHARED= ../shared-core
-
-SUBDIR = drm mach64 mga r128 radeon savage sis tdfx i915 #nouveau
-
-.include <bsd.obj.mk>
-
-depend: drm_pciids.h
-all: drm_pciids.h
-
-drm_pciids.h: ${SHARED}/drm_pciids.txt
- sh ../scripts/create_bsd_pci_lists.sh < ${SHARED}/drm_pciids.txt
diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c
deleted file mode 100644
index bae10a69..00000000
--- a/bsd-core/ati_pcigart.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file ati_pcigart.c
- * Implementation of ATI's PCIGART, which provides an aperture in card virtual
- * address space with addresses remapped to system memory.
- */
-
-#include "drmP.h"
-
-#define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
-#define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1))
-
-#define ATI_PCIE_WRITE 0x4
-#define ATI_PCIE_READ 0x8
-
-static void
-drm_ati_alloc_pcigart_table_cb(void *arg, bus_dma_segment_t *segs,
- int nsegs, int error)
-{
- struct drm_dma_handle *dmah = arg;
-
- if (error != 0)
- return;
-
- KASSERT(nsegs == 1,
- ("drm_ati_alloc_pcigart_table_cb: bad dma segment count"));
-
- dmah->busaddr = segs[0].ds_addr;
-}
-
-static int
-drm_ati_alloc_pcigart_table(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- struct drm_dma_handle *dmah;
- int flags, ret;
-
- dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA,
- M_ZERO | M_NOWAIT);
- if (dmah == NULL)
- return ENOMEM;
-
- DRM_UNLOCK();
- ret = bus_dma_tag_create(NULL, PAGE_SIZE, 0, /* tag, align, boundary */
- gart_info->table_mask, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
- NULL, NULL, /* filtfunc, filtfuncargs */
- gart_info->table_size, 1, /* maxsize, nsegs */
- gart_info->table_size, /* maxsegsize */
- BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */
- &dmah->tag);
- if (ret != 0) {
- free(dmah, DRM_MEM_DMA);
- return ENOMEM;
- }
-
- flags = BUS_DMA_NOWAIT | BUS_DMA_ZERO;
- if (gart_info->gart_reg_if == DRM_ATI_GART_IGP)
- flags |= BUS_DMA_NOCACHE;
-
- ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, flags, &dmah->map);
- if (ret != 0) {
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- return ENOMEM;
- }
- DRM_LOCK();
-
- ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr,
- gart_info->table_size, drm_ati_alloc_pcigart_table_cb, dmah, 0);
- if (ret != 0) {
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- return ENOMEM;
- }
-
- dev->sg->dmah = dmah;
-
- return 0;
-}
-
-static void
-drm_ati_free_pcigart_table(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- struct drm_dma_handle *dmah = dev->sg->dmah;
-
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- dev->sg->dmah = NULL;
-}
-
-int
-drm_ati_pcigart_cleanup(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- /* we need to support large memory configurations */
- if (dev->sg == NULL) {
- DRM_ERROR("no scatter/gather memory!\n");
- return 0;
- }
-
- if (gart_info->bus_addr) {
- if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
- gart_info->bus_addr = 0;
- if (dev->sg->dmah)
- drm_ati_free_pcigart_table(dev, gart_info);
- }
- }
-
- return 1;
-}
-
-int
-drm_ati_pcigart_init(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- void *address = NULL;
- unsigned long pages;
- u32 *pci_gart, page_base;
- dma_addr_t bus_address = 0;
- dma_addr_t entry_addr;
- int i, j, ret = 0;
- int max_pages;
-
- /* we need to support large memory configurations */
- if (dev->sg == NULL) {
- DRM_ERROR("no scatter/gather memory!\n");
- goto done;
- }
-
- if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
- DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
-
- ret = drm_ati_alloc_pcigart_table(dev, gart_info);
- if (ret) {
- DRM_ERROR("cannot allocate PCI GART page!\n");
- goto done;
- }
-
- address = (void *)dev->sg->dmah->vaddr;
- bus_address = dev->sg->dmah->busaddr;
- } else {
- address = gart_info->addr;
- bus_address = gart_info->bus_addr;
- DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n",
- (unsigned int)bus_address, (unsigned long)address);
- }
-
- pci_gart = (u32 *) address;
-
- max_pages = (gart_info->table_size / sizeof(u32));
- pages = (dev->sg->pages <= max_pages)
- ? dev->sg->pages : max_pages;
-
- memset(pci_gart, 0, max_pages * sizeof(u32));
-
- KASSERT(PAGE_SIZE >= ATI_PCIGART_PAGE_SIZE, ("page size too small"));
-
- for (i = 0; i < pages; i++) {
- entry_addr = dev->sg->busaddr[i];
- for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
- page_base = (u32) entry_addr & ATI_PCIGART_PAGE_MASK;
- switch(gart_info->gart_reg_if) {
- case DRM_ATI_GART_IGP:
- page_base |=
- (upper_32_bits(entry_addr) & 0xff) << 4;
- page_base |= 0xc;
- break;
- case DRM_ATI_GART_PCIE:
- page_base >>= 8;
- page_base |=
- (upper_32_bits(entry_addr) & 0xff) << 24;
- page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
- break;
- default:
- case DRM_ATI_GART_PCI:
- break;
- }
- *pci_gart = cpu_to_le32(page_base);
- pci_gart++;
- entry_addr += ATI_PCIGART_PAGE_SIZE;
- }
- }
-
- ret = 1;
-
- done:
- gart_info->addr = address;
- gart_info->bus_addr = bus_address;
- return ret;
-}
diff --git a/bsd-core/drm.h b/bsd-core/drm.h
deleted file mode 120000
index 29636692..00000000
--- a/bsd-core/drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/drm.h \ No newline at end of file
diff --git a/bsd-core/drm/Makefile b/bsd-core/drm/Makefile
deleted file mode 100644
index 7a7ccd90..00000000
--- a/bsd-core/drm/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = drm
-NO_MAN = YES
-SRCS = \
- ati_pcigart.c \
- drm_agpsupport.c \
- drm_auth.c \
- drm_bufs.c \
- drm_context.c \
- drm_dma.c \
- drm_drawable.c \
- drm_drv.c \
- drm_fops.c \
- drm_ioctl.c \
- drm_irq.c \
- drm_lock.c \
- drm_memory.c \
- drm_pci.c \
- drm_scatter.c \
- drm_sysctl.c \
- drm_vm.c
-
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
deleted file mode 100644
index affc0a8d..00000000
--- a/bsd-core/drmP.h
+++ /dev/null
@@ -1,1019 +0,0 @@
-/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef _DRM_P_H_
-#define _DRM_P_H_
-
-#if defined(_KERNEL) || defined(__KERNEL__)
-
-struct drm_device;
-struct drm_file;
-
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/stat.h>
-#if __FreeBSD_version >= 700000
-#include <sys/priv.h>
-#endif
-#include <sys/proc.h>
-#include <sys/lock.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <sys/filio.h>
-#include <sys/sysctl.h>
-#include <sys/bus.h>
-#include <sys/signalvar.h>
-#include <sys/poll.h>
-#include <sys/tree.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_map.h>
-#include <vm/vm_param.h>
-#include <machine/param.h>
-#include <machine/pmap.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <sys/endian.h>
-#include <sys/mman.h>
-#include <sys/rman.h>
-#include <sys/memrange.h>
-#if __FreeBSD_version >= 800004
-#include <dev/agp/agpvar.h>
-#else /* __FreeBSD_version >= 800004 */
-#include <pci/agpvar.h>
-#endif /* __FreeBSD_version >= 800004 */
-#include <sys/agpio.h>
-#include <sys/mutex.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <sys/selinfo.h>
-#include <sys/bus.h>
-
-#include "drm.h"
-#include "drm_linux_list.h"
-#include "drm_atomic.h"
-#include "drm_internal.h"
-
-#include <opt_drm.h>
-#ifdef DRM_DEBUG
-#undef DRM_DEBUG
-#define DRM_DEBUG_DEFAULT_ON 1
-#endif /* DRM_DEBUG */
-
-#if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <machine/../linux/linux.h>
-#include <machine/../linux/linux_proto.h>
-#else
-/* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
- * supported on this OS yet.
- */
-#undef DRM_LINUX
-#define DRM_LINUX 0
-#endif
-
-/* driver capabilities and requirements mask */
-#define DRIVER_USE_AGP 0x1
-#define DRIVER_REQUIRE_AGP 0x2
-#define DRIVER_USE_MTRR 0x4
-#define DRIVER_PCI_DMA 0x8
-#define DRIVER_SG 0x10
-#define DRIVER_HAVE_DMA 0x20
-#define DRIVER_HAVE_IRQ 0x40
-#define DRIVER_DMA_QUEUE 0x100
-
-
-#define DRM_HASH_SIZE 16 /* Size of key hash table */
-#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
-#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
-
-MALLOC_DECLARE(DRM_MEM_DMA);
-MALLOC_DECLARE(DRM_MEM_SAREA);
-MALLOC_DECLARE(DRM_MEM_DRIVER);
-MALLOC_DECLARE(DRM_MEM_MAGIC);
-MALLOC_DECLARE(DRM_MEM_IOCTLS);
-MALLOC_DECLARE(DRM_MEM_MAPS);
-MALLOC_DECLARE(DRM_MEM_BUFS);
-MALLOC_DECLARE(DRM_MEM_SEGS);
-MALLOC_DECLARE(DRM_MEM_PAGES);
-MALLOC_DECLARE(DRM_MEM_FILES);
-MALLOC_DECLARE(DRM_MEM_QUEUES);
-MALLOC_DECLARE(DRM_MEM_CMDS);
-MALLOC_DECLARE(DRM_MEM_MAPPINGS);
-MALLOC_DECLARE(DRM_MEM_BUFLISTS);
-MALLOC_DECLARE(DRM_MEM_AGPLISTS);
-MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
-MALLOC_DECLARE(DRM_MEM_SGLISTS);
-MALLOC_DECLARE(DRM_MEM_DRAWABLE);
-
-#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
-
- /* Internal types and structures */
-#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#define DRM_MIN(a,b) ((a)<(b)?(a):(b))
-#define DRM_MAX(a,b) ((a)>(b)?(a):(b))
-
-#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
-
-#define __OS_HAS_AGP 1
-
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-#define DRM_DEV_UID 0
-#define DRM_DEV_GID 0
-
-#define wait_queue_head_t atomic_t
-#define DRM_WAKEUP(w) wakeup((void *)w)
-#define DRM_WAKEUP_INT(w) wakeup(w)
-#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
-
-#define DRM_CURPROC curthread
-#define DRM_STRUCTPROC struct thread
-#define DRM_SPINTYPE struct mtx
-#define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
-#define DRM_SPINUNINIT(l) mtx_destroy(l)
-#define DRM_SPINLOCK(l) mtx_lock(l)
-#define DRM_SPINUNLOCK(u) mtx_unlock(u)
-#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
- mtx_lock(l); \
- (void)irqflags; \
-} while (0)
-#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
-#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
-#define DRM_CURRENTPID curthread->td_proc->p_pid
-#define DRM_LOCK() mtx_lock(&dev->dev_lock)
-#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
-#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
-
-#define DRM_IRQ_ARGS void *arg
-typedef void irqreturn_t;
-#define IRQ_HANDLED /* nothing */
-#define IRQ_NONE /* nothing */
-
-enum {
- DRM_IS_NOT_AGP,
- DRM_IS_AGP,
- DRM_MIGHT_BE_AGP
-};
-#define DRM_AGP_MEM struct agp_memory_info
-
-#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
-
-#define PAGE_ALIGN(addr) round_page(addr)
-/* DRM_SUSER returns true if the user is superuser */
-#if __FreeBSD_version >= 700000
-#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
-#else
-#define DRM_SUSER(p) (suser(p) == 0)
-#endif
-#define DRM_AGP_FIND_DEVICE() agp_find_device()
-#define DRM_MTRR_WC MDF_WRITECOMBINE
-#define jiffies ticks
-
-typedef unsigned long dma_addr_t;
-typedef u_int64_t u64;
-typedef u_int32_t u32;
-typedef u_int16_t u16;
-typedef u_int8_t u8;
-
-/* DRM_READMEMORYBARRIER() prevents reordering of reads.
- * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
- * DRM_MEMORYBARRIER() prevents reordering of reads and writes.
- */
-#if defined(__i386__)
-#define DRM_READMEMORYBARRIER() __asm __volatile( \
- "lock; addl $0,0(%%esp)" : : : "memory");
-#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
-#define DRM_MEMORYBARRIER() __asm __volatile( \
- "lock; addl $0,0(%%esp)" : : : "memory");
-#elif defined(__alpha__)
-#define DRM_READMEMORYBARRIER() alpha_mb();
-#define DRM_WRITEMEMORYBARRIER() alpha_wmb();
-#define DRM_MEMORYBARRIER() alpha_mb();
-#elif defined(__amd64__)
-#define DRM_READMEMORYBARRIER() __asm __volatile( \
- "lock; addl $0,0(%%rsp)" : : : "memory");
-#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
-#define DRM_MEMORYBARRIER() __asm __volatile( \
- "lock; addl $0,0(%%rsp)" : : : "memory");
-#endif
-
-#define DRM_READ8(map, offset) \
- *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_READ16(map, offset) \
- *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_READ32(map, offset) \
- *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset))
-#define DRM_WRITE8(map, offset, val) \
- *(volatile u_int8_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-#define DRM_WRITE16(map, offset, val) \
- *(volatile u_int16_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-#define DRM_WRITE32(map, offset, val) \
- *(volatile u_int32_t *)(((vm_offset_t)(map)->handle) + \
- (vm_offset_t)(offset)) = val
-
-#define DRM_VERIFYAREA_READ( uaddr, size ) \
- (!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
-
-#define DRM_COPY_TO_USER(user, kern, size) \
- copyout(kern, user, size)
-#define DRM_COPY_FROM_USER(kern, user, size) \
- copyin(user, kern, size)
-#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
- copyin(arg2, arg1, arg3)
-#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
- copyout(arg2, arg1, arg3)
-#define DRM_GET_USER_UNCHECKED(val, uaddr) \
- ((val) = fuword32(uaddr), 0)
-
-#define cpu_to_le32(x) htole32(x)
-#define le32_to_cpu(x) le32toh(x)
-
-#define DRM_HZ hz
-#define DRM_UDELAY(udelay) DELAY(udelay)
-#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
-
-#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
- (_map) = (_dev)->context_sareas[_ctx]; \
-} while(0)
-
-#define LOCK_TEST_WITH_RETURN(dev, file_priv) \
-do { \
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
- dev->lock.file_priv != file_priv) { \
- DRM_ERROR("%s called without lock held\n", \
- __FUNCTION__); \
- return EINVAL; \
- } \
-} while (0)
-
-/* Returns -errno to shared code */
-#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
-for ( ret = 0 ; !ret && !(condition) ; ) { \
- DRM_UNLOCK(); \
- mtx_lock(&dev->irq_lock); \
- if (!(condition)) \
- ret = -mtx_sleep(&(queue), &dev->irq_lock, \
- PCATCH, "drmwtq", (timeout)); \
- mtx_unlock(&dev->irq_lock); \
- DRM_LOCK(); \
-}
-
-#define DRM_ERROR(fmt, ...) \
- printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
- DRM_CURRENTPID, __func__ , ##__VA_ARGS__)
-
-#define DRM_INFO(fmt, ...) printf("info: [" DRM_NAME "] " fmt , ##__VA_ARGS__)
-
-#define DRM_DEBUG(fmt, ...) do { \
- if (drm_debug_flag) \
- printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \
- __func__ , ##__VA_ARGS__); \
-} while (0)
-
-typedef struct drm_pci_id_list
-{
- int vendor;
- int device;
- long driver_private;
- char *name;
-} drm_pci_id_list_t;
-
-struct drm_msi_blacklist_entry
-{
- int vendor;
- int device;
-};
-
-#define DRM_AUTH 0x1
-#define DRM_MASTER 0x2
-#define DRM_ROOT_ONLY 0x4
-typedef struct drm_ioctl_desc {
- unsigned long cmd;
- int (*func)(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
- int flags;
-} drm_ioctl_desc_t;
-/**
- * Creates a driver or general drm_ioctl_desc array entry for the given
- * ioctl, for use by drm_ioctl().
- */
-#define DRM_IOCTL_DEF(ioctl, func, flags) \
- [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
-
-typedef struct drm_magic_entry {
- drm_magic_t magic;
- struct drm_file *priv;
- struct drm_magic_entry *next;
-} drm_magic_entry_t;
-
-typedef struct drm_magic_head {
- struct drm_magic_entry *head;
- struct drm_magic_entry *tail;
-} drm_magic_head_t;
-
-typedef struct drm_buf {
- int idx; /* Index into master buflist */
- int total; /* Buffer size */
- int order; /* log-base-2(total) */
- int used; /* Amount of buffer in use (for DMA) */
- unsigned long offset; /* Byte offset (used internally) */
- void *address; /* Address of buffer */
- unsigned long bus_address; /* Bus address of buffer */
- struct drm_buf *next; /* Kernel-only: used for free list */
- __volatile__ int pending; /* On hardware DMA queue */
- struct drm_file *file_priv; /* Unique identifier of holding process */
- int context; /* Kernel queue for this buffer */
- enum {
- DRM_LIST_NONE = 0,
- DRM_LIST_FREE = 1,
- DRM_LIST_WAIT = 2,
- DRM_LIST_PEND = 3,
- DRM_LIST_PRIO = 4,
- DRM_LIST_RECLAIM = 5
- } list; /* Which list we're on */
-
- int dev_priv_size; /* Size of buffer private stoarge */
- void *dev_private; /* Per-buffer private storage */
-} drm_buf_t;
-
-typedef struct drm_freelist {
- int initialized; /* Freelist in use */
- atomic_t count; /* Number of free buffers */
- drm_buf_t *next; /* End pointer */
-
- int low_mark; /* Low water mark */
- int high_mark; /* High water mark */
-} drm_freelist_t;
-
-typedef struct drm_dma_handle {
- void *vaddr;
- bus_addr_t busaddr;
- bus_dma_tag_t tag;
- bus_dmamap_t map;
-} drm_dma_handle_t;
-
-typedef struct drm_buf_entry {
- int buf_size;
- int buf_count;
- drm_buf_t *buflist;
- int seg_count;
- drm_dma_handle_t **seglist;
- int page_order;
-
- drm_freelist_t freelist;
-} drm_buf_entry_t;
-
-typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
-struct drm_file {
- TAILQ_ENTRY(drm_file) link;
- struct drm_device *dev;
- int authenticated;
- int master;
- int minor;
- pid_t pid;
- uid_t uid;
- drm_magic_t magic;
- unsigned long ioctl_count;
- void *driver_priv;
-};
-
-typedef struct drm_lock_data {
- struct drm_hw_lock *hw_lock; /* Hardware lock */
- struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
- int lock_queue; /* Queue of blocked processes */
- unsigned long lock_time; /* Time of last lock in jiffies */
-} drm_lock_data_t;
-
-/* This structure, in the struct drm_device, is always initialized while the
- * device
- * is open. dev->dma_lock protects the incrementing of dev->buf_use, which
- * when set marks that no further bufs may be allocated until device teardown
- * occurs (when the last open of the device has closed). The high/low
- * watermarks of bufs are only touched by the X Server, and thus not
- * concurrently accessed, so no locking is needed.
- */
-typedef struct drm_device_dma {
- drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
- int buf_count;
- drm_buf_t **buflist; /* Vector of pointers info bufs */
- int seg_count;
- int page_count;
- unsigned long *pagelist;
- unsigned long byte_count;
- enum {
- _DRM_DMA_USE_AGP = 0x01,
- _DRM_DMA_USE_SG = 0x02
- } flags;
-} drm_device_dma_t;
-
-typedef struct drm_agp_mem {
- void *handle;
- unsigned long bound; /* address */
- int pages;
- struct drm_agp_mem *prev;
- struct drm_agp_mem *next;
-} drm_agp_mem_t;
-
-typedef struct drm_agp_head {
- device_t agpdev;
- struct agp_info info;
- const char *chipset;
- drm_agp_mem_t *memory;
- unsigned long mode;
- int enabled;
- int acquired;
- unsigned long base;
- int mtrr;
- int cant_use_aperture;
- unsigned long page_mask;
-} drm_agp_head_t;
-
-typedef struct drm_sg_mem {
- unsigned long handle;
- void *virtual;
- int pages;
- dma_addr_t *busaddr;
- struct drm_dma_handle *sg_dmah; /* Handle for sg_pages */
- struct drm_dma_handle *dmah; /* Handle to PCI memory */
- /* for ATI PCIGART table */
-} drm_sg_mem_t;
-
-typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
-
-typedef struct drm_local_map {
- unsigned long offset; /* Physical address (0 for SAREA)*/
- unsigned long size; /* Physical size (bytes) */
- enum drm_map_type type; /* Type of memory mapped */
- enum drm_map_flags flags; /* Flags */
- void *handle; /* User-space: "Handle" to pass to mmap */
- /* Kernel-space: kernel-virtual address */
- int mtrr; /* Boolean: MTRR used */
- /* Private data */
- int rid; /* PCI resource ID for bus_space */
- struct resource *bsr;
- bus_space_tag_t bst;
- bus_space_handle_t bsh;
- drm_dma_handle_t *dmah;
- TAILQ_ENTRY(drm_local_map) link;
-} drm_local_map_t;
-
-TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig);
-typedef struct drm_vbl_sig {
- TAILQ_ENTRY(drm_vbl_sig) link;
- unsigned int sequence;
- int signo;
- int pid;
-} drm_vbl_sig_t;
-
-struct drm_vblank_info {
- wait_queue_head_t queue; /* vblank wait queue */
- atomic_t count; /* number of VBLANK interrupts */
- /* (driver must alloc the right number of counters) */
- struct drm_vbl_sig_list sigs; /* signal list to send on VBLANK */
- atomic_t refcount; /* number of users of vblank interrupts */
- u32 last; /* protected by dev->vbl_lock, used */
- /* for wraparound handling */
- int enabled; /* so we don't call enable more than */
- /* once per disable */
- int inmodeset; /* Display driver is setting mode */
-};
-
-/* location of GART table */
-#define DRM_ATI_GART_MAIN 1
-#define DRM_ATI_GART_FB 2
-
-#define DRM_ATI_GART_PCI 1
-#define DRM_ATI_GART_PCIE 2
-#define DRM_ATI_GART_IGP 3
-
-struct drm_ati_pcigart_info {
- int gart_table_location;
- int gart_reg_if;
- void *addr;
- dma_addr_t bus_addr;
- dma_addr_t table_mask;
- dma_addr_t member_mask;
- struct drm_dma_handle *table_handle;
- drm_local_map_t mapping;
- int table_size;
-};
-
-#ifndef DMA_BIT_MASK
-#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
-#endif
-
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
-
-struct drm_driver_info {
- int (*load)(struct drm_device *, unsigned long flags);
- int (*firstopen)(struct drm_device *);
- int (*open)(struct drm_device *, struct drm_file *);
- void (*preclose)(struct drm_device *, struct drm_file *file_priv);
- void (*postclose)(struct drm_device *, struct drm_file *);
- void (*lastclose)(struct drm_device *);
- int (*unload)(struct drm_device *);
- void (*reclaim_buffers_locked)(struct drm_device *,
- struct drm_file *file_priv);
- int (*dma_ioctl)(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
- void (*dma_ready)(struct drm_device *);
- int (*dma_quiescent)(struct drm_device *);
- int (*dma_flush_block_and_flush)(struct drm_device *, int context,
- enum drm_lock_flags flags);
- int (*dma_flush_unblock)(struct drm_device *, int context,
- enum drm_lock_flags flags);
- int (*context_ctor)(struct drm_device *dev, int context);
- int (*context_dtor)(struct drm_device *dev, int context);
- int (*kernel_context_switch)(struct drm_device *dev, int old,
- int new);
- int (*kernel_context_switch_unlock)(struct drm_device *dev);
- void (*irq_preinstall)(struct drm_device *dev);
- int (*irq_postinstall)(struct drm_device *dev);
- void (*irq_uninstall)(struct drm_device *dev);
- void (*irq_handler)(DRM_IRQ_ARGS);
- u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
- int (*enable_vblank)(struct drm_device *dev, int crtc);
- void (*disable_vblank)(struct drm_device *dev, int crtc);
-
- drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
-
- /**
- * Called by \c drm_device_is_agp. Typically used to determine if a
- * card is really attached to AGP or not.
- *
- * \param dev DRM device handle
- *
- * \returns
- * One of three values is returned depending on whether or not the
- * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
- * (return of 1), or may or may not be AGP (return of 2).
- */
- int (*device_is_agp) (struct drm_device * dev);
-
- drm_ioctl_desc_t *ioctls;
- int max_ioctl;
-
- int buf_priv_size;
-
- int major;
- int minor;
- int patchlevel;
- const char *name; /* Simple driver name */
- const char *desc; /* Longer driver name */
- const char *date; /* Date of last major changes. */
-
- u32 driver_features;
-};
-
-/* Length for the array of resource pointers for drm_get_resource_*. */
-#define DRM_MAX_PCI_RESOURCE 6
-
-/**
- * DRM device functions structure
- */
-struct drm_device {
- struct drm_driver_info *driver;
- drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
-
- u_int16_t pci_device; /* PCI device id */
- u_int16_t pci_vendor; /* PCI vendor id */
-
- char *unique; /* Unique identifier: e.g., busid */
- int unique_len; /* Length of unique field */
- device_t device; /* Device instance from newbus */
- struct cdev *devnode; /* Device number for mknod */
- int if_version; /* Highest interface version set */
-
- int flags; /* Flags to open(2) */
-
- /* Locks */
- struct mtx vbl_lock; /* protects vblank operations */
- struct mtx dma_lock; /* protects dev->dma */
- struct mtx irq_lock; /* protects irq condition checks */
- struct mtx dev_lock; /* protects everything else */
- DRM_SPINTYPE drw_lock;
-
- /* Usage Counters */
- int open_count; /* Outstanding files open */
- int buf_use; /* Buffers in use -- cannot alloc */
-
- /* Performance counters */
- unsigned long counters;
- enum drm_stat_type types[15];
- atomic_t counts[15];
-
- /* Authentication */
- drm_file_list_t files;
- drm_magic_head_t magiclist[DRM_HASH_SIZE];
-
- /* Linked list of mappable regions. Protected by dev_lock */
- drm_map_list_t maplist;
-
- drm_local_map_t **context_sareas;
- int max_context;
-
- drm_lock_data_t lock; /* Information on hardware lock */
-
- /* DMA queues (contexts) */
- drm_device_dma_t *dma; /* Optional pointer for DMA support */
-
- /* Context support */
- int irq; /* Interrupt used by board */
- int irq_enabled; /* True if the irq handler is enabled */
- int msi_enabled; /* MSI enabled */
- int irqrid; /* Interrupt used by board */
- struct resource *irqr; /* Resource for interrupt used by board */
- void *irqh; /* Handle from bus_setup_intr */
-
- /* Storage of resource pointers for drm_get_resource_* */
- struct resource *pcir[DRM_MAX_PCI_RESOURCE];
- int pcirid[DRM_MAX_PCI_RESOURCE];
-
- int pci_domain;
- int pci_bus;
- int pci_slot;
- int pci_func;
-
- atomic_t context_flag; /* Context swapping flag */
- int last_context; /* Last current context */
-
- int vblank_disable_allowed;
- atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */
- struct callout vblank_disable_timer;
- u32 max_vblank_count; /* size of vblank counter register */
- struct drm_vblank_info *vblank; /* per crtc vblank info */
- int num_crtcs;
-
- struct sigio *buf_sigio; /* Processes waiting for SIGIO */
-
- /* Sysctl support */
- struct drm_sysctl_info *sysctl;
-
- drm_agp_head_t *agp;
- drm_sg_mem_t *sg; /* Scatter gather memory */
- atomic_t *ctx_bitmap;
- void *dev_private;
- unsigned int agp_buffer_token;
- drm_local_map_t *agp_buffer_map;
-
- struct unrhdr *drw_unrhdr;
- /* RB tree of drawable infos */
- RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
-};
-
-static __inline__ int drm_core_check_feature(struct drm_device *dev,
- int feature)
-{
- return ((dev->driver->driver_features & feature) ? 1 : 0);
-}
-
-#if __OS_HAS_AGP
-static inline int drm_core_has_AGP(struct drm_device *dev)
-{
- return drm_core_check_feature(dev, DRIVER_USE_AGP);
-}
-#else
-#define drm_core_has_AGP(dev) (0)
-#endif
-
-extern int drm_debug_flag;
-
-/* Device setup support (drm_drv.c) */
-int drm_probe(device_t kdev, drm_pci_id_list_t *idlist);
-int drm_attach(device_t kdev, drm_pci_id_list_t *idlist);
-void drm_close(void *data);
-int drm_detach(device_t kdev);
-d_ioctl_t drm_ioctl;
-d_open_t drm_open;
-d_read_t drm_read;
-d_poll_t drm_poll;
-d_mmap_t drm_mmap;
-extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
-
-/* File operations helpers (drm_fops.c) */
-extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
- DRM_STRUCTPROC *p,
- struct drm_device *dev);
-
-/* Memory management support (drm_memory.c) */
-void drm_mem_init(void);
-void drm_mem_uninit(void);
-void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map);
-void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
-void drm_ioremapfree(drm_local_map_t *map);
-int drm_mtrr_add(unsigned long offset, size_t size, int flags);
-int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
-
-int drm_context_switch(struct drm_device *dev, int old, int new);
-int drm_context_switch_complete(struct drm_device *dev, int new);
-
-int drm_ctxbitmap_init(struct drm_device *dev);
-void drm_ctxbitmap_cleanup(struct drm_device *dev);
-void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
-int drm_ctxbitmap_next(struct drm_device *dev);
-
-/* Locking IOCTL support (drm_lock.c) */
-int drm_lock_take(struct drm_lock_data *lock_data,
- unsigned int context);
-int drm_lock_transfer(struct drm_lock_data *lock_data,
- unsigned int context);
-int drm_lock_free(struct drm_lock_data *lock_data,
- unsigned int context);
-
-/* Buffer management support (drm_bufs.c) */
-unsigned long drm_get_resource_start(struct drm_device *dev,
- unsigned int resource);
-unsigned long drm_get_resource_len(struct drm_device *dev,
- unsigned int resource);
-void drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
-int drm_order(unsigned long size);
-int drm_addmap(struct drm_device *dev, unsigned long offset,
- unsigned long size,
- enum drm_map_type type, enum drm_map_flags flags,
- drm_local_map_t **map_ptr);
-int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request);
-int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request);
-int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request);
-
-/* DMA support (drm_dma.c) */
-int drm_dma_setup(struct drm_device *dev);
-void drm_dma_takedown(struct drm_device *dev);
-void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
-void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
-#define drm_core_reclaim_buffers drm_reclaim_buffers
-
-/* IRQ support (drm_irq.c) */
-int drm_irq_install(struct drm_device *dev);
-int drm_irq_uninstall(struct drm_device *dev);
-irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
-void drm_driver_irq_preinstall(struct drm_device *dev);
-void drm_driver_irq_postinstall(struct drm_device *dev);
-void drm_driver_irq_uninstall(struct drm_device *dev);
-void drm_handle_vblank(struct drm_device *dev, int crtc);
-u32 drm_vblank_count(struct drm_device *dev, int crtc);
-int drm_vblank_get(struct drm_device *dev, int crtc);
-void drm_vblank_put(struct drm_device *dev, int crtc);
-void drm_vblank_cleanup(struct drm_device *dev);
-int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
-int drm_vblank_init(struct drm_device *dev, int num_crtcs);
-void drm_vbl_send_signals(struct drm_device *dev, int crtc);
-int drm_modeset_ctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* AGP/PCI Express/GART support (drm_agpsupport.c) */
-int drm_device_is_agp(struct drm_device *dev);
-int drm_device_is_pcie(struct drm_device *dev);
-drm_agp_head_t *drm_agp_init(void);
-int drm_agp_acquire(struct drm_device *dev);
-int drm_agp_release(struct drm_device *dev);
-int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info);
-int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
-void *drm_agp_allocate_memory(size_t pages, u32 type);
-int drm_agp_free_memory(void *handle);
-int drm_agp_bind_memory(void *handle, off_t start);
-int drm_agp_unbind_memory(void *handle);
-int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
-int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
-int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
-int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
-
-/* Scatter Gather Support (drm_scatter.c) */
-void drm_sg_cleanup(drm_sg_mem_t *entry);
-int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
-
-/* sysctl support (drm_sysctl.h) */
-extern int drm_sysctl_init(struct drm_device *dev);
-extern int drm_sysctl_cleanup(struct drm_device *dev);
-
-/* ATI PCIGART support (ati_pcigart.c) */
-int drm_ati_pcigart_init(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info);
-int drm_ati_pcigart_cleanup(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info);
-
-/* Locking IOCTL support (drm_drv.c) */
-int drm_lock(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_unlock(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_version(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_setversion(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* Misc. IOCTL support (drm_ioctl.c) */
-int drm_irq_by_busid(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_setunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getmap(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getclient(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getstats(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_noop(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* Context IOCTL support (drm_context.c) */
-int drm_resctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_addctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_modctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_switchctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_newctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_rmctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_setsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_getsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* Drawable IOCTL support (drm_drawable.c) */
-int drm_adddraw(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_rmdraw(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_update_draw(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
- int handle);
-
-/* Drawable support (drm_drawable.c) */
-void drm_drawable_free_all(struct drm_device *dev);
-
-/* Authentication IOCTL support (drm_auth.c) */
-int drm_getmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_authmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* Buffer management support (drm_bufs.c) */
-int drm_addmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_rmmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_addbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_infobufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_markbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_freebufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_mapbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* DMA support (drm_dma.c) */
-int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
-
-/* IRQ support (drm_irq.c) */
-int drm_control(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_wait_vblank(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* AGP/GART support (drm_agpsupport.c) */
-int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_release_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_info_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_free_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* Scatter Gather Support (drm_scatter.c) */
-int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_sg_free(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-/* consistent PCI memory functions (drm_pci.c) */
-drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
- size_t align, dma_addr_t maxaddr);
-void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
-
-/* Inline replacements for drm_alloc and friends */
-static __inline__ void *
-drm_alloc(size_t size, struct malloc_type *area)
-{
- return malloc(size, area, M_NOWAIT);
-}
-
-static __inline__ void *
-drm_calloc(size_t nmemb, size_t size, struct malloc_type *area)
-{
- return malloc(size * nmemb, area, M_NOWAIT | M_ZERO);
-}
-
-static __inline__ void *
-drm_realloc(void *oldpt, size_t oldsize, size_t size,
- struct malloc_type *area)
-{
- return reallocf(oldpt, size, area, M_NOWAIT);
-}
-
-static __inline__ void
-drm_free(void *pt, size_t size, struct malloc_type *area)
-{
- free(pt, area);
-}
-
-/* Inline replacements for DRM_IOREMAP macros */
-static __inline__ void
-drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
-{
- map->handle = drm_ioremap_wc(dev, map);
-}
-static __inline__ void
-drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
-{
- map->handle = drm_ioremap(dev, map);
-}
-static __inline__ void
-drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
-{
- if ( map->handle && map->size )
- drm_ioremapfree(map);
-}
-
-static __inline__ struct drm_local_map *
-drm_core_findmap(struct drm_device *dev, unsigned long offset)
-{
- drm_local_map_t *map;
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (map->offset == offset)
- return map;
- }
- return NULL;
-}
-
-static __inline__ void drm_core_dropmap(struct drm_map *map)
-{
-}
-
-#endif /* __KERNEL__ */
-#endif /* _DRM_P_H_ */
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
deleted file mode 100644
index 34b23af1..00000000
--- a/bsd-core/drm_agpsupport.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Author:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_agpsupport.c
- * Support code for tying the kernel AGP support to DRM drivers and
- * the DRM's AGP ioctls.
- */
-
-#include "drmP.h"
-
-#if __FreeBSD_version >= 800004
-#include <dev/agp/agpreg.h>
-#else /* __FreeBSD_version >= 800004 */
-#include <pci/agpreg.h>
-#endif /* __FreeBSD_version >= 800004 */
-#include <dev/pci/pcireg.h>
-
-/* Returns 1 if AGP or 0 if not. */
-static int
-drm_device_find_capability(struct drm_device *dev, int cap)
-{
-#if __FreeBSD_version >= 602102
-
- return (pci_find_extcap(dev->device, cap, NULL) == 0);
-#else
- /* Code taken from agp.c. IWBNI that was a public interface. */
- u_int32_t status;
- u_int8_t ptr, next;
-
- /*
- * Check the CAP_LIST bit of the PCI status register first.
- */
- status = pci_read_config(dev->device, PCIR_STATUS, 2);
- if (!(status & 0x10))
- return 0;
-
- /*
- * Traverse the capabilities list.
- */
- for (ptr = pci_read_config(dev->device, AGP_CAPPTR, 1);
- ptr != 0;
- ptr = next) {
- u_int32_t capid = pci_read_config(dev->device, ptr, 4);
- next = AGP_CAPID_GET_NEXT_PTR(capid);
-
- /*
- * If this capability entry ID is cap, then we are done.
- */
- if (AGP_CAPID_GET_CAP_ID(capid) == cap)
- return 1;
- }
-
- return 0;
-#endif
-}
-
-int drm_device_is_agp(struct drm_device *dev)
-{
- if (dev->driver->device_is_agp != NULL) {
- int ret;
-
- /* device_is_agp returns a tristate, 0 = not AGP, 1 = definitely
- * AGP, 2 = fall back to PCI capability
- */
- ret = (*dev->driver->device_is_agp)(dev);
- if (ret != DRM_MIGHT_BE_AGP)
- return ret;
- }
-
- return (drm_device_find_capability(dev, PCIY_AGP));
-}
-
-int drm_device_is_pcie(struct drm_device *dev)
-{
- return (drm_device_find_capability(dev, PCIY_EXPRESS));
-}
-
-int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info)
-{
- struct agp_info *kern;
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- kern = &dev->agp->info;
- agp_get_info(dev->agp->agpdev, kern);
- info->agp_version_major = 1;
- info->agp_version_minor = 0;
- info->mode = kern->ai_mode;
- info->aperture_base = kern->ai_aperture_base;
- info->aperture_size = kern->ai_aperture_size;
- info->memory_allowed = kern->ai_memory_allowed;
- info->memory_used = kern->ai_memory_used;
- info->id_vendor = kern->ai_devid & 0xffff;
- info->id_device = kern->ai_devid >> 16;
-
- return 0;
-}
-
-int drm_agp_info_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- int err;
- struct drm_agp_info info;
-
- err = drm_agp_info(dev, &info);
- if (err != 0)
- return err;
-
- *(struct drm_agp_info *) data = info;
- return 0;
-}
-
-int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
-
- return drm_agp_acquire(dev);
-}
-
-int drm_agp_acquire(struct drm_device *dev)
-{
- int retcode;
-
- if (!dev->agp || dev->agp->acquired)
- return EINVAL;
-
- retcode = agp_acquire(dev->agp->agpdev);
- if (retcode)
- return retcode;
-
- dev->agp->acquired = 1;
- return 0;
-}
-
-int drm_agp_release_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
-
- return drm_agp_release(dev);
-}
-
-int drm_agp_release(struct drm_device * dev)
-{
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
- agp_release(dev->agp->agpdev);
- dev->agp->acquired = 0;
- return 0;
-}
-
-int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
-{
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- dev->agp->mode = mode.mode;
- agp_enable(dev->agp->agpdev, mode.mode);
- dev->agp->enabled = 1;
- return 0;
-}
-
-int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_mode mode;
-
- mode = *(struct drm_agp_mode *) data;
-
- return drm_agp_enable(dev, mode);
-}
-
-int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
-{
- drm_agp_mem_t *entry;
- void *handle;
- unsigned long pages;
- u_int32_t type;
- struct agp_memory_info info;
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT | M_ZERO);
- if (entry == NULL)
- return ENOMEM;
-
- pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
- type = (u_int32_t) request->type;
-
- DRM_UNLOCK();
- handle = drm_agp_allocate_memory(pages, type);
- DRM_LOCK();
- if (handle == NULL) {
- free(entry, DRM_MEM_AGPLISTS);
- return ENOMEM;
- }
-
- entry->handle = handle;
- entry->bound = 0;
- entry->pages = pages;
- entry->prev = NULL;
- entry->next = dev->agp->memory;
- if (dev->agp->memory)
- dev->agp->memory->prev = entry;
- dev->agp->memory = entry;
-
- agp_memory_info(dev->agp->agpdev, entry->handle, &info);
-
- request->handle = (unsigned long) entry->handle;
- request->physical = info.ami_physical;
-
- return 0;
-}
-
-int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_buffer request;
- int retcode;
-
- request = *(struct drm_agp_buffer *) data;
-
- DRM_LOCK();
- retcode = drm_agp_alloc(dev, &request);
- DRM_UNLOCK();
-
- *(struct drm_agp_buffer *) data = request;
-
- return retcode;
-}
-
-static drm_agp_mem_t * drm_agp_lookup_entry(struct drm_device *dev,
- void *handle)
-{
- drm_agp_mem_t *entry;
-
- for (entry = dev->agp->memory; entry; entry = entry->next) {
- if (entry->handle == handle) return entry;
- }
- return NULL;
-}
-
-int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
-{
- drm_agp_mem_t *entry;
- int retcode;
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- entry = drm_agp_lookup_entry(dev, (void *)request->handle);
- if (entry == NULL || !entry->bound)
- return EINVAL;
-
- DRM_UNLOCK();
- retcode = drm_agp_unbind_memory(entry->handle);
- DRM_LOCK();
-
- if (retcode == 0)
- entry->bound = 0;
-
- return retcode;
-}
-
-int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_binding request;
- int retcode;
-
- request = *(struct drm_agp_binding *) data;
-
- DRM_LOCK();
- retcode = drm_agp_unbind(dev, &request);
- DRM_UNLOCK();
-
- return retcode;
-}
-
-int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
-{
- drm_agp_mem_t *entry;
- int retcode;
- int page;
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- DRM_DEBUG("agp_bind, page_size=%x\n", PAGE_SIZE);
-
- entry = drm_agp_lookup_entry(dev, (void *)request->handle);
- if (entry == NULL || entry->bound)
- return EINVAL;
-
- page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE;
-
- DRM_UNLOCK();
- retcode = drm_agp_bind_memory(entry->handle, page);
- DRM_LOCK();
- if (retcode == 0)
- entry->bound = dev->agp->base + (page << PAGE_SHIFT);
-
- return retcode;
-}
-
-int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_binding request;
- int retcode;
-
- request = *(struct drm_agp_binding *) data;
-
- DRM_LOCK();
- retcode = drm_agp_bind(dev, &request);
- DRM_UNLOCK();
-
- return retcode;
-}
-
-int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
-{
- drm_agp_mem_t *entry;
-
- if (!dev->agp || !dev->agp->acquired)
- return EINVAL;
-
- entry = drm_agp_lookup_entry(dev, (void*)request->handle);
- if (entry == NULL)
- return EINVAL;
-
- if (entry->prev)
- entry->prev->next = entry->next;
- else
- dev->agp->memory = entry->next;
- if (entry->next)
- entry->next->prev = entry->prev;
-
- DRM_UNLOCK();
- if (entry->bound)
- drm_agp_unbind_memory(entry->handle);
- drm_agp_free_memory(entry->handle);
- DRM_LOCK();
-
- free(entry, DRM_MEM_AGPLISTS);
-
- return 0;
-
-}
-
-int drm_agp_free_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_buffer request;
- int retcode;
-
- request = *(struct drm_agp_buffer *) data;
-
- DRM_LOCK();
- retcode = drm_agp_free(dev, &request);
- DRM_UNLOCK();
-
- return retcode;
-}
-
-drm_agp_head_t *drm_agp_init(void)
-{
- device_t agpdev;
- drm_agp_head_t *head = NULL;
- int agp_available = 1;
-
- agpdev = DRM_AGP_FIND_DEVICE();
- if (!agpdev)
- agp_available = 0;
-
- DRM_DEBUG("agp_available = %d\n", agp_available);
-
- if (agp_available) {
- head = malloc(sizeof(*head), DRM_MEM_AGPLISTS,
- M_NOWAIT | M_ZERO);
- if (head == NULL)
- return NULL;
- head->agpdev = agpdev;
- agp_get_info(agpdev, &head->info);
- head->base = head->info.ai_aperture_base;
- head->memory = NULL;
- DRM_INFO("AGP at 0x%08lx %dMB\n",
- (long)head->info.ai_aperture_base,
- (int)(head->info.ai_aperture_size >> 20));
- }
- return head;
-}
-
-void *drm_agp_allocate_memory(size_t pages, u32 type)
-{
- device_t agpdev;
-
- agpdev = DRM_AGP_FIND_DEVICE();
- if (!agpdev)
- return NULL;
-
- return agp_alloc_memory(agpdev, type, pages << AGP_PAGE_SHIFT);
-}
-
-int drm_agp_free_memory(void *handle)
-{
- device_t agpdev;
-
- agpdev = DRM_AGP_FIND_DEVICE();
- if (!agpdev || !handle)
- return 0;
-
- agp_free_memory(agpdev, handle);
- return 1;
-}
-
-int drm_agp_bind_memory(void *handle, off_t start)
-{
- device_t agpdev;
-
- agpdev = DRM_AGP_FIND_DEVICE();
- if (!agpdev || !handle)
- return EINVAL;
-
- return agp_bind_memory(agpdev, handle, start * PAGE_SIZE);
-}
-
-int drm_agp_unbind_memory(void *handle)
-{
- device_t agpdev;
-
- agpdev = DRM_AGP_FIND_DEVICE();
- if (!agpdev || !handle)
- return EINVAL;
-
- return agp_unbind_memory(agpdev, handle);
-}
diff --git a/bsd-core/drm_atomic.h b/bsd-core/drm_atomic.h
deleted file mode 100644
index 76de7a2f..00000000
--- a/bsd-core/drm_atomic.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * \file drm_atomic.h
- * Atomic operations used in the DRM which may or may not be provided by the OS.
- *
- * \author Eric Anholt <anholt@FreeBSD.org>
- */
-
-/*-
- * Copyright 2004 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Many of these implementations are rather fake, but good enough. */
-
-typedef u_int32_t atomic_t;
-
-#define atomic_set(p, v) (*(p) = (v))
-#define atomic_read(p) (*(p))
-#define atomic_inc(p) atomic_add_int(p, 1)
-#define atomic_dec(p) atomic_subtract_int(p, 1)
-#define atomic_add(n, p) atomic_add_int(p, n)
-#define atomic_sub(n, p) atomic_subtract_int(p, n)
-
-static __inline atomic_t
-test_and_set_bit(int b, volatile void *p)
-{
- int s = splhigh();
- unsigned int m = 1<<b;
- unsigned int r = *(volatile int *)p & m;
- *(volatile int *)p |= m;
- splx(s);
- return r;
-}
-
-static __inline void
-clear_bit(int b, volatile void *p)
-{
- atomic_clear_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
-}
-
-static __inline void
-set_bit(int b, volatile void *p)
-{
- atomic_set_int(((volatile int *)p) + (b >> 5), 1 << (b & 0x1f));
-}
-
-static __inline int
-test_bit(int b, volatile void *p)
-{
- return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f));
-}
-
-static __inline int
-find_first_zero_bit(volatile void *p, int max)
-{
- int b;
- volatile int *ptr = (volatile int *)p;
-
- for (b = 0; b < max; b += 32) {
- if (ptr[b >> 5] != ~0) {
- for (;;) {
- if ((ptr[b >> 5] & (1 << (b & 0x1f))) == 0)
- return b;
- b++;
- }
- }
- }
- return max;
-}
diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c
deleted file mode 100644
index 6a76ed59..00000000
--- a/bsd-core/drm_auth.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_auth.c
- * Implementation of the get/authmagic ioctls implementing the authentication
- * scheme between the master and clients.
- */
-
-#include "drmP.h"
-
-static int drm_hash_magic(drm_magic_t magic)
-{
- return magic & (DRM_HASH_SIZE-1);
-}
-
-/**
- * Returns the file private associated with the given magic number.
- */
-static struct drm_file *drm_find_file(struct drm_device *dev, drm_magic_t magic)
-{
- drm_magic_entry_t *pt;
- int hash = drm_hash_magic(magic);
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
- if (pt->magic == magic) {
- return pt->priv;
- }
- }
-
- return NULL;
-}
-
-/**
- * Inserts the given magic number into the hash table of used magic number
- * lists.
- */
-static int drm_add_magic(struct drm_device *dev, struct drm_file *priv,
- drm_magic_t magic)
-{
- int hash;
- drm_magic_entry_t *entry;
-
- DRM_DEBUG("%d\n", magic);
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- hash = drm_hash_magic(magic);
- entry = malloc(sizeof(*entry), DRM_MEM_MAGIC, M_ZERO | M_NOWAIT);
- if (!entry)
- return ENOMEM;
- entry->magic = magic;
- entry->priv = priv;
- entry->next = NULL;
-
- if (dev->magiclist[hash].tail) {
- dev->magiclist[hash].tail->next = entry;
- dev->magiclist[hash].tail = entry;
- } else {
- dev->magiclist[hash].head = entry;
- dev->magiclist[hash].tail = entry;
- }
-
- return 0;
-}
-
-/**
- * Removes the given magic number from the hash table of used magic number
- * lists.
- */
-static int drm_remove_magic(struct drm_device *dev, drm_magic_t magic)
-{
- drm_magic_entry_t *prev = NULL;
- drm_magic_entry_t *pt;
- int hash;
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- DRM_DEBUG("%d\n", magic);
- hash = drm_hash_magic(magic);
-
- for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
- if (pt->magic == magic) {
- if (dev->magiclist[hash].head == pt) {
- dev->magiclist[hash].head = pt->next;
- }
- if (dev->magiclist[hash].tail == pt) {
- dev->magiclist[hash].tail = prev;
- }
- if (prev) {
- prev->next = pt->next;
- }
- free(pt, DRM_MEM_MAGIC);
- return 0;
- }
- }
-
- return EINVAL;
-}
-
-/**
- * Called by the client, this returns a unique magic number to be authorized
- * by the master.
- *
- * The master may use its own knowledge of the client (such as the X
- * connection that the magic is passed over) to determine if the magic number
- * should be authenticated.
- */
-int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- static drm_magic_t sequence = 0;
- struct drm_auth *auth = data;
-
- /* Find unique magic */
- if (file_priv->magic) {
- auth->magic = file_priv->magic;
- } else {
- DRM_LOCK();
- do {
- int old = sequence;
-
- auth->magic = old+1;
-
- if (!atomic_cmpset_int(&sequence, old, auth->magic))
- continue;
- } while (drm_find_file(dev, auth->magic));
- file_priv->magic = auth->magic;
- drm_add_magic(dev, file_priv, auth->magic);
- DRM_UNLOCK();
- }
-
- DRM_DEBUG("%u\n", auth->magic);
-
- return 0;
-}
-
-/**
- * Marks the client associated with the given magic number as authenticated.
- */
-int drm_authmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_auth *auth = data;
- struct drm_file *priv;
-
- DRM_DEBUG("%u\n", auth->magic);
-
- DRM_LOCK();
- priv = drm_find_file(dev, auth->magic);
- if (priv != NULL) {
- priv->authenticated = 1;
- drm_remove_magic(dev, auth->magic);
- DRM_UNLOCK();
- return 0;
- } else {
- DRM_UNLOCK();
- return EINVAL;
- }
-}
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
deleted file mode 100644
index 53cff648..00000000
--- a/bsd-core/drm_bufs.c
+++ /dev/null
@@ -1,1110 +0,0 @@
-/*-
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_bufs.c
- * Implementation of the ioctls for setup of DRM mappings and DMA buffers.
- */
-
-#include "dev/pci/pcireg.h"
-
-#include "drmP.h"
-
-/* Allocation of PCI memory resources (framebuffer, registers, etc.) for
- * drm_get_resource_*. Note that they are not RF_ACTIVE, so there's no virtual
- * address for accessing them. Cleaned up at unload.
- */
-static int drm_alloc_resource(struct drm_device *dev, int resource)
-{
- if (resource >= DRM_MAX_PCI_RESOURCE) {
- DRM_ERROR("Resource %d too large\n", resource);
- return 1;
- }
-
- DRM_UNLOCK();
- if (dev->pcir[resource] != NULL) {
- DRM_LOCK();
- return 0;
- }
-
- dev->pcirid[resource] = PCIR_BAR(resource);
- dev->pcir[resource] = bus_alloc_resource_any(dev->device,
- SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE);
- DRM_LOCK();
-
- if (dev->pcir[resource] == NULL) {
- DRM_ERROR("Couldn't find resource 0x%x\n", resource);
- return 1;
- }
-
- return 0;
-}
-
-unsigned long drm_get_resource_start(struct drm_device *dev,
- unsigned int resource)
-{
- if (drm_alloc_resource(dev, resource) != 0)
- return 0;
-
- return rman_get_start(dev->pcir[resource]);
-}
-
-unsigned long drm_get_resource_len(struct drm_device *dev,
- unsigned int resource)
-{
- if (drm_alloc_resource(dev, resource) != 0)
- return 0;
-
- return rman_get_size(dev->pcir[resource]);
-}
-
-int drm_addmap(struct drm_device * dev, unsigned long offset,
- unsigned long size,
- enum drm_map_type type, enum drm_map_flags flags, drm_local_map_t **map_ptr)
-{
- drm_local_map_t *map;
- int align;
- /*drm_agp_mem_t *entry;
- int valid;*/
-
- /* Only allow shared memory to be removable since we only keep enough
- * book keeping information about shared memory to allow for removal
- * when processes fork.
- */
- if ((flags & _DRM_REMOVABLE) && type != _DRM_SHM) {
- DRM_ERROR("Requested removable map for non-DRM_SHM\n");
- return EINVAL;
- }
- if ((offset & PAGE_MASK) || (size & PAGE_MASK)) {
- DRM_ERROR("offset/size not page aligned: 0x%lx/0x%lx\n",
- offset, size);
- return EINVAL;
- }
- if (offset + size < offset) {
- DRM_ERROR("offset and size wrap around: 0x%lx/0x%lx\n",
- offset, size);
- return EINVAL;
- }
-
- DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n", offset,
- size, type);
-
- /* Check if this is just another version of a kernel-allocated map, and
- * just hand that back if so.
- */
- if (type == _DRM_REGISTERS || type == _DRM_FRAME_BUFFER ||
- type == _DRM_SHM) {
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (map->type == type && (map->offset == offset ||
- (map->type == _DRM_SHM &&
- map->flags == _DRM_CONTAINS_LOCK))) {
- map->size = size;
- DRM_DEBUG("Found kernel map %d\n", type);
- goto done;
- }
- }
- }
- DRM_UNLOCK();
-
- /* Allocate a new map structure, fill it in, and do any type-specific
- * initialization necessary.
- */
- map = malloc(sizeof(*map), DRM_MEM_MAPS, M_ZERO | M_NOWAIT);
- if (!map) {
- DRM_LOCK();
- return ENOMEM;
- }
-
- map->offset = offset;
- map->size = size;
- map->type = type;
- map->flags = flags;
-
- switch (map->type) {
- case _DRM_REGISTERS:
- map->handle = drm_ioremap(dev, map);
- if (!(map->flags & _DRM_WRITE_COMBINING))
- break;
- /* FALLTHROUGH */
- case _DRM_FRAME_BUFFER:
- if (drm_mtrr_add(map->offset, map->size, DRM_MTRR_WC) == 0)
- map->mtrr = 1;
- break;
- case _DRM_SHM:
- map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT);
- DRM_DEBUG("%lu %d %p\n",
- map->size, drm_order(map->size), map->handle);
- if (!map->handle) {
- free(map, DRM_MEM_MAPS);
- DRM_LOCK();
- return ENOMEM;
- }
- map->offset = (unsigned long)map->handle;
- if (map->flags & _DRM_CONTAINS_LOCK) {
- /* Prevent a 2nd X Server from creating a 2nd lock */
- DRM_LOCK();
- if (dev->lock.hw_lock != NULL) {
- DRM_UNLOCK();
- free(map->handle, DRM_MEM_MAPS);
- free(map, DRM_MEM_MAPS);
- return EBUSY;
- }
- dev->lock.hw_lock = map->handle; /* Pointer to lock */
- DRM_UNLOCK();
- }
- break;
- case _DRM_AGP:
- /*valid = 0;*/
- /* In some cases (i810 driver), user space may have already
- * added the AGP base itself, because dev->agp->base previously
- * only got set during AGP enable. So, only add the base
- * address if the map's offset isn't already within the
- * aperture.
- */
- if (map->offset < dev->agp->base ||
- map->offset > dev->agp->base +
- dev->agp->info.ai_aperture_size - 1) {
- map->offset += dev->agp->base;
- }
- map->mtrr = dev->agp->mtrr; /* for getmap */
- /*for (entry = dev->agp->memory; entry; entry = entry->next) {
- if ((map->offset >= entry->bound) &&
- (map->offset + map->size <=
- entry->bound + entry->pages * PAGE_SIZE)) {
- valid = 1;
- break;
- }
- }
- if (!valid) {
- free(map, DRM_MEM_MAPS);
- DRM_LOCK();
- return EACCES;
- }*/
- break;
- case _DRM_SCATTER_GATHER:
- if (!dev->sg) {
- free(map, DRM_MEM_MAPS);
- DRM_LOCK();
- return EINVAL;
- }
- map->offset += dev->sg->handle;
- break;
- case _DRM_CONSISTENT:
- /* Unfortunately, we don't get any alignment specification from
- * the caller, so we have to guess. drm_pci_alloc requires
- * a power-of-two alignment, so try to align the bus address of
- * the map to it size if possible, otherwise just assume
- * PAGE_SIZE alignment.
- */
- align = map->size;
- if ((align & (align - 1)) != 0)
- align = PAGE_SIZE;
- map->dmah = drm_pci_alloc(dev, map->size, align, 0xfffffffful);
- if (map->dmah == NULL) {
- free(map, DRM_MEM_MAPS);
- DRM_LOCK();
- return ENOMEM;
- }
- map->handle = map->dmah->vaddr;
- map->offset = map->dmah->busaddr;
- break;
- default:
- DRM_ERROR("Bad map type %d\n", map->type);
- free(map, DRM_MEM_MAPS);
- DRM_LOCK();
- return EINVAL;
- }
-
- DRM_LOCK();
- TAILQ_INSERT_TAIL(&dev->maplist, map, link);
-
-done:
- /* Jumped to, with lock held, when a kernel map is found. */
-
- DRM_DEBUG("Added map %d 0x%lx/0x%lx\n", map->type, map->offset,
- map->size);
-
- *map_ptr = map;
-
- return 0;
-}
-
-int drm_addmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_map *request = data;
- drm_local_map_t *map;
- int err;
-
- if (!(dev->flags & (FREAD|FWRITE)))
- return EACCES; /* Require read/write */
-
- if (!DRM_SUSER(DRM_CURPROC) && request->type != _DRM_AGP)
- return EACCES;
-
- DRM_LOCK();
- err = drm_addmap(dev, request->offset, request->size, request->type,
- request->flags, &map);
- DRM_UNLOCK();
- if (err != 0)
- return err;
-
- request->offset = map->offset;
- request->size = map->size;
- request->type = map->type;
- request->flags = map->flags;
- request->mtrr = map->mtrr;
- request->handle = map->handle;
-
- if (request->type != _DRM_SHM) {
- request->handle = (void *)request->offset;
- }
-
- return 0;
-}
-
-void drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
-{
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- TAILQ_REMOVE(&dev->maplist, map, link);
-
- switch (map->type) {
- case _DRM_REGISTERS:
- if (map->bsr == NULL)
- drm_ioremapfree(map);
- /* FALLTHROUGH */
- case _DRM_FRAME_BUFFER:
- if (map->mtrr) {
- int __unused retcode;
-
- retcode = drm_mtrr_del(0, map->offset, map->size,
- DRM_MTRR_WC);
- DRM_DEBUG("mtrr_del = %d\n", retcode);
- }
- break;
- case _DRM_SHM:
- free(map->handle, DRM_MEM_MAPS);
- break;
- case _DRM_AGP:
- case _DRM_SCATTER_GATHER:
- break;
- case _DRM_CONSISTENT:
- drm_pci_free(dev, map->dmah);
- break;
- default:
- DRM_ERROR("Bad map type %d\n", map->type);
- break;
- }
-
- if (map->bsr != NULL) {
- bus_release_resource(dev->device, SYS_RES_MEMORY, map->rid,
- map->bsr);
- }
-
- free(map, DRM_MEM_MAPS);
-}
-
-/* Remove a map private from list and deallocate resources if the mapping
- * isn't in use.
- */
-
-int drm_rmmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- drm_local_map_t *map;
- struct drm_map *request = data;
-
- DRM_LOCK();
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (map->handle == request->handle &&
- map->flags & _DRM_REMOVABLE)
- break;
- }
-
- /* No match found. */
- if (map == NULL) {
- DRM_UNLOCK();
- return EINVAL;
- }
-
- drm_rmmap(dev, map);
-
- DRM_UNLOCK();
-
- return 0;
-}
-
-
-static void drm_cleanup_buf_error(struct drm_device *dev,
- drm_buf_entry_t *entry)
-{
- int i;
-
- if (entry->seg_count) {
- for (i = 0; i < entry->seg_count; i++) {
- drm_pci_free(dev, entry->seglist[i]);
- }
- free(entry->seglist, DRM_MEM_SEGS);
-
- entry->seg_count = 0;
- }
-
- if (entry->buf_count) {
- for (i = 0; i < entry->buf_count; i++) {
- free(entry->buflist[i].dev_private, DRM_MEM_BUFS);
- }
- free(entry->buflist, DRM_MEM_BUFS);
-
- entry->buf_count = 0;
- }
-}
-
-static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request)
-{
- drm_device_dma_t *dma = dev->dma;
- drm_buf_entry_t *entry;
- /*drm_agp_mem_t *agp_entry;
- int valid*/
- drm_buf_t *buf;
- unsigned long offset;
- unsigned long agp_offset;
- int count;
- int order;
- int size;
- int alignment;
- int page_order;
- int total;
- int byte_count;
- int i;
- drm_buf_t **temp_buflist;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- byte_count = 0;
- agp_offset = dev->agp->base + request->agp_start;
-
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: 0x%lx\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
-
- /* Make sure buffers are located in AGP memory that we own */
- /* Breaks MGA due to drm_alloc_agp not setting up entries for the
- * memory. Safe to ignore for now because these ioctls are still
- * root-only.
- */
- /*valid = 0;
- for (agp_entry = dev->agp->memory; agp_entry;
- agp_entry = agp_entry->next) {
- if ((agp_offset >= agp_entry->bound) &&
- (agp_offset + total * count <=
- agp_entry->bound + agp_entry->pages * PAGE_SIZE)) {
- valid = 1;
- break;
- }
- }
- if (!valid) {
- DRM_DEBUG("zone invalid\n");
- return EINVAL;
- }*/
-
- entry = &dma->bufs[order];
-
- entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
- M_NOWAIT | M_ZERO);
- if (!entry->buflist) {
- return ENOMEM;
- }
-
- entry->buf_size = size;
- entry->page_order = page_order;
-
- offset = 0;
-
- while (entry->buf_count < count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
-
- buf->offset = (dma->byte_count + offset);
- buf->bus_address = agp_offset + offset;
- buf->address = (void *)(agp_offset + offset);
- buf->next = NULL;
- buf->pending = 0;
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
- M_NOWAIT | M_ZERO);
- if (buf->dev_private == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf_error(dev, entry);
- return ENOMEM;
- }
-
- offset += alignment;
- entry->buf_count++;
- byte_count += PAGE_SIZE << page_order;
- }
-
- DRM_DEBUG("byte_count: %d\n", byte_count);
-
- temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
- DRM_MEM_BUFS, M_NOWAIT);
- if (temp_buflist == NULL) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- return ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- dma->buf_count += entry->buf_count;
- dma->byte_count += byte_count;
-
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
-
- request->count = entry->buf_count;
- request->size = size;
-
- dma->flags = _DRM_DMA_USE_AGP;
-
- return 0;
-}
-
-static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request)
-{
- drm_device_dma_t *dma = dev->dma;
- int count;
- int order;
- int size;
- int total;
- int page_order;
- drm_buf_entry_t *entry;
- drm_buf_t *buf;
- int alignment;
- unsigned long offset;
- int i;
- int byte_count;
- int page_count;
- unsigned long *temp_pagelist;
- drm_buf_t **temp_buflist;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
- request->count, request->size, size, order);
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- entry = &dma->bufs[order];
-
- entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
- M_NOWAIT | M_ZERO);
- entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS,
- M_NOWAIT | M_ZERO);
-
- /* Keep the original pagelist until we know all the allocations
- * have succeeded
- */
- temp_pagelist = malloc((dma->page_count + (count << page_order)) *
- sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT);
-
- if (entry->buflist == NULL || entry->seglist == NULL ||
- temp_pagelist == NULL) {
- free(temp_pagelist, DRM_MEM_PAGES);
- free(entry->seglist, DRM_MEM_SEGS);
- free(entry->buflist, DRM_MEM_BUFS);
- return ENOMEM;
- }
-
- memcpy(temp_pagelist, dma->pagelist, dma->page_count *
- sizeof(*dma->pagelist));
-
- DRM_DEBUG("pagelist: %d entries\n",
- dma->page_count + (count << page_order));
-
- entry->buf_size = size;
- entry->page_order = page_order;
- byte_count = 0;
- page_count = 0;
-
- while (entry->buf_count < count) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- drm_dma_handle_t *dmah = drm_pci_alloc(dev, size, alignment,
- 0xfffffffful);
- DRM_SPINLOCK(&dev->dma_lock);
- if (dmah == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- entry->seg_count = count;
- drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, DRM_MEM_PAGES);
- return ENOMEM;
- }
-
- entry->seglist[entry->seg_count++] = dmah;
- for (i = 0; i < (1 << page_order); i++) {
- DRM_DEBUG("page %d @ %p\n",
- dma->page_count + page_count,
- (char *)dmah->vaddr + PAGE_SIZE * i);
- temp_pagelist[dma->page_count + page_count++] =
- (long)dmah->vaddr + PAGE_SIZE * i;
- }
- for (offset = 0;
- offset + size <= total && entry->buf_count < count;
- offset += alignment, ++entry->buf_count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
- buf->offset = (dma->byte_count + byte_count + offset);
- buf->address = ((char *)dmah->vaddr + offset);
- buf->bus_address = dmah->busaddr + offset;
- buf->next = NULL;
- buf->pending = 0;
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size,
- DRM_MEM_BUFS, M_NOWAIT | M_ZERO);
- if (buf->dev_private == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- entry->seg_count = count;
- drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, DRM_MEM_PAGES);
- return ENOMEM;
- }
-
- DRM_DEBUG("buffer %d @ %p\n",
- entry->buf_count, buf->address);
- }
- byte_count += PAGE_SIZE << page_order;
- }
-
- temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
- DRM_MEM_BUFS, M_NOWAIT);
- if (temp_buflist == NULL) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- free(temp_pagelist, DRM_MEM_PAGES);
- return ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- /* No allocations failed, so now we can replace the orginal pagelist
- * with the new one.
- */
- free(dma->pagelist, DRM_MEM_PAGES);
- dma->pagelist = temp_pagelist;
-
- dma->buf_count += entry->buf_count;
- dma->seg_count += entry->seg_count;
- dma->page_count += entry->seg_count << page_order;
- dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
-
- request->count = entry->buf_count;
- request->size = size;
-
- return 0;
-
-}
-
-static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request)
-{
- drm_device_dma_t *dma = dev->dma;
- drm_buf_entry_t *entry;
- drm_buf_t *buf;
- unsigned long offset;
- unsigned long agp_offset;
- int count;
- int order;
- int size;
- int alignment;
- int page_order;
- int total;
- int byte_count;
- int i;
- drm_buf_t **temp_buflist;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- byte_count = 0;
- agp_offset = request->agp_start;
-
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %ld\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
-
- entry = &dma->bufs[order];
-
- entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
- M_NOWAIT | M_ZERO);
- if (entry->buflist == NULL)
- return ENOMEM;
-
- entry->buf_size = size;
- entry->page_order = page_order;
-
- offset = 0;
-
- while (entry->buf_count < count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
-
- buf->offset = (dma->byte_count + offset);
- buf->bus_address = agp_offset + offset;
- buf->address = (void *)(agp_offset + offset + dev->sg->handle);
- buf->next = NULL;
- buf->pending = 0;
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->buf_priv_size;
- buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
- M_NOWAIT | M_ZERO);
- if (buf->dev_private == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf_error(dev, entry);
- return ENOMEM;
- }
-
- DRM_DEBUG("buffer %d @ %p\n",
- entry->buf_count, buf->address);
-
- offset += alignment;
- entry->buf_count++;
- byte_count += PAGE_SIZE << page_order;
- }
-
- DRM_DEBUG("byte_count: %d\n", byte_count);
-
- temp_buflist = realloc(dma->buflist,
- (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
- DRM_MEM_BUFS, M_NOWAIT);
- if (temp_buflist == NULL) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- return ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- dma->buf_count += entry->buf_count;
- dma->byte_count += byte_count;
-
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
-
- request->count = entry->buf_count;
- request->size = size;
-
- dma->flags = _DRM_DMA_USE_SG;
-
- return 0;
-}
-
-int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request)
-{
- int order, ret;
-
- if (request->count < 0 || request->count > 4096)
- return EINVAL;
-
- order = drm_order(request->size);
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return EINVAL;
-
- DRM_SPINLOCK(&dev->dma_lock);
-
- /* No more allocations after first buffer-using ioctl. */
- if (dev->buf_use != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return EBUSY;
- }
- /* No more than one allocation per order */
- if (dev->dma->bufs[order].buf_count != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return ENOMEM;
- }
-
- ret = drm_do_addbufs_agp(dev, request);
-
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- return ret;
-}
-
-int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request)
-{
- int order, ret;
-
- if (!DRM_SUSER(DRM_CURPROC))
- return EACCES;
-
- if (request->count < 0 || request->count > 4096)
- return EINVAL;
-
- order = drm_order(request->size);
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return EINVAL;
-
- DRM_SPINLOCK(&dev->dma_lock);
-
- /* No more allocations after first buffer-using ioctl. */
- if (dev->buf_use != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return EBUSY;
- }
- /* No more than one allocation per order */
- if (dev->dma->bufs[order].buf_count != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return ENOMEM;
- }
-
- ret = drm_do_addbufs_sg(dev, request);
-
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- return ret;
-}
-
-int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request)
-{
- int order, ret;
-
- if (!DRM_SUSER(DRM_CURPROC))
- return EACCES;
-
- if (request->count < 0 || request->count > 4096)
- return EINVAL;
-
- order = drm_order(request->size);
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return EINVAL;
-
- DRM_SPINLOCK(&dev->dma_lock);
-
- /* No more allocations after first buffer-using ioctl. */
- if (dev->buf_use != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return EBUSY;
- }
- /* No more than one allocation per order */
- if (dev->dma->bufs[order].buf_count != 0) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return ENOMEM;
- }
-
- ret = drm_do_addbufs_pci(dev, request);
-
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- return ret;
-}
-
-int drm_addbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_buf_desc *request = data;
- int err;
-
- if (request->flags & _DRM_AGP_BUFFER)
- err = drm_addbufs_agp(dev, request);
- else if (request->flags & _DRM_SG_BUFFER)
- err = drm_addbufs_sg(dev, request);
- else
- err = drm_addbufs_pci(dev, request);
-
- return err;
-}
-
-int drm_infobufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- drm_device_dma_t *dma = dev->dma;
- struct drm_buf_info *request = data;
- int i;
- int count;
- int retcode = 0;
-
- DRM_SPINLOCK(&dev->dma_lock);
- ++dev->buf_use; /* Can't allocate more after this call */
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
- if (dma->bufs[i].buf_count)
- ++count;
- }
-
- DRM_DEBUG("count = %d\n", count);
-
- if (request->count >= count) {
- for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
- if (dma->bufs[i].buf_count) {
- struct drm_buf_desc from;
-
- from.count = dma->bufs[i].buf_count;
- from.size = dma->bufs[i].buf_size;
- from.low_mark = dma->bufs[i].freelist.low_mark;
- from.high_mark = dma->bufs[i].freelist.high_mark;
-
- if (DRM_COPY_TO_USER(&request->list[count], &from,
- sizeof(struct drm_buf_desc)) != 0) {
- retcode = EFAULT;
- break;
- }
-
- DRM_DEBUG("%d %d %d %d %d\n",
- i, dma->bufs[i].buf_count,
- dma->bufs[i].buf_size,
- dma->bufs[i].freelist.low_mark,
- dma->bufs[i].freelist.high_mark);
- ++count;
- }
- }
- }
- request->count = count;
-
- return retcode;
-}
-
-int drm_markbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- drm_device_dma_t *dma = dev->dma;
- struct drm_buf_desc *request = data;
- int order;
-
- DRM_DEBUG("%d, %d, %d\n",
- request->size, request->low_mark, request->high_mark);
-
-
- order = drm_order(request->size);
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ||
- request->low_mark < 0 || request->high_mark < 0) {
- return EINVAL;
- }
-
- DRM_SPINLOCK(&dev->dma_lock);
- if (request->low_mark > dma->bufs[order].buf_count ||
- request->high_mark > dma->bufs[order].buf_count) {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return EINVAL;
- }
-
- dma->bufs[order].freelist.low_mark = request->low_mark;
- dma->bufs[order].freelist.high_mark = request->high_mark;
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- return 0;
-}
-
-int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- drm_device_dma_t *dma = dev->dma;
- struct drm_buf_free *request = data;
- int i;
- int idx;
- drm_buf_t *buf;
- int retcode = 0;
-
- DRM_DEBUG("%d\n", request->count);
-
- DRM_SPINLOCK(&dev->dma_lock);
- for (i = 0; i < request->count; i++) {
- if (DRM_COPY_FROM_USER(&idx, &request->list[i], sizeof(idx))) {
- retcode = EFAULT;
- break;
- }
- if (idx < 0 || idx >= dma->buf_count) {
- DRM_ERROR("Index %d (of %d max)\n",
- idx, dma->buf_count - 1);
- retcode = EINVAL;
- break;
- }
- buf = dma->buflist[idx];
- if (buf->file_priv != file_priv) {
- DRM_ERROR("Process %d freeing buffer not owned\n",
- DRM_CURRENTPID);
- retcode = EINVAL;
- break;
- }
- drm_free_buffer(dev, buf);
- }
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- return retcode;
-}
-
-int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- drm_device_dma_t *dma = dev->dma;
- int retcode = 0;
- const int zero = 0;
- vm_offset_t address;
- struct vmspace *vms;
- vm_ooffset_t foff;
- vm_size_t size;
- vm_offset_t vaddr;
- struct drm_buf_map *request = data;
- int i;
-
- vms = DRM_CURPROC->td_proc->p_vmspace;
-
- DRM_SPINLOCK(&dev->dma_lock);
- dev->buf_use++; /* Can't allocate more after this call */
- DRM_SPINUNLOCK(&dev->dma_lock);
-
- if (request->count < dma->buf_count)
- goto done;
-
- if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) ||
- (drm_core_check_feature(dev, DRIVER_SG) &&
- (dma->flags & _DRM_DMA_USE_SG))) {
- drm_local_map_t *map = dev->agp_buffer_map;
-
- if (map == NULL) {
- retcode = EINVAL;
- goto done;
- }
- size = round_page(map->size);
- foff = map->offset;
- } else {
- size = round_page(dma->byte_count),
- foff = 0;
- }
-
- vaddr = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ);
-#if __FreeBSD_version >= 600023
- retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE,
- VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC, OBJT_DEVICE, dev->devnode, foff);
-#else
- retcode = vm_mmap(&vms->vm_map, &vaddr, size, PROT_READ | PROT_WRITE,
- VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC, SLIST_FIRST(&dev->devnode->si_hlist),
- foff);
-#endif
- if (retcode)
- goto done;
-
- request->virtual = (void *)vaddr;
-
- for (i = 0; i < dma->buf_count; i++) {
- if (DRM_COPY_TO_USER(&request->list[i].idx,
- &dma->buflist[i]->idx, sizeof(request->list[0].idx))) {
- retcode = EFAULT;
- goto done;
- }
- if (DRM_COPY_TO_USER(&request->list[i].total,
- &dma->buflist[i]->total, sizeof(request->list[0].total))) {
- retcode = EFAULT;
- goto done;
- }
- if (DRM_COPY_TO_USER(&request->list[i].used, &zero,
- sizeof(zero))) {
- retcode = EFAULT;
- goto done;
- }
- address = vaddr + dma->buflist[i]->offset; /* *** */
- if (DRM_COPY_TO_USER(&request->list[i].address, &address,
- sizeof(address))) {
- retcode = EFAULT;
- goto done;
- }
- }
-
- done:
- request->count = dma->buf_count;
-
- DRM_DEBUG("%d buffers, retcode = %d\n", request->count, retcode);
-
- return retcode;
-}
-
-/*
- * Compute order. Can be made faster.
- */
-int drm_order(unsigned long size)
-{
- int order;
-
- if (size == 0)
- return 0;
-
- order = flsl(size) - 1;
- if (size & ~(1ul << order))
- ++order;
-
- return order;
-}
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
deleted file mode 100644
index 4dddd9c8..00000000
--- a/bsd-core/drm_context.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*-
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_context.c
- * Implementation of the context management ioctls.
- */
-
-#include "drmP.h"
-
-/* ================================================================
- * Context bitmap support
- */
-
-void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle)
-{
- if (ctx_handle < 0 || ctx_handle >= DRM_MAX_CTXBITMAP ||
- dev->ctx_bitmap == NULL) {
- DRM_ERROR("Attempt to free invalid context handle: %d\n",
- ctx_handle);
- return;
- }
-
- DRM_LOCK();
- clear_bit(ctx_handle, dev->ctx_bitmap);
- dev->context_sareas[ctx_handle] = NULL;
- DRM_UNLOCK();
- return;
-}
-
-int drm_ctxbitmap_next(struct drm_device *dev)
-{
- int bit;
-
- if (dev->ctx_bitmap == NULL)
- return -1;
-
- DRM_LOCK();
- bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP);
- if (bit >= DRM_MAX_CTXBITMAP) {
- DRM_UNLOCK();
- return -1;
- }
-
- set_bit(bit, dev->ctx_bitmap);
- DRM_DEBUG("drm_ctxbitmap_next bit : %d\n", bit);
- if ((bit+1) > dev->max_context) {
- dev->max_context = (bit+1);
- if (dev->context_sareas != NULL) {
- drm_local_map_t **ctx_sareas;
-
- ctx_sareas = realloc(dev->context_sareas,
- dev->max_context * sizeof(*dev->context_sareas),
- DRM_MEM_SAREA, M_NOWAIT);
- if (ctx_sareas == NULL) {
- clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK();
- return -1;
- }
- dev->context_sareas = ctx_sareas;
- dev->context_sareas[bit] = NULL;
- } else {
- /* max_context == 1 at this point */
- dev->context_sareas = malloc(dev->max_context *
- sizeof(*dev->context_sareas), DRM_MEM_SAREA,
- M_NOWAIT);
- if (dev->context_sareas == NULL) {
- clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK();
- return -1;
- }
- dev->context_sareas[bit] = NULL;
- }
- }
- DRM_UNLOCK();
- return bit;
-}
-
-int drm_ctxbitmap_init(struct drm_device *dev)
-{
- int i;
- int temp;
-
- DRM_LOCK();
- dev->ctx_bitmap = malloc(PAGE_SIZE, DRM_MEM_CTXBITMAP,
- M_NOWAIT | M_ZERO);
- if (dev->ctx_bitmap == NULL) {
- DRM_UNLOCK();
- return ENOMEM;
- }
- dev->context_sareas = NULL;
- dev->max_context = -1;
- DRM_UNLOCK();
-
- for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
- temp = drm_ctxbitmap_next(dev);
- DRM_DEBUG("drm_ctxbitmap_init : %d\n", temp);
- }
-
- return 0;
-}
-
-void drm_ctxbitmap_cleanup(struct drm_device *dev)
-{
- DRM_LOCK();
- if (dev->context_sareas != NULL)
- free(dev->context_sareas, DRM_MEM_SAREA);
- free(dev->ctx_bitmap, DRM_MEM_CTXBITMAP);
- DRM_UNLOCK();
-}
-
-/* ================================================================
- * Per Context SAREA Support
- */
-
-int drm_getsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_ctx_priv_map *request = data;
- drm_local_map_t *map;
-
- DRM_LOCK();
- if (dev->max_context < 0 ||
- request->ctx_id >= (unsigned) dev->max_context) {
- DRM_UNLOCK();
- return EINVAL;
- }
-
- map = dev->context_sareas[request->ctx_id];
- DRM_UNLOCK();
-
- request->handle = map->handle;
-
- return 0;
-}
-
-int drm_setsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_ctx_priv_map *request = data;
- drm_local_map_t *map = NULL;
-
- DRM_LOCK();
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (map->handle == request->handle) {
- if (dev->max_context < 0)
- goto bad;
- if (request->ctx_id >= (unsigned) dev->max_context)
- goto bad;
- dev->context_sareas[request->ctx_id] = map;
- DRM_UNLOCK();
- return 0;
- }
- }
-
-bad:
- DRM_UNLOCK();
- return EINVAL;
-}
-
-/* ================================================================
- * The actual DRM context handling routines
- */
-
-int drm_context_switch(struct drm_device *dev, int old, int new)
-{
- if (test_and_set_bit(0, &dev->context_flag)) {
- DRM_ERROR("Reentering -- FIXME\n");
- return EBUSY;
- }
-
- DRM_DEBUG("Context switch from %d to %d\n", old, new);
-
- if (new == dev->last_context) {
- clear_bit(0, &dev->context_flag);
- return 0;
- }
-
- return 0;
-}
-
-int drm_context_switch_complete(struct drm_device *dev, int new)
-{
- dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
-
- if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
- DRM_ERROR("Lock isn't held after context switch\n");
- }
-
- /* If a context switch is ever initiated
- when the kernel holds the lock, release
- that lock here. */
- clear_bit(0, &dev->context_flag);
-
- return 0;
-}
-
-int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_ctx_res *res = data;
- struct drm_ctx ctx;
- int i;
-
- if (res->count >= DRM_RESERVED_CONTEXTS) {
- bzero(&ctx, sizeof(ctx));
- for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
- ctx.handle = i;
- if (DRM_COPY_TO_USER(&res->contexts[i],
- &ctx, sizeof(ctx)))
- return EFAULT;
- }
- }
- res->count = DRM_RESERVED_CONTEXTS;
-
- return 0;
-}
-
-int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_ctx *ctx = data;
-
- ctx->handle = drm_ctxbitmap_next(dev);
- if (ctx->handle == DRM_KERNEL_CONTEXT) {
- /* Skip kernel's context and get a new one. */
- ctx->handle = drm_ctxbitmap_next(dev);
- }
- DRM_DEBUG("%d\n", ctx->handle);
- if (ctx->handle == -1) {
- DRM_DEBUG("Not enough free contexts.\n");
- /* Should this return -EBUSY instead? */
- return ENOMEM;
- }
-
- if (dev->driver->context_ctor && ctx->handle != DRM_KERNEL_CONTEXT) {
- DRM_LOCK();
- dev->driver->context_ctor(dev, ctx->handle);
- DRM_UNLOCK();
- }
-
- return 0;
-}
-
-int drm_modctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- /* This does nothing */
- return 0;
-}
-
-int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_ctx *ctx = data;
-
- /* This is 0, because we don't handle any context flags */
- ctx->flags = 0;
-
- return 0;
-}
-
-int drm_switchctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_ctx *ctx = data;
-
- DRM_DEBUG("%d\n", ctx->handle);
- return drm_context_switch(dev, dev->last_context, ctx->handle);
-}
-
-int drm_newctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_ctx *ctx = data;
-
- DRM_DEBUG("%d\n", ctx->handle);
- drm_context_switch_complete(dev, ctx->handle);
-
- return 0;
-}
-
-int drm_rmctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_ctx *ctx = data;
-
- DRM_DEBUG("%d\n", ctx->handle);
- if (ctx->handle != DRM_KERNEL_CONTEXT) {
- if (dev->driver->context_dtor) {
- DRM_LOCK();
- dev->driver->context_dtor(dev, ctx->handle);
- DRM_UNLOCK();
- }
-
- drm_ctxbitmap_free(dev, ctx->handle);
- }
-
- return 0;
-}
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
deleted file mode 100644
index c2d9994e..00000000
--- a/bsd-core/drm_dma.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*-
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_dma.c
- * Support code for DMA buffer management.
- *
- * The implementation used to be significantly more complicated, but the
- * complexity has been moved into the drivers as different buffer management
- * schemes evolved.
- */
-
-#include "drmP.h"
-
-int drm_dma_setup(struct drm_device *dev)
-{
-
- dev->dma = malloc(sizeof(*dev->dma), DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
- if (dev->dma == NULL)
- return ENOMEM;
-
- DRM_SPININIT(&dev->dma_lock, "drmdma");
-
- return 0;
-}
-
-void drm_dma_takedown(struct drm_device *dev)
-{
- drm_device_dma_t *dma = dev->dma;
- int i, j;
-
- if (dma == NULL)
- return;
-
- /* Clear dma buffers */
- for (i = 0; i <= DRM_MAX_ORDER; i++) {
- if (dma->bufs[i].seg_count) {
- DRM_DEBUG("order %d: buf_count = %d,"
- " seg_count = %d\n", i, dma->bufs[i].buf_count,
- dma->bufs[i].seg_count);
- for (j = 0; j < dma->bufs[i].seg_count; j++) {
- drm_pci_free(dev, dma->bufs[i].seglist[j]);
- }
- free(dma->bufs[i].seglist, DRM_MEM_SEGS);
- }
-
- if (dma->bufs[i].buf_count) {
- for (j = 0; j < dma->bufs[i].buf_count; j++) {
- free(dma->bufs[i].buflist[j].dev_private,
- DRM_MEM_BUFS);
- }
- free(dma->bufs[i].buflist, DRM_MEM_BUFS);
- }
- }
-
- free(dma->buflist, DRM_MEM_BUFS);
- free(dma->pagelist, DRM_MEM_PAGES);
- free(dev->dma, DRM_MEM_DRIVER);
- dev->dma = NULL;
- DRM_SPINUNINIT(&dev->dma_lock);
-}
-
-
-void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf)
-{
- if (!buf)
- return;
-
- buf->pending = 0;
- buf->file_priv= NULL;
- buf->used = 0;
-}
-
-void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
-{
- drm_device_dma_t *dma = dev->dma;
- int i;
-
- if (!dma)
- return;
-
- for (i = 0; i < dma->buf_count; i++) {
- if (dma->buflist[i]->file_priv == file_priv) {
- switch (dma->buflist[i]->list) {
- case DRM_LIST_NONE:
- drm_free_buffer(dev, dma->buflist[i]);
- break;
- case DRM_LIST_WAIT:
- dma->buflist[i]->list = DRM_LIST_RECLAIM;
- break;
- default:
- /* Buffer already on hardware. */
- break;
- }
- }
- }
-}
-
-/* Call into the driver-specific DMA handler */
-int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
-
- if (dev->driver->dma_ioctl) {
- /* shared code returns -errno */
- return -dev->driver->dma_ioctl(dev, data, file_priv);
- } else {
- DRM_DEBUG("DMA ioctl on driver with no dma handler\n");
- return EINVAL;
- }
-}
diff --git a/bsd-core/drm_drawable.c b/bsd-core/drm_drawable.c
deleted file mode 100644
index 2ae11dbb..00000000
--- a/bsd-core/drm_drawable.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_drawable.c
- * This file implements ioctls to store information along with DRM drawables,
- * such as the current set of cliprects for vblank-synced buffer swaps.
- */
-
-#include "drmP.h"
-
-struct bsd_drm_drawable_info {
- struct drm_drawable_info info;
- int handle;
- RB_ENTRY(bsd_drm_drawable_info) tree;
-};
-
-static int
-drm_drawable_compare(struct bsd_drm_drawable_info *a,
- struct bsd_drm_drawable_info *b)
-{
- if (a->handle > b->handle)
- return 1;
- if (a->handle < b->handle)
- return -1;
- return 0;
-}
-
-RB_GENERATE_STATIC(drawable_tree, bsd_drm_drawable_info, tree,
- drm_drawable_compare);
-
-struct drm_drawable_info *
-drm_get_drawable_info(struct drm_device *dev, int handle)
-{
- struct bsd_drm_drawable_info find, *result;
-
- find.handle = handle;
- result = RB_FIND(drawable_tree, &dev->drw_head, &find);
-
- return &result->info;
-}
-
-int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_draw *draw = data;
- struct bsd_drm_drawable_info *info;
-
- info = malloc(sizeof(struct bsd_drm_drawable_info), DRM_MEM_DRAWABLE,
- M_NOWAIT | M_ZERO);
- if (info == NULL)
- return ENOMEM;
-
- info->handle = alloc_unr(dev->drw_unrhdr);
- DRM_SPINLOCK(&dev->drw_lock);
- RB_INSERT(drawable_tree, &dev->drw_head, info);
- draw->handle = info->handle;
- DRM_SPINUNLOCK(&dev->drw_lock);
-
- DRM_DEBUG("%d\n", draw->handle);
-
- return 0;
-}
-
-int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_draw *draw = (struct drm_draw *)data;
- struct drm_drawable_info *info;
-
- DRM_SPINLOCK(&dev->drw_lock);
- info = drm_get_drawable_info(dev, draw->handle);
- if (info != NULL) {
- RB_REMOVE(drawable_tree, &dev->drw_head,
- (struct bsd_drm_drawable_info *)info);
- DRM_SPINUNLOCK(&dev->drw_lock);
- free_unr(dev->drw_unrhdr, draw->handle);
- free(info->rects, DRM_MEM_DRAWABLE);
- free(info, DRM_MEM_DRAWABLE);
- return 0;
- } else {
- DRM_SPINUNLOCK(&dev->drw_lock);
- return EINVAL;
- }
-}
-
-int drm_update_draw(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_drawable_info *info;
- struct drm_update_draw *update = (struct drm_update_draw *)data;
- int ret;
-
- info = drm_get_drawable_info(dev, update->handle);
- if (info == NULL)
- return EINVAL;
-
- switch (update->type) {
- case DRM_DRAWABLE_CLIPRECTS:
- DRM_SPINLOCK(&dev->drw_lock);
- if (update->num != info->num_rects) {
- free(info->rects, DRM_MEM_DRAWABLE);
- info->rects = NULL;
- info->num_rects = 0;
- }
- if (update->num == 0) {
- DRM_SPINUNLOCK(&dev->drw_lock);
- return 0;
- }
- if (info->rects == NULL) {
- info->rects = malloc(sizeof(*info->rects) *
- update->num, DRM_MEM_DRAWABLE, M_NOWAIT);
- if (info->rects == NULL) {
- DRM_SPINUNLOCK(&dev->drw_lock);
- return ENOMEM;
- }
- info->num_rects = update->num;
- }
- /* For some reason the pointer arg is unsigned long long. */
- ret = copyin((void *)(intptr_t)update->data, info->rects,
- sizeof(*info->rects) * info->num_rects);
- DRM_SPINUNLOCK(&dev->drw_lock);
- return ret;
- default:
- return EINVAL;
- }
-}
-
-void drm_drawable_free_all(struct drm_device *dev)
-{
- struct bsd_drm_drawable_info *info, *next;
-
- DRM_SPINLOCK(&dev->drw_lock);
- for (info = RB_MIN(drawable_tree, &dev->drw_head);
- info != NULL ; info = next) {
- next = RB_NEXT(drawable_tree, &dev->drw_head, info);
- RB_REMOVE(drawable_tree, &dev->drw_head,
- (struct bsd_drm_drawable_info *)info);
- DRM_SPINUNLOCK(&dev->drw_lock);
- free_unr(dev->drw_unrhdr, info->handle);
- free(info->info.rects, DRM_MEM_DRAWABLE);
- free(info, DRM_MEM_DRAWABLE);
- DRM_SPINLOCK(&dev->drw_lock);
- }
- DRM_SPINUNLOCK(&dev->drw_lock);
-}
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
deleted file mode 100644
index ce683a66..00000000
--- a/bsd-core/drm_drv.c
+++ /dev/null
@@ -1,839 +0,0 @@
-/*-
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_drv.c
- * The catch-all file for DRM device support, including module setup/teardown,
- * open/close, and ioctl dispatch.
- */
-
-
-#include <sys/limits.h>
-#include "drmP.h"
-#include "drm.h"
-#include "drm_sarea.h"
-
-#ifdef DRM_DEBUG_DEFAULT_ON
-int drm_debug_flag = 1;
-#else
-int drm_debug_flag = 0;
-#endif
-
-static int drm_load(struct drm_device *dev);
-static void drm_unload(struct drm_device *dev);
-static drm_pci_id_list_t *drm_find_description(int vendor, int device,
- drm_pci_id_list_t *idlist);
-
-#define DRIVER_SOFTC(unit) \
- ((struct drm_device *)devclass_get_softc(drm_devclass, unit))
-
-MODULE_VERSION(drm, 1);
-MODULE_DEPEND(drm, agp, 1, 1, 1);
-MODULE_DEPEND(drm, pci, 1, 1, 1);
-MODULE_DEPEND(drm, mem, 1, 1, 1);
-
-static drm_ioctl_desc_t drm_ioctls[256] = {
- DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_getmap, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER|DRM_ROOT_ONLY),
-
- DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_BLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-
- DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP, drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP, drm_rmmap_ioctl, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_getsareactx, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_addctx, DRM_AUTH|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_GET_CTX, drm_getctx, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_SWITCH_CTX, drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_RES_CTX, drm_resctx, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_adddraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_rmdraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-
- DRM_IOCTL_DEF(DRM_IOCTL_LOCK, drm_lock, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_UNLOCK, drm_unlock, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_ADD_BUFS, drm_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_MARK_BUFS, drm_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma, DRM_AUTH),
-
- DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_ACQUIRE, drm_agp_acquire_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_RELEASE, drm_agp_release_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_ENABLE, drm_agp_enable_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_INFO, drm_agp_info_ioctl, DRM_AUTH),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_ALLOC, drm_agp_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_FREE, drm_agp_free_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_BIND, drm_agp_bind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_AGP_UNBIND, drm_agp_unbind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-
- DRM_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_sg_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_SG_FREE, drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
- DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_modeset_ctl, 0),
- DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_update_draw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-};
-
-static struct cdevsw drm_cdevsw = {
- .d_version = D_VERSION,
- .d_open = drm_open,
- .d_read = drm_read,
- .d_ioctl = drm_ioctl,
- .d_poll = drm_poll,
- .d_mmap = drm_mmap,
- .d_name = "drm",
- .d_flags = D_TRACKCLOSE
-};
-
-int drm_msi = 1; /* Enable by default. */
-TUNABLE_INT("hw.drm.msi", &drm_msi);
-
-static struct drm_msi_blacklist_entry drm_msi_blacklist[] = {
- {0x8086, 0x2772}, /* Intel i945G */ \
- {0x8086, 0x27A2}, /* Intel i945GM */ \
- {0x8086, 0x27AE}, /* Intel i945GME */ \
- {0, 0}
-};
-
-static int drm_msi_is_blacklisted(int vendor, int device)
-{
- int i = 0;
-
- for (i = 0; drm_msi_blacklist[i].vendor != 0; i++) {
- if ((drm_msi_blacklist[i].vendor == vendor) &&
- (drm_msi_blacklist[i].device == device)) {
- return 1;
- }
- }
-
- return 0;
-}
-
-int drm_probe(device_t kdev, drm_pci_id_list_t *idlist)
-{
- drm_pci_id_list_t *id_entry;
- int vendor, device;
-#if __FreeBSD_version < 700010
- device_t realdev;
-
- if (!strcmp(device_get_name(kdev), "drmsub"))
- realdev = device_get_parent(kdev);
- else
- realdev = kdev;
- vendor = pci_get_vendor(realdev);
- device = pci_get_device(realdev);
-#else
- vendor = pci_get_vendor(kdev);
- device = pci_get_device(kdev);
-#endif
-
- if (pci_get_class(kdev) != PCIC_DISPLAY
- || pci_get_subclass(kdev) != PCIS_DISPLAY_VGA)
- return ENXIO;
-
- id_entry = drm_find_description(vendor, device, idlist);
- if (id_entry != NULL) {
- if (!device_get_desc(kdev)) {
- DRM_DEBUG("desc : %s\n", device_get_desc(kdev));
- device_set_desc(kdev, id_entry->name);
- }
- return 0;
- }
-
- return ENXIO;
-}
-
-int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
-{
- struct drm_device *dev;
- drm_pci_id_list_t *id_entry;
- int unit, msicount;
-
- unit = device_get_unit(kdev);
- dev = device_get_softc(kdev);
-
-#if __FreeBSD_version < 700010
- if (!strcmp(device_get_name(kdev), "drmsub"))
- dev->device = device_get_parent(kdev);
- else
- dev->device = kdev;
-#else
- dev->device = kdev;
-#endif
- dev->devnode = make_dev(&drm_cdevsw,
- unit,
- DRM_DEV_UID,
- DRM_DEV_GID,
- DRM_DEV_MODE,
- "dri/card%d", unit);
-
-#if __FreeBSD_version >= 700053
- dev->pci_domain = pci_get_domain(dev->device);
-#else
- dev->pci_domain = 0;
-#endif
- dev->pci_bus = pci_get_bus(dev->device);
- dev->pci_slot = pci_get_slot(dev->device);
- dev->pci_func = pci_get_function(dev->device);
-
- dev->pci_vendor = pci_get_vendor(dev->device);
- dev->pci_device = pci_get_device(dev->device);
-
- if (drm_msi &&
- !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) {
- msicount = pci_msi_count(dev->device);
- DRM_DEBUG("MSI count = %d\n", msicount);
- if (msicount > 1)
- msicount = 1;
-
- if (pci_alloc_msi(dev->device, &msicount) == 0) {
- DRM_INFO("MSI enabled %d message(s)\n", msicount);
- dev->msi_enabled = 1;
- dev->irqrid = 1;
- }
- }
-
- dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ,
- &dev->irqrid, RF_SHAREABLE);
- if (!dev->irqr) {
- return ENOENT;
- }
-
- dev->irq = (int) rman_get_start(dev->irqr);
-
- mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF);
- mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF);
- mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF);
- mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF);
-
- id_entry = drm_find_description(dev->pci_vendor,
- dev->pci_device, idlist);
- dev->id_entry = id_entry;
-
- return drm_load(dev);
-}
-
-int drm_detach(device_t kdev)
-{
- struct drm_device *dev;
-
- dev = device_get_softc(kdev);
-
- drm_unload(dev);
-
- bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
-
- if (dev->msi_enabled) {
- pci_release_msi(dev->device);
- DRM_INFO("MSI released\n");
- }
-
- return 0;
-}
-
-#ifndef DRM_DEV_NAME
-#define DRM_DEV_NAME "drm"
-#endif
-
-devclass_t drm_devclass;
-
-drm_pci_id_list_t *drm_find_description(int vendor, int device,
- drm_pci_id_list_t *idlist)
-{
- int i = 0;
-
- for (i = 0; idlist[i].vendor != 0; i++) {
- if ((idlist[i].vendor == vendor) &&
- ((idlist[i].device == device) ||
- (idlist[i].device == 0))) {
- return &idlist[i];
- }
- }
- return NULL;
-}
-
-static int drm_firstopen(struct drm_device *dev)
-{
- drm_local_map_t *map;
- int i;
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- /* prebuild the SAREA */
- i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM,
- _DRM_CONTAINS_LOCK, &map);
- if (i != 0)
- return i;
-
- if (dev->driver->firstopen)
- dev->driver->firstopen(dev);
-
- dev->buf_use = 0;
-
- if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) {
- i = drm_dma_setup(dev);
- if (i != 0)
- return i;
- }
-
- for (i = 0; i < DRM_HASH_SIZE; i++) {
- dev->magiclist[i].head = NULL;
- dev->magiclist[i].tail = NULL;
- }
-
- dev->lock.lock_queue = 0;
- dev->irq_enabled = 0;
- dev->context_flag = 0;
- dev->last_context = 0;
- dev->if_version = 0;
-
- dev->buf_sigio = NULL;
-
- DRM_DEBUG("\n");
-
- return 0;
-}
-
-static int drm_lastclose(struct drm_device *dev)
-{
- drm_magic_entry_t *pt, *next;
- drm_local_map_t *map, *mapsave;
- int i;
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
-
- DRM_DEBUG("\n");
-
- if (dev->driver->lastclose != NULL)
- dev->driver->lastclose(dev);
-
- if (dev->irq_enabled)
- drm_irq_uninstall(dev);
-
- if (dev->unique) {
- free(dev->unique, DRM_MEM_DRIVER);
- dev->unique = NULL;
- dev->unique_len = 0;
- }
- /* Clear pid list */
- for (i = 0; i < DRM_HASH_SIZE; i++) {
- for (pt = dev->magiclist[i].head; pt; pt = next) {
- next = pt->next;
- free(pt, DRM_MEM_MAGIC);
- }
- dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
- }
-
- DRM_UNLOCK();
- drm_drawable_free_all(dev);
- DRM_LOCK();
-
- /* Clear AGP information */
- if (dev->agp) {
- drm_agp_mem_t *entry;
- drm_agp_mem_t *nexte;
-
- /* Remove AGP resources, but leave dev->agp intact until
- * drm_unload is called.
- */
- for (entry = dev->agp->memory; entry; entry = nexte) {
- nexte = entry->next;
- if (entry->bound)
- drm_agp_unbind_memory(entry->handle);
- drm_agp_free_memory(entry->handle);
- free(entry, DRM_MEM_AGPLISTS);
- }
- dev->agp->memory = NULL;
-
- if (dev->agp->acquired)
- drm_agp_release(dev);
-
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
- }
- if (dev->sg != NULL) {
- drm_sg_cleanup(dev->sg);
- dev->sg = NULL;
- }
-
- TAILQ_FOREACH_SAFE(map, &dev->maplist, link, mapsave) {
- if (!(map->flags & _DRM_DRIVER))
- drm_rmmap(dev, map);
- }
-
- drm_dma_takedown(dev);
- if (dev->lock.hw_lock) {
- dev->lock.hw_lock = NULL; /* SHM removed */
- dev->lock.file_priv = NULL;
- DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
- }
-
- return 0;
-}
-
-static int drm_load(struct drm_device *dev)
-{
- int i, retcode;
-
- DRM_DEBUG("\n");
-
- TAILQ_INIT(&dev->maplist);
-
- drm_mem_init();
- drm_sysctl_init(dev);
- TAILQ_INIT(&dev->files);
-
- dev->counters = 6;
- dev->types[0] = _DRM_STAT_LOCK;
- dev->types[1] = _DRM_STAT_OPENS;
- dev->types[2] = _DRM_STAT_CLOSES;
- dev->types[3] = _DRM_STAT_IOCTLS;
- dev->types[4] = _DRM_STAT_LOCKS;
- dev->types[5] = _DRM_STAT_UNLOCKS;
-
- for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++)
- atomic_set(&dev->counts[i], 0);
-
- if (dev->driver->load != NULL) {
- DRM_LOCK();
- /* Shared code returns -errno. */
- retcode = -dev->driver->load(dev,
- dev->id_entry->driver_private);
- if (pci_enable_busmaster(dev->device))
- DRM_ERROR("Request to enable bus-master failed.\n");
- DRM_UNLOCK();
- if (retcode != 0)
- goto error;
- }
-
- if (drm_core_has_AGP(dev)) {
- if (drm_device_is_agp(dev))
- dev->agp = drm_agp_init();
- if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) &&
- dev->agp == NULL) {
- DRM_ERROR("Card isn't AGP, or couldn't initialize "
- "AGP.\n");
- retcode = ENOMEM;
- goto error;
- }
- if (dev->agp != NULL) {
- if (drm_mtrr_add(dev->agp->info.ai_aperture_base,
- dev->agp->info.ai_aperture_size, DRM_MTRR_WC) == 0)
- dev->agp->mtrr = 1;
- }
- }
-
- retcode = drm_ctxbitmap_init(dev);
- if (retcode != 0) {
- DRM_ERROR("Cannot allocate memory for context bitmap.\n");
- goto error;
- }
-
- dev->drw_unrhdr = new_unrhdr(1, INT_MAX, NULL);
- if (dev->drw_unrhdr == NULL) {
- DRM_ERROR("Couldn't allocate drawable number allocator\n");
- goto error;
- }
-
- DRM_INFO("Initialized %s %d.%d.%d %s\n",
- dev->driver->name,
- dev->driver->major,
- dev->driver->minor,
- dev->driver->patchlevel,
- dev->driver->date);
-
- return 0;
-
-error:
- drm_sysctl_cleanup(dev);
- DRM_LOCK();
- drm_lastclose(dev);
- DRM_UNLOCK();
- destroy_dev(dev->devnode);
-
- mtx_destroy(&dev->drw_lock);
- mtx_destroy(&dev->vbl_lock);
- mtx_destroy(&dev->irq_lock);
- mtx_destroy(&dev->dev_lock);
-
- return retcode;
-}
-
-static void drm_unload(struct drm_device *dev)
-{
- int i;
-
- DRM_DEBUG("\n");
-
- drm_sysctl_cleanup(dev);
- destroy_dev(dev->devnode);
-
- drm_ctxbitmap_cleanup(dev);
-
- if (dev->agp && dev->agp->mtrr) {
- int __unused retcode;
-
- retcode = drm_mtrr_del(0, dev->agp->info.ai_aperture_base,
- dev->agp->info.ai_aperture_size, DRM_MTRR_WC);
- DRM_DEBUG("mtrr_del = %d", retcode);
- }
-
- DRM_LOCK();
- drm_lastclose(dev);
- DRM_UNLOCK();
-
- drm_vblank_cleanup(dev);
-
- /* Clean up PCI resources allocated by drm_bufs.c. We're not really
- * worried about resource consumption while the DRM is inactive (between
- * lastclose and firstopen or unload) because these aren't actually
- * taking up KVA, just keeping the PCI resource allocated.
- */
- for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
- if (dev->pcir[i] == NULL)
- continue;
- bus_release_resource(dev->device, SYS_RES_MEMORY,
- dev->pcirid[i], dev->pcir[i]);
- dev->pcir[i] = NULL;
- }
-
- if (dev->agp) {
- free(dev->agp, DRM_MEM_AGPLISTS);
- dev->agp = NULL;
- }
-
- if (dev->driver->unload != NULL) {
- DRM_LOCK();
- dev->driver->unload(dev);
- DRM_UNLOCK();
- }
-
- delete_unrhdr(dev->drw_unrhdr);
-
- drm_mem_uninit();
-
- if (pci_disable_busmaster(dev->device))
- DRM_ERROR("Request to disable bus-master failed.\n");
-
- mtx_destroy(&dev->drw_lock);
- mtx_destroy(&dev->vbl_lock);
- mtx_destroy(&dev->irq_lock);
- mtx_destroy(&dev->dev_lock);
-}
-
-int drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_version *version = data;
- int len;
-
-#define DRM_COPY( name, value ) \
- len = strlen( value ); \
- if ( len > name##_len ) len = name##_len; \
- name##_len = strlen( value ); \
- if ( len && name ) { \
- if ( DRM_COPY_TO_USER( name, value, len ) ) \
- return EFAULT; \
- }
-
- version->version_major = dev->driver->major;
- version->version_minor = dev->driver->minor;
- version->version_patchlevel = dev->driver->patchlevel;
-
- DRM_COPY(version->name, dev->driver->name);
- DRM_COPY(version->date, dev->driver->date);
- DRM_COPY(version->desc, dev->driver->desc);
-
- return 0;
-}
-
-int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
-{
- struct drm_device *dev = NULL;
- int retcode = 0;
-
- dev = DRIVER_SOFTC(dev2unit(kdev));
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
-
- retcode = drm_open_helper(kdev, flags, fmt, p, dev);
-
- if (!retcode) {
- atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
- DRM_LOCK();
- device_busy(dev->device);
- if (!dev->open_count++)
- retcode = drm_firstopen(dev);
- DRM_UNLOCK();
- }
-
- return retcode;
-}
-
-void drm_close(void *data)
-{
- struct drm_file *file_priv = data;
- struct drm_device *dev = file_priv->dev;
- int retcode = 0;
-
- DRM_DEBUG("open_count = %d\n", dev->open_count);
-
- DRM_LOCK();
-
- if (dev->driver->preclose != NULL)
- dev->driver->preclose(dev, file_priv);
-
- /* ========================================================
- * Begin inline drm_release
- */
-
- DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- DRM_CURRENTPID, (long)dev->device, dev->open_count);
-
- if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
- && dev->lock.file_priv == file_priv) {
- DRM_DEBUG("Process %d dead, freeing lock for context %d\n",
- DRM_CURRENTPID,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
- if (dev->driver->reclaim_buffers_locked != NULL)
- dev->driver->reclaim_buffers_locked(dev, file_priv);
-
- drm_lock_free(&dev->lock,
- _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
-
- /* FIXME: may require heavy-handed reset of
- hardware at this point, possibly
- processed via a callback to the X
- server. */
- } else if (dev->driver->reclaim_buffers_locked != NULL &&
- dev->lock.hw_lock != NULL) {
- /* The lock is required to reclaim buffers */
- for (;;) {
- if (!dev->lock.hw_lock) {
- /* Device has been unregistered */
- retcode = EINTR;
- break;
- }
- if (drm_lock_take(&dev->lock, DRM_KERNEL_CONTEXT)) {
- dev->lock.file_priv = file_priv;
- dev->lock.lock_time = jiffies;
- atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
- break; /* Got lock */
- }
- /* Contention */
- retcode = mtx_sleep((void *)&dev->lock.lock_queue,
- &dev->dev_lock, PCATCH, "drmlk2", 0);
- if (retcode)
- break;
- }
- if (retcode == 0) {
- dev->driver->reclaim_buffers_locked(dev, file_priv);
- drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT);
- }
- }
-
- if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
- !dev->driver->reclaim_buffers_locked)
- drm_reclaim_buffers(dev, file_priv);
-
- funsetown(&dev->buf_sigio);
-
- if (dev->driver->postclose != NULL)
- dev->driver->postclose(dev, file_priv);
- TAILQ_REMOVE(&dev->files, file_priv, link);
- free(file_priv, DRM_MEM_FILES);
-
- /* ========================================================
- * End inline drm_release
- */
-
- atomic_inc(&dev->counts[_DRM_STAT_CLOSES]);
- device_unbusy(dev->device);
- if (--dev->open_count == 0) {
- retcode = drm_lastclose(dev);
- }
-
- DRM_UNLOCK();
-}
-
-/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm.
- */
-int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
- DRM_STRUCTPROC *p)
-{
- struct drm_device *dev = drm_get_device_from_kdev(kdev);
- int retcode = 0;
- drm_ioctl_desc_t *ioctl;
- int (*func)(struct drm_device *dev, void *data, struct drm_file *file_priv);
- int nr = DRM_IOCTL_NR(cmd);
- int is_driver_ioctl = 0;
- struct drm_file *file_priv;
-
- retcode = devfs_get_cdevpriv((void **)&file_priv);
- if (retcode != 0) {
- DRM_ERROR("can't find authenticator\n");
- return EINVAL;
- }
-
- atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
- ++file_priv->ioctl_count;
-
- DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
- DRM_CURRENTPID, cmd, nr, (long)dev->device,
- file_priv->authenticated);
-
- switch (cmd) {
- case FIONBIO:
- case FIOASYNC:
- return 0;
-
- case FIOSETOWN:
- return fsetown(*(int *)data, &dev->buf_sigio);
-
- case FIOGETOWN:
- *(int *) data = fgetown(&dev->buf_sigio);
- return 0;
- }
-
- if (IOCGROUP(cmd) != DRM_IOCTL_BASE) {
- DRM_DEBUG("Bad ioctl group 0x%x\n", (int)IOCGROUP(cmd));
- return EINVAL;
- }
-
- ioctl = &drm_ioctls[nr];
- /* It's not a core DRM ioctl, try driver-specific. */
- if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) {
- /* The array entries begin at DRM_COMMAND_BASE ioctl nr */
- nr -= DRM_COMMAND_BASE;
- if (nr > dev->driver->max_ioctl) {
- DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n",
- nr, dev->driver->max_ioctl);
- return EINVAL;
- }
- ioctl = &dev->driver->ioctls[nr];
- is_driver_ioctl = 1;
- }
- func = ioctl->func;
-
- if (func == NULL) {
- DRM_DEBUG("no function\n");
- return EINVAL;
- }
-
- if (((ioctl->flags & DRM_ROOT_ONLY) && !DRM_SUSER(p)) ||
- ((ioctl->flags & DRM_AUTH) && !file_priv->authenticated) ||
- ((ioctl->flags & DRM_MASTER) && !file_priv->master))
- return EACCES;
-
- if (is_driver_ioctl) {
- DRM_LOCK();
- /* shared code returns -errno */
- retcode = -func(dev, data, file_priv);
- DRM_UNLOCK();
- } else {
- retcode = func(dev, data, file_priv);
- }
-
- if (retcode != 0)
- DRM_DEBUG(" returning %d\n", retcode);
-
- return retcode;
-}
-
-drm_local_map_t *drm_getsarea(struct drm_device *dev)
-{
- drm_local_map_t *map;
-
- DRM_SPINLOCK_ASSERT(&dev->dev_lock);
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (map->type == _DRM_SHM && (map->flags & _DRM_CONTAINS_LOCK))
- return map;
- }
-
- return NULL;
-}
-
-#if DRM_LINUX
-
-#include <sys/sysproto.h>
-
-MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 1);
-
-#define LINUX_IOCTL_DRM_MIN 0x6400
-#define LINUX_IOCTL_DRM_MAX 0x64ff
-
-static linux_ioctl_function_t drm_linux_ioctl;
-static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl,
- LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX};
-
-SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
- linux_ioctl_register_handler, &drm_handler);
-SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
- linux_ioctl_unregister_handler, &drm_handler);
-
-/* The bits for in/out are switched on Linux */
-#define LINUX_IOC_IN IOC_OUT
-#define LINUX_IOC_OUT IOC_IN
-
-static int
-drm_linux_ioctl(DRM_STRUCTPROC *p, struct linux_ioctl_args* args)
-{
- int error;
- int cmd = args->cmd;
-
- args->cmd &= ~(LINUX_IOC_IN | LINUX_IOC_OUT);
- if (cmd & LINUX_IOC_IN)
- args->cmd |= IOC_IN;
- if (cmd & LINUX_IOC_OUT)
- args->cmd |= IOC_OUT;
-
- error = ioctl(p, (struct ioctl_args *)args);
-
- return error;
-}
-#endif /* DRM_LINUX */
diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c
deleted file mode 100644
index e4cf8461..00000000
--- a/bsd-core/drm_fops.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Daryll Strauss <daryll@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_fops.c
- * Support code for dealing with the file privates associated with each
- * open of the DRM device.
- */
-
-#include "drmP.h"
-
-/* drm_open_helper is called whenever a process opens /dev/drm. */
-int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
- struct drm_device *dev)
-{
- struct drm_file *priv;
- int m = dev2unit(kdev);
- int retcode;
-
- if (flags & O_EXCL)
- return EBUSY; /* No exclusive opens */
- dev->flags = flags;
-
- DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
-
- priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO);
- if (priv == NULL) {
- return ENOMEM;
- }
-
- retcode = devfs_set_cdevpriv(priv, drm_close);
- if (retcode != 0) {
- free(priv, DRM_MEM_FILES);
- return retcode;
- }
-
- DRM_LOCK();
- priv->dev = dev;
- priv->uid = p->td_ucred->cr_svuid;
- priv->pid = p->td_proc->p_pid;
- priv->minor = m;
- priv->ioctl_count = 0;
-
- /* for compatibility root is always authenticated */
- priv->authenticated = DRM_SUSER(p);
-
- if (dev->driver->open) {
- /* shared code returns -errno */
- retcode = -dev->driver->open(dev, priv);
- if (retcode != 0) {
- devfs_clear_cdevpriv();
- free(priv, DRM_MEM_FILES);
- DRM_UNLOCK();
- return retcode;
- }
- }
-
- /* first opener automatically becomes master */
- priv->master = TAILQ_EMPTY(&dev->files);
-
- TAILQ_INSERT_TAIL(&dev->files, priv, link);
- DRM_UNLOCK();
- kdev->si_drv1 = dev;
- return 0;
-}
-
-
-/* The drm_read and drm_poll are stubs to prevent spurious errors
- * on older X Servers (4.3.0 and earlier) */
-
-int drm_read(struct cdev *kdev, struct uio *uio, int ioflag)
-{
- return 0;
-}
-
-int drm_poll(struct cdev *kdev, int events, DRM_STRUCTPROC *p)
-{
- return 0;
-}
diff --git a/bsd-core/drm_internal.h b/bsd-core/drm_internal.h
deleted file mode 120000
index b30ef94a..00000000
--- a/bsd-core/drm_internal.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/drm_internal.h \ No newline at end of file
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c
deleted file mode 100644
index cae853ee..00000000
--- a/bsd-core/drm_ioctl.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_ioctl.c
- * Varios minor DRM ioctls not applicable to other files, such as versioning
- * information and reporting DRM information to userland.
- */
-
-#include "drmP.h"
-
-/*
- * Beginning in revision 1.1 of the DRM interface, getunique will return
- * a unique in the form pci:oooo:bb:dd.f (o=domain, b=bus, d=device, f=function)
- * before setunique has been called. The format for the bus-specific part of
- * the unique is not defined for any other bus.
- */
-int drm_getunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_unique *u = data;
-
- if (u->unique_len >= dev->unique_len) {
- if (DRM_COPY_TO_USER(u->unique, dev->unique, dev->unique_len))
- return EFAULT;
- }
- u->unique_len = dev->unique_len;
-
- return 0;
-}
-
-/* Deprecated in DRM version 1.1, and will return EBUSY when setversion has
- * requested version 1.1 or greater.
- */
-int drm_setunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_unique *u = data;
- int domain, bus, slot, func, ret;
- char *busid;
-
- /* Check and copy in the submitted Bus ID */
- if (!u->unique_len || u->unique_len > 1024)
- return EINVAL;
-
- busid = malloc(u->unique_len + 1, DRM_MEM_DRIVER, M_WAITOK);
- if (busid == NULL)
- return ENOMEM;
-
- if (DRM_COPY_FROM_USER(busid, u->unique, u->unique_len)) {
- free(busid, DRM_MEM_DRIVER);
- return EFAULT;
- }
- busid[u->unique_len] = '\0';
-
- /* Return error if the busid submitted doesn't match the device's actual
- * busid.
- */
- ret = sscanf(busid, "PCI:%d:%d:%d", &bus, &slot, &func);
- if (ret != 3) {
- free(busid, DRM_MEM_DRIVER);
- return EINVAL;
- }
- domain = bus >> 8;
- bus &= 0xff;
-
- if ((domain != dev->pci_domain) ||
- (bus != dev->pci_bus) ||
- (slot != dev->pci_slot) ||
- (func != dev->pci_func)) {
- free(busid, DRM_MEM_DRIVER);
- return EINVAL;
- }
-
- /* Actually set the device's busid now. */
- DRM_LOCK();
- if (dev->unique_len || dev->unique) {
- DRM_UNLOCK();
- return EBUSY;
- }
-
- dev->unique_len = u->unique_len;
- dev->unique = busid;
- DRM_UNLOCK();
-
- return 0;
-}
-
-
-static int
-drm_set_busid(struct drm_device *dev)
-{
-
- DRM_LOCK();
-
- if (dev->unique != NULL) {
- DRM_UNLOCK();
- return EBUSY;
- }
-
- dev->unique_len = 20;
- dev->unique = malloc(dev->unique_len + 1, DRM_MEM_DRIVER, M_NOWAIT);
- if (dev->unique == NULL) {
- DRM_UNLOCK();
- return ENOMEM;
- }
-
- snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%1x",
- dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
-
- DRM_UNLOCK();
-
- return 0;
-}
-
-int drm_getmap(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_map *map = data;
- drm_local_map_t *mapinlist;
- int idx;
- int i = 0;
-
- idx = map->offset;
-
- DRM_LOCK();
- if (idx < 0) {
- DRM_UNLOCK();
- return EINVAL;
- }
-
- TAILQ_FOREACH(mapinlist, &dev->maplist, link) {
- if (i == idx) {
- map->offset = mapinlist->offset;
- map->size = mapinlist->size;
- map->type = mapinlist->type;
- map->flags = mapinlist->flags;
- map->handle = mapinlist->handle;
- map->mtrr = mapinlist->mtrr;
- break;
- }
- i++;
- }
-
- DRM_UNLOCK();
-
- if (mapinlist == NULL)
- return EINVAL;
-
- return 0;
-}
-
-int drm_getclient(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_client *client = data;
- struct drm_file *pt;
- int idx;
- int i = 0;
-
- idx = client->idx;
- DRM_LOCK();
- TAILQ_FOREACH(pt, &dev->files, link) {
- if (i == idx) {
- client->auth = pt->authenticated;
- client->pid = pt->pid;
- client->uid = pt->uid;
- client->magic = pt->magic;
- client->iocs = pt->ioctl_count;
- DRM_UNLOCK();
- return 0;
- }
- i++;
- }
- DRM_UNLOCK();
-
- return EINVAL;
-}
-
-int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_stats *stats = data;
- int i;
-
- memset(stats, 0, sizeof(struct drm_stats));
-
- DRM_LOCK();
-
- for (i = 0; i < dev->counters; i++) {
- if (dev->types[i] == _DRM_STAT_LOCK)
- stats->data[i].value =
- (dev->lock.hw_lock ? dev->lock.hw_lock->lock : 0);
- else
- stats->data[i].value = atomic_read(&dev->counts[i]);
- stats->data[i].type = dev->types[i];
- }
-
- stats->count = dev->counters;
-
- DRM_UNLOCK();
-
- return 0;
-}
-
-#define DRM_IF_MAJOR 1
-#define DRM_IF_MINOR 2
-
-int drm_setversion(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_set_version *sv = data;
- struct drm_set_version ver;
- int if_version;
-
- /* Save the incoming data, and set the response before continuing
- * any further.
- */
- ver = *sv;
- sv->drm_di_major = DRM_IF_MAJOR;
- sv->drm_di_minor = DRM_IF_MINOR;
- sv->drm_dd_major = dev->driver->major;
- sv->drm_dd_minor = dev->driver->minor;
-
- if (ver.drm_di_major != -1) {
- if (ver.drm_di_major != DRM_IF_MAJOR ||
- ver.drm_di_minor < 0 || ver.drm_di_minor > DRM_IF_MINOR) {
- return EINVAL;
- }
- if_version = DRM_IF_VERSION(ver.drm_di_major,
- ver.drm_dd_minor);
- dev->if_version = DRM_MAX(if_version, dev->if_version);
- if (ver.drm_di_minor >= 1) {
- /*
- * Version 1.1 includes tying of DRM to specific device
- */
- drm_set_busid(dev);
- }
- }
-
- if (ver.drm_dd_major != -1) {
- if (ver.drm_dd_major != dev->driver->major ||
- ver.drm_dd_minor < 0 ||
- ver.drm_dd_minor > dev->driver->minor)
- {
- return EINVAL;
- }
- }
-
- return 0;
-}
-
-
-int drm_noop(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- DRM_DEBUG("\n");
- return 0;
-}
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
deleted file mode 100644
index 2ca4275e..00000000
--- a/bsd-core/drm_irq.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*-
- * Copyright 2003 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-/** @file drm_irq.c
- * Support code for handling setup/teardown of interrupt handlers and
- * handing interrupt handlers off to the drivers.
- */
-
-#include "drmP.h"
-#include "drm.h"
-
-int drm_irq_by_busid(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_irq_busid *irq = data;
-
- if ((irq->busnum >> 8) != dev->pci_domain ||
- (irq->busnum & 0xff) != dev->pci_bus ||
- irq->devnum != dev->pci_slot ||
- irq->funcnum != dev->pci_func)
- return EINVAL;
-
- irq->irq = dev->irq;
-
- DRM_DEBUG("%d:%d:%d => IRQ %d\n",
- irq->busnum, irq->devnum, irq->funcnum, irq->irq);
-
- return 0;
-}
-
-static irqreturn_t
-drm_irq_handler_wrap(DRM_IRQ_ARGS)
-{
- struct drm_device *dev = arg;
-
- DRM_SPINLOCK(&dev->irq_lock);
- dev->driver->irq_handler(arg);
- DRM_SPINUNLOCK(&dev->irq_lock);
-}
-
-static void vblank_disable_fn(void *arg)
-{
- struct drm_device *dev = (struct drm_device *)arg;
- int i;
-
- if (callout_pending(&dev->vblank_disable_timer)) {
- /* callout was reset */
- return;
- }
- if (!callout_active(&dev->vblank_disable_timer)) {
- /* callout was stopped */
- return;
- }
- callout_deactivate(&dev->vblank_disable_timer);
-
- DRM_DEBUG("vblank_disable_allowed=%d\n", dev->vblank_disable_allowed);
- if (!dev->vblank_disable_allowed)
- return;
-
- for (i = 0; i < dev->num_crtcs; i++) {
- if (atomic_read(&dev->vblank[i].refcount) == 0 &&
- dev->vblank[i].enabled) {
- DRM_DEBUG("disabling vblank on crtc %d\n", i);
- dev->vblank[i].last =
- dev->driver->get_vblank_counter(dev, i);
- dev->driver->disable_vblank(dev, i);
- dev->vblank[i].enabled = 0;
- }
- }
-}
-
-void drm_vblank_cleanup(struct drm_device *dev)
-{
- unsigned long irqflags;
-
- /* Bail if the driver didn't call drm_vblank_init() */
- if (dev->num_crtcs == 0)
- return;
-
- DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
- callout_stop(&dev->vblank_disable_timer);
- DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
-
- callout_drain(&dev->vblank_disable_timer);
-
- vblank_disable_fn((void *)dev);
-
- free(dev->vblank, DRM_MEM_DRIVER);
-
- dev->num_crtcs = 0;
-}
-
-int drm_vblank_init(struct drm_device *dev, int num_crtcs)
-{
- int i, ret = ENOMEM;
-
- callout_init_mtx(&dev->vblank_disable_timer, &dev->vbl_lock, 0);
- atomic_set(&dev->vbl_signal_pending, 0);
- dev->num_crtcs = num_crtcs;
-
- dev->vblank = malloc(sizeof(struct drm_vblank_info) * num_crtcs,
- DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
- if (!dev->vblank)
- goto err;
-
- DRM_DEBUG("\n");
-
- /* Zero per-crtc vblank stuff */
- for (i = 0; i < num_crtcs; i++) {
- DRM_INIT_WAITQUEUE(&dev->vblank[i].queue);
- TAILQ_INIT(&dev->vblank[i].sigs);
- atomic_set(&dev->vblank[i].count, 0);
- atomic_set(&dev->vblank[i].refcount, 0);
- }
-
- dev->vblank_disable_allowed = 0;
-
- return 0;
-
-err:
- drm_vblank_cleanup(dev);
- return ret;
-}
-
-int drm_irq_install(struct drm_device *dev)
-{
- int retcode;
-
- if (dev->irq == 0 || dev->dev_private == NULL)
- return EINVAL;
-
- DRM_DEBUG("irq=%d\n", dev->irq);
-
- DRM_LOCK();
- if (dev->irq_enabled) {
- DRM_UNLOCK();
- return EBUSY;
- }
- dev->irq_enabled = 1;
-
- dev->context_flag = 0;
-
- /* Before installing handler */
- dev->driver->irq_preinstall(dev);
- DRM_UNLOCK();
-
- /* Install handler */
-#if __FreeBSD_version >= 700031
- retcode = bus_setup_intr(dev->device, dev->irqr,
- INTR_TYPE_TTY | INTR_MPSAFE,
- NULL, drm_irq_handler_wrap, dev, &dev->irqh);
-#else
- retcode = bus_setup_intr(dev->device, dev->irqr,
- INTR_TYPE_TTY | INTR_MPSAFE,
- drm_irq_handler_wrap, dev, &dev->irqh);
-#endif
- if (retcode != 0)
- goto err;
-
- /* After installing handler */
- DRM_LOCK();
- dev->driver->irq_postinstall(dev);
- DRM_UNLOCK();
-
- return 0;
-err:
- DRM_LOCK();
- dev->irq_enabled = 0;
- DRM_UNLOCK();
-
- return retcode;
-}
-
-int drm_irq_uninstall(struct drm_device *dev)
-{
- if (!dev->irq_enabled)
- return EINVAL;
-
- dev->irq_enabled = 0;
-
- DRM_DEBUG("irq=%d\n", dev->irq);
-
- dev->driver->irq_uninstall(dev);
-
- DRM_UNLOCK();
- bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
- DRM_LOCK();
-
- return 0;
-}
-
-int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_control *ctl = data;
- int err;
-
- switch (ctl->func) {
- case DRM_INST_HANDLER:
- /* Handle drivers whose DRM used to require IRQ setup but the
- * no longer does.
- */
- if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
- return 0;
- if (dev->if_version < DRM_IF_VERSION(1, 2) &&
- ctl->irq != dev->irq)
- return EINVAL;
- return drm_irq_install(dev);
- case DRM_UNINST_HANDLER:
- if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
- return 0;
- DRM_LOCK();
- err = drm_irq_uninstall(dev);
- DRM_UNLOCK();
- return err;
- default:
- return EINVAL;
- }
-}
-
-u32 drm_vblank_count(struct drm_device *dev, int crtc)
-{
- return atomic_read(&dev->vblank[crtc].count);
-}
-
-static void drm_update_vblank_count(struct drm_device *dev, int crtc)
-{
- u32 cur_vblank, diff;
-
- /*
- * Interrupts were disabled prior to this call, so deal with counter
- * wrap if needed.
- * NOTE! It's possible we lost a full dev->max_vblank_count events
- * here if the register is small or we had vblank interrupts off for
- * a long time.
- */
- cur_vblank = dev->driver->get_vblank_counter(dev, crtc);
- diff = cur_vblank - dev->vblank[crtc].last;
- if (cur_vblank < dev->vblank[crtc].last) {
- diff += dev->max_vblank_count;
-
- DRM_DEBUG("vblank[%d].last=0x%x, cur_vblank=0x%x => diff=0x%x\n",
- crtc, dev->vblank[crtc].last, cur_vblank, diff);
- }
-
- DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
- crtc, diff);
-
- atomic_add(diff, &dev->vblank[crtc].count);
-}
-
-int drm_vblank_get(struct drm_device *dev, int crtc)
-{
- unsigned long irqflags;
- int ret = 0;
-
- DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
- /* Going from 0->1 means we have to enable interrupts again */
- atomic_add_acq_int(&dev->vblank[crtc].refcount, 1);
- DRM_DEBUG("vblank refcount = %d\n", dev->vblank[crtc].refcount);
- if (dev->vblank[crtc].refcount == 1 &&
- !dev->vblank[crtc].enabled) {
- ret = dev->driver->enable_vblank(dev, crtc);
- if (ret)
- atomic_dec(&dev->vblank[crtc].refcount);
- else {
- dev->vblank[crtc].enabled = 1;
- drm_update_vblank_count(dev, crtc);
- }
- }
- DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
-
- return ret;
-}
-
-void drm_vblank_put(struct drm_device *dev, int crtc)
-{
- unsigned long irqflags;
-
- DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
- /* Last user schedules interrupt disable */
- atomic_subtract_acq_int(&dev->vblank[crtc].refcount, 1);
- DRM_DEBUG("vblank refcount = %d\n", dev->vblank[crtc].refcount);
- if (dev->vblank[crtc].refcount == 0)
- callout_reset(&dev->vblank_disable_timer, 5 * DRM_HZ,
- (timeout_t *)vblank_disable_fn, (void *)dev);
- DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
-}
-
-int drm_modeset_ctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_modeset_ctl *modeset = data;
- unsigned long irqflags;
- int crtc, ret = 0;
-
- DRM_DEBUG("num_crtcs=%d\n", dev->num_crtcs);
- /* If drm_vblank_init() hasn't been called yet, just no-op */
- if (!dev->num_crtcs)
- goto out;
-
- crtc = modeset->crtc;
- DRM_DEBUG("crtc=%d\n", crtc);
- if (crtc >= dev->num_crtcs) {
- ret = EINVAL;
- goto out;
- }
-
- /*
- * To avoid all the problems that might happen if interrupts
- * were enabled/disabled around or between these calls, we just
- * have the kernel take a reference on the CRTC (just once though
- * to avoid corrupting the count if multiple, mismatch calls occur),
- * so that interrupts remain enabled in the interim.
- */
- switch (modeset->cmd) {
- case _DRM_PRE_MODESET:
- DRM_DEBUG("pre-modeset\n");
- if (!dev->vblank[crtc].inmodeset) {
- dev->vblank[crtc].inmodeset = 1;
- drm_vblank_get(dev, crtc);
- }
- break;
- case _DRM_POST_MODESET:
- DRM_DEBUG("post-modeset\n");
- if (dev->vblank[crtc].inmodeset) {
- DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
- dev->vblank_disable_allowed = 1;
- dev->vblank[crtc].inmodeset = 0;
- DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
- drm_vblank_put(dev, crtc);
- }
- break;
- default:
- ret = EINVAL;
- break;
- }
-
-out:
- return ret;
-}
-
-int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- union drm_wait_vblank *vblwait = data;
- unsigned int flags, seq, crtc;
- int ret = 0;
-
- if (!dev->irq_enabled)
- return EINVAL;
-
- if (vblwait->request.type &
- ~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)) {
- DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n",
- vblwait->request.type,
- (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK));
- return EINVAL;
- }
-
- flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
- crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0;
-
- if (crtc >= dev->num_crtcs)
- return EINVAL;
-
- ret = drm_vblank_get(dev, crtc);
- if (ret) {
- DRM_ERROR("failed to acquire vblank counter, %d\n", ret);
- return ret;
- }
- seq = drm_vblank_count(dev, crtc);
-
- switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
- case _DRM_VBLANK_RELATIVE:
- vblwait->request.sequence += seq;
- vblwait->request.type &= ~_DRM_VBLANK_RELATIVE;
- case _DRM_VBLANK_ABSOLUTE:
- break;
- default:
- ret = EINVAL;
- goto done;
- }
-
- if ((flags & _DRM_VBLANK_NEXTONMISS) &&
- (seq - vblwait->request.sequence) <= (1<<23)) {
- vblwait->request.sequence = seq + 1;
- }
-
- if (flags & _DRM_VBLANK_SIGNAL) {
-#if 0 /* disabled */
- drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t),
- DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
- if (vbl_sig == NULL)
- return ENOMEM;
-
- vbl_sig->sequence = vblwait->request.sequence;
- vbl_sig->signo = vblwait->request.signal;
- vbl_sig->pid = DRM_CURRENTPID;
-
- vblwait->reply.sequence = atomic_read(&dev->vbl_received);
-
- DRM_SPINLOCK(&dev->vbl_lock);
- TAILQ_INSERT_HEAD(&dev->vbl_sig_list, vbl_sig, link);
- DRM_SPINUNLOCK(&dev->vbl_lock);
- ret = 0;
-#endif
- ret = EINVAL;
- } else {
- DRM_DEBUG("waiting on vblank count %d, crtc %d\n",
- vblwait->request.sequence, crtc);
- for ( ret = 0 ; !ret && !((drm_vblank_count(dev, crtc) -
- vblwait->request.sequence) <= (1 << 23)) ; ) {
- mtx_lock(&dev->irq_lock);
- if (!((drm_vblank_count(dev, crtc) -
- vblwait->request.sequence) <= (1 << 23)))
- ret = mtx_sleep(&dev->vblank[crtc].queue,
- &dev->irq_lock, PCATCH, "vblwtq",
- 3 * DRM_HZ);
- mtx_unlock(&dev->irq_lock);
- }
-
- DRM_DEBUG("return = %d\n", ret);
- if (ret != EINTR) {
- struct timeval now;
-
- microtime(&now);
- vblwait->reply.tval_sec = now.tv_sec;
- vblwait->reply.tval_usec = now.tv_usec;
- vblwait->reply.sequence = drm_vblank_count(dev, crtc);
- DRM_DEBUG("returning %d to client\n",
- vblwait->reply.sequence);
- } else {
- DRM_DEBUG("vblank wait interrupted by signal\n");
- }
- }
-
-done:
- drm_vblank_put(dev, crtc);
- return ret;
-}
-
-void drm_vbl_send_signals(struct drm_device *dev, int crtc)
-{
-}
-
-#if 0 /* disabled */
-void drm_vbl_send_signals(struct drm_device *dev, int crtc )
-{
- drm_vbl_sig_t *vbl_sig;
- unsigned int vbl_seq = atomic_read( &dev->vbl_received );
- struct proc *p;
-
- vbl_sig = TAILQ_FIRST(&dev->vbl_sig_list);
- while (vbl_sig != NULL) {
- drm_vbl_sig_t *next = TAILQ_NEXT(vbl_sig, link);
-
- if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
- p = pfind(vbl_sig->pid);
- if (p != NULL)
- psignal(p, vbl_sig->signo);
-
- TAILQ_REMOVE(&dev->vbl_sig_list, vbl_sig, link);
- DRM_FREE(vbl_sig,sizeof(*vbl_sig));
- }
- vbl_sig = next;
- }
-}
-#endif
-
-void drm_handle_vblank(struct drm_device *dev, int crtc)
-{
- atomic_inc(&dev->vblank[crtc].count);
- DRM_WAKEUP(&dev->vblank[crtc].queue);
- drm_vbl_send_signals(dev, crtc);
-}
-
diff --git a/bsd-core/drm_linux_list.h b/bsd-core/drm_linux_list.h
deleted file mode 100644
index 15c1b6ee..00000000
--- a/bsd-core/drm_linux_list.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* drm_linux_list.h -- linux list functions for the BSDs.
- * Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org
- */
-/*-
- * Copyright 2003 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-struct list_head {
- struct list_head *next, *prev;
-};
-
-/* Cheat, assume the list_head is at the start of the struct */
-#define list_entry(entry, type, member) (type *)(entry)
-
-static __inline__ void
-INIT_LIST_HEAD(struct list_head *head) {
- (head)->next = head;
- (head)->prev = head;
-}
-
-static __inline__ int
-list_empty(struct list_head *head) {
- return (head)->next == head;
-}
-
-static __inline__ void
-list_add_tail(struct list_head *entry, struct list_head *head) {
- (entry)->prev = (head)->prev;
- (entry)->next = head;
- (head)->prev->next = entry;
- (head)->prev = entry;
-}
-
-static __inline__ void
-list_del(struct list_head *entry) {
- (entry)->next->prev = (entry)->prev;
- (entry)->prev->next = (entry)->next;
-}
-
-#define list_for_each(entry, head) \
- for (entry = (head)->next; entry != head; entry = (entry)->next)
-
-#define list_for_each_prev(entry, head) \
- for (entry = (head)->prev; entry != (head); \
- entry = entry->prev)
-
-#define list_for_each_safe(entry, temp, head) \
- for (entry = (head)->next, temp = (entry)->next; \
- entry != head; \
- entry = temp, temp = entry->next)
-
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
deleted file mode 100644
index 24c127a9..00000000
--- a/bsd-core/drm_lock.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_lock.c
- * Implementation of the ioctls and other support code for dealing with the
- * hardware lock.
- *
- * The DRM hardware lock is a shared structure between the kernel and userland.
- *
- * On uncontended access where the new context was the last context, the
- * client may take the lock without dropping down into the kernel, using atomic
- * compare-and-set.
- *
- * If the client finds during compare-and-set that it was not the last owner
- * of the lock, it calls the DRM lock ioctl, which may sleep waiting for the
- * lock, and may have side-effects of kernel-managed context switching.
- *
- * When the client releases the lock, if the lock is marked as being contended
- * by another client, then the DRM unlock ioctl is called so that the
- * contending client may be woken up.
- */
-
-#include "drmP.h"
-
-int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_lock *lock = data;
- int ret = 0;
-
- if (lock->context == DRM_KERNEL_CONTEXT) {
- DRM_ERROR("Process %d using kernel context %d\n",
- DRM_CURRENTPID, lock->context);
- return EINVAL;
- }
-
- DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
- lock->context, DRM_CURRENTPID, dev->lock.hw_lock->lock,
- lock->flags);
-
- if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) &&
- lock->context < 0)
- return EINVAL;
-
- DRM_LOCK();
- for (;;) {
- if (drm_lock_take(&dev->lock, lock->context)) {
- dev->lock.file_priv = file_priv;
- dev->lock.lock_time = jiffies;
- atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
- break; /* Got lock */
- }
-
- /* Contention */
- ret = mtx_sleep((void *)&dev->lock.lock_queue, &dev->dev_lock,
- PCATCH, "drmlk2", 0);
- if (ret != 0)
- break;
- }
- DRM_UNLOCK();
- DRM_DEBUG("%d %s\n", lock->context, ret ? "interrupted" : "has lock");
-
- if (ret != 0)
- return ret;
-
- /* XXX: Add signal blocking here */
-
- if (dev->driver->dma_quiescent != NULL &&
- (lock->flags & _DRM_LOCK_QUIESCENT))
- dev->driver->dma_quiescent(dev);
-
- return 0;
-}
-
-int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_lock *lock = data;
-
- DRM_DEBUG("%d (pid %d) requests unlock (0x%08x), flags = 0x%08x\n",
- lock->context, DRM_CURRENTPID, dev->lock.hw_lock->lock,
- lock->flags);
-
- if (lock->context == DRM_KERNEL_CONTEXT) {
- DRM_ERROR("Process %d using kernel context %d\n",
- DRM_CURRENTPID, lock->context);
- return EINVAL;
- }
-
- atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
-
- DRM_LOCK();
- drm_lock_transfer(&dev->lock, DRM_KERNEL_CONTEXT);
-
- if (drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT)) {
- DRM_ERROR("\n");
- }
- DRM_UNLOCK();
-
- return 0;
-}
-
-int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context)
-{
- volatile unsigned int *lock = &lock_data->hw_lock->lock;
- unsigned int old, new;
-
- do {
- old = *lock;
- if (old & _DRM_LOCK_HELD)
- new = old | _DRM_LOCK_CONT;
- else
- new = context | _DRM_LOCK_HELD;
- } while (!atomic_cmpset_int(lock, old, new));
-
- if (_DRM_LOCKING_CONTEXT(old) == context) {
- if (old & _DRM_LOCK_HELD) {
- if (context != DRM_KERNEL_CONTEXT) {
- DRM_ERROR("%d holds heavyweight lock\n",
- context);
- }
- return 0;
- }
- }
- if (new == (context | _DRM_LOCK_HELD)) {
- /* Have lock */
- return 1;
- }
- return 0;
-}
-
-/* This takes a lock forcibly and hands it to context. Should ONLY be used
- inside *_unlock to give lock to kernel before calling *_dma_schedule. */
-int drm_lock_transfer(struct drm_lock_data *lock_data, unsigned int context)
-{
- volatile unsigned int *lock = &lock_data->hw_lock->lock;
- unsigned int old, new;
-
- lock_data->file_priv = NULL;
- do {
- old = *lock;
- new = context | _DRM_LOCK_HELD;
- } while (!atomic_cmpset_int(lock, old, new));
-
- return 1;
-}
-
-int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
-{
- volatile unsigned int *lock = &lock_data->hw_lock->lock;
- unsigned int old, new;
-
- lock_data->file_priv = NULL;
- do {
- old = *lock;
- new = 0;
- } while (!atomic_cmpset_int(lock, old, new));
-
- if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
- DRM_ERROR("%d freed heavyweight lock held by %d\n",
- context, _DRM_LOCKING_CONTEXT(old));
- return 1;
- }
- DRM_WAKEUP_INT((void *)&lock_data->lock_queue);
- return 0;
-}
diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c
deleted file mode 100644
index ac43cb0c..00000000
--- a/bsd-core/drm_memory.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- *Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_memory.c
- * Wrappers for kernel memory allocation routines, and MTRR management support.
- *
- * This file previously implemented a memory consumption tracking system using
- * the "area" argument for various different types of allocations, but that
- * has been stripped out for now.
- */
-
-#include "drmP.h"
-
-MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures");
-MALLOC_DEFINE(DRM_MEM_SAREA, "drm_sarea", "DRM SAREA Data Structures");
-MALLOC_DEFINE(DRM_MEM_DRIVER, "drm_driver", "DRM DRIVER Data Structures");
-MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures");
-MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures");
-MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures");
-MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures");
-MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures");
-MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures");
-MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures");
-MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures");
-MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures");
-MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures");
-MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures");
-MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures");
-MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap",
- "DRM CTXBITMAP Data Structures");
-MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures");
-MALLOC_DEFINE(DRM_MEM_DRAWABLE, "drm_drawable", "DRM DRAWABLE Data Structures");
-
-void drm_mem_init(void)
-{
-}
-
-void drm_mem_uninit(void)
-{
-}
-
-void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map)
-{
- return pmap_mapdev_attr(map->offset, map->size, PAT_WRITE_COMBINING);
-}
-
-void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
-{
- return pmap_mapdev(map->offset, map->size);
-}
-
-void drm_ioremapfree(drm_local_map_t *map)
-{
- pmap_unmapdev((vm_offset_t) map->handle, map->size);
-}
-
-int
-drm_mtrr_add(unsigned long offset, size_t size, int flags)
-{
- int act;
- struct mem_range_desc mrdesc;
-
- mrdesc.mr_base = offset;
- mrdesc.mr_len = size;
- mrdesc.mr_flags = flags;
- act = MEMRANGE_SET_UPDATE;
- strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
- return mem_range_attr_set(&mrdesc, &act);
-}
-
-int
-drm_mtrr_del(int __unused handle, unsigned long offset, size_t size, int flags)
-{
- int act;
- struct mem_range_desc mrdesc;
-
- mrdesc.mr_base = offset;
- mrdesc.mr_len = size;
- mrdesc.mr_flags = flags;
- act = MEMRANGE_SET_REMOVE;
- strlcpy(mrdesc.mr_owner, "drm", sizeof(mrdesc.mr_owner));
- return mem_range_attr_set(&mrdesc, &act);
-}
diff --git a/bsd-core/drm_mode.h b/bsd-core/drm_mode.h
deleted file mode 120000
index a43f1385..00000000
--- a/bsd-core/drm_mode.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/drm_mode.h \ No newline at end of file
diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c
deleted file mode 100644
index b2d2635c..00000000
--- a/bsd-core/drm_pci.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * Copyright 2003 Eric Anholt.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file drm_pci.h
- * \brief PCI consistent, DMA-accessible memory allocation.
- *
- * \author Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "drmP.h"
-
-/**********************************************************************/
-/** \name PCI memory */
-/*@{*/
-
-static void
-drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
- drm_dma_handle_t *dmah = arg;
-
- if (error != 0)
- return;
-
- KASSERT(nsegs == 1, ("drm_pci_busdma_callback: bad dma segment count"));
- dmah->busaddr = segs[0].ds_addr;
-}
-
-/**
- * \brief Allocate a physically contiguous DMA-accessible consistent
- * memory block.
- */
-drm_dma_handle_t *
-drm_pci_alloc(struct drm_device *dev, size_t size,
- size_t align, dma_addr_t maxaddr)
-{
- drm_dma_handle_t *dmah;
- int ret;
-
- /* Need power-of-two alignment, so fail the allocation if it isn't. */
- if ((align & (align - 1)) != 0) {
- DRM_ERROR("drm_pci_alloc with non-power-of-two alignment %d\n",
- (int)align);
- return NULL;
- }
-
- dmah = malloc(sizeof(drm_dma_handle_t), DRM_MEM_DMA, M_ZERO | M_NOWAIT);
- if (dmah == NULL)
- return NULL;
-
- /* Make sure we aren't holding locks here */
- mtx_assert(&dev->dev_lock, MA_NOTOWNED);
- if (mtx_owned(&dev->dev_lock))
- DRM_ERROR("called while holding dev_lock\n");
- mtx_assert(&dev->dma_lock, MA_NOTOWNED);
- if (mtx_owned(&dev->dma_lock))
- DRM_ERROR("called while holding dma_lock\n");
-
- ret = bus_dma_tag_create(NULL, align, 0, /* tag, align, boundary */
- maxaddr, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
- NULL, NULL, /* filtfunc, filtfuncargs */
- size, 1, size, /* maxsize, nsegs, maxsegsize */
- 0, NULL, NULL, /* flags, lockfunc, lockfuncargs */
- &dmah->tag);
- if (ret != 0) {
- free(dmah, DRM_MEM_DMA);
- return NULL;
- }
-
- ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr,
- BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map);
- if (ret != 0) {
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- return NULL;
- }
-
- ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, size,
- drm_pci_busdma_callback, dmah, BUS_DMA_NOWAIT | BUS_DMA_NOCACHE);
- if (ret != 0) {
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- return NULL;
- }
-
- return dmah;
-}
-
-/**
- * \brief Free a DMA-accessible consistent memory block.
- */
-void
-drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
-{
- if (dmah == NULL)
- return;
-
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
-
- free(dmah, DRM_MEM_DMA);
-}
-
-/*@}*/
diff --git a/bsd-core/drm_sarea.h b/bsd-core/drm_sarea.h
deleted file mode 120000
index fd428f42..00000000
--- a/bsd-core/drm_sarea.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/drm_sarea.h \ No newline at end of file
diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c
deleted file mode 100644
index 09bc5aae..00000000
--- a/bsd-core/drm_scatter.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-/** @file drm_scatter.c
- * Allocation of memory for scatter-gather mappings by the graphics chip.
- *
- * The memory allocated here is then made into an aperture in the card
- * by drm_ati_pcigart_init().
- */
-
-#include "drmP.h"
-
-static void drm_sg_alloc_cb(void *arg, bus_dma_segment_t *segs,
- int nsegs, int error);
-
-int
-drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather *request)
-{
- struct drm_sg_mem *entry;
- struct drm_dma_handle *dmah;
- unsigned long pages;
- int ret;
-
- if (dev->sg)
- return EINVAL;
-
- entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
- if (!entry)
- return ENOMEM;
-
- pages = round_page(request->size) / PAGE_SIZE;
- DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages);
-
- entry->pages = pages;
-
- entry->busaddr = malloc(pages * sizeof(*entry->busaddr), DRM_MEM_PAGES,
- M_WAITOK | M_ZERO);
- if (!entry->busaddr) {
- free(entry, DRM_MEM_SGLISTS);
- return ENOMEM;
- }
-
- dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA,
- M_ZERO | M_NOWAIT);
- if (dmah == NULL) {
- free(entry->busaddr, DRM_MEM_PAGES);
- free(entry, DRM_MEM_SGLISTS);
- return ENOMEM;
- }
-
- ret = bus_dma_tag_create(NULL, PAGE_SIZE, 0, /* tag, align, boundary */
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
- NULL, NULL, /* filtfunc, filtfuncargs */
- request->size, pages, /* maxsize, nsegs */
- PAGE_SIZE, 0, /* maxsegsize, flags */
- NULL, NULL, /* lockfunc, lockfuncargs */
- &dmah->tag);
- if (ret != 0) {
- free(dmah, DRM_MEM_DMA);
- free(entry->busaddr, DRM_MEM_PAGES);
- free(entry, DRM_MEM_SGLISTS);
- return ENOMEM;
- }
-
- ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr,
- BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map);
- if (ret != 0) {
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- free(entry->busaddr, DRM_MEM_PAGES);
- free(entry, DRM_MEM_SGLISTS);
- return ENOMEM;
- }
-
- ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr,
- request->size, drm_sg_alloc_cb, entry,
- BUS_DMA_NOWAIT | BUS_DMA_NOCACHE);
- if (ret != 0) {
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- free(entry->busaddr, DRM_MEM_PAGES);
- free(entry, DRM_MEM_SGLISTS);
- return ENOMEM;
- }
-
- entry->sg_dmah = dmah;
- entry->handle = (unsigned long)dmah->vaddr;
-
- DRM_DEBUG("sg alloc handle = %08lx\n", entry->handle);
-
- entry->virtual = (void *)entry->handle;
- request->handle = entry->handle;
-
- DRM_LOCK();
- if (dev->sg) {
- DRM_UNLOCK();
- drm_sg_cleanup(entry);
- return EINVAL;
- }
- dev->sg = entry;
- DRM_UNLOCK();
-
- return 0;
-}
-
-static void
-drm_sg_alloc_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
- struct drm_sg_mem *entry = arg;
- int i;
-
- if (error != 0)
- return;
-
- for(i = 0 ; i < nsegs ; i++) {
- entry->busaddr[i] = segs[i].ds_addr;
- }
-}
-
-int
-drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_scatter_gather *request = data;
-
- DRM_DEBUG("\n");
-
- return drm_sg_alloc(dev, request);
-}
-
-void
-drm_sg_cleanup(struct drm_sg_mem *entry)
-{
- struct drm_dma_handle *dmah = entry->sg_dmah;
-
- bus_dmamap_unload(dmah->tag, dmah->map);
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, DRM_MEM_DMA);
- free(entry->busaddr, DRM_MEM_PAGES);
- free(entry, DRM_MEM_SGLISTS);
-}
-
-int
-drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_scatter_gather *request = data;
- struct drm_sg_mem *entry;
-
- DRM_LOCK();
- entry = dev->sg;
- dev->sg = NULL;
- DRM_UNLOCK();
-
- if (!entry || entry->handle != request->handle)
- return EINVAL;
-
- DRM_DEBUG("sg free virtual = 0x%lx\n", entry->handle);
-
- drm_sg_cleanup(entry);
-
- return 0;
-}
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
deleted file mode 100644
index 608169de..00000000
--- a/bsd-core/drm_sysctl.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*-
- * Copyright 2003 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/** @file drm_sysctl.c
- * Implementation of various sysctls for controlling DRM behavior and reporting
- * debug information.
- */
-
-#include "drmP.h"
-#include "drm.h"
-
-#include <sys/sysctl.h>
-
-static int drm_name_info DRM_SYSCTL_HANDLER_ARGS;
-static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS;
-static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS;
-static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS;
-
-struct drm_sysctl_list {
- const char *name;
- int (*f) DRM_SYSCTL_HANDLER_ARGS;
-} drm_sysctl_list[] = {
- {"name", drm_name_info},
- {"vm", drm_vm_info},
- {"clients", drm_clients_info},
- {"bufs", drm_bufs_info},
-};
-#define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0]))
-
-struct drm_sysctl_info {
- struct sysctl_ctx_list ctx;
- char name[2];
-};
-
-int drm_sysctl_init(struct drm_device *dev)
-{
- struct drm_sysctl_info *info;
- struct sysctl_oid *oid;
- struct sysctl_oid *top, *drioid;
- int i;
-
- info = malloc(sizeof *info, DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
- if ( !info )
- return 1;
- dev->sysctl = info;
-
- /* Add the sysctl node for DRI if it doesn't already exist */
- drioid = SYSCTL_ADD_NODE( &info->ctx, &sysctl__hw_children, OID_AUTO, "dri", CTLFLAG_RW, NULL, "DRI Graphics");
- if (!drioid)
- return 1;
-
- /* Find the next free slot under hw.dri */
- i = 0;
- SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) {
- if (i <= oid->oid_arg2)
- i = oid->oid_arg2 + 1;
- }
- if (i>9)
- return 1;
-
- /* Add the hw.dri.x for our device */
- info->name[0] = '0' + i;
- info->name[1] = 0;
- top = SYSCTL_ADD_NODE( &info->ctx, SYSCTL_CHILDREN(drioid), OID_AUTO, info->name, CTLFLAG_RW, NULL, NULL);
- if (!top)
- return 1;
-
- for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) {
- oid = SYSCTL_ADD_OID(&info->ctx,
- SYSCTL_CHILDREN(top),
- OID_AUTO,
- drm_sysctl_list[i].name,
- CTLTYPE_INT | CTLFLAG_RD,
- dev,
- 0,
- drm_sysctl_list[i].f,
- "A",
- NULL);
- if (!oid)
- return 1;
- }
- SYSCTL_ADD_INT(&info->ctx, SYSCTL_CHILDREN(top), OID_AUTO, "debug",
- CTLFLAG_RW, &drm_debug_flag, sizeof(drm_debug_flag),
- "Enable debugging output");
-
- return 0;
-}
-
-int drm_sysctl_cleanup(struct drm_device *dev)
-{
- int error;
- error = sysctl_ctx_free( &dev->sysctl->ctx );
-
- free(dev->sysctl, DRM_MEM_DRIVER);
- dev->sysctl = NULL;
-
- return error;
-}
-
-#define DRM_SYSCTL_PRINT(fmt, arg...) \
-do { \
- snprintf(buf, sizeof(buf), fmt, ##arg); \
- retcode = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (retcode) \
- goto done; \
-} while (0)
-
-static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
-{
- struct drm_device *dev = arg1;
- char buf[128];
- int retcode;
- int hasunique = 0;
-
- DRM_SYSCTL_PRINT("%s 0x%x", dev->driver->name, dev2udev(dev->devnode));
-
- DRM_LOCK();
- if (dev->unique) {
- snprintf(buf, sizeof(buf), " %s", dev->unique);
- hasunique = 1;
- }
- DRM_UNLOCK();
-
- if (hasunique)
- SYSCTL_OUT(req, buf, strlen(buf));
-
- SYSCTL_OUT(req, "", 1);
-
-done:
- return retcode;
-}
-
-static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
-{
- struct drm_device *dev = arg1;
- drm_local_map_t *map, *tempmaps;
- const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
- const char *type, *yesno;
- int i, mapcount;
- char buf[128];
- int retcode;
-
- /* We can't hold the lock while doing SYSCTL_OUTs, so allocate a
- * temporary copy of all the map entries and then SYSCTL_OUT that.
- */
- DRM_LOCK();
-
- mapcount = 0;
- TAILQ_FOREACH(map, &dev->maplist, link)
- mapcount++;
-
- tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER,
- M_NOWAIT);
- if (tempmaps == NULL) {
- DRM_UNLOCK();
- return ENOMEM;
- }
-
- i = 0;
- TAILQ_FOREACH(map, &dev->maplist, link)
- tempmaps[i++] = *map;
-
- DRM_UNLOCK();
-
- DRM_SYSCTL_PRINT("\nslot offset size "
- "type flags address mtrr\n");
-
- for (i = 0; i < mapcount; i++) {
- map = &tempmaps[i];
-
- if (map->type < 0 || map->type > 4)
- type = "??";
- else
- type = types[map->type];
-
- if (!map->mtrr)
- yesno = "no";
- else
- yesno = "yes";
-
- DRM_SYSCTL_PRINT(
- "%4d 0x%016lx 0x%08lx %4.4s 0x%02x 0x%016lx %s\n", i,
- map->offset, map->size, type, map->flags,
- (unsigned long)map->handle, yesno);
- }
- SYSCTL_OUT(req, "", 1);
-
-done:
- free(tempmaps, DRM_MEM_DRIVER);
- return retcode;
-}
-
-static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
-{
- struct drm_device *dev = arg1;
- drm_device_dma_t *dma = dev->dma;
- drm_device_dma_t tempdma;
- int *templists;
- int i;
- char buf[128];
- int retcode;
-
- /* We can't hold the locks around DRM_SYSCTL_PRINT, so make a temporary
- * copy of the whole structure and the relevant data from buflist.
- */
- DRM_LOCK();
- if (dma == NULL) {
- DRM_UNLOCK();
- return 0;
- }
- DRM_SPINLOCK(&dev->dma_lock);
- tempdma = *dma;
- templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER,
- M_NOWAIT);
- for (i = 0; i < dma->buf_count; i++)
- templists[i] = dma->buflist[i]->list;
- dma = &tempdma;
- DRM_SPINUNLOCK(&dev->dma_lock);
- DRM_UNLOCK();
-
- DRM_SYSCTL_PRINT("\n o size count free segs pages kB\n");
- for (i = 0; i <= DRM_MAX_ORDER; i++) {
- if (dma->bufs[i].buf_count)
- DRM_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\n",
- i,
- dma->bufs[i].buf_size,
- dma->bufs[i].buf_count,
- atomic_read(&dma->bufs[i]
- .freelist.count),
- dma->bufs[i].seg_count,
- dma->bufs[i].seg_count
- *(1 << dma->bufs[i].page_order),
- (dma->bufs[i].seg_count
- * (1 << dma->bufs[i].page_order))
- * PAGE_SIZE / 1024);
- }
- DRM_SYSCTL_PRINT("\n");
- for (i = 0; i < dma->buf_count; i++) {
- if (i && !(i%32)) DRM_SYSCTL_PRINT("\n");
- DRM_SYSCTL_PRINT(" %d", templists[i]);
- }
- DRM_SYSCTL_PRINT("\n");
-
- SYSCTL_OUT(req, "", 1);
-done:
- free(templists, DRM_MEM_DRIVER);
- return retcode;
-}
-
-static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
-{
- struct drm_device *dev = arg1;
- struct drm_file *priv, *tempprivs;
- char buf[128];
- int retcode;
- int privcount, i;
-
- DRM_LOCK();
-
- privcount = 0;
- TAILQ_FOREACH(priv, &dev->files, link)
- privcount++;
-
- tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER,
- M_NOWAIT);
- if (tempprivs == NULL) {
- DRM_UNLOCK();
- return ENOMEM;
- }
- i = 0;
- TAILQ_FOREACH(priv, &dev->files, link)
- tempprivs[i++] = *priv;
-
- DRM_UNLOCK();
-
- DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n");
- for (i = 0; i < privcount; i++) {
- priv = &tempprivs[i];
- DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n",
- priv->authenticated ? 'y' : 'n',
- priv->minor,
- priv->pid,
- priv->uid,
- priv->magic,
- priv->ioctl_count);
- }
-
- SYSCTL_OUT(req, "", 1);
-done:
- free(tempprivs, DRM_MEM_DRIVER);
- return retcode;
-}
diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c
deleted file mode 100644
index a7bee4b3..00000000
--- a/bsd-core/drm_vm.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * Copyright 2003 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/** @file drm_vm.c
- * Support code for mmaping of DRM maps.
- */
-
-#include "drmP.h"
-#include "drm.h"
-
-int drm_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr,
- int prot)
-{
- struct drm_device *dev = drm_get_device_from_kdev(kdev);
- struct drm_file *file_priv = NULL;
- drm_local_map_t *map;
- enum drm_map_type type;
- vm_paddr_t phys;
- int error;
-
- /* d_mmap gets called twice, we can only reference file_priv during
- * the first call. We need to assume that if error is EBADF the
- * call was succesful and the client is authenticated.
- */
- error = devfs_get_cdevpriv((void **)&file_priv);
- if (error == ENOENT) {
- DRM_ERROR("Could not find authenticator!\n");
- return EINVAL;
- }
-
- if (file_priv && !file_priv->authenticated)
- return EACCES;
-
- if (dev->dma && offset >= 0 && offset < ptoa(dev->dma->page_count)) {
- drm_device_dma_t *dma = dev->dma;
-
- DRM_SPINLOCK(&dev->dma_lock);
-
- if (dma->pagelist != NULL) {
- unsigned long page = offset >> PAGE_SHIFT;
- unsigned long phys = dma->pagelist[page];
-
- DRM_SPINUNLOCK(&dev->dma_lock);
- *paddr = phys;
- return 0;
- } else {
- DRM_SPINUNLOCK(&dev->dma_lock);
- return -1;
- }
- }
-
- /* A sequential search of a linked list is
- fine here because: 1) there will only be
- about 5-10 entries in the list and, 2) a
- DRI client only has to do this mapping
- once, so it doesn't have to be optimized
- for performance, even if the list was a
- bit longer. */
- DRM_LOCK();
- TAILQ_FOREACH(map, &dev->maplist, link) {
- if (offset >= map->offset && offset < map->offset + map->size)
- break;
- }
-
- if (map == NULL) {
- DRM_DEBUG("Can't find map, requested offset = %016lx\n",
- offset);
- TAILQ_FOREACH(map, &dev->maplist, link) {
- DRM_DEBUG("map offset = %016lx, handle = %016lx\n",
- map->offset, (unsigned long)map->handle);
- }
- DRM_UNLOCK();
- return -1;
- }
- if (((map->flags&_DRM_RESTRICTED) && !DRM_SUSER(DRM_CURPROC))) {
- DRM_UNLOCK();
- DRM_DEBUG("restricted map\n");
- return -1;
- }
- type = map->type;
- DRM_UNLOCK();
-
- switch (type) {
- case _DRM_FRAME_BUFFER:
- case _DRM_REGISTERS:
- case _DRM_AGP:
- phys = offset;
- break;
- case _DRM_CONSISTENT:
- phys = vtophys((char *)map->handle + (offset - map->offset));
- break;
- case _DRM_SCATTER_GATHER:
- case _DRM_SHM:
- phys = vtophys(offset);
- break;
- default:
- DRM_ERROR("bad map type %d\n", type);
- return -1; /* This should never happen. */
- }
-
- *paddr = phys;
- return 0;
-}
-
diff --git a/bsd-core/i915/Makefile b/bsd-core/i915/Makefile
deleted file mode 100644
index f88155a5..00000000
--- a/bsd-core/i915/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = i915
-NO_MAN = YES
-SRCS = i915_dma.c i915_drv.c i915_irq.c i915_mem.c i915_suspend.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/i915_dma.c b/bsd-core/i915_dma.c
deleted file mode 120000
index c61d967e..00000000
--- a/bsd-core/i915_dma.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_dma.c \ No newline at end of file
diff --git a/bsd-core/i915_drm.h b/bsd-core/i915_drm.h
deleted file mode 120000
index ed53f01d..00000000
--- a/bsd-core/i915_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_drm.h \ No newline at end of file
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
deleted file mode 100644
index 1f7cfa46..00000000
--- a/bsd-core/i915_drv.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* i915_drv.c -- Intel i915 driver -*- linux-c -*-
- * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
- */
-/*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "i915_drm.h"
-#include "i915_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t i915_pciidlist[] = {
- i915_PCI_IDS
-};
-
-static int i915_suspend(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- struct drm_i915_private *dev_priv = dev->dev_private;
-
- if (!dev || !dev_priv) {
- DRM_ERROR("dev: 0x%lx, dev_priv: 0x%lx\n",
- (unsigned long) dev, (unsigned long) dev_priv);
- DRM_ERROR("DRM not initialized, aborting suspend.\n");
- return -ENODEV;
- }
-
- i915_save_state(dev);
-
- return (bus_generic_suspend(kdev));
-}
-
-static int i915_resume(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- i915_restore_state(dev);
-
- return (bus_generic_resume(kdev));
-}
-
-static void i915_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
- DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = sizeof(drm_i915_private_t);
- dev->driver->load = i915_driver_load;
- dev->driver->unload = i915_driver_unload;
- dev->driver->preclose = i915_driver_preclose;
- dev->driver->lastclose = i915_driver_lastclose;
- dev->driver->device_is_agp = i915_driver_device_is_agp;
- dev->driver->enable_vblank = i915_enable_vblank;
- dev->driver->disable_vblank = i915_disable_vblank;
- dev->driver->irq_preinstall = i915_driver_irq_preinstall;
- dev->driver->irq_postinstall = i915_driver_irq_postinstall;
- dev->driver->irq_uninstall = i915_driver_irq_uninstall;
- dev->driver->irq_handler = i915_driver_irq_handler;
-
- dev->driver->ioctls = i915_ioctls;
- dev->driver->max_ioctl = i915_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-i915_probe(device_t kdev)
-{
- return drm_probe(kdev, i915_pciidlist);
-}
-
-static int
-i915_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- i915_configure(dev);
-
- return drm_attach(kdev, i915_pciidlist);
-}
-
-static int
-i915_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t i915_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, i915_probe),
- DEVMETHOD(device_attach, i915_attach),
- DEVMETHOD(device_suspend, i915_suspend),
- DEVMETHOD(device_resume, i915_resume),
- DEVMETHOD(device_detach, i915_detach),
-
- { 0, 0 }
-};
-
-static driver_t i915_driver = {
-#if __FreeBSD_version >= 700010
- "drm",
-#else
- "drmsub",
-#endif
- i915_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(i915, drm, 1, 1, 1);
diff --git a/bsd-core/i915_drv.h b/bsd-core/i915_drv.h
deleted file mode 120000
index 085558ca..00000000
--- a/bsd-core/i915_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_drv.h \ No newline at end of file
diff --git a/bsd-core/i915_irq.c b/bsd-core/i915_irq.c
deleted file mode 120000
index 2058a2e4..00000000
--- a/bsd-core/i915_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_irq.c \ No newline at end of file
diff --git a/bsd-core/i915_mem.c b/bsd-core/i915_mem.c
deleted file mode 120000
index e8e56553..00000000
--- a/bsd-core/i915_mem.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_mem.c \ No newline at end of file
diff --git a/bsd-core/i915_reg.h b/bsd-core/i915_reg.h
deleted file mode 120000
index d364e7f1..00000000
--- a/bsd-core/i915_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_reg.h \ No newline at end of file
diff --git a/bsd-core/i915_suspend.c b/bsd-core/i915_suspend.c
deleted file mode 120000
index b55754c5..00000000
--- a/bsd-core/i915_suspend.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/i915_suspend.c \ No newline at end of file
diff --git a/bsd-core/mach64/Makefile b/bsd-core/mach64/Makefile
deleted file mode 100644
index 1e6210d9..00000000
--- a/bsd-core/mach64/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = mach64
-NO_MAN = YES
-SRCS = mach64_dma.c mach64_drv.c mach64_irq.c mach64_state.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/mach64_dma.c b/bsd-core/mach64_dma.c
deleted file mode 120000
index e5c28975..00000000
--- a/bsd-core/mach64_dma.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mach64_dma.c \ No newline at end of file
diff --git a/bsd-core/mach64_drm.h b/bsd-core/mach64_drm.h
deleted file mode 120000
index 136ea936..00000000
--- a/bsd-core/mach64_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mach64_drm.h \ No newline at end of file
diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c
deleted file mode 100644
index 2cc0ef1e..00000000
--- a/bsd-core/mach64_drv.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* mach64_drv.c -- ATI Rage 128 driver -*- linux-c -*-
- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-
-#include <sys/types.h>
-
-#include "drmP.h"
-#include "drm.h"
-#include "mach64_drm.h"
-#include "mach64_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t mach64_pciidlist[] = {
- mach64_PCI_IDS
-};
-
-static void mach64_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
- DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = 1; /* No dev_priv */
- dev->driver->load = mach64_driver_load;
- dev->driver->lastclose = mach64_driver_lastclose;
- dev->driver->get_vblank_counter = mach64_get_vblank_counter;
- dev->driver->enable_vblank = mach64_enable_vblank;
- dev->driver->disable_vblank = mach64_disable_vblank;
- dev->driver->irq_preinstall = mach64_driver_irq_preinstall;
- dev->driver->irq_postinstall = mach64_driver_irq_postinstall;
- dev->driver->irq_uninstall = mach64_driver_irq_uninstall;
- dev->driver->irq_handler = mach64_driver_irq_handler;
- dev->driver->dma_ioctl = mach64_dma_buffers;
-
- dev->driver->ioctls = mach64_ioctls;
- dev->driver->max_ioctl = mach64_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-mach64_probe(device_t kdev)
-{
- return drm_probe(kdev, mach64_pciidlist);
-}
-
-static int
-mach64_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- mach64_configure(dev);
-
- return drm_attach(kdev, mach64_pciidlist);
-}
-
-int
-mach64_driver_load(struct drm_device * dev, unsigned long flags)
-{
- return drm_vblank_init(dev, 1);
-}
-
-static int
-mach64_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t mach64_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, mach64_probe),
- DEVMETHOD(device_attach, mach64_attach),
- DEVMETHOD(device_detach, mach64_detach),
-
- { 0, 0 }
-};
-
-static driver_t mach64_driver = {
- "drm",
- mach64_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(mach64, drm, 1, 1, 1);
diff --git a/bsd-core/mach64_drv.h b/bsd-core/mach64_drv.h
deleted file mode 120000
index 85222cc2..00000000
--- a/bsd-core/mach64_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mach64_drv.h \ No newline at end of file
diff --git a/bsd-core/mach64_irq.c b/bsd-core/mach64_irq.c
deleted file mode 120000
index a1235d58..00000000
--- a/bsd-core/mach64_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mach64_irq.c \ No newline at end of file
diff --git a/bsd-core/mach64_state.c b/bsd-core/mach64_state.c
deleted file mode 120000
index b11f202c..00000000
--- a/bsd-core/mach64_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mach64_state.c \ No newline at end of file
diff --git a/bsd-core/mga/Makefile b/bsd-core/mga/Makefile
deleted file mode 100644
index 2e534ce7..00000000
--- a/bsd-core/mga/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD= mga
-NO_MAN= YES
-SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c mga_irq.c
-SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS+= ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/mga_dma.c b/bsd-core/mga_dma.c
deleted file mode 120000
index f290be9b..00000000
--- a/bsd-core/mga_dma.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_dma.c \ No newline at end of file
diff --git a/bsd-core/mga_drm.h b/bsd-core/mga_drm.h
deleted file mode 120000
index 1c87036f..00000000
--- a/bsd-core/mga_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_drm.h \ No newline at end of file
diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c
deleted file mode 100644
index d72215f3..00000000
--- a/bsd-core/mga_drv.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*-
- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "mga_drm.h"
-#include "mga_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t mga_pciidlist[] = {
- mga_PCI_IDS
-};
-
-/**
- * Determine if the device really is AGP or not.
- *
- * In addition to the usual tests performed by \c drm_device_is_agp, this
- * function detects PCI G450 cards that appear to the system exactly like
- * AGP G450 cards.
- *
- * \param dev The device to be tested.
- *
- * \returns
- * If the device is a PCI G450, zero is returned. Otherwise non-zero is
- * returned.
- *
- * \bug
- * This function needs to be filled in! The implementation in
- * linux-core/mga_drv.c shows what needs to be done.
- */
-static int mga_driver_device_is_agp(struct drm_device * dev)
-{
- device_t bus;
-
- /* There are PCI versions of the G450. These cards have the
- * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
- * bridge chip. We detect these cards, which are not currently
- * supported by this driver, by looking at the device ID of the
- * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the
- * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
- * device.
- */
-#if __FreeBSD_version >= 700010
- bus = device_get_parent(device_get_parent(dev->device));
-#else
- bus = device_get_parent(dev->device);
-#endif
- if (pci_get_device(dev->device) == 0x0525 &&
- pci_get_vendor(bus) == 0x3388 &&
- pci_get_device(bus) == 0x0021)
- return DRM_IS_NOT_AGP;
- else
- return DRM_MIGHT_BE_AGP;
-}
-
-static void mga_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
- DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = sizeof(drm_mga_buf_priv_t);
- dev->driver->load = mga_driver_load;
- dev->driver->unload = mga_driver_unload;
- dev->driver->lastclose = mga_driver_lastclose;
- dev->driver->get_vblank_counter = mga_get_vblank_counter;
- dev->driver->enable_vblank = mga_enable_vblank;
- dev->driver->disable_vblank = mga_disable_vblank;
- dev->driver->irq_preinstall = mga_driver_irq_preinstall;
- dev->driver->irq_postinstall = mga_driver_irq_postinstall;
- dev->driver->irq_uninstall = mga_driver_irq_uninstall;
- dev->driver->irq_handler = mga_driver_irq_handler;
- dev->driver->dma_ioctl = mga_dma_buffers;
- dev->driver->dma_quiescent = mga_driver_dma_quiescent;
- dev->driver->device_is_agp = mga_driver_device_is_agp;
-
- dev->driver->ioctls = mga_ioctls;
- dev->driver->max_ioctl = mga_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-mga_probe(device_t kdev)
-{
- return drm_probe(kdev, mga_pciidlist);
-}
-
-static int
-mga_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- mga_configure(dev);
-
- return drm_attach(kdev, mga_pciidlist);
-}
-
-static int
-mga_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t mga_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, mga_probe),
- DEVMETHOD(device_attach, mga_attach),
- DEVMETHOD(device_detach, mga_detach),
-
- { 0, 0 }
-};
-
-static driver_t mga_driver = {
- "drm",
- mga_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(mga, vgapci, mga_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(mga, pci, mga_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(mga, drm, 1, 1, 1);
diff --git a/bsd-core/mga_drv.h b/bsd-core/mga_drv.h
deleted file mode 120000
index cb0c9e1d..00000000
--- a/bsd-core/mga_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_drv.h \ No newline at end of file
diff --git a/bsd-core/mga_irq.c b/bsd-core/mga_irq.c
deleted file mode 120000
index cf521d29..00000000
--- a/bsd-core/mga_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_irq.c \ No newline at end of file
diff --git a/bsd-core/mga_state.c b/bsd-core/mga_state.c
deleted file mode 120000
index 8bda8ba9..00000000
--- a/bsd-core/mga_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_state.c \ No newline at end of file
diff --git a/bsd-core/mga_ucode.h b/bsd-core/mga_ucode.h
deleted file mode 120000
index 728b9aca..00000000
--- a/bsd-core/mga_ucode.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_ucode.h \ No newline at end of file
diff --git a/bsd-core/mga_warp.c b/bsd-core/mga_warp.c
deleted file mode 120000
index d35b3255..00000000
--- a/bsd-core/mga_warp.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/mga_warp.c \ No newline at end of file
diff --git a/bsd-core/nouveau/@ b/bsd-core/nouveau/@
deleted file mode 120000
index 8fd4e8f4..00000000
--- a/bsd-core/nouveau/@
+++ /dev/null
@@ -1 +0,0 @@
-/usr/src/sys \ No newline at end of file
diff --git a/bsd-core/nouveau/Makefile b/bsd-core/nouveau/Makefile
deleted file mode 100644
index b0d72c90..00000000
--- a/bsd-core/nouveau/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = nouveau
-NO_MAN = YES
-SRCS = nouveau_drv.c nouveau_state.c nouveau_mem.c nouveau_object.c \
- nouveau_sgdma.c nouveau_fifo.c nouveau_notifier.c nouveau_dma.c \
- nouveau_irq.c nouveau_swmthd.c \
- nv04_timer.c \
- nv04_mc.c nv40_mc.c nv50_mc.c \
- nv04_fb.c nv10_fb.c nv40_fb.c \
- nv04_fifo.c nv10_fifo.c nv40_fifo.c nv50_fifo.c \
- nv04_graph.c nv10_graph.c nv20_graph.c \
- nv40_graph.c nv50_graph.c \
- nv04_instmem.c nv50_instmem.c
-# nouveau_bo.c nouveau_fence.c \
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/nouveau/machine b/bsd-core/nouveau/machine
deleted file mode 120000
index f5ca0131..00000000
--- a/bsd-core/nouveau/machine
+++ /dev/null
@@ -1 +0,0 @@
-/usr/src/sys/amd64/include \ No newline at end of file
diff --git a/bsd-core/nouveau_dma.c b/bsd-core/nouveau_dma.c
deleted file mode 120000
index f8e0bdc3..00000000
--- a/bsd-core/nouveau_dma.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_dma.c \ No newline at end of file
diff --git a/bsd-core/nouveau_dma.h b/bsd-core/nouveau_dma.h
deleted file mode 120000
index a545e387..00000000
--- a/bsd-core/nouveau_dma.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_dma.h \ No newline at end of file
diff --git a/bsd-core/nouveau_drm.h b/bsd-core/nouveau_drm.h
deleted file mode 120000
index d300ae06..00000000
--- a/bsd-core/nouveau_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_drm.h \ No newline at end of file
diff --git a/bsd-core/nouveau_drv.c b/bsd-core/nouveau_drv.c
deleted file mode 100644
index 28b3f9a3..00000000
--- a/bsd-core/nouveau_drv.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* nouveau_drv.c.c -- nouveau nouveau driver -*- linux-c -*-
- * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
- */
-/*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "nouveau_drv.h"
-#include "drm_pciids.h"
-
-extern struct drm_ioctl_desc nouveau_ioctls[];
-extern int nouveau_max_ioctl;
-
-/* drv_PCI_IDs for nouveau is just to match the vendor id */
-static struct drm_pci_id_list nouveau_pciidlist[] = {
- {0x10DE, 0, 0, "NVidia Display Adapter"}, \
- {0, 0, 0, NULL}
-};
-
-static void nouveau_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = sizeof(struct drm_nouveau_private);
- dev->driver->load = nouveau_load;
- dev->driver->unload = nouveau_unload;
- dev->driver->firstopen = nouveau_firstopen;
- dev->driver->preclose = nouveau_preclose;
- dev->driver->lastclose = nouveau_lastclose;
- dev->driver->irq_preinstall = nouveau_irq_preinstall;
- dev->driver->irq_postinstall = nouveau_irq_postinstall;
- dev->driver->irq_uninstall = nouveau_irq_uninstall;
- dev->driver->irq_handler = nouveau_irq_handler;
-
- dev->driver->ioctls = nouveau_ioctls;
- dev->driver->max_ioctl = nouveau_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-nouveau_probe(device_t kdev)
-{
- int vendor;
-
- if (pci_get_class(kdev) == PCIC_DISPLAY) {
- vendor = pci_get_vendor(kdev);
- if (vendor == 0x10de) {
-
- const char *ident;
- char model[64];
-
- if (pci_get_vpd_ident(kdev, &ident) == 0) {
- snprintf(model, 64, "%s", ident);
- device_set_desc_copy(kdev, model);
- DRM_DEBUG("VPD : %s\n", model);
- }
-
- return drm_probe(kdev, nouveau_pciidlist);
- }
- }
- return ENXIO;
-}
-
-static int
-nouveau_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- nouveau_configure(dev);
-
- return drm_attach(kdev, nouveau_pciidlist);
-}
-
-static int
-nouveau_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t nouveau_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, nouveau_probe),
- DEVMETHOD(device_attach, nouveau_attach),
- DEVMETHOD(device_detach, nouveau_detach),
-
- { 0, 0 }
-};
-
-static driver_t nouveau_driver = {
-#if __FreeBSD_version >= 700010
- "drm",
-#else
- "drmsub",
-#endif
- nouveau_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(nouveau, vgapci, nouveau_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(nouveau, agp, nouveau_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(nouveau, drm, 1, 1, 1);
diff --git a/bsd-core/nouveau_drv.h b/bsd-core/nouveau_drv.h
deleted file mode 120000
index 8852e264..00000000
--- a/bsd-core/nouveau_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_drv.h \ No newline at end of file
diff --git a/bsd-core/nouveau_fifo.c b/bsd-core/nouveau_fifo.c
deleted file mode 120000
index 60759a57..00000000
--- a/bsd-core/nouveau_fifo.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_fifo.c \ No newline at end of file
diff --git a/bsd-core/nouveau_irq.c b/bsd-core/nouveau_irq.c
deleted file mode 120000
index 3137b813..00000000
--- a/bsd-core/nouveau_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_irq.c \ No newline at end of file
diff --git a/bsd-core/nouveau_mem.c b/bsd-core/nouveau_mem.c
deleted file mode 120000
index a0085200..00000000
--- a/bsd-core/nouveau_mem.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_mem.c \ No newline at end of file
diff --git a/bsd-core/nouveau_notifier.c b/bsd-core/nouveau_notifier.c
deleted file mode 120000
index 285469c5..00000000
--- a/bsd-core/nouveau_notifier.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_notifier.c \ No newline at end of file
diff --git a/bsd-core/nouveau_object.c b/bsd-core/nouveau_object.c
deleted file mode 120000
index 1c1426e3..00000000
--- a/bsd-core/nouveau_object.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_object.c \ No newline at end of file
diff --git a/bsd-core/nouveau_reg.h b/bsd-core/nouveau_reg.h
deleted file mode 120000
index 2ad07397..00000000
--- a/bsd-core/nouveau_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_reg.h \ No newline at end of file
diff --git a/bsd-core/nouveau_sgdma.c b/bsd-core/nouveau_sgdma.c
deleted file mode 100644
index 99f854fe..00000000
--- a/bsd-core/nouveau_sgdma.c
+++ /dev/null
@@ -1,357 +0,0 @@
-#include "drmP.h"
-#include "nouveau_drv.h"
-
-#define NV_CTXDMA_PAGE_SHIFT 12
-#define NV_CTXDMA_PAGE_SIZE (1 << NV_CTXDMA_PAGE_SHIFT)
-#define NV_CTXDMA_PAGE_MASK (NV_CTXDMA_PAGE_SIZE - 1)
-
-#if 0
-struct nouveau_sgdma_be {
- struct drm_ttm_backend backend;
- struct drm_device *dev;
-
- int pages;
- int pages_populated;
- dma_addr_t *pagelist;
- int is_bound;
-
- unsigned int pte_start;
-};
-
-static int
-nouveau_sgdma_needs_ub_cache_adjust(struct drm_ttm_backend *be)
-{
- return ((be->flags & DRM_BE_FLAG_BOUND_CACHED) ? 0 : 1);
-}
-
-static int
-nouveau_sgdma_populate(struct drm_ttm_backend *be, unsigned long num_pages,
- struct page **pages, struct page *dummy_read_page)
-{
- struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
- int p, d, o;
-
- DRM_DEBUG("num_pages = %ld\n", num_pages);
-
- if (nvbe->pagelist)
- return -EINVAL;
- nvbe->pages = (num_pages << PAGE_SHIFT) >> NV_CTXDMA_PAGE_SHIFT;
- nvbe->pagelist = drm_alloc(nvbe->pages*sizeof(dma_addr_t),
- DRM_MEM_PAGES);
-
- nvbe->pages_populated = d = 0;
- for (p = 0; p < num_pages; p++) {
- for (o = 0; o < PAGE_SIZE; o += NV_CTXDMA_PAGE_SIZE) {
- struct page *page = pages[p];
- if (!page)
- page = dummy_read_page;
-#ifdef __linux__
- nvbe->pagelist[d] = pci_map_page(nvbe->dev->pdev,
- page, o,
- NV_CTXDMA_PAGE_SIZE,
- PCI_DMA_BIDIRECTIONAL);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- if (pci_dma_mapping_error(nvbe->dev->pdev, nvbe->pagelist[d])) {
-#else
- if (pci_dma_mapping_error(nvbe->pagelist[d])) {
-#endif
- be->func->clear(be);
- DRM_ERROR("pci_map_page failed\n");
- return -EINVAL;
- }
-#endif
- nvbe->pages_populated = ++d;
- }
- }
-
- return 0;
-}
-
-static void
-nouveau_sgdma_clear(struct drm_ttm_backend *be)
-{
- struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
-#ifdef __linux__
- int d;
-#endif
- DRM_DEBUG("\n");
-
- if (nvbe && nvbe->pagelist) {
- if (nvbe->is_bound)
- be->func->unbind(be);
-#ifdef __linux__
- for (d = 0; d < nvbe->pages_populated; d++) {
- pci_unmap_page(nvbe->dev->pdev, nvbe->pagelist[d],
- NV_CTXDMA_PAGE_SIZE,
- PCI_DMA_BIDIRECTIONAL);
- }
-#endif
- drm_free(nvbe->pagelist, nvbe->pages*sizeof(dma_addr_t),
- DRM_MEM_PAGES);
- }
-}
-
-static int
-nouveau_sgdma_bind(struct drm_ttm_backend *be, struct drm_bo_mem_reg *mem)
-{
- struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
- struct drm_nouveau_private *dev_priv = nvbe->dev->dev_private;
- struct nouveau_gpuobj *gpuobj = dev_priv->gart_info.sg_ctxdma;
- uint64_t offset = (mem->mm_node->start << PAGE_SHIFT);
- uint32_t i;
-
- DRM_DEBUG("pg=0x%lx (0x%llx), cached=%d\n", mem->mm_node->start,
- (unsigned long long)offset,
- (mem->flags & DRM_BO_FLAG_CACHED) == 1);
-
- if (offset & NV_CTXDMA_PAGE_MASK)
- return -EINVAL;
- nvbe->pte_start = (offset >> NV_CTXDMA_PAGE_SHIFT);
- if (dev_priv->card_type < NV_50)
- nvbe->pte_start += 2; /* skip ctxdma header */
-
- for (i = nvbe->pte_start; i < nvbe->pte_start + nvbe->pages; i++) {
- uint64_t pteval = nvbe->pagelist[i - nvbe->pte_start];
-
- if (pteval & NV_CTXDMA_PAGE_MASK) {
- DRM_ERROR("Bad pteval 0x%llx\n",
- (unsigned long long)pteval);
- return -EINVAL;
- }
-
- if (dev_priv->card_type < NV_50) {
- INSTANCE_WR(gpuobj, i, pteval | 3);
- } else {
- INSTANCE_WR(gpuobj, (i<<1)+0, pteval | 0x21);
- INSTANCE_WR(gpuobj, (i<<1)+1, 0x00000000);
- }
- }
-
- nvbe->is_bound = 1;
- return 0;
-}
-
-static int
-nouveau_sgdma_unbind(struct drm_ttm_backend *be)
-{
- struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
- struct drm_nouveau_private *dev_priv = nvbe->dev->dev_private;
-
- DRM_DEBUG("\n");
-
- if (nvbe->is_bound) {
- struct nouveau_gpuobj *gpuobj = dev_priv->gart_info.sg_ctxdma;
- unsigned int pte;
-
- pte = nvbe->pte_start;
- while (pte < (nvbe->pte_start + nvbe->pages)) {
- uint64_t pteval = dev_priv->gart_info.sg_dummy_bus;
-
- if (dev_priv->card_type < NV_50) {
- INSTANCE_WR(gpuobj, pte, pteval | 3);
- } else {
- INSTANCE_WR(gpuobj, (pte<<1)+0, pteval | 0x21);
- INSTANCE_WR(gpuobj, (pte<<1)+1, 0x00000000);
- }
-
- pte++;
- }
-
- nvbe->is_bound = 0;
- }
-
- return 0;
-}
-
-static void
-nouveau_sgdma_destroy(struct drm_ttm_backend *be)
-{
- DRM_DEBUG("\n");
- if (be) {
- struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
- if (nvbe) {
- if (nvbe->pagelist)
- be->func->clear(be);
- drm_ctl_free(nvbe, sizeof(*nvbe), DRM_MEM_TTM);
- }
- }
-}
-
-static struct drm_ttm_backend_func nouveau_sgdma_backend = {
- .needs_ub_cache_adjust = nouveau_sgdma_needs_ub_cache_adjust,
- .populate = nouveau_sgdma_populate,
- .clear = nouveau_sgdma_clear,
- .bind = nouveau_sgdma_bind,
- .unbind = nouveau_sgdma_unbind,
- .destroy = nouveau_sgdma_destroy
-};
-
-struct drm_ttm_backend *
-nouveau_sgdma_init_ttm(struct drm_device *dev)
-{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
- struct nouveau_sgdma_be *nvbe;
-
- if (!dev_priv->gart_info.sg_ctxdma)
- return NULL;
-
- nvbe = drm_ctl_calloc(1, sizeof(*nvbe), DRM_MEM_TTM);
- if (!nvbe)
- return NULL;
-
- nvbe->dev = dev;
-
- nvbe->backend.func = &nouveau_sgdma_backend;
-
- return &nvbe->backend;
-}
-#endif
-
-int
-nouveau_sgdma_init(struct drm_device *dev)
-{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
- struct nouveau_gpuobj *gpuobj = NULL;
- uint32_t aper_size, obj_size;
- int i, ret;
-
- if (dev_priv->card_type < NV_50) {
- aper_size = (64 * 1024 * 1024);
- obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 4;
- obj_size += 8; /* ctxdma header */
- } else {
- /* 1 entire VM page table */
- aper_size = (512 * 1024 * 1024);
- obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 8;
- }
-
- if ((ret = nouveau_gpuobj_new(dev, NULL, obj_size, 16,
- NVOBJ_FLAG_ALLOW_NO_REFS |
- NVOBJ_FLAG_ZERO_ALLOC |
- NVOBJ_FLAG_ZERO_FREE, &gpuobj))) {
- DRM_ERROR("Error creating sgdma object: %d\n", ret);
- return ret;
- }
-#ifdef __linux__
- dev_priv->gart_info.sg_dummy_page =
- alloc_page(GFP_KERNEL|__GFP_DMA32);
- set_page_locked(dev_priv->gart_info.sg_dummy_page);
- dev_priv->gart_info.sg_dummy_bus =
- pci_map_page(dev->pdev, dev_priv->gart_info.sg_dummy_page, 0,
- PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-#endif
- if (dev_priv->card_type < NV_50) {
- /* Maybe use NV_DMA_TARGET_AGP for PCIE? NVIDIA do this, and
- * confirmed to work on c51. Perhaps means NV_DMA_TARGET_PCIE
- * on those cards? */
- INSTANCE_WR(gpuobj, 0, NV_CLASS_DMA_IN_MEMORY |
- (1 << 12) /* PT present */ |
- (0 << 13) /* PT *not* linear */ |
- (NV_DMA_ACCESS_RW << 14) |
- (NV_DMA_TARGET_PCI << 16));
- INSTANCE_WR(gpuobj, 1, aper_size - 1);
- for (i=2; i<2+(aper_size>>12); i++) {
- INSTANCE_WR(gpuobj, i,
- dev_priv->gart_info.sg_dummy_bus | 3);
- }
- } else {
- for (i=0; i<obj_size; i+=8) {
- INSTANCE_WR(gpuobj, (i+0)/4,
- dev_priv->gart_info.sg_dummy_bus | 0x21);
- INSTANCE_WR(gpuobj, (i+4)/4, 0);
- }
- }
-
- dev_priv->gart_info.type = NOUVEAU_GART_SGDMA;
- dev_priv->gart_info.aper_base = 0;
- dev_priv->gart_info.aper_size = aper_size;
- dev_priv->gart_info.sg_ctxdma = gpuobj;
- return 0;
-}
-
-void
-nouveau_sgdma_takedown(struct drm_device *dev)
-{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
-
- if (dev_priv->gart_info.sg_dummy_page) {
-#ifdef __linux__
- pci_unmap_page(dev->pdev, dev_priv->gart_info.sg_dummy_bus,
- NV_CTXDMA_PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
- unlock_page(dev_priv->gart_info.sg_dummy_page);
- __free_page(dev_priv->gart_info.sg_dummy_page);
-#endif
- dev_priv->gart_info.sg_dummy_page = NULL;
- dev_priv->gart_info.sg_dummy_bus = 0;
- }
-
- nouveau_gpuobj_del(dev, &dev_priv->gart_info.sg_ctxdma);
-}
-
-#if 0
-int
-nouveau_sgdma_nottm_hack_init(struct drm_device *dev)
-{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
- struct drm_ttm_backend *be;
- struct drm_scatter_gather sgreq;
- struct drm_mm_node mm_node;
- struct drm_bo_mem_reg mem;
- int ret;
-
- dev_priv->gart_info.sg_be = nouveau_sgdma_init_ttm(dev);
- if (!dev_priv->gart_info.sg_be)
- return -ENOMEM;
- be = dev_priv->gart_info.sg_be;
-
- /* Hack the aperture size down to the amount of system memory
- * we're going to bind into it.
- */
- if (dev_priv->gart_info.aper_size > 32*1024*1024)
- dev_priv->gart_info.aper_size = 32*1024*1024;
-
- sgreq.size = dev_priv->gart_info.aper_size;
- if ((ret = drm_sg_alloc(dev, &sgreq))) {
- DRM_ERROR("drm_sg_alloc failed: %d\n", ret);
- return ret;
- }
- dev_priv->gart_info.sg_handle = sgreq.handle;
-
- if ((ret = be->func->populate(be, dev->sg->pages, dev->sg->pagelist, dev->bm.dummy_read_page))) {
- DRM_ERROR("failed populate: %d\n", ret);
- return ret;
- }
-
- mm_node.start = 0;
- mem.mm_node = &mm_node;
-
- if ((ret = be->func->bind(be, &mem))) {
- DRM_ERROR("failed bind: %d\n", ret);
- return ret;
- }
-
- return 0;
-}
-
-void
-nouveau_sgdma_nottm_hack_takedown(struct drm_device *dev)
-{
-}
-#endif
-
-int
-nouveau_sgdma_get_page(struct drm_device *dev, uint32_t offset, uint32_t *page)
-{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
- struct nouveau_gpuobj *gpuobj = dev_priv->gart_info.sg_ctxdma;
- int pte;
-
- pte = (offset >> NV_CTXDMA_PAGE_SHIFT);
- if (dev_priv->card_type < NV_50) {
- *page = INSTANCE_RD(gpuobj, (pte + 2)) & ~NV_CTXDMA_PAGE_MASK;
- return 0;
- }
-
- DRM_ERROR("Unimplemented on NV50\n");
- return -EINVAL;
-}
diff --git a/bsd-core/nouveau_state.c b/bsd-core/nouveau_state.c
deleted file mode 120000
index b304f6bb..00000000
--- a/bsd-core/nouveau_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_state.c \ No newline at end of file
diff --git a/bsd-core/nouveau_swmthd.c b/bsd-core/nouveau_swmthd.c
deleted file mode 120000
index c5390801..00000000
--- a/bsd-core/nouveau_swmthd.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_swmthd.c \ No newline at end of file
diff --git a/bsd-core/nouveau_swmthd.h b/bsd-core/nouveau_swmthd.h
deleted file mode 120000
index 33425dcd..00000000
--- a/bsd-core/nouveau_swmthd.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nouveau_swmthd.h \ No newline at end of file
diff --git a/bsd-core/nv04_fb.c b/bsd-core/nv04_fb.c
deleted file mode 120000
index 867e2007..00000000
--- a/bsd-core/nv04_fb.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_fb.c \ No newline at end of file
diff --git a/bsd-core/nv04_fifo.c b/bsd-core/nv04_fifo.c
deleted file mode 120000
index d10beb19..00000000
--- a/bsd-core/nv04_fifo.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_fifo.c \ No newline at end of file
diff --git a/bsd-core/nv04_graph.c b/bsd-core/nv04_graph.c
deleted file mode 120000
index 0d7a0b35..00000000
--- a/bsd-core/nv04_graph.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_graph.c \ No newline at end of file
diff --git a/bsd-core/nv04_instmem.c b/bsd-core/nv04_instmem.c
deleted file mode 120000
index e720fb5b..00000000
--- a/bsd-core/nv04_instmem.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_instmem.c \ No newline at end of file
diff --git a/bsd-core/nv04_mc.c b/bsd-core/nv04_mc.c
deleted file mode 120000
index 32e91825..00000000
--- a/bsd-core/nv04_mc.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_mc.c \ No newline at end of file
diff --git a/bsd-core/nv04_timer.c b/bsd-core/nv04_timer.c
deleted file mode 120000
index 11108b2b..00000000
--- a/bsd-core/nv04_timer.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv04_timer.c \ No newline at end of file
diff --git a/bsd-core/nv10_fb.c b/bsd-core/nv10_fb.c
deleted file mode 120000
index f858c7c6..00000000
--- a/bsd-core/nv10_fb.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv10_fb.c \ No newline at end of file
diff --git a/bsd-core/nv10_fifo.c b/bsd-core/nv10_fifo.c
deleted file mode 120000
index 8630ad04..00000000
--- a/bsd-core/nv10_fifo.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv10_fifo.c \ No newline at end of file
diff --git a/bsd-core/nv10_graph.c b/bsd-core/nv10_graph.c
deleted file mode 120000
index 0d5a0eb4..00000000
--- a/bsd-core/nv10_graph.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv10_graph.c \ No newline at end of file
diff --git a/bsd-core/nv20_graph.c b/bsd-core/nv20_graph.c
deleted file mode 120000
index 73049914..00000000
--- a/bsd-core/nv20_graph.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv20_graph.c \ No newline at end of file
diff --git a/bsd-core/nv40_fb.c b/bsd-core/nv40_fb.c
deleted file mode 120000
index 4a816b13..00000000
--- a/bsd-core/nv40_fb.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv40_fb.c \ No newline at end of file
diff --git a/bsd-core/nv40_fifo.c b/bsd-core/nv40_fifo.c
deleted file mode 120000
index cc71e7a4..00000000
--- a/bsd-core/nv40_fifo.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv40_fifo.c \ No newline at end of file
diff --git a/bsd-core/nv40_graph.c b/bsd-core/nv40_graph.c
deleted file mode 120000
index 2fe59919..00000000
--- a/bsd-core/nv40_graph.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv40_graph.c \ No newline at end of file
diff --git a/bsd-core/nv40_mc.c b/bsd-core/nv40_mc.c
deleted file mode 120000
index fff26494..00000000
--- a/bsd-core/nv40_mc.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv40_mc.c \ No newline at end of file
diff --git a/bsd-core/nv50_fifo.c b/bsd-core/nv50_fifo.c
deleted file mode 120000
index 4c9990a9..00000000
--- a/bsd-core/nv50_fifo.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv50_fifo.c \ No newline at end of file
diff --git a/bsd-core/nv50_graph.c b/bsd-core/nv50_graph.c
deleted file mode 120000
index 03f69e68..00000000
--- a/bsd-core/nv50_graph.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv50_graph.c \ No newline at end of file
diff --git a/bsd-core/nv50_grctx.h b/bsd-core/nv50_grctx.h
deleted file mode 120000
index d40b9a86..00000000
--- a/bsd-core/nv50_grctx.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv50_grctx.h \ No newline at end of file
diff --git a/bsd-core/nv50_instmem.c b/bsd-core/nv50_instmem.c
deleted file mode 120000
index 4e45344a..00000000
--- a/bsd-core/nv50_instmem.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv50_instmem.c \ No newline at end of file
diff --git a/bsd-core/nv50_mc.c b/bsd-core/nv50_mc.c
deleted file mode 120000
index f4bb369e..00000000
--- a/bsd-core/nv50_mc.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/nv50_mc.c \ No newline at end of file
diff --git a/bsd-core/r128/Makefile b/bsd-core/r128/Makefile
deleted file mode 100644
index 0b62d0b5..00000000
--- a/bsd-core/r128/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = r128
-NO_MAN = YES
-SRCS = r128_cce.c r128_drv.c r128_state.c r128_irq.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/r128_cce.c b/bsd-core/r128_cce.c
deleted file mode 120000
index 0c1d659e..00000000
--- a/bsd-core/r128_cce.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r128_cce.c \ No newline at end of file
diff --git a/bsd-core/r128_drm.h b/bsd-core/r128_drm.h
deleted file mode 120000
index 363852cb..00000000
--- a/bsd-core/r128_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r128_drm.h \ No newline at end of file
diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c
deleted file mode 100644
index a783d581..00000000
--- a/bsd-core/r128_drv.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*-
- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "r128_drm.h"
-#include "r128_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t r128_pciidlist[] = {
- r128_PCI_IDS
-};
-
-static void r128_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
- DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = sizeof(drm_r128_buf_priv_t);
- dev->driver->load = r128_driver_load;
- dev->driver->preclose = r128_driver_preclose;
- dev->driver->lastclose = r128_driver_lastclose;
- dev->driver->get_vblank_counter = r128_get_vblank_counter;
- dev->driver->enable_vblank = r128_enable_vblank;
- dev->driver->disable_vblank = r128_disable_vblank;
- dev->driver->irq_preinstall = r128_driver_irq_preinstall;
- dev->driver->irq_postinstall = r128_driver_irq_postinstall;
- dev->driver->irq_uninstall = r128_driver_irq_uninstall;
- dev->driver->irq_handler = r128_driver_irq_handler;
- dev->driver->dma_ioctl = r128_cce_buffers;
-
- dev->driver->ioctls = r128_ioctls;
- dev->driver->max_ioctl = r128_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-r128_probe(device_t kdev)
-{
- return drm_probe(kdev, r128_pciidlist);
-}
-
-static int
-r128_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- r128_configure(dev);
-
- return drm_attach(kdev, r128_pciidlist);
-}
-
-int r128_driver_load(struct drm_device * dev, unsigned long flags)
-{
- return drm_vblank_init(dev, 1);
-}
-
-static int
-r128_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t r128_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, r128_probe),
- DEVMETHOD(device_attach, r128_attach),
- DEVMETHOD(device_detach, r128_detach),
-
- { 0, 0 }
-};
-
-static driver_t r128_driver = {
- "drm",
- r128_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(r128, drm, 1, 1, 1);
diff --git a/bsd-core/r128_drv.h b/bsd-core/r128_drv.h
deleted file mode 120000
index 4f7e822d..00000000
--- a/bsd-core/r128_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r128_drv.h \ No newline at end of file
diff --git a/bsd-core/r128_irq.c b/bsd-core/r128_irq.c
deleted file mode 120000
index 66d28b05..00000000
--- a/bsd-core/r128_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r128_irq.c \ No newline at end of file
diff --git a/bsd-core/r128_state.c b/bsd-core/r128_state.c
deleted file mode 120000
index e83d84b5..00000000
--- a/bsd-core/r128_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r128_state.c \ No newline at end of file
diff --git a/bsd-core/r300_cmdbuf.c b/bsd-core/r300_cmdbuf.c
deleted file mode 120000
index 6674d056..00000000
--- a/bsd-core/r300_cmdbuf.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r300_cmdbuf.c \ No newline at end of file
diff --git a/bsd-core/r300_reg.h b/bsd-core/r300_reg.h
deleted file mode 120000
index ef54eba2..00000000
--- a/bsd-core/r300_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/r300_reg.h \ No newline at end of file
diff --git a/bsd-core/radeon/Makefile b/bsd-core/radeon/Makefile
deleted file mode 100644
index 7fe27f60..00000000
--- a/bsd-core/radeon/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = radeon
-NO_MAN = YES
-SRCS = r300_cmdbuf.c radeon_cp.c radeon_drv.c radeon_state.c radeon_irq.c \
- radeon_mem.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if ${CC} != "icc"
-CFLAGS += --param large-function-growth=1000
-.endif
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/radeon_cp.c b/bsd-core/radeon_cp.c
deleted file mode 120000
index ee860943..00000000
--- a/bsd-core/radeon_cp.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_cp.c \ No newline at end of file
diff --git a/bsd-core/radeon_drm.h b/bsd-core/radeon_drm.h
deleted file mode 120000
index 54f595a3..00000000
--- a/bsd-core/radeon_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_drm.h \ No newline at end of file
diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c
deleted file mode 100644
index 7bc77daa..00000000
--- a/bsd-core/radeon_drv.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*-
- * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
- */
-/*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "radeon_drv.h"
-#include "drm_pciids.h"
-
-int radeon_no_wb;
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t radeon_pciidlist[] = {
- radeon_PCI_IDS
-};
-
-static void radeon_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
- DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = sizeof(drm_radeon_buf_priv_t);
- dev->driver->load = radeon_driver_load;
- dev->driver->unload = radeon_driver_unload;
- dev->driver->firstopen = radeon_driver_firstopen;
- dev->driver->open = radeon_driver_open;
- dev->driver->preclose = radeon_driver_preclose;
- dev->driver->postclose = radeon_driver_postclose;
- dev->driver->lastclose = radeon_driver_lastclose;
- dev->driver->get_vblank_counter = radeon_get_vblank_counter;
- dev->driver->enable_vblank = radeon_enable_vblank;
- dev->driver->disable_vblank = radeon_disable_vblank;
- dev->driver->irq_preinstall = radeon_driver_irq_preinstall;
- dev->driver->irq_postinstall = radeon_driver_irq_postinstall;
- dev->driver->irq_uninstall = radeon_driver_irq_uninstall;
- dev->driver->irq_handler = radeon_driver_irq_handler;
- dev->driver->dma_ioctl = radeon_cp_buffers;
-
- dev->driver->ioctls = radeon_ioctls;
- dev->driver->max_ioctl = radeon_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-radeon_probe(device_t kdev)
-{
- return drm_probe(kdev, radeon_pciidlist);
-}
-
-static int
-radeon_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- radeon_configure(dev);
-
- return drm_attach(kdev, radeon_pciidlist);
-}
-
-static int
-radeon_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t radeon_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, radeon_probe),
- DEVMETHOD(device_attach, radeon_attach),
- DEVMETHOD(device_detach, radeon_detach),
-
- { 0, 0 }
-};
-
-static driver_t radeon_driver = {
- "drm",
- radeon_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(radeon, vgapci, radeon_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(radeon, pci, radeon_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(radeon, drm, 1, 1, 1);
diff --git a/bsd-core/radeon_drv.h b/bsd-core/radeon_drv.h
deleted file mode 120000
index 5b415ea8..00000000
--- a/bsd-core/radeon_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_drv.h \ No newline at end of file
diff --git a/bsd-core/radeon_irq.c b/bsd-core/radeon_irq.c
deleted file mode 120000
index 2f394a5e..00000000
--- a/bsd-core/radeon_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_irq.c \ No newline at end of file
diff --git a/bsd-core/radeon_mem.c b/bsd-core/radeon_mem.c
deleted file mode 120000
index 8cc27989..00000000
--- a/bsd-core/radeon_mem.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_mem.c \ No newline at end of file
diff --git a/bsd-core/radeon_microcode.h b/bsd-core/radeon_microcode.h
deleted file mode 120000
index 709fff30..00000000
--- a/bsd-core/radeon_microcode.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_microcode.h \ No newline at end of file
diff --git a/bsd-core/radeon_state.c b/bsd-core/radeon_state.c
deleted file mode 120000
index ccee8761..00000000
--- a/bsd-core/radeon_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/radeon_state.c \ No newline at end of file
diff --git a/bsd-core/savage/Makefile b/bsd-core/savage/Makefile
deleted file mode 100644
index ac51e359..00000000
--- a/bsd-core/savage/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = savage
-NO_MAN = YES
-SRCS = savage_bci.c savage_drv.c savage_state.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/savage_bci.c b/bsd-core/savage_bci.c
deleted file mode 120000
index b8436713..00000000
--- a/bsd-core/savage_bci.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/savage_bci.c \ No newline at end of file
diff --git a/bsd-core/savage_drm.h b/bsd-core/savage_drm.h
deleted file mode 120000
index 0dab2e3b..00000000
--- a/bsd-core/savage_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/savage_drm.h \ No newline at end of file
diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c
deleted file mode 100644
index c5376e7b..00000000
--- a/bsd-core/savage_drv.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* savage_drv.c -- Savage DRI driver
- */
-/*-
- * Copyright 2005 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "savage_drm.h"
-#include "savage_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t savage_pciidlist[] = {
- savage_PCI_IDS
-};
-
-static void savage_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
- DRIVER_HAVE_DMA;
-
- dev->driver->buf_priv_size = sizeof(drm_savage_buf_priv_t);
- dev->driver->load = savage_driver_load;
- dev->driver->firstopen = savage_driver_firstopen;
- dev->driver->lastclose = savage_driver_lastclose;
- dev->driver->unload = savage_driver_unload;
- dev->driver->reclaim_buffers_locked = savage_reclaim_buffers;
- dev->driver->dma_ioctl = savage_bci_buffers;
-
- dev->driver->ioctls = savage_ioctls;
- dev->driver->max_ioctl = savage_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-savage_probe(device_t kdev)
-{
- return drm_probe(kdev, savage_pciidlist);
-}
-
-static int
-savage_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- savage_configure(dev);
-
- return drm_attach(kdev, savage_pciidlist);
-}
-
-static int
-savage_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t savage_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, savage_probe),
- DEVMETHOD(device_attach, savage_attach),
- DEVMETHOD(device_detach, savage_detach),
-
- { 0, 0 }
-};
-
-static driver_t savage_driver = {
- "drm",
- savage_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(savage, drm, 1, 1, 1);
diff --git a/bsd-core/savage_drv.h b/bsd-core/savage_drv.h
deleted file mode 120000
index 8397009c..00000000
--- a/bsd-core/savage_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/savage_drv.h \ No newline at end of file
diff --git a/bsd-core/savage_state.c b/bsd-core/savage_state.c
deleted file mode 120000
index e55dc5d4..00000000
--- a/bsd-core/savage_state.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/savage_state.c \ No newline at end of file
diff --git a/bsd-core/sis/Makefile b/bsd-core/sis/Makefile
deleted file mode 100644
index e21a4ba4..00000000
--- a/bsd-core/sis/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD= sis
-NO_MAN= YES
-SRCS= sis_drv.c sis_ds.c sis_mm.c
-SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS+= ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/sis_drm.h b/bsd-core/sis_drm.h
deleted file mode 120000
index 36c77aac..00000000
--- a/bsd-core/sis_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/sis_drm.h \ No newline at end of file
diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c
deleted file mode 100644
index a294246a..00000000
--- a/bsd-core/sis_drv.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* sis.c -- sis driver -*- linux-c -*-
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include "drmP.h"
-#include "sis_drm.h"
-#include "sis_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t sis_pciidlist[] = {
- sis_PCI_IDS
-};
-
-static void sis_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR;
-
- dev->driver->buf_priv_size = 1; /* No dev_priv */
- dev->driver->context_ctor = sis_init_context;
- dev->driver->context_dtor = sis_final_context;
-
- dev->driver->ioctls = sis_ioctls;
- dev->driver->max_ioctl = sis_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-sis_probe(device_t kdev)
-{
- return drm_probe(kdev, sis_pciidlist);
-}
-
-static int
-sis_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- sis_configure(dev);
-
- return drm_attach(kdev, sis_pciidlist);
-}
-
-static int
-sis_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t sis_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, sis_probe),
- DEVMETHOD(device_attach, sis_attach),
- DEVMETHOD(device_detach, sis_detach),
-
- { 0, 0 }
-};
-
-static driver_t sis_driver = {
- "drm",
- sis_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
diff --git a/bsd-core/sis_drv.h b/bsd-core/sis_drv.h
deleted file mode 120000
index 3fddfdae..00000000
--- a/bsd-core/sis_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/sis_drv.h \ No newline at end of file
diff --git a/bsd-core/sis_ds.c b/bsd-core/sis_ds.c
deleted file mode 120000
index 242310a0..00000000
--- a/bsd-core/sis_ds.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/sis_ds.c \ No newline at end of file
diff --git a/bsd-core/sis_ds.h b/bsd-core/sis_ds.h
deleted file mode 120000
index 8cbdaf3b..00000000
--- a/bsd-core/sis_ds.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/sis_ds.h \ No newline at end of file
diff --git a/bsd-core/sis_mm.c b/bsd-core/sis_mm.c
deleted file mode 120000
index 8f802ec3..00000000
--- a/bsd-core/sis_mm.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/sis_mm.c \ No newline at end of file
diff --git a/bsd-core/tdfx/Makefile b/bsd-core/tdfx/Makefile
deleted file mode 100644
index 5770491a..00000000
--- a/bsd-core/tdfx/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD= tdfx
-NO_MAN= YES
-SRCS= tdfx_drv.c
-SRCS+= device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS+= ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c
deleted file mode 100644
index f293f4b3..00000000
--- a/bsd-core/tdfx_drv.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* tdfx_drv.c -- tdfx driver -*- linux-c -*-
- * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com
- */
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Daryll Strauss <daryll@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "tdfx_drv.h"
-#include "drmP.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t tdfx_pciidlist[] = {
- tdfx_PCI_IDS
-};
-
-static void tdfx_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_MTRR;
-
- dev->driver->buf_priv_size = 1; /* No dev_priv */
-
- dev->driver->max_ioctl = 0;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-tdfx_probe(device_t kdev)
-{
- return drm_probe(kdev, tdfx_pciidlist);
-}
-
-static int
-tdfx_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- tdfx_configure(dev);
-
- return drm_attach(kdev, tdfx_pciidlist);
-}
-
-static int
-tdfx_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t tdfx_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, tdfx_probe),
- DEVMETHOD(device_attach, tdfx_attach),
- DEVMETHOD(device_detach, tdfx_detach),
-
- { 0, 0 }
-};
-
-static driver_t tdfx_driver = {
- "drm",
- tdfx_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-#if __FreeBSD_version >= 700010
-DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0);
-#else
-DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
-#endif
-MODULE_DEPEND(tdfx, drm, 1, 1, 1);
diff --git a/bsd-core/tdfx_drv.h b/bsd-core/tdfx_drv.h
deleted file mode 120000
index 8df70329..00000000
--- a/bsd-core/tdfx_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/tdfx_drv.h \ No newline at end of file
diff --git a/bsd-core/via/Makefile b/bsd-core/via/Makefile
deleted file mode 100644
index 7aaa01df..00000000
--- a/bsd-core/via/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/..
-KMOD = via
-NO_MAN = YES
-SRCS = via_dma.c via_drv.c via_ds.c via_irq.c via_map.c via_mm.c \
- via_verifier.c via_video.c
-SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
-CFLAGS += ${DEBUG_FLAGS} -I. -I..
-
-.if defined(DRM_DEBUG)
-DRM_DEBUG_OPT= "\#define DRM_DEBUG 1"
-.endif
-
-.if !defined(DRM_NOLINUX)
-DRM_LINUX_OPT= "\#define DRM_LINUX 1"
-.endif
-
-opt_drm.h:
- touch opt_drm.h
- echo $(DRM_DEBUG_OPT) >> opt_drm.h
- echo $(DRM_LINUX_OPT) >> opt_drm.h
-
-.include <bsd.kmod.mk>
diff --git a/bsd-core/via_3d_reg.h b/bsd-core/via_3d_reg.h
deleted file mode 120000
index 90d238ec..00000000
--- a/bsd-core/via_3d_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_3d_reg.h \ No newline at end of file
diff --git a/bsd-core/via_dma.c b/bsd-core/via_dma.c
deleted file mode 120000
index 1f4d920f..00000000
--- a/bsd-core/via_dma.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_dma.c \ No newline at end of file
diff --git a/bsd-core/via_drm.h b/bsd-core/via_drm.h
deleted file mode 120000
index 7cd175d3..00000000
--- a/bsd-core/via_drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_drm.h \ No newline at end of file
diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c
deleted file mode 100644
index 5a2307eb..00000000
--- a/bsd-core/via_drv.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* via_drv.c -- VIA unichrome driver -*- linux-c -*-
- * Created: Fri Aug 12 2005 by anholt@FreeBSD.org
- */
-/*-
- * Copyright 2005 Eric Anholt
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-#include "drmP.h"
-#include "drm.h"
-#include "via_drm.h"
-#include "via_drv.h"
-#include "drm_pciids.h"
-
-/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
-static drm_pci_id_list_t via_pciidlist[] = {
- viadrv_PCI_IDS
-};
-
-static void via_configure(struct drm_device *dev)
-{
- dev->driver->driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ;
-
- dev->driver->buf_priv_size = 1;
- dev->driver->load = via_driver_load;
- dev->driver->unload = via_driver_unload;
- dev->driver->context_ctor = via_init_context;
- dev->driver->context_dtor = via_final_context;
- dev->driver->get_vblank_counter = via_get_vblank_counter;
- dev->driver->enable_vblank = via_enable_vblank;
- dev->driver->disable_vblank = via_disable_vblank;
- dev->driver->irq_preinstall = via_driver_irq_preinstall;
- dev->driver->irq_postinstall = via_driver_irq_postinstall;
- dev->driver->irq_uninstall = via_driver_irq_uninstall;
- dev->driver->irq_handler = via_driver_irq_handler;
- dev->driver->dma_quiescent = via_driver_dma_quiescent;
-
- dev->driver->ioctls = via_ioctls;
- dev->driver->max_ioctl = via_max_ioctl;
-
- dev->driver->name = DRIVER_NAME;
- dev->driver->desc = DRIVER_DESC;
- dev->driver->date = DRIVER_DATE;
- dev->driver->major = DRIVER_MAJOR;
- dev->driver->minor = DRIVER_MINOR;
- dev->driver->patchlevel = DRIVER_PATCHLEVEL;
-}
-
-static int
-via_probe(device_t kdev)
-{
- return drm_probe(kdev, via_pciidlist);
-}
-
-static int
-via_attach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
-
- dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
- M_WAITOK | M_ZERO);
-
- via_configure(dev);
-
- return drm_attach(kdev, via_pciidlist);
-}
-
-static int
-via_detach(device_t kdev)
-{
- struct drm_device *dev = device_get_softc(kdev);
- int ret;
-
- ret = drm_detach(kdev);
-
- free(dev->driver, DRM_MEM_DRIVER);
-
- return ret;
-}
-
-static device_method_t via_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, via_probe),
- DEVMETHOD(device_attach, via_attach),
- DEVMETHOD(device_detach, via_detach),
-
- { 0, 0 }
-};
-
-static driver_t via_driver = {
- "drm",
- via_methods,
- sizeof(struct drm_device)
-};
-
-extern devclass_t drm_devclass;
-DRIVER_MODULE(via, pci, via_driver, drm_devclass, 0, 0);
-MODULE_DEPEND(via, drm, 1, 1, 1);
diff --git a/bsd-core/via_drv.h b/bsd-core/via_drv.h
deleted file mode 120000
index 8954fe88..00000000
--- a/bsd-core/via_drv.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_drv.h \ No newline at end of file
diff --git a/bsd-core/via_ds.c b/bsd-core/via_ds.c
deleted file mode 120000
index b0fbb694..00000000
--- a/bsd-core/via_ds.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_ds.c \ No newline at end of file
diff --git a/bsd-core/via_ds.h b/bsd-core/via_ds.h
deleted file mode 120000
index dc8f2f44..00000000
--- a/bsd-core/via_ds.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_ds.h \ No newline at end of file
diff --git a/bsd-core/via_irq.c b/bsd-core/via_irq.c
deleted file mode 120000
index f615af87..00000000
--- a/bsd-core/via_irq.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_irq.c \ No newline at end of file
diff --git a/bsd-core/via_map.c b/bsd-core/via_map.c
deleted file mode 120000
index b5056634..00000000
--- a/bsd-core/via_map.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_map.c \ No newline at end of file
diff --git a/bsd-core/via_mm.c b/bsd-core/via_mm.c
deleted file mode 120000
index f9ec0f37..00000000
--- a/bsd-core/via_mm.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_mm.c \ No newline at end of file
diff --git a/bsd-core/via_mm.h b/bsd-core/via_mm.h
deleted file mode 120000
index fe2234f6..00000000
--- a/bsd-core/via_mm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_mm.h \ No newline at end of file
diff --git a/bsd-core/via_verifier.c b/bsd-core/via_verifier.c
deleted file mode 120000
index 00b411bd..00000000
--- a/bsd-core/via_verifier.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_verifier.c \ No newline at end of file
diff --git a/bsd-core/via_verifier.h b/bsd-core/via_verifier.h
deleted file mode 120000
index 62d3e287..00000000
--- a/bsd-core/via_verifier.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_verifier.h \ No newline at end of file
diff --git a/bsd-core/via_video.c b/bsd-core/via_video.c
deleted file mode 120000
index a6d27947..00000000
--- a/bsd-core/via_video.c
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/via_video.c \ No newline at end of file
diff --git a/linux-core/.gitignore b/linux-core/.gitignore
deleted file mode 100644
index 1d045d63..00000000
--- a/linux-core/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Module*.symvers
diff --git a/linux-core/Config.in b/linux-core/Config.in
deleted file mode 100644
index 46ba48d6..00000000
--- a/linux-core/Config.in
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Drm device configuration
-#
-# This driver provides support for the
-# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
-#
-
-tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX
-#tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA
-tristate ' ATI Rage 128' CONFIG_DRM_R128
-tristate ' ATI Radeon' CONFIG_DRM_RADEON
-dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP
-dep_tristate ' Intel 830M/845G/852GM/855GM/865G' CONFIG_DRM_I830 $CONFIG_AGP
-dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP
-tristate ' SiS' CONFIG_DRM_SIS
-tristate ' Via Unichrome' CONFIG_DRM_VIA
-
diff --git a/linux-core/Doxyfile b/linux-core/Doxyfile
deleted file mode 100644
index 97efeaa6..00000000
--- a/linux-core/Doxyfile
+++ /dev/null
@@ -1,1161 +0,0 @@
-# Doxyfile 1.3.8
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "Direct Rendering Module"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of source
-# files, where putting all generated files in the same directory would otherwise
-# cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is used
-# as the annotated text. Otherwise, the brief description is used as-is. If left
-# blank, the following values are used ("$name" is automatically replaced with the
-# name of the entity): "The $name class" "The $name widget" "The $name file"
-# "is" "provides" "specifies" "contains" "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = YES
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = NO
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = NO
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = . \
- ../shared-core
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS = *.c \
- *.h
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS = YES
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED = __KERNEL__ \
- DRM(x)=x \
- __OS_HAS_AGP=1 \
- __OS_HAS_MTRR=1
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = DRMFILE \
- DRM_IOCTL_ARGS \
- DRM_IRQ_ARGS \
- DRM_TASKQUEUE_ARGS
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse the
-# parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superseded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes that
-# lay further from the root node will be omitted. Note that setting this option to
-# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that a graph may be further truncated if the graph's image dimensions are
-# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
-# If 0 is used for the depth value (the default), the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/linux-core/Kconfig b/linux-core/Kconfig
deleted file mode 100644
index df8dd5c0..00000000
--- a/linux-core/Kconfig
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Drm device configuration
-#
-# This driver provides support for the
-# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
-#
-config DRM
- bool "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
- help
- Kernel-level support for the Direct Rendering Infrastructure (DRI)
- introduced in XFree86 4.0. If you say Y here, you need to select
- the module that's right for your graphics card from the list below.
- These modules provide support for synchronization, security, and
- DMA transfers. Please see <http://dri.sourceforge.net/> for more
- details. You should also select and configure AGP
- (/dev/agpgart) support.
-
-config DRM_TDFX
- tristate "3dfx Banshee/Voodoo3+"
- depends on DRM && PCI
- help
- Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
- graphics card. If M is selected, the module will be called tdfx.
-
-config DRM_R128
- tristate "ATI Rage 128"
- depends on DRM && PCI
- help
- Choose this option if you have an ATI Rage 128 graphics card. If M
- is selected, the module will be called r128. AGP support for
- this card is strongly suggested (unless you have a PCI version).
-
-config DRM_RADEON
- tristate "ATI Radeon"
- depends on DRM && PCI
- help
- Choose this option if you have an ATI Radeon graphics card. There
- are both PCI and AGP versions. You don't need to choose this to
- run the Radeon in plain VGA mode. There is a product page at
- <http://www.ati.com/na/pages/products/pc/radeon32/index.html>.
- If M is selected, the module will be called radeon.
-
-config DRM_I810
- tristate "Intel I810"
- depends on DRM && AGP && AGP_INTEL
- help
- Choose this option if you have an Intel I810 graphics card. If M is
- selected, the module will be called i810. AGP support is required
- for this driver to work.
-
-config DRM_MGA
- tristate "Matrox g200/g400"
- depends on DRM && (!X86_64 || BROKEN) && (!PPC || BROKEN)
- help
- Choose this option if you have a Matrox G200, G400, G450 or G550
- graphics card. If M is selected, the module will be called mga.
-
-config DRM_SIS
- tristate "SiS video cards"
- depends on DRM
- help
- Choose this option if you have a SiS 630 or compatible video
- chipset. If M is selected the module will be called sis.
-
-config DRM_VIA
- tristate "Via unichrome video cards"
- depends on DRM
- help
- Choose this option if you have a Via unichrome or compatible video
- chipset. If M is selected the module will be called via.
-
-config DRM_MACH64
- tristate "ATI Rage Pro (Mach64)"
- depends on DRM && PCI
- help
- Choose this option if you have an ATI Rage Pro (mach64 chipset)
- graphics card. Example cards include: 3D Rage Pro, Xpert 98,
- 3D Rage LT Pro, 3D Rage XL/XC, and 3D Rage Mobility (P/M, M1).
- Cards earlier than ATI Rage Pro (e.g. Rage II) are not supported.
- If M is selected, the module will be called mach64. AGP support for
- this card is strongly suggested (unless you have a PCI version).
-
-
diff --git a/linux-core/Makefile b/linux-core/Makefile
deleted file mode 100644
index 591b6cfa..00000000
--- a/linux-core/Makefile
+++ /dev/null
@@ -1,336 +0,0 @@
-# Makefile -- For the Direct Rendering Manager module (drm)
-#
-# Based on David Woodhouse's mtd build.
-#
-# Modified to handle the DRM requirements and builds on a wider range of
-# platforms in a flexible way by David Dawes. It's not clear, however,
-# that this approach is simpler than the old one.
-#
-# The purpose of this Makefile is to handle setting up everything
-# needed for an out-of-kernel source build. Makefile.kernel contains
-# everything required for in-kernel source builds. It is included into
-# this file, so none of that should be duplicated here.
-#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.40 2003/08/17 17:12:25 dawes Exp $
-#
-
-#
-# By default, the build is done against the running linux kernel source.
-# To build against a different kernel source tree, set LINUXDIR:
-#
-# make LINUXDIR=/path/to/kernel/source
-
-#
-# To build only some modules, either set DRM_MODULES to the list of modules,
-# or specify the modules as targets:
-#
-# make r128.o radeon.o
-#
-# or:
-#
-# make DRM_MODULES="r128 radeon"
-#
-
-SHELL=/bin/sh
-
-.SUFFIXES:
-
-ifndef LINUXDIR
-RUNNING_REL := $(shell uname -r)
-
-LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
- echo /lib/modules/$(RUNNING_REL)/source; \
- else echo /lib/modules/$(RUNNING_REL)/build; fi)
-endif
-
-ifndef O
-O := $(shell if [ -e /lib/modules/$(RUNNING_REL)/build ]; then \
- echo /lib/modules/$(RUNNING_REL)/build; \
- else echo ""; fi)
-#O := $(LINUXDIR)
-endif
-
-ifdef ARCH
-MACHINE := $(ARCH)
-else
-MACHINE := $(shell uname -m)
-endif
-
-# Modules for all architectures
-MODULE_LIST := drm.o tdfx.o r128.o radeon.o mga.o sis.o savage.o via.o \
- mach64.o xgi.o
-
-# Modules only for ix86 architectures
-ifneq (,$(findstring 86,$(MACHINE)))
-ARCHX86 := 1
-MODULE_LIST += i810.o
-endif
-
-ifneq (,$(findstring sparc64,$(MACHINE)))
-ARCHSPARC64 := 1
-#MODULE_LIST += ffb.o
-endif
-
-DRM_MODULES ?= $(MODULE_LIST)
-
-# These definitions are for handling dependencies in the out of kernel build.
-
-DRMHEADERS = drmP.h drm_compat.h drm_os_linux.h drm.h drm_sarea.h
-COREHEADERS = drm_core.h drm_sman.h drm_hashtab.h
-
-TDFXHEADERS = tdfx_drv.h $(DRMHEADERS)
-R128HEADERS = r128_drv.h r128_drm.h $(DRMHEADERS)
-RADEONHEADERS = radeon_drv.h radeon_drm.h r300_reg.h $(DRMHEADERS)
-MGAHEADERS = mga_drv.h mga_drm.h mga_ucode.h $(DRMHEADERS)
-I810HEADERS = i810_drv.h i810_drm.h $(DRMHEADERS)
-SISHEADERS= sis_drv.h sis_drm.h drm_hashtab.h drm_sman.h $(DRMHEADERS)
-SAVAGEHEADERS= savage_drv.h savage_drm.h $(DRMHEADERS)
-VIAHEADERS = via_drm.h via_drv.h via_3d_reg.h via_verifier.h $(DRMHEADERS)
-MACH64HEADERS = mach64_drv.h mach64_drm.h $(DRMHEADERS)
-FFBHEADERS = ffb_drv.h $(DRMHEADERS)
-NOUVEAUHEADERS = nouveau_drv.h nouveau_drm.h nouveau_reg.h $(DRMHEADERS)
-XGIHEADERS = xgi_cmdlist.h xgi_drv.h xgi_misc.h xgi_regs.h $(DRMHEADERS)
-
-CLEANFILES = *.o *.ko .depend .*.flags .*.d .*.cmd *.mod.c drm_pciids.h .tmp_versions
-
-# VERSION is not defined from the initial invocation. It is defined when
-# this Makefile is invoked from the kernel's root Makefile.
-
-ifndef VERSION
-
-ifdef RUNNING_REL
-
-# SuSE has the version.h and autoconf.h headers for the current kernel
-# in /boot as /boot/vmlinuz.version.h and /boot/vmlinuz.autoconf.h.
-# Check these first to see if they match the running kernel.
-
-BOOTVERSION_PREFIX = /boot/vmlinuz.
-
-V := $(shell if [ -f $(BOOTVERSION_PREFIX)version.h ]; then \
- grep UTS_RELEASE $(BOOTVERSION_PREFIX)version.h | \
- cut -d' ' -f3; fi)
-
-ifeq ($(V),"$(RUNNING_REL)")
-HEADERFROMBOOT := 1
-GETCONFIG := MAKEFILES=$(shell /bin/pwd)/.config
-HAVECONFIG := y
-endif
-
-# On Red Hat we need to check if there is a .config file in the kernel
-# source directory. If there isn't, we need to check if there's a
-# matching file in the configs subdirectory.
-
-ifneq ($(HAVECONFIG),y)
-HAVECONFIG := $(shell if [ -e $(LINUXDIR)/.config ]; then echo y; fi)
-endif
-
-ifneq ($(HAVECONFIG),y)
-REL_BASE := $(shell echo $(RUNNING_REL) | sed 's/-.*//')
-REL_TYPE := $(shell echo $(RUNNING_REL) | sed 's/[0-9.-]//g')
-ifeq ($(REL_TYPE),)
-RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE).config
-else
-RHCONFIG := configs/kernel-$(REL_BASE)-$(MACHINE)-$(REL_TYPE).config
-endif
-HAVECONFIG := $(shell if [ -e $(LINUXDIR)/$(RHCONFIG) ]; then echo y; fi)
-ifneq ($(HAVECONFIG),y)
-RHCONFIG :=
-endif
-endif
-
-ifneq ($(HAVECONFIG),y)
-ifneq ($(0),$(LINUXDIR))
-GETCONFIG += O=$(O)
-endif
-HAVECONFIG := $(shell if [ -e $(O)/.config ]; then echo y; fi)
-endif
-
-ifneq ($(HAVECONFIG),y)
-$(error Cannot find a kernel config file)
-endif
-
-endif
-
-CLEANCONFIG := $(shell if cmp -s $(LINUXDIR)/.config .config; then echo y; fi)
-ifeq ($(CLEANCONFIG),y)
-CLEANFILES += $(LINUXDIR)/.config .config $(LINUXDIR)/tmp_include_depends
-endif
-
-all: modules
-
-modules: includes
- +make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`/bin/pwd` DRMSRCDIR=`/bin/pwd` modules
-
-ifeq ($(HEADERFROMBOOT),1)
-
-BOOTHEADERS = version.h autoconf.h
-BOOTCONFIG = .config
-
-CLEANFILES += $(BOOTHEADERS) $(BOOTCONFIG)
-
-includes:: $(BOOTHEADERS) $(BOOTCONFIG)
-
-version.h: $(BOOTVERSION_PREFIX)version.h
- rm -f $@
- ln -s $< $@
-
-autoconf.h: $(BOOTVERSION_PREFIX)autoconf.h
- rm -f $@
- ln -s $< $@
-
-.config: $(BOOTVERSION_PREFIX)config
- rm -f $@
- ln -s $< $@
-endif
-
-# This prepares an unused Red Hat kernel tree for the build.
-ifneq ($(RHCONFIG),)
-includes:: $(LINUXDIR)/.config $(LINUXDIR)/tmp_include_depends .config
-
-$(LINUXDIR)/.config: $(LINUXDIR)/$(RHCONFIG)
- rm -f $@
- ln -s $< $@
-
-.config: $(LINUXDIR)/$(RHCONFIG)
- rm -f $@
- ln -s $< $@
-
-$(LINUXDIR)/tmp_include_depends:
- echo all: > $@
-endif
-
-# Make sure that the shared source files are linked into this directory.
-
-
-SHAREDDIR := ../shared-core
-
-ifeq ($(shell if [ -d $(SHAREDDIR) ]; then echo y; fi),y)
-includes:: drm_pciids.h
-
-drm_pciids.h: $(SHAREDDIR)/drm_pciids.txt
- sh ../scripts/create_linux_pci_lists.sh < $(SHAREDDIR)/drm_pciids.txt
-endif
-
-clean cleandir:
- rm -rf $(CLEANFILES)
-
-$(MODULE_LIST)::
- make DRM_MODULES=$@ modules
-
-install:
- make -C $(LINUXDIR) $(GETCONFIG) SUBDIRS=`/bin/pwd` DRMSRCDIR=`/bin/pwd` modules_install
-
-else
-
-# Check for kernel versions that we don't support.
-
-BELOW26 := $(shell if [ $(VERSION) -lt 2 -o $(PATCHLEVEL) -lt 6 ]; then \
- echo y; fi)
-
-ifeq ($(BELOW26),y)
-$(error Only 2.6.x and later kernels are supported \
- ($(VERSION).$(PATCHLEVEL).$(SUBLEVEL)))
-endif
-
-ifdef ARCHX86
-ifndef CONFIG_X86_CMPXCHG
-$(error CONFIG_X86_CMPXCHG needs to be enabled in the kernel)
-endif
-endif
-
-# This needs to go before all other include paths.
-CC += -I$(DRMSRCDIR)
-
-# Check for PAGE_AGP definition
-PAGE_AGP := $(shell cat $(LINUXDIR)/include/asm/agp.h 2>/dev/null | \
- grep -c PAGE_AGP)
-
-ifneq ($(PAGE_AGP),0)
-EXTRA_CFLAGS += -DHAVE_PAGE_AGP
-endif
-
-ifeq ($(OS_HAS_GEM), 1)
-EXTRA_CFLAGS += -DOS_HAS_GEM=1
-endif
-
-# Start with all modules turned off.
-CONFIG_DRM_GAMMA := n
-CONFIG_DRM_TDFX := n
-CONFIG_DRM_MGA := n
-CONFIG_DRM_I810 := n
-CONFIG_DRM_R128 := n
-CONFIG_DRM_RADEON := n
-CONFIG_DRM_SIS := n
-CONFIG_DRM_FFB := n
-CONFIG_DRM_SAVAGE := n
-CONFIG_DRM_VIA := n
-CONFIG_DRM_MACH64 := n
-CONFIG_DRM_NOUVEAU := n
-CONFIG_DRM_XGI := n
-
-# Enable module builds for the modules requested/supported.
-
-ifneq (,$(findstring tdfx,$(DRM_MODULES)))
-CONFIG_DRM_TDFX := m
-endif
-ifneq (,$(findstring r128,$(DRM_MODULES)))
-CONFIG_DRM_R128 := m
-endif
-ifneq (,$(findstring radeon,$(DRM_MODULES)))
-CONFIG_DRM_RADEON := m
-endif
-ifneq (,$(findstring sis,$(DRM_MODULES)))
-CONFIG_DRM_SIS := m
-endif
-ifneq (,$(findstring via,$(DRM_MODULES)))
-CONFIG_DRM_VIA := m
-endif
-ifneq (,$(findstring mach64,$(DRM_MODULES)))
-CONFIG_DRM_MACH64 := m
-endif
-ifneq (,$(findstring ffb,$(DRM_MODULES)))
-CONFIG_DRM_FFB := m
-endif
-ifneq (,$(findstring savage,$(DRM_MODULES)))
-CONFIG_DRM_SAVAGE := m
-endif
-ifneq (,$(findstring mga,$(DRM_MODULES)))
-CONFIG_DRM_MGA := m
-endif
-ifneq (,$(findstring nouveau,$(DRM_MODULES)))
-CONFIG_DRM_NOUVEAU := m
-endif
-ifneq (,$(findstring xgi,$(DRM_MODULES)))
-CONFIG_DRM_XGI := m
-endif
-
-# These require AGP support
-
-ifneq (,$(findstring i810,$(DRM_MODULES)))
-CONFIG_DRM_I810 := m
-endif
-
-GIT_REVISION := $(shell cd "$(DRMSRCDIR)" && git describe --abbrev=17)
-ifneq ($(GIT_REVISION),)
-EXTRA_CFLAGS+=-D"GIT_REVISION=\"$(GIT_REVISION)\""
-endif
-
-include $(DRMSRCDIR)/Makefile.kernel
-
-# Depencencies
-$(drm-objs): $(DRMHEADERS) $(COREHEADERS)
-$(tdfx-objs): $(TDFXHEADERS)
-$(r128-objs): $(R128HEADERS)
-$(mga-objs): $(MGAHEADERS)
-$(i810-objs): $(I810HEADERS)
-$(radeon-objs): $(RADEONHEADERS)
-$(sis-objs): $(SISHEADERS)
-$(ffb-objs): $(FFBHEADERS)
-$(savage-objs): $(SAVAGEHEADERS)
-$(via-objs): $(VIAHEADERS)
-$(mach64-objs): $(MACH64HEADERS)
-$(nouveau-objs): $(NOUVEAUHEADERS)
-$(xgi-objs): $(XGIHEADERS)
-
-endif
-
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
deleted file mode 100644
index e83f15c7..00000000
--- a/linux-core/Makefile.kernel
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Makefile for the drm device driver. This driver provides support for the
-# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
-#
-# Based on David Woodhouse's mtd build.
-#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.18 2003/08/16 17:59:17 dawes Exp $
-#
-
-drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \
- drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \
- drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
- drm_sysfs.o drm_pci.o drm_agpsupport.o drm_scatter.o \
- drm_memory_debug.o ati_pcigart.o drm_sman.o \
- drm_hashtab.o drm_mm.o drm_compat.o \
- drm_vm_nopage_compat.o drm_gem.o
-tdfx-objs := tdfx_drv.o
-r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o
-mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
-i810-objs := i810_drv.o i810_dma.o
-nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
- nouveau_object.o nouveau_irq.o nouveau_notifier.o nouveau_swmthd.o \
- nouveau_sgdma.o nouveau_dma.o nouveau_bo.o nouveau_fence.o \
- nouveau_backlight.o \
- nv04_timer.o \
- nv04_mc.o nv40_mc.o nv50_mc.o \
- nv04_fb.o nv10_fb.o nv40_fb.o \
- nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \
- nv04_graph.o nv10_graph.o nv20_graph.o \
- nv40_graph.o nv50_graph.o \
- nv04_instmem.o nv50_instmem.o
-radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
-sis-objs := sis_drv.o sis_mm.o
-ffb-objs := ffb_drv.o ffb_context.o
-savage-objs := savage_drv.o savage_bci.o savage_state.o
-via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o \
- via_video.o via_dmablit.o
-mach64-objs := mach64_drv.o mach64_dma.o mach64_irq.o mach64_state.o
-xgi-objs := xgi_cmdlist.o xgi_drv.o xgi_fb.o xgi_misc.o xgi_pcie.o \
- xgi_fence.o
-
-ifeq ($(CONFIG_COMPAT),y)
-drm-objs += drm_ioc32.o
-radeon-objs += radeon_ioc32.o
-mga-objs += mga_ioc32.o
-r128-objs += r128_ioc32.o
-nouveau-objs += nouveau_ioc32.o
-xgi-objs += xgi_ioc32.o
-endif
-
-obj-m += drm.o
-obj-$(CONFIG_DRM_TDFX) += tdfx.o
-obj-$(CONFIG_DRM_R128) += r128.o
-obj-$(CONFIG_DRM_RADEON)+= radeon.o
-obj-$(CONFIG_DRM_MGA) += mga.o
-obj-$(CONFIG_DRM_I810) += i810.o
-obj-$(CONFIG_DRM_SIS) += sis.o
-obj-$(CONFIG_DRM_FFB) += ffb.o
-obj-$(CONFIG_DRM_SAVAGE)+= savage.o
-obj-$(CONFIG_DRM_VIA) += via.o
-obj-$(CONFIG_DRM_MACH64)+= mach64.o
-obj-$(CONFIG_DRM_NOUVEAU) += nouveau.o
-obj-$(CONFIG_DRM_XGI) += xgi.o
diff --git a/linux-core/README.drm b/linux-core/README.drm
deleted file mode 100644
index 7bcd6191..00000000
--- a/linux-core/README.drm
+++ /dev/null
@@ -1,25 +0,0 @@
-************************************************************
-* For the very latest on DRI development, please see: *
-* http://dri.freedesktop.org/ *
-************************************************************
-
-The Direct Rendering Manager (drm) is a device-independent kernel-level
-device driver that provides support for the XFree86 Direct Rendering
-Infrastructure (DRI).
-
-The DRM supports the Direct Rendering Infrastructure (DRI) in four major
-ways:
-
- 1. The DRM provides synchronized access to the graphics hardware via
- the use of an optimized two-tiered lock.
-
- 2. The DRM enforces the DRI security policy for access to the graphics
- hardware by only allowing authenticated X11 clients access to
- restricted regions of memory.
-
- 3. The DRM provides a generic DMA engine, complete with multiple
- queues and the ability to detect the need for an OpenGL context
- switch.
-
- 4. The DRM is extensible via the use of small device-specific modules
- that rely extensively on the API exported by the DRM module.
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c
deleted file mode 100644
index fce96dd1..00000000
--- a/linux-core/ati_pcigart.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * \file ati_pcigart.c
- * ATI PCI GART support
- *
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com
- *
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include "drmP.h"
-
-# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
-# define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1))
-
-#define ATI_PCIE_WRITE 0x4
-#define ATI_PCIE_READ 0x8
-
-static __inline__ void gart_insert_page_into_table(struct drm_ati_pcigart_info *gart_info, dma_addr_t addr, u32 *pci_gart)
-{
- u32 page_base;
-
- page_base = (u32)addr & ATI_PCIGART_PAGE_MASK;
- switch(gart_info->gart_reg_if) {
- case DRM_ATI_GART_IGP:
- page_base |= (upper_32_bits(addr) & 0xff) << 4;
- page_base |= 0xc;
- break;
- case DRM_ATI_GART_PCIE:
- page_base >>= 8;
- page_base |= (upper_32_bits(addr) & 0xff) << 24;
- page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
- break;
- default:
- case DRM_ATI_GART_PCI:
- break;
- }
- *pci_gart = cpu_to_le32(page_base);
-}
-
-static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
- PAGE_SIZE,
- gart_info->table_mask);
- if (gart_info->table_handle == NULL)
- return -ENOMEM;
-
- return 0;
-}
-
-static void drm_ati_free_pcigart_table(struct drm_device *dev,
- struct drm_ati_pcigart_info *gart_info)
-{
- drm_pci_free(dev, gart_info->table_handle);
- gart_info->table_handle = NULL;
-}
-
-int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
-{
- struct drm_sg_mem *entry = dev->sg;
- unsigned long pages;
- int i;
- int max_pages;
-
- /* we need to support large memory configurations */
- if (!entry) {
- DRM_ERROR("no scatter/gather memory!\n");
- return 0;
- }
-
- if (gart_info->bus_addr) {
-
- max_pages = (gart_info->table_size / sizeof(u32));
- pages = (entry->pages <= max_pages)
- ? entry->pages : max_pages;
-
- for (i = 0; i < pages; i++) {
- if (!entry->busaddr[i])
- break;
- pci_unmap_page(dev->pdev, entry->busaddr[i],
- PAGE_SIZE, PCI_DMA_TODEVICE);
- }
-
- if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
- gart_info->bus_addr = 0;
- }
-
-
- if (gart_info->gart_table_location == DRM_ATI_GART_MAIN
- && gart_info->table_handle) {
-
- drm_ati_free_pcigart_table(dev, gart_info);
- }
-
- return 1;
-}
-EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
-
-int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
-{
- struct drm_sg_mem *entry = dev->sg;
- void *address = NULL;
- unsigned long pages;
- u32 *pci_gart;
- dma_addr_t bus_address = 0;
- int i, j, ret = 0;
- int max_pages;
- dma_addr_t entry_addr;
-
- if (!entry) {
- DRM_ERROR("no scatter/gather memory!\n");
- goto done;
- }
-
- if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
- DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
-
- ret = drm_ati_alloc_pcigart_table(dev, gart_info);
- if (ret) {
- DRM_ERROR("cannot allocate PCI GART page!\n");
- goto done;
- }
-
- address = gart_info->table_handle->vaddr;
- bus_address = gart_info->table_handle->busaddr;
- } else {
- address = gart_info->addr;
- bus_address = gart_info->bus_addr;
- DRM_DEBUG("PCI: Gart Table: VRAM %08llX mapped at %08lX\n",
- (u64)bus_address, (unsigned long)address);
- }
-
- pci_gart = (u32 *) address;
-
- max_pages = (gart_info->table_size / sizeof(u32));
- pages = (entry->pages <= max_pages)
- ? entry->pages : max_pages;
-
- memset(pci_gart, 0, max_pages * sizeof(u32));
-
- for (i = 0; i < pages; i++) {
- /* we need to support large memory configurations */
- entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i],
- 0, PAGE_SIZE, PCI_DMA_TODEVICE);
- if (entry->busaddr[i] == 0) {
- DRM_ERROR("unable to map PCIGART pages!\n");
- drm_ati_pcigart_cleanup(dev, gart_info);
- address = NULL;
- bus_address = 0;
- goto done;
- }
-
- entry_addr = entry->busaddr[i];
- for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
- gart_insert_page_into_table(gart_info, entry_addr, pci_gart);
- pci_gart++;
- entry_addr += ATI_PCIGART_PAGE_SIZE;
- }
- }
-
- ret = 1;
-
-#if defined(__i386__) || defined(__x86_64__)
- wbinvd();
-#else
- mb();
-#endif
-
- done:
- gart_info->addr = address;
- gart_info->bus_addr = bus_address;
- return ret;
-}
-EXPORT_SYMBOL(drm_ati_pcigart_init);
diff --git a/linux-core/drm-gem.txt b/linux-core/drm-gem.txt
deleted file mode 100644
index 5cda87f8..00000000
--- a/linux-core/drm-gem.txt
+++ /dev/null
@@ -1,805 +0,0 @@
- The Graphics Execution Manager
- Part of the Direct Rendering Manager
- ==============================
-
- Keith Packard <keithp@keithp.com>
- Eric Anholt <eric@anholt.net>
- 2008-5-9
-
-Contents:
-
- 1. GEM Overview
- 2. API overview and conventions
- 3. Object Creation/Destruction
- 4. Reading/writing contents
- 5. Mapping objects to userspace
- 6. Memory Domains
- 7. Execution (Intel specific)
- 8. Other misc Intel-specific functions
-
-1. Graphics Execution Manager Overview
-
-Gem is designed to manage graphics memory, control access to the graphics
-device execution context and handle the essentially NUMA environment unique
-to modern graphics hardware. Gem allows multiple applications to share
-graphics device resources without the need to constantly reload the entire
-graphics card. Data may be shared between multiple applications with gem
-ensuring that the correct memory synchronization occurs.
-
-Graphics data can consume arbitrary amounts of memory, with 3D applications
-constructing ever larger sets of textures and vertices. With graphics cards
-memory space growing larger every year, and graphics APIs growing more
-complex, we can no longer insist that each application save a complete copy
-of their graphics state so that the card can be re-initialized from user
-space at each context switch. Ensuring that graphics data remains persistent
-across context switches allows applications significant new functionality
-while also improving performance for existing APIs.
-
-Modern linux desktops include significant 3D rendering as a fundemental
-component of the desktop image construction process. 2D and 3D applications
-paint their content to offscreen storage and the central 'compositing
-manager' constructs the final screen image from those window contents. This
-means that pixel image data from these applications must move within reach
-of the compositing manager and used as source operands for screen image
-rendering operations.
-
-Gem provides simple mechanisms to manage graphics data and control execution
-flow within the linux operating system. Using many existing kernel
-subsystems, it does this with a modest amount of code.
-
-2. API Overview and Conventions
-
-All APIs here are defined in terms of ioctls appplied to the DRM file
-descriptor. To create and manipulate objects, an application must be
-'authorized' using the DRI or DRI2 protocols with the X server. To relax
-that, we will need to implement some better access control mechanisms within
-the hardware portion of the driver to prevent inappropriate
-cross-application data access.
-
-Any DRM driver which does not support GEM will return -ENODEV for all of
-these ioctls. Invalid object handles return -EINVAL. Invalid object names
-return -ENOENT. Other errors are as documented in the specific API below.
-
-To avoid the need to translate ioctl contents on mixed-size systems (with
-32-bit user space running on a 64-bit kernel), the ioctl data structures
-contain explicitly sized objects, using 64-bits for all size and pointer
-data and 32-bits for identifiers. In addition, the 64-bit objects are all
-carefully aligned on 64-bit boundaries. Because of this, all pointers in the
-ioctl data structures are passed as uint64_t values. Suitable casts will
-be necessary.
-
-One significant operation which is explicitly left out of this API is object
-locking. Applications are expected to perform locking of shared objects
-outside of the GEM api. This kind of locking is not necessary to safely
-manipulate the graphics engine, and with multiple objects interacting in
-unknown ways, per-object locking would likely introduce all kinds of
-lock-order issues. Punting this to the application seems like the only
-sensible plan. Given that DRM already offers a global lock on the hardware,
-this doesn't change the current situation.
-
-3. Object Creation and Destruction
-
-Gem provides explicit memory management primitives. System pages are
-allocated when the object is created, either as the fundemental storage for
-hardware where system memory is used by the graphics processor directly, or
-as backing store for graphics-processor resident memory.
-
-Objects are referenced from user space using handles. These are, for all
-intents and purposes, equivalent to file descriptors. We could simply use
-file descriptors were it not for the small limit (1024) of file descriptors
-available to applications, and for the fact that the X server (a rather
-significant user of this API) uses 'select' and has a limited maximum file
-descriptor for that operation. Given the ability to allocate more file
-descriptors, and given the ability to place these 'higher' in the file
-descriptor space, we'd love to simply use file descriptors.
-
-Objects may be published with a name so that other applications can access
-them. The name remains valid as long as the object exists. Right now, our
-DRI APIs use 32-bit integer names, so that's what we expose here
-
- A. Creation
-
- struct drm_gem_create {
- /**
- * Requested size for the object.
- *
- * The (page-aligned) allocated size for the object
- * will be returned.
- */
- uint64_t size;
- /**
- * Returned handle for the object.
- *
- * Object handles are nonzero.
- */
- uint32_t handle;
- uint32_t pad;
- };
-
- /* usage */
- create.size = 16384;
- ret = ioctl (fd, DRM_IOCTL_GEM_CREATE, &create);
- if (ret == 0)
- return create.handle;
-
- Note that the size is rounded up to a page boundary, and that
- the rounded-up size is returned in 'size'. No name is assigned to
- this object, making it local to this process.
-
- If insufficient memory is availabe, -ENOMEM will be returned.
-
- B. Closing
-
- struct drm_gem_close {
- /** Handle of the object to be closed. */
- uint32_t handle;
- uint32_t pad;
- };
-
-
- /* usage */
- close.handle = <handle>;
- ret = ioctl (fd, DRM_IOCTL_GEM_CLOSE, &close);
-
- This call makes the specified handle invalid, and if no other
- applications are using the object, any necessary graphics hardware
- synchronization is performed and the resources used by the object
- released.
-
- C. Naming
-
- struct drm_gem_flink {
- /** Handle for the object being named */
- uint32_t handle;
-
- /** Returned global name */
- uint32_t name;
- };
-
- /* usage */
- flink.handle = <handle>;
- ret = ioctl (fd, DRM_IOCTL_GEM_FLINK, &flink);
- if (ret == 0)
- return flink.name;
-
- Flink creates a name for the object and returns it to the
- application. This name can be used by other applications to gain
- access to the same object.
-
- D. Opening by name
-
- struct drm_gem_open {
- /** Name of object being opened */
- uint32_t name;
-
- /** Returned handle for the object */
- uint32_t handle;
-
- /** Returned size of the object */
- uint64_t size;
- };
-
- /* usage */
- open.name = <name>;
- ret = ioctl (fd, DRM_IOCTL_GEM_OPEN, &open);
- if (ret == 0) {
- *sizep = open.size;
- return open.handle;
- }
-
- Open accesses an existing object and returns a handle for it. If the
- object doesn't exist, -ENOENT is returned. The size of the object is
- also returned. This handle has all the same capabilities as the
- handle used to create the object. In particular, the object is not
- destroyed until all handles are closed.
-
-4. Basic read/write operations
-
-By default, gem objects are not mapped to the applications address space,
-getting data in and out of them is done with I/O operations instead. This
-allows the data to reside in otherwise unmapped pages, including pages in
-video memory on an attached discrete graphics card. In addition, using
-explicit I/O operations allows better control over cache contents, as
-graphics devices are generally not cache coherent with the CPU, mapping
-pages used for graphics into an application address space requires the use
-of expensive cache flushing operations. Providing direct control over
-graphics data access ensures that data are handled in the most efficient
-possible fashion.
-
- A. Reading
-
- struct drm_gem_pread {
- /** Handle for the object being read. */
- uint32_t handle;
- uint32_t pad;
- /** Offset into the object to read from */
- uint64_t offset;
- /** Length of data to read */
- uint64_t size;
- /** Pointer to write the data into. */
- uint64_t data_ptr; /* void * */
- };
-
- This copies data into the specified object at the specified
- position. Any necessary graphics device synchronization and
- flushing will be done automatically.
-
- struct drm_gem_pwrite {
- /** Handle for the object being written to. */
- uint32_t handle;
- uint32_t pad;
- /** Offset into the object to write to */
- uint64_t offset;
- /** Length of data to write */
- uint64_t size;
- /** Pointer to read the data from. */
- uint64_t data_ptr; /* void * */
- };
-
- This copies data out of the specified object into the
- waiting user memory. Again, device synchronization will
- be handled by the kernel to ensure user space sees a
- consistent view of the graphics device.
-
-5. Mapping objects to user space
-
-For most objects, reading/writing is the preferred interaction mode.
-However, when the CPU is involved in rendering to cover deficiencies in
-hardware support for particular operations, the CPU will want to directly
-access the relevant objects.
-
-Because mmap is fairly heavyweight, we allow applications to retain maps to
-objects persistently and then update how they're using the memory through a
-separate interface. Applications which fail to use this separate interface
-may exhibit unpredictable behaviour as memory consistency will not be
-preserved.
-
- A. Mapping
-
- struct drm_gem_mmap {
- /** Handle for the object being mapped. */
- uint32_t handle;
- uint32_t pad;
- /** Offset in the object to map. */
- uint64_t offset;
- /**
- * Length of data to map.
- *
- * The value will be page-aligned.
- */
- uint64_t size;
- /** Returned pointer the data was mapped at */
- uint64_t addr_ptr; /* void * */
- };
-
- /* usage */
- mmap.handle = <handle>;
- mmap.offset = <offset>;
- mmap.size = <size>;
- ret = ioctl (fd, DRM_IOCTL_GEM_MMAP, &mmap);
- if (ret == 0)
- return (void *) (uintptr_t) mmap.addr_ptr;
-
-
- B. Unmapping
-
- munmap (addr, length);
-
- Nothing strange here, just use the normal munmap syscall.
-
-6. Memory Domains
-
-Graphics devices remain a strong bastion of non cache-coherent memory. As a
-result, accessing data through one functional unit will end up loading that
-cache with data which then needs to be manually synchronized when that data
-is used with another functional unit.
-
-Tracking where data are resident is done by identifying how functional units
-deal with caches. Each cache is labeled as a separate memory domain. Then,
-each sequence of operations is expected to load data into various read
-domains and leave data in at most one write domain. Gem tracks the read and
-write memory domains of each object and performs the necessary
-synchronization operations when objects move from one domain set to another.
-
-For example, if operation 'A' constructs an image that is immediately used
-by operation 'B', then when the read domain for 'B' is not the same as the
-write domain for 'A', then the write domain must be flushed, and the read
-domain invalidated. If these two operations are both executed in the same
-command queue, then the flush operation can go inbetween them in the same
-queue, avoiding any kind of CPU-based synchronization and leaving the GPU to
-do the work itself.
-
-6.1 Memory Domains (GPU-independent)
-
- * DRM_GEM_DOMAIN_CPU.
-
- Objects in this domain are using caches which are connected to the CPU.
- Moving objects from non-CPU domains into the CPU domain can involve waiting
- for the GPU to finish with operations using this object. Moving objects
- from this domain to a GPU domain can involve flushing CPU caches and chipset
- buffers.
-
-6.1 GPU-independent memory domain ioctl
-
-This ioctl is independent of the GPU in use. So far, no use other than
-synchronizing objects to the CPU domain have been found; if that turns out
-to be generally true, this ioctl may be simplified further.
-
- A. Explicit domain control
-
- struct drm_gem_set_domain {
- /** Handle for the object */
- uint32_t handle;
-
- /** New read domains */
- uint32_t read_domains;
-
- /** New write domain */
- uint32_t write_domain;
- };
-
- /* usage */
- set_domain.handle = <handle>;
- set_domain.read_domains = <read_domains>;
- set_domain.write_domain = <write_domain>;
- ret = ioctl (fd, DRM_IOCTL_GEM_SET_DOMAIN, &set_domain);
-
- When the application wants to explicitly manage memory domains for
- an object, it can use this function. Usually, this is only used
- when the application wants to synchronize object contents between
- the GPU and CPU-based application rendering. In that case,
- the <read_domains> would be set to DRM_GEM_DOMAIN_CPU, and if the
- application were going to write to the object, the <write_domain>
- would also be set to DRM_GEM_DOMAIN_CPU. After the call, gem
- guarantees that all previous rendering operations involving this
- object are complete. The application is then free to access the
- object through the address returned by the mmap call. Afterwards,
- when the application again uses the object through the GPU, any
- necessary CPU flushing will occur and the object will be correctly
- synchronized with the GPU.
-
- Note that this synchronization is not required for any accesses
- going through the driver itself. The pread, pwrite and execbuffer
- ioctls all perform the necessary domain management internally.
- Explicit synchronization is only necessary when accessing the object
- through the mmap'd address.
-
-7. Execution (Intel specific)
-
-Managing the command buffers is inherently chip-specific, so the core of gem
-doesn't have any intrinsic functions. Rather, execution is left to the
-device-specific portions of the driver.
-
-The Intel DRM_I915_GEM_EXECBUFFER ioctl takes a list of gem objects, all of
-which are mapped to the graphics device. The last object in the list is the
-command buffer.
-
-7.1. Relocations
-
-Command buffers often refer to other objects, and to allow the kernel driver
-to move objects around, a sequence of relocations is associated with each
-object. Device-specific relocation operations are used to place the
-target-object relative value into the object.
-
-The Intel driver has a single relocation type:
-
- struct drm_i915_gem_relocation_entry {
- /**
- * Handle of the buffer being pointed to by this
- * relocation entry.
- *
- * It's appealing to make this be an index into the
- * mm_validate_entry list to refer to the buffer,
- * but this allows the driver to create a relocation
- * list for state buffers and not re-write it per
- * exec using the buffer.
- */
- uint32_t target_handle;
-
- /**
- * Value to be added to the offset of the target
- * buffer to make up the relocation entry.
- */
- uint32_t delta;
-
- /**
- * Offset in the buffer the relocation entry will be
- * written into
- */
- uint64_t offset;
-
- /**
- * Offset value of the target buffer that the
- * relocation entry was last written as.
- *
- * If the buffer has the same offset as last time, we
- * can skip syncing and writing the relocation. This
- * value is written back out by the execbuffer ioctl
- * when the relocation is written.
- */
- uint64_t presumed_offset;
-
- /**
- * Target memory domains read by this operation.
- */
- uint32_t read_domains;
-
- /*
- * Target memory domains written by this operation.
- *
- * Note that only one domain may be written by the
- * whole execbuffer operation, so that where there are
- * conflicts, the application will get -EINVAL back.
- */
- uint32_t write_domain;
- };
-
- 'target_handle', the handle to the target object. This object must
- be one of the objects listed in the execbuffer request or
- bad things will happen. The kernel doesn't check for this.
-
- 'offset' is where, in the source object, the relocation data
- are written. Each relocation value is a 32-bit value consisting
- of the location of the target object in the GPU memory space plus
- the 'delta' value included in the relocation.
-
- 'presumed_offset' is where user-space believes the target object
- lies in GPU memory space. If this value matches where the object
- actually is, then no relocation data are written, the kernel
- assumes that user space has set up data in the source object
- using this presumption. This offers a fairly important optimization
- as writing relocation data requires mapping of the source object
- into the kernel memory space.
-
- 'read_domains' and 'write_domains' list the usage by the source
- object of the target object. The kernel unions all of the domain
- information from all relocations in the execbuffer request. No more
- than one write_domain is allowed, otherwise an EINVAL error is
- returned. read_domains must contain write_domain. This domain
- information is used to synchronize buffer contents as described
- above in the section on domains.
-
-7.1.1 Memory Domains (Intel specific)
-
-The Intel GPU has several internal caches which are not coherent and hence
-require explicit synchronization. Memory domains provide the necessary data
-to synchronize what is needed while leaving other cache contents intact.
-
- * DRM_GEM_DOMAIN_I915_RENDER.
- The GPU 3D and 2D rendering operations use a unified rendering cache, so
- operations doing 3D painting and 2D blts will use this domain
-
- * DRM_GEM_DOMAIN_I915_SAMPLER
- Textures are loaded by the sampler through a separate cache, so
- any texture reading will use this domain. Note that the sampler
- and renderer use different caches, so moving an object from render target
- to texture source will require a domain transfer.
-
- * DRM_GEM_DOMAIN_I915_COMMAND
- The command buffer doesn't have an explicit cache (although it does
- read ahead quite a bit), so this domain just indicates that the object
- needs to be flushed to the GPU.
-
- * DRM_GEM_DOMAIN_I915_INSTRUCTION
- All of the programs on Gen4 and later chips use an instruction cache to
- speed program execution. It must be explicitly flushed when new programs
- are written to memory by the CPU.
-
- * DRM_GEM_DOMAIN_I915_VERTEX
- Vertex data uses two different vertex caches, but they're
- both flushed with the same instruction.
-
-7.2 Execution object list (Intel specific)
-
- struct drm_i915_gem_exec_object {
- /**
- * User's handle for a buffer to be bound into the GTT
- * for this operation.
- */
- uint32_t handle;
-
- /**
- * List of relocations to be performed on this buffer
- */
- uint32_t relocation_count;
- /* struct drm_i915_gem_relocation_entry *relocs */
- uint64_t relocs_ptr;
-
- /**
- * Required alignment in graphics aperture
- */
- uint64_t alignment;
-
- /**
- * Returned value of the updated offset of the object,
- * for future presumed_offset writes.
- */
- uint64_t offset;
- };
-
- Each object involved in a particular execution operation must be
- listed using one of these structures.
-
- 'handle' references the object.
-
- 'relocs_ptr' is a user-mode pointer to a array of 'relocation_count'
- drm_i915_gem_relocation_entry structs (see above) that
- define the relocations necessary in this buffer. Note that all
- relocations must reference other exec_object structures in the same
- execbuffer ioctl and that those other buffers must come earlier in
- the exec_object array. In other words, the dependencies mapped by the
- exec_object relocations must form a directed acyclic graph.
-
- 'alignment' is the byte alignment necessary for this buffer. Each
- object has specific alignment requirements, as the kernel doesn't
- know what each object is being used for, those requirements must be
- provided by user mode. If an object is used in two different ways,
- it's quite possible that the alignment requirements will differ.
-
- 'offset' is a return value, receiving the location of the object
- during this execbuffer operation. The application should use this
- as the presumed offset in future operations; if the object does not
- move, then kernel need not write relocation data.
-
-7.3 Execbuffer ioctl (Intel specific)
-
- struct drm_i915_gem_execbuffer {
- /**
- * List of buffers to be validated with their
- * relocations to be performend on them.
- *
- * These buffers must be listed in an order such that
- * all relocations a buffer is performing refer to
- * buffers that have already appeared in the validate
- * list.
- */
- /* struct drm_i915_gem_validate_entry *buffers */
- uint64_t buffers_ptr;
- uint32_t buffer_count;
-
- /**
- * Offset in the batchbuffer to start execution from.
- */
- uint32_t batch_start_offset;
-
- /**
- * Bytes used in batchbuffer from batch_start_offset
- */
- uint32_t batch_len;
- uint32_t DR1;
- uint32_t DR4;
- uint32_t num_cliprects;
- uint64_t cliprects_ptr; /* struct drm_clip_rect *cliprects */
- };
-
-
- 'buffers_ptr' is a user-mode pointer to an array of 'buffer_count'
- drm_i915_gem_exec_object structures which contains the complete set
- of objects required for this execbuffer operation. The last entry in
- this array, the 'batch buffer', is the buffer of commands which will
- be linked to the ring and executed.
-
- 'batch_start_offset' is the byte offset within the batch buffer which
- contains the first command to execute. So far, we haven't found a
- reason to use anything other than '0' here, but the thought was that
- some space might be allocated for additional initialization which
- could be skipped in some cases. This must be a multiple of 4.
-
- 'batch_len' is the length, in bytes, of the data to be executed
- (i.e., the amount of data after batch_start_offset). This must
- be a multiple of 4.
-
- 'num_cliprects' and 'cliprects_ptr' reference an array of
- drm_clip_rect structures that is num_cliprects long. The entire
- batch buffer will be executed multiple times, once for each
- rectangle in this list. If num_cliprects is 0, then no clipping
- rectangle will be set.
-
- 'DR1' and 'DR4' are portions of the 3DSTATE_DRAWING_RECTANGLE
- command which will be queued when this operation is clipped
- (num_cliprects != 0).
-
- DR1 bit definition
- 31 Fast Scissor Clip Disable (debug only).
- Disables a hardware optimization that
- improves performance. This should have
- no visible effect, other than reducing
- performance
-
- 30 Depth Buffer Coordinate Offset Disable.
- This disables the addition of the
- depth buffer offset bits which are used
- to change the location of the depth buffer
- relative to the front buffer.
-
- 27:26 X Dither Offset. Specifies the X pixel
- offset to use when accessing the dither table
-
- 25:24 Y Dither Offset. Specifies the Y pixel
- offset to use when accessing the dither
- table.
-
- DR4 bit definition
- 31:16 Drawing Rectangle Origin Y. Specifies the Y
- origin of coordinates relative to the
- draw buffer.
-
- 15:0 Drawing Rectangle Origin X. Specifies the X
- origin of coordinates relative to the
- draw buffer.
-
- As you can see, these two fields are necessary for correctly
- offsetting drawing within a buffer which contains multiple surfaces.
- Note that DR1 is only used on Gen3 and earlier hardware and that
- newer hardware sticks the dither offset elsewhere.
-
-7.3.1 Detailed Execution Description
-
- Execution of a single batch buffer requires several preparatory
- steps to make the objects visible to the graphics engine and resolve
- relocations to account for their current addresses.
-
- A. Mapping and Relocation
-
- Each exec_object structure in the array is examined in turn.
-
- If the object is not already bound to the GTT, it is assigned a
- location in the graphics address space. If no space is available in
- the GTT, some other object will be evicted. This may require waiting
- for previous execbuffer requests to complete before that object can
- be unmapped. With the location assigned, the pages for the object
- are pinned in memory using find_or_create_page and the GTT entries
- updated to point at the relevant pages using drm_agp_bind_pages.
-
- Then the array of relocations is traversed. Each relocation record
- looks up the target object and, if the presumed offset does not
- match the current offset (remember that this buffer has already been
- assigned an address as it must have been mapped earlier), the
- relocation value is computed using the current offset. If the
- object is currently in use by the graphics engine, writing the data
- out must be preceeded by a delay while the object is still busy.
- Once it is idle, then the page containing the relocation is mapped
- by the CPU and the updated relocation data written out.
-
- The read_domains and write_domain entries in each relocation are
- used to compute the new read_domains and write_domain values for the
- target buffers. The actual execution of the domain changes must wait
- until all of the exec_object entries have been evaluated as the
- complete set of domain information will not be available until then.
-
- B. Memory Domain Resolution
-
- After all of the new memory domain data has been pulled out of the
- relocations and computed for each object, the list of objects is
- again traversed and the new memory domains compared against the
- current memory domains. There are two basic operations involved here:
-
- * Flushing the current write domain. If the new read domains
- are not equal to the current write domain, then the current
- write domain must be flushed. Otherwise, reads will not see data
- present in the write domain cache. In addition, any new read domains
- other than the current write domain must be invalidated to ensure
- that the flushed data are re-read into their caches.
-
- * Invaliding new read domains. Any domains which were not currently
- used for this object must be invalidated as old objects which
- were mapped at the same location may have stale data in the new
- domain caches.
-
- If the CPU cache is being invalidated and some GPU cache is being
- flushed, then we'll have to wait for rendering to complete so that
- any pending GPU writes will be complete before we flush the GPU
- cache.
-
- If the CPU cache is being flushed, then we use 'clflush' to get data
- written from the CPU.
-
- Because the GPU caches cannot be partially flushed or invalidated,
- we don't actually flush them during this traversal stage. Rather, we
- gather the invalidate and flush bits up in the device structure.
-
- Once all of the object domain changes have been evaluated, then the
- gathered invalidate and flush bits are examined. For any GPU flush
- operations, we emit a single MI_FLUSH command that performs all of
- the necessary flushes. We then look to see if the CPU cache was
- flushed. If so, we use the chipset flush magic (writing to a special
- page) to get the data out of the chipset and into memory.
-
- C. Queuing Batch Buffer to the Ring
-
- With all of the objects resident in graphics memory space, and all
- of the caches prepared with appropriate data, the batch buffer
- object can be queued to the ring. If there are clip rectangles, then
- the buffer is queued once per rectangle, with suitable clipping
- inserted into the ring just before the batch buffer.
-
- D. Creating an IRQ Cookie
-
- Right after the batch buffer is placed in the ring, a request to
- generate an IRQ is added to the ring along with a command to write a
- marker into memory. When the IRQ fires, the driver can look at the
- memory location to see where in the ring the GPU has passed. This
- magic cookie value is stored in each object used in this execbuffer
- command; it is used whereever you saw 'wait for rendering' above in
- this document.
-
- E. Writing back the new object offsets
-
- So that the application has a better idea what to use for
- 'presumed_offset' values later, the current object offsets are
- written back to the exec_object structures.
-
-
-8. Other misc Intel-specific functions.
-
-To complete the driver, a few other functions were necessary.
-
-8.1 Initialization from the X server
-
-As the X server is currently responsible for apportioning memory between 2D
-and 3D, it must tell the kernel which region of the GTT aperture is
-available for 3D objects to be mapped into.
-
- struct drm_i915_gem_init {
- /**
- * Beginning offset in the GTT to be managed by the
- * DRM memory manager.
- */
- uint64_t gtt_start;
- /**
- * Ending offset in the GTT to be managed by the DRM
- * memory manager.
- */
- uint64_t gtt_end;
- };
- /* usage */
- init.gtt_start = <gtt_start>;
- init.gtt_end = <gtt_end>;
- ret = ioctl (fd, DRM_IOCTL_I915_GEM_INIT, &init);
-
- The GTT aperture between gtt_start and gtt_end will be used to map
- objects. This also tells the kernel that the ring can be used,
- pulling the ring addresses from the device registers.
-
-8.2 Pinning objects in the GTT
-
-For scan-out buffers and the current shared depth and back buffers, we need
-to have them always available in the GTT, at least for now. Pinning means to
-lock their pages in memory along with keeping them at a fixed offset in the
-graphics aperture. These operations are available only to root.
-
- struct drm_i915_gem_pin {
- /** Handle of the buffer to be pinned. */
- uint32_t handle;
- uint32_t pad;
-
- /** alignment required within the aperture */
- uint64_t alignment;
-
- /** Returned GTT offset of the buffer. */
- uint64_t offset;
- };
-
- /* usage */
- pin.handle = <handle>;
- pin.alignment = <alignment>;
- ret = ioctl (fd, DRM_IOCTL_I915_GEM_PIN, &pin);
- if (ret == 0)
- return pin.offset;
-
- Pinning an object ensures that it will not be evicted from the GTT
- or moved. It will stay resident until destroyed or unpinned.
-
- struct drm_i915_gem_unpin {
- /** Handle of the buffer to be unpinned. */
- uint32_t handle;
- uint32_t pad;
- };
-
- /* usage */
- unpin.handle = <handle>;
- ret = ioctl (fd, DRM_IOCTL_I915_GEM_UNPIN, &unpin);
-
- Unpinning an object makes it possible to evict this object from the
- GTT. It doesn't ensure that it will be evicted, just that it may.
-
diff --git a/linux-core/drm.h b/linux-core/drm.h
deleted file mode 120000
index 29636692..00000000
--- a/linux-core/drm.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/drm.h \ No newline at end of file
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
deleted file mode 100644
index 9b4b071c..00000000
--- a/linux-core/drmP.h
+++ /dev/null
@@ -1,1480 +0,0 @@
-/**
- * \file drmP.h
- * Private header for Direct Rendering Manager
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_P_H_
-#define _DRM_P_H_
-
-#ifdef __KERNEL__
-#ifdef __alpha__
-/* add include of current.h so that "current" is defined
- * before static inline funcs in wait.h. Doing this so we
- * can build the DRM (part of PI DRI). 4/21/2000 S + B */
-#include <asm/current.h>
-#endif /* __alpha__ */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/miscdevice.h>
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <linux/init.h>
-#include <linux/file.h>
-#include <linux/pci.h>
-#include <linux/version.h>
-#include <linux/sched.h>
-#include <linux/smp_lock.h> /* For (un)lock_kernel */
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/kref.h>
-#include <linux/pagemap.h>
-#include <linux/mutex.h>
-#if defined(__alpha__) || defined(__powerpc__)
-#include <asm/pgtable.h> /* For pte_wrprotect */
-#endif
-#include <asm/io.h>
-#include <asm/mman.h>
-#include <asm/uaccess.h>
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-#include <asm/agp.h>
-#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
-#include <linux/types.h>
-#include <linux/agp_backend.h>
-#endif
-#include <linux/workqueue.h>
-#include <linux/poll.h>
-#include <asm/pgalloc.h>
-#include "drm.h"
-#include <linux/slab.h>
-#include <linux/idr.h>
-
-#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
-
-#include "drm_os_linux.h"
-#include "drm_hashtab.h"
-#include "drm_internal.h"
-
-struct drm_device;
-struct drm_file;
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-typedef unsigned long uintptr_t;
-#endif
-
-/* If you want the memory alloc debug functionality, change define below */
-/* #define DEBUG_MEMORY */
-
-/***********************************************************************/
-/** \name DRM template customization defaults */
-/*@{*/
-
-/* driver capabilities and requirements mask */
-#define DRIVER_USE_AGP 0x1
-#define DRIVER_REQUIRE_AGP 0x2
-#define DRIVER_USE_MTRR 0x4
-#define DRIVER_PCI_DMA 0x8
-#define DRIVER_SG 0x10
-#define DRIVER_HAVE_DMA 0x20
-#define DRIVER_HAVE_IRQ 0x40
-#define DRIVER_IRQ_SHARED 0x80
-#define DRIVER_DMA_QUEUE 0x100
-#define DRIVER_FB_DMA 0x200
-#define DRIVER_GEM 0x400
-
-/*@}*/
-
-/***********************************************************************/
-/** \name Begin the DRM... */
-/*@{*/
-
-#define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then
- also include looping detection. */
-
-#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
-#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
-#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
-#define DRM_LOOPING_LIMIT 5000000
-#define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */
-#define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */
-
-#define DRM_FLAG_DEBUG 0x01
-
-#define DRM_MEM_DMA 0
-#define DRM_MEM_SAREA 1
-#define DRM_MEM_DRIVER 2
-#define DRM_MEM_MAGIC 3
-#define DRM_MEM_IOCTLS 4
-#define DRM_MEM_MAPS 5
-#define DRM_MEM_VMAS 6
-#define DRM_MEM_BUFS 7
-#define DRM_MEM_SEGS 8
-#define DRM_MEM_PAGES 9
-#define DRM_MEM_FILES 10
-#define DRM_MEM_QUEUES 11
-#define DRM_MEM_CMDS 12
-#define DRM_MEM_MAPPINGS 13
-#define DRM_MEM_BUFLISTS 14
-#define DRM_MEM_AGPLISTS 15
-#define DRM_MEM_TOTALAGP 16
-#define DRM_MEM_BOUNDAGP 17
-#define DRM_MEM_CTXBITMAP 18
-#define DRM_MEM_STUB 19
-#define DRM_MEM_SGLISTS 20
-#define DRM_MEM_CTXLIST 21
-#define DRM_MEM_MM 22
-#define DRM_MEM_HASHTAB 23
-#define DRM_MEM_OBJECTS 24
-#define DRM_MEM_BUFOBJ 27
-
-#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
-#define DRM_MAP_HASH_OFFSET 0x10000000
-#define DRM_MAP_HASH_ORDER 12
-#define DRM_OBJECT_HASH_ORDER 12
-#define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1)
-#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 16)
-/*
- * This should be small enough to allow the use of kmalloc for hash tables
- * instead of vmalloc.
- */
-
-#define DRM_FILE_HASH_ORDER 8
-#define DRM_MM_INIT_MAX_PAGES 256
-
-/*@}*/
-
-#include "drm_compat.h"
-
-/***********************************************************************/
-/** \name Macros to make printk easier */
-/*@{*/
-
-/**
- * Error output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_ERROR(fmt, arg...) \
- printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __FUNCTION__ , ##arg)
-
-/**
- * Memory error output.
- *
- * \param area memory area where the error occurred.
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#define DRM_MEM_ERROR(area, fmt, arg...) \
- printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \
- drm_mem_stats[area].name , ##arg)
-#define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
-
-/**
- * Debug output.
- *
- * \param fmt printf() like format string.
- * \param arg arguments
- */
-#if DRM_DEBUG_CODE
-#define DRM_DEBUG(fmt, arg...) \
- do { \
- if ( drm_debug ) \
- printk(KERN_DEBUG \
- "[" DRM_NAME ":%s] " fmt , \
- __FUNCTION__ , ##arg); \
- } while (0)
-#else
-#define DRM_DEBUG(fmt, arg...) do { } while (0)
-#endif
-
-#define DRM_PROC_LIMIT (PAGE_SIZE-80)
-
-#define DRM_PROC_PRINT(fmt, arg...) \
- len += sprintf(&buf[len], fmt , ##arg); \
- if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; }
-
-#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
- len += sprintf(&buf[len], fmt , ##arg); \
- if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; }
-
-/*@}*/
-
-/***********************************************************************/
-/** \name Internal types and structures */
-/*@{*/
-
-#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
-#define DRM_MIN(a,b) min(a,b)
-#define DRM_MAX(a,b) max(a,b)
-
-#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
-#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
-#define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
-
-#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
-/**
- * Get the private SAREA mapping.
- *
- * \param _dev DRM device.
- * \param _ctx context number.
- * \param _map output mapping.
- */
-#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
- (_map) = (_dev)->context_sareas[_ctx]; \
-} while(0)
-
-/**
- * Test that the hardware lock is held by the caller, returning otherwise.
- *
- * \param dev DRM device.
- * \param file_priv DRM file private pointer of the caller.
- */
-#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \
-do { \
- if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
- dev->lock.file_priv != file_priv ) { \
- DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
- __FUNCTION__, _DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ),\
- dev->lock.file_priv, file_priv ); \
- return -EINVAL; \
- } \
-} while (0)
-
-/**
- * Copy and IOCTL return string to user space
- */
-#define DRM_COPY( name, value ) \
- len = strlen( value ); \
- if ( len > name##_len ) len = name##_len; \
- name##_len = strlen( value ); \
- if ( len && name ) { \
- if ( copy_to_user( name, value, len ) ) \
- return -EFAULT; \
- }
-
-/**
- * Ioctl function type.
- *
- * \param dev DRM device structure
- * \param data pointer to kernel-space stored data, copied in and out according
- * to ioctl description.
- * \param file_priv DRM file private pointer.
- */
-typedef int drm_ioctl_t(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
- unsigned long arg);
-
-#define DRM_AUTH 0x1
-#define DRM_MASTER 0x2
-#define DRM_ROOT_ONLY 0x4
-
-struct drm_ioctl_desc {
- unsigned int cmd;
- drm_ioctl_t *func;
- int flags;
-};
-/**
- * Creates a driver or general drm_ioctl_desc array entry for the given
- * ioctl, for use by drm_ioctl().
- */
-#define DRM_IOCTL_DEF(ioctl, func, flags) \
- [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
-
-struct drm_magic_entry {
- struct list_head head;
- struct drm_hash_item hash_item;
- struct drm_file *priv;
-};
-
-struct drm_vma_entry {
- struct list_head head;
- struct vm_area_struct *vma;
- pid_t pid;
-};
-
-/**
- * DMA buffer.
- */
-struct drm_buf {
- int idx; /**< Index into master buflist */
- int total; /**< Buffer size */
- int order; /**< log-base-2(total) */
- int used; /**< Amount of buffer in use (for DMA) */
- unsigned long offset; /**< Byte offset (used internally) */
- void *address; /**< Address of buffer */
- unsigned long bus_address; /**< Bus address of buffer */
- struct drm_buf *next; /**< Kernel-only: used for free list */
- __volatile__ int waiting; /**< On kernel DMA queue */
- __volatile__ int pending; /**< On hardware DMA queue */
- wait_queue_head_t dma_wait; /**< Processes waiting */
- struct drm_file *file_priv; /**< Private of holding file descr */
- int context; /**< Kernel queue for this buffer */
- int while_locked; /**< Dispatch this buffer while locked */
- enum {
- DRM_LIST_NONE = 0,
- DRM_LIST_FREE = 1,
- DRM_LIST_WAIT = 2,
- DRM_LIST_PEND = 3,
- DRM_LIST_PRIO = 4,
- DRM_LIST_RECLAIM = 5
- } list; /**< Which list we're on */
-
- int dev_priv_size; /**< Size of buffer private storage */
- void *dev_private; /**< Per-buffer private storage */
-};
-
-/** bufs is one longer than it has to be */
-struct drm_waitlist {
- int count; /**< Number of possible buffers */
- struct drm_buf **bufs; /**< List of pointers to buffers */
- struct drm_buf **rp; /**< Read pointer */
- struct drm_buf **wp; /**< Write pointer */
- struct drm_buf **end; /**< End pointer */
- spinlock_t read_lock;
- spinlock_t write_lock;
-};
-
-struct drm_freelist {
- int initialized; /**< Freelist in use */
- atomic_t count; /**< Number of free buffers */
- struct drm_buf *next; /**< End pointer */
-
- wait_queue_head_t waiting; /**< Processes waiting on free bufs */
- int low_mark; /**< Low water mark */
- int high_mark; /**< High water mark */
- atomic_t wfh; /**< If waiting for high mark */
- spinlock_t lock;
-};
-
-typedef struct drm_dma_handle {
- dma_addr_t busaddr;
- void *vaddr;
- size_t size;
-} drm_dma_handle_t;
-
-/**
- * Buffer entry. There is one of this for each buffer size order.
- */
-struct drm_buf_entry {
- int buf_size; /**< size */
- int buf_count; /**< number of buffers */
- struct drm_buf *buflist; /**< buffer list */
- int seg_count;
- int page_order;
- struct drm_dma_handle **seglist;
- struct drm_freelist freelist;
-};
-
-
-enum drm_ref_type {
- _DRM_REF_USE = 0,
- _DRM_REF_TYPE1,
- _DRM_NO_REF_TYPES
-};
-
-
-/** File private data */
-struct drm_file {
- int authenticated;
- int master;
- pid_t pid;
- uid_t uid;
- drm_magic_t magic;
- unsigned long ioctl_count;
- struct list_head lhead;
- struct drm_minor *minor;
- int remove_auth_on_close;
- unsigned long lock_count;
-
- /*
- * The user object hash table is global and resides in the
- * drm_device structure. We protect the lists and hash tables with the
- * device struct_mutex. A bit coarse-grained but probably the best
- * option.
- */
-
- struct list_head refd_objects;
-
- /** Mapping of mm object handles to object pointers. */
- struct idr object_idr;
- /** Lock for synchronization of access to object_idr. */
- spinlock_t table_lock;
-
- struct drm_open_hash refd_object_hash[_DRM_NO_REF_TYPES];
- struct file *filp;
- void *driver_priv;
-};
-
-/** Wait queue */
-struct drm_queue {
- atomic_t use_count; /**< Outstanding uses (+1) */
- atomic_t finalization; /**< Finalization in progress */
- atomic_t block_count; /**< Count of processes waiting */
- atomic_t block_read; /**< Queue blocked for reads */
- wait_queue_head_t read_queue; /**< Processes waiting on block_read */
- atomic_t block_write; /**< Queue blocked for writes */
- wait_queue_head_t write_queue; /**< Processes waiting on block_write */
-#if 1
- atomic_t total_queued; /**< Total queued statistic */
- atomic_t total_flushed; /**< Total flushes statistic */
- atomic_t total_locks; /**< Total locks statistics */
-#endif
- enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
- struct drm_waitlist waitlist; /**< Pending buffers */
- wait_queue_head_t flush_queue; /**< Processes waiting until flush */
-};
-
-/**
- * Lock data.
- */
-struct drm_lock_data {
- struct drm_hw_lock *hw_lock; /**< Hardware lock */
- /** Private of lock holder's file (NULL=kernel) */
- struct drm_file *file_priv;
- wait_queue_head_t lock_queue; /**< Queue of blocked processes */
- unsigned long lock_time; /**< Time of last lock in jiffies */
- spinlock_t spinlock;
- uint32_t kernel_waiters;
- uint32_t user_waiters;
- int idle_has_lock;
-};
-
-/**
- * DMA data.
- */
-struct drm_device_dma {
-
- struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
- int buf_count; /**< total number of buffers */
- struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */
- int seg_count;
- int page_count; /**< number of pages */
- unsigned long *pagelist; /**< page list */
- unsigned long byte_count;
- enum {
- _DRM_DMA_USE_AGP = 0x01,
- _DRM_DMA_USE_SG = 0x02,
- _DRM_DMA_USE_FB = 0x04,
- _DRM_DMA_USE_PCI_RO = 0x08
- } flags;
-
-};
-
-/**
- * AGP memory entry. Stored as a doubly linked list.
- */
-struct drm_agp_mem {
- unsigned long handle; /**< handle */
- DRM_AGP_MEM *memory;
- unsigned long bound; /**< address */
- int pages;
- struct list_head head;
-};
-
-/**
- * AGP data.
- *
- * \sa drm_agp_init() and drm_device::agp.
- */
-struct drm_agp_head {
- DRM_AGP_KERN agp_info; /**< AGP device information */
- struct list_head memory;
- unsigned long mode; /**< AGP mode */
- struct agp_bridge_data *bridge;
- int enabled; /**< whether the AGP bus as been enabled */
- int acquired; /**< whether the AGP device has been acquired */
- unsigned long base;
- int agp_mtrr;
- int cant_use_aperture;
- unsigned long page_mask;
-};
-
-/**
- * Scatter-gather memory.
- */
-struct drm_sg_mem {
- unsigned long handle;
- void *virtual;
- int pages;
- struct page **pagelist;
- dma_addr_t *busaddr;
-};
-
-struct drm_sigdata {
- int context;
- struct drm_hw_lock *lock;
-};
-
-
-/*
- * Generic memory manager structs
- */
-
-struct drm_mm_node {
- struct list_head fl_entry;
- struct list_head ml_entry;
- int free;
- unsigned long start;
- unsigned long size;
- struct drm_mm *mm;
- void *private;
-};
-
-struct drm_mm {
- struct list_head fl_entry;
- struct list_head ml_entry;
-};
-
-
-/**
- * Mappings list
- */
-struct drm_map_list {
- struct list_head head; /**< list head */
- struct drm_hash_item hash;
- struct drm_map *map; /**< mapping */
- uint64_t user_token;
- struct drm_mm_node *file_offset_node;
-};
-
-typedef struct drm_map drm_local_map_t;
-
-/**
- * Context handle list
- */
-struct drm_ctx_list {
- struct list_head head; /**< list head */
- drm_context_t handle; /**< context handle */
- struct drm_file *tag; /**< associated fd private data */
-};
-
-struct drm_vbl_sig {
- struct list_head head;
- unsigned int sequence;
- struct siginfo info;
- struct task_struct *task;
-};
-
-/* location of GART table */
-#define DRM_ATI_GART_MAIN 1
-#define DRM_ATI_GART_FB 2
-
-#define DRM_ATI_GART_PCI 1
-#define DRM_ATI_GART_PCIE 2
-#define DRM_ATI_GART_IGP 3
-
-struct drm_ati_pcigart_info {
- int gart_table_location;
- int gart_reg_if;
- void *addr;
- dma_addr_t bus_addr;
- dma_addr_t table_mask;
- dma_addr_t member_mask;
- struct drm_dma_handle *table_handle;
- drm_local_map_t mapping;
- int table_size;
-};
-
-/**
- * This structure defines the drm_mm memory object, which will be used by the
- * DRM for its buffer objects.
- */
-struct drm_gem_object {
- /** Reference count of this object */
- struct kref refcount;
-
- /** Handle count of this object. Each handle also holds a reference */
- struct kref handlecount;
-
- /** Related drm device */
- struct drm_device *dev;
-
- /** File representing the shmem storage */
- struct file *filp;
-
- /**
- * Size of the object, in bytes. Immutable over the object's
- * lifetime.
- */
- size_t size;
-
- /**
- * Global name for this object, starts at 1. 0 means unnamed.
- * Access is covered by the object_name_lock in the related drm_device
- */
- int name;
-
- /**
- * Memory domains. These monitor which caches contain read/write data
- * related to the object. When transitioning from one set of domains
- * to another, the driver is called to ensure that caches are suitably
- * flushed and invalidated
- */
- uint32_t read_domains;
- uint32_t write_domain;
-
- /**
- * While validating an exec operation, the
- * new read/write domain values are computed here.
- * They will be transferred to the above values
- * at the point that any cache flushing occurs
- */
- uint32_t pending_read_domains;
- uint32_t pending_write_domain;
-
- void *driver_private;
-};
-
-/**
- * DRM driver structure. This structure represent the common code for
- * a family of cards. There will one drm_device for each card present
- * in this family
- */
-
-struct drm_driver {
- int (*load) (struct drm_device *, unsigned long flags);
- int (*firstopen) (struct drm_device *);
- int (*open) (struct drm_device *, struct drm_file *);
- void (*preclose) (struct drm_device *, struct drm_file *file_priv);
- void (*postclose) (struct drm_device *, struct drm_file *);
- void (*lastclose) (struct drm_device *);
- int (*unload) (struct drm_device *);
- int (*suspend) (struct drm_device *, pm_message_t state);
- int (*resume) (struct drm_device *);
- int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
- void (*dma_ready) (struct drm_device *);
- int (*dma_quiescent) (struct drm_device *);
- int (*context_ctor) (struct drm_device *dev, int context);
- int (*context_dtor) (struct drm_device *dev, int context);
- int (*kernel_context_switch) (struct drm_device *dev, int old,
- int new);
- void (*kernel_context_switch_unlock) (struct drm_device * dev);
- /**
- * get_vblank_counter - get raw hardware vblank counter
- * @dev: DRM device
- * @crtc: counter to fetch
- *
- * Driver callback for fetching a raw hardware vblank counter
- * for @crtc. If a device doesn't have a hardware counter, the
- * driver can simply return the value of drm_vblank_count and
- * make the enable_vblank() and disable_vblank() hooks into no-ops,
- * leaving interrupts enabled at all times.
- *
- * Wraparound handling and loss of events due to modesetting is dealt
- * with in the DRM core code.
- *
- * RETURNS
- * Raw vblank counter value.
- */
- u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);
-
- /**
- * enable_vblank - enable vblank interrupt events
- * @dev: DRM device
- * @crtc: which irq to enable
- *
- * Enable vblank interrupts for @crtc. If the device doesn't have
- * a hardware vblank counter, this routine should be a no-op, since
- * interrupts will have to stay on to keep the count accurate.
- *
- * RETURNS
- * Zero on success, appropriate errno if the given @crtc's vblank
- * interrupt cannot be enabled.
- */
- int (*enable_vblank) (struct drm_device *dev, int crtc);
-
- /**
- * disable_vblank - disable vblank interrupt events
- * @dev: DRM device
- * @crtc: which irq to enable
- *
- * Disable vblank interrupts for @crtc. If the device doesn't have
- * a hardware vblank counter, this routine should be a no-op, since
- * interrupts will have to stay on to keep the count accurate.
- */
- void (*disable_vblank) (struct drm_device *dev, int crtc);
- int (*dri_library_name) (struct drm_device *dev, char * buf);
-
- /**
- * Called by \c drm_device_is_agp. Typically used to determine if a
- * card is really attached to AGP or not.
- *
- * \param dev DRM device handle
- *
- * \returns
- * One of three values is returned depending on whether or not the
- * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
- * (return of 1), or may or may not be AGP (return of 2).
- */
- int (*device_is_agp) (struct drm_device *dev);
-
-/* these have to be filled in */
- irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
- void (*irq_preinstall) (struct drm_device *dev);
- int (*irq_postinstall) (struct drm_device *dev);
- void (*irq_uninstall) (struct drm_device *dev);
- void (*reclaim_buffers) (struct drm_device *dev,
- struct drm_file *file_priv);
- void (*reclaim_buffers_locked) (struct drm_device *dev,
- struct drm_file *file_priv);
- void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
- struct drm_file *file_priv);
- unsigned long (*get_map_ofs) (struct drm_map *map);
- unsigned long (*get_reg_ofs) (struct drm_device *dev);
- void (*set_version) (struct drm_device *dev,
- struct drm_set_version *sv);
-
- int (*proc_init)(struct drm_minor *minor);
- void (*proc_cleanup)(struct drm_minor *minor);
-
- /**
- * Driver-specific constructor for drm_gem_objects, to set up
- * obj->driver_private.
- *
- * Returns 0 on success.
- */
- int (*gem_init_object) (struct drm_gem_object *obj);
- void (*gem_free_object) (struct drm_gem_object *obj);
-
- struct drm_fence_driver *fence_driver;
- struct drm_bo_driver *bo_driver;
-
- int major;
- int minor;
- int patchlevel;
- char *name;
- char *desc;
- char *date;
-
-/* variables */
- u32 driver_features;
- int dev_priv_size;
- struct drm_ioctl_desc *ioctls;
- int num_ioctls;
- struct file_operations fops;
- struct pci_driver pci_driver;
-};
-
-#define DRM_MINOR_UNASSIGNED 0
-#define DRM_MINOR_LEGACY 1
-
-/**
- * DRM minor structure. This structure represents a drm minor number.
- */
-struct drm_minor {
- int index; /**< Minor device number */
- int type; /**< Control or render */
- dev_t device; /**< Device number for mknod */
- struct device kdev; /**< Linux device */
- struct drm_device *dev;
- struct proc_dir_entry *dev_root; /**< proc directory entry */
- struct class_device *dev_class;
-};
-
-
-/**
- * DRM device structure. This structure represent a complete card that
- * may contain multiple heads.
- */
-struct drm_device {
- char *unique; /**< Unique identifier: e.g., busid */
- int unique_len; /**< Length of unique field */
- char *devname; /**< For /proc/interrupts */
- int if_version; /**< Highest interface version set */
-
- int blocked; /**< Blocked due to VC switch? */
-
- /** \name Locks */
- /*@{ */
- spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
- struct mutex struct_mutex; /**< For others */
- /*@} */
-
- /** \name Usage Counters */
- /*@{ */
- int open_count; /**< Outstanding files open */
- atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
- atomic_t vma_count; /**< Outstanding vma areas open */
- int buf_use; /**< Buffers in use -- cannot alloc */
- atomic_t buf_alloc; /**< Buffer allocation in progress */
- /*@} */
-
- /** \name Performance counters */
- /*@{ */
- unsigned long counters;
- enum drm_stat_type types[15];
- atomic_t counts[15];
- /*@} */
-
- /** \name Authentication */
- /*@{ */
- struct list_head filelist;
- struct drm_open_hash magiclist;
- struct list_head magicfree;
- /*@} */
-
- /** \name Memory management */
- /*@{ */
- struct list_head maplist; /**< Linked list of regions */
- int map_count; /**< Number of mappable regions */
- struct drm_open_hash map_hash; /**< User token hash table for maps */
-
- /** \name Context handle management */
- /*@{ */
- struct list_head ctxlist; /**< Linked list of context handles */
- int ctx_count; /**< Number of context handles */
- struct mutex ctxlist_mutex; /**< For ctxlist */
-
- struct idr ctx_idr;
-
- struct list_head vmalist; /**< List of vmas (for debugging) */
- struct drm_lock_data lock; /**< Information on hardware lock */
- /*@} */
-
- /** \name DMA queues (contexts) */
- /*@{ */
- int queue_count; /**< Number of active DMA queues */
- int queue_reserved; /**< Number of reserved DMA queues */
- int queue_slots; /**< Actual length of queuelist */
- struct drm_queue **queuelist; /**< Vector of pointers to DMA queues */
- struct drm_device_dma *dma; /**< Optional pointer for DMA support */
- /*@} */
-
- /** \name Context support */
- /*@{ */
- int irq; /**< Interrupt used by board */
- int irq_enabled; /**< True if irq handler is enabled */
- int msi_enabled; /**< True if irq is MSI */
- __volatile__ long context_flag; /**< Context swapping flag */
- __volatile__ long interrupt_flag; /**< Interruption handler flag */
- __volatile__ long dma_flag; /**< DMA dispatch flag */
- struct timer_list timer; /**< Timer for delaying ctx switch */
- wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */
- int last_checked; /**< Last context checked for DMA */
- int last_context; /**< Last current context */
- unsigned long last_switch; /**< jiffies at last context switch */
- /*@} */
-
- struct work_struct work;
-
- /** \name VBLANK IRQ support */
- /*@{ */
-
- /*
- * At load time, disabling the vblank interrupt won't be allowed since
- * old clients may not call the modeset ioctl and therefore misbehave.
- * Once the modeset ioctl *has* been called though, we can safely
- * disable them when unused.
- */
- int vblank_disable_allowed;
-
- wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
- atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
- spinlock_t vbl_lock;
- struct list_head *vbl_sigs; /**< signal list to send on VBLANK */
- atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
- atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */
- u32 *last_vblank; /* protected by dev->vbl_lock, used */
- /* for wraparound handling */
- int *vblank_enabled; /* so we don't call enable more than
- once per disable */
- int *vblank_inmodeset; /* Display driver is setting mode */
- struct timer_list vblank_disable_timer;
-
- u32 max_vblank_count; /**< size of vblank counter register */
- spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
- void (*locked_tasklet_func)(struct drm_device *dev);
-
- /*@} */
- cycles_t ctx_start;
- cycles_t lck_start;
-
- struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */
- wait_queue_head_t buf_readers; /**< Processes waiting to read */
- wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
-
- struct drm_agp_head *agp; /**< AGP data */
-
- struct pci_dev *pdev; /**< PCI device structure */
- int pci_vendor; /**< PCI vendor id */
- int pci_device; /**< PCI device id */
-#ifdef __alpha__
- struct pci_controller *hose;
-#endif
- int num_crtcs; /**< Number of CRTCs on this device */
- struct drm_sg_mem *sg; /**< Scatter gather memory */
- void *dev_private; /**< device private data */
- struct drm_sigdata sigdata; /**< For block_all_signals */
- sigset_t sigmask;
-
- struct drm_driver *driver;
- drm_local_map_t *agp_buffer_map;
- unsigned int agp_buffer_token;
- struct drm_minor *primary; /**< render type primary screen head */
-
- /** \name Drawable information */
- /*@{ */
- spinlock_t drw_lock;
- struct idr drw_idr;
- /*@} */
-
- /** \name GEM information */
- /*@{ */
- spinlock_t object_name_lock;
- struct idr object_name_idr;
- atomic_t object_count;
- atomic_t object_memory;
- atomic_t pin_count;
- atomic_t pin_memory;
- atomic_t gtt_count;
- atomic_t gtt_memory;
- uint32_t gtt_total;
- uint32_t invalidate_domains; /* domains pending invalidation */
- uint32_t flush_domains; /* domains pending flush */
- /*@} */
-};
-
-
-static __inline__ int drm_core_check_feature(struct drm_device *dev,
- int feature)
-{
- return ((dev->driver->driver_features & feature) ? 1 : 0);
-}
-
-#ifdef __alpha__
-#define drm_get_pci_domain(dev) dev->hose->index
-#else
-#define drm_get_pci_domain(dev) 0
-#endif
-
-#if __OS_HAS_AGP
-static inline int drm_core_has_AGP(struct drm_device *dev)
-{
- return drm_core_check_feature(dev, DRIVER_USE_AGP);
-}
-#else
-#define drm_core_has_AGP(dev) (0)
-#endif
-
-#if __OS_HAS_MTRR
-static inline int drm_core_has_MTRR(struct drm_device *dev)
-{
- return drm_core_check_feature(dev, DRIVER_USE_MTRR);
-}
-
-#define DRM_MTRR_WC MTRR_TYPE_WRCOMB
-
-static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
- unsigned int flags)
-{
- return mtrr_add(offset, size, flags, 1);
-}
-
-static inline int drm_mtrr_del(int handle, unsigned long offset,
- unsigned long size, unsigned int flags)
-{
- return mtrr_del(handle, offset, size);
-}
-
-#else
-static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
- unsigned int flags)
-{
- return -ENODEV;
-}
-
-static inline int drm_mtrr_del(int handle, unsigned long offset,
- unsigned long size, unsigned int flags)
-{
- return -ENODEV;
-}
-
-#define drm_core_has_MTRR(dev) (0)
-#define DRM_MTRR_WC 0
-#endif
-
-
-/******************************************************************/
-/** \name Internal function definitions */
-/*@{*/
-
- /* Driver support (drm_drv.h) */
-extern int drm_fb_loaded;
-extern int drm_init(struct drm_driver *driver,
- struct pci_device_id *pciidlist);
-extern void drm_exit(struct drm_driver *driver);
-extern void drm_cleanup_pci(struct pci_dev *pdev);
-extern int drm_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern long drm_unlocked_ioctl(struct file *filp,
- unsigned int cmd, unsigned long arg);
-extern long drm_compat_ioctl(struct file *filp,
- unsigned int cmd, unsigned long arg);
-
-extern int drm_lastclose(struct drm_device *dev);
-
- /* Device support (drm_fops.h) */
-extern int drm_open(struct inode *inode, struct file *filp);
-extern int drm_stub_open(struct inode *inode, struct file *filp);
-extern int drm_fasync(int fd, struct file *filp, int on);
-extern int drm_release(struct inode *inode, struct file *filp);
-unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
-
- /* Mapping support (drm_vm.h) */
-extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
-extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
-extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
-extern pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma);
-
- /* Memory management support (drm_memory.h) */
-#include "drm_memory.h"
-extern void drm_mem_init(void);
-extern int drm_mem_info(char *buf, char **start, off_t offset,
- int request, int *eof, void *data);
-extern void *drm_calloc(size_t nmemb, size_t size, int area);
-extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
-extern unsigned long drm_alloc_pages(int order, int area);
-extern void drm_free_pages(unsigned long address, int order, int area);
-extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
-extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
-extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
-extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
- struct page **pages,
- unsigned long num_pages,
- uint32_t gtt_offset);
-extern int drm_unbind_agp(DRM_AGP_MEM * handle);
-
-extern void drm_free_memctl(size_t size);
-extern int drm_alloc_memctl(size_t size);
-extern void drm_query_memctl(uint64_t *cur_used,
- uint64_t *emer_used,
- uint64_t *low_threshold,
- uint64_t *high_threshold,
- uint64_t *emer_threshold);
-extern void drm_init_memctl(size_t low_threshold,
- size_t high_threshold,
- size_t unit_size);
-
- /* Misc. IOCTL support (drm_ioctl.h) */
-extern int drm_irq_by_busid(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_setunique(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getmap(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getclient(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getstats(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_setversion(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_noop(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
- /* Context IOCTL support (drm_context.h) */
-extern int drm_resctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_addctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_modctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_switchctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_newctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_rmctx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-extern int drm_ctxbitmap_init(struct drm_device *dev);
-extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
-extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
-
-extern int drm_setsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_getsareactx(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
- /* Drawable IOCTL support (drm_drawable.h) */
-extern int drm_adddraw(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_rmdraw(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_update_drawable_info(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
- drm_drawable_t id);
-extern void drm_drawable_free_all(struct drm_device *dev);
-
- /* Authentication IOCTL support (drm_auth.h) */
-extern int drm_getmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_authmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
- /* Locking IOCTL support (drm_lock.h) */
-extern int drm_lock(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_unlock(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
-extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
-extern void drm_idlelock_take(struct drm_lock_data *lock_data);
-extern void drm_idlelock_release(struct drm_lock_data *lock_data);
-
-/*
- * These are exported to drivers so that they can implement fencing using
- * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
- */
-
-extern int drm_i_have_hw_lock(struct drm_device *dev,
- struct drm_file *file_priv);
-
- /* Buffer management support (drm_bufs.h) */
-extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
-extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
-extern int drm_addbufs_fb (struct drm_device *dev, struct drm_buf_desc * request);
-extern int drm_addmap(struct drm_device *dev, unsigned int offset,
- unsigned int size, enum drm_map_type type,
- enum drm_map_flags flags, drm_local_map_t ** map_ptr);
-extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
-extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map);
-extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_addbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_infobufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_markbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_freebufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_mapbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_order(unsigned long size);
-extern unsigned long drm_get_resource_start(struct drm_device *dev,
- unsigned int resource);
-extern unsigned long drm_get_resource_len(struct drm_device *dev,
- unsigned int resource);
-extern struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
- drm_local_map_t *map);
-
-
- /* DMA support (drm_dma.h) */
-extern int drm_dma_setup(struct drm_device *dev);
-extern void drm_dma_takedown(struct drm_device *dev);
-extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
-extern void drm_core_reclaim_buffers(struct drm_device *dev,
- struct drm_file *filp);
-
- /* IRQ support (drm_irq.h) */
-extern int drm_control(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
-extern int drm_irq_install(struct drm_device *dev);
-extern int drm_irq_uninstall(struct drm_device *dev);
-extern void drm_driver_irq_preinstall(struct drm_device *dev);
-extern void drm_driver_irq_postinstall(struct drm_device *dev);
-extern void drm_driver_irq_uninstall(struct drm_device *dev);
-
-extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
-extern void drm_vblank_cleanup(struct drm_device *dev);
-extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *filp);
-extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq);
-extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
-extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
-extern void drm_handle_vblank(struct drm_device *dev, int crtc);
-extern int drm_vblank_get(struct drm_device *dev, int crtc);
-extern void drm_vblank_put(struct drm_device *dev, int crtc);
-
- /* Modesetting support */
-extern int drm_modeset_ctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
- /* AGP/GART support (drm_agpsupport.h) */
-extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-extern int drm_agp_acquire(struct drm_device *dev);
-extern int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_release(struct drm_device *dev);
-extern int drm_agp_release_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
-extern int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
-extern int drm_agp_info_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
-extern int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
-extern int drm_agp_free_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
-extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
-extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);
-extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
-extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
-extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
-extern void drm_agp_chipset_flush(struct drm_device *dev);
- /* Stub support (drm_stub.h) */
-extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
- struct drm_driver *driver);
-extern int drm_put_dev(struct drm_device *dev);
-extern int drm_put_minor(struct drm_device *dev);
-extern unsigned int drm_debug; /* 1 to enable debug output */
-
-extern struct class *drm_class;
-extern struct proc_dir_entry *drm_proc_root;
-
-extern struct idr drm_minors_idr;
-
-extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
-
- /* Proc support (drm_proc.h) */
-int drm_proc_init(struct drm_minor *minor, int minor_id,
- struct proc_dir_entry *root);
-int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
-
- /* Scatter Gather Support (drm_scatter.h) */
-extern void drm_sg_cleanup(struct drm_sg_mem * entry);
-extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-extern int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
-extern int drm_sg_free(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
- /* ATI PCIGART support (ati_pcigart.h) */
-extern int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info);
-extern int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info);
-
-extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
- size_t align, dma_addr_t maxaddr);
-extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
-extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
-
- /* sysfs support (drm_sysfs.c) */
-struct drm_sysfs_class;
-extern struct class *drm_sysfs_create(struct module *owner, char *name);
-extern void drm_sysfs_destroy(void);
-extern int drm_sysfs_device_add(struct drm_minor *minor);
-extern void drm_sysfs_device_remove(struct drm_minor *minor);
-
-/*
- * Basic memory manager support (drm_mm.c)
- */
-
-extern struct drm_mm_node * drm_mm_get_block(struct drm_mm_node * parent, unsigned long size,
- unsigned alignment);
-extern void drm_mm_put_block(struct drm_mm_node *cur);
-extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size,
- unsigned alignment, int best_match);
-extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size);
-extern void drm_mm_takedown(struct drm_mm *mm);
-extern int drm_mm_clean(struct drm_mm *mm);
-extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
-extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
-extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
-
-static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
-{
- return block->mm;
-}
-
-/* Graphics Execution Manager library functions (drm_gem.c) */
-int
-drm_gem_init (struct drm_device *dev);
-
-void
-drm_gem_object_free (struct kref *kref);
-
-struct drm_gem_object *
-drm_gem_object_alloc(struct drm_device *dev, size_t size);
-
-void
-drm_gem_object_handle_free (struct kref *kref);
-
-static inline void drm_gem_object_reference(struct drm_gem_object *obj)
-{
- kref_get(&obj->refcount);
-}
-
-static inline void drm_gem_object_unreference(struct drm_gem_object *obj)
-{
- if (obj == NULL)
- return;
-
- kref_put (&obj->refcount, drm_gem_object_free);
-}
-
-int
-drm_gem_handle_create(struct drm_file *file_priv,
- struct drm_gem_object *obj,
- int *handlep);
-
-static inline void drm_gem_object_handle_reference (struct drm_gem_object *obj)
-{
- drm_gem_object_reference (obj);
- kref_get(&obj->handlecount);
-}
-
-static inline void drm_gem_object_handle_unreference (struct drm_gem_object *obj)
-{
- if (obj == NULL)
- return;
-
- /*
- * Must bump handle count first as this may be the last
- * ref, in which case the object would disappear before we
- * checked for a name
- */
- kref_put (&obj->handlecount, drm_gem_object_handle_free);
- drm_gem_object_unreference (obj);
-}
-
-struct drm_gem_object *
-drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
- int handle);
-int drm_gem_close_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-int drm_gem_open_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv);
-
-void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
-void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
-
-extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
-extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev);
-extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
-
-static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev,
- unsigned int token)
-{
- struct drm_map_list *_entry;
- list_for_each_entry(_entry, &dev->maplist, head)
- if (_entry->user_token == token)
- return _entry->map;
- return NULL;
-}
-
-static __inline__ int drm_device_is_agp(struct drm_device *dev)
-{
- if ( dev->driver->device_is_agp != NULL ) {
- int err = (*dev->driver->device_is_agp)(dev);
-
- if (err != 2) {
- return err;
- }
- }
-
- return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
-}
-
-static __inline__ int drm_device_is_pcie(struct drm_device *dev)
-{
- return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
-}
-
-static __inline__ void drm_core_dropmap(struct drm_map *map)
-{
-}
-
-#ifndef DEBUG_MEMORY
-/** Wrapper around kmalloc() */
-static __inline__ void *drm_alloc(size_t size, int area)
-{
- return kmalloc(size, GFP_KERNEL);
-}
-
-/** Wrapper around kfree() */
-static __inline__ void drm_free(void *pt, size_t size, int area)
-{
- kfree(pt);
-}
-#else
-extern void *drm_alloc(size_t size, int area);
-extern void drm_free(void *pt, size_t size, int area);
-#endif
-
-/*
- * Accounting variants of standard calls.
- */
-
-static inline void *drm_ctl_alloc(size_t size, int area)
-{
- void *ret;
- if (drm_alloc_memctl(size))
- return NULL;
- ret = drm_alloc(size, area);
- if (!ret)
- drm_free_memctl(size);
- return ret;
-}
-
-static inline void *drm_ctl_calloc(size_t nmemb, size_t size, int area)
-{
- void *ret;
-
- if (drm_alloc_memctl(nmemb*size))
- return NULL;
- ret = drm_calloc(nmemb, size, area);
- if (!ret)
- drm_free_memctl(nmemb*size);
- return ret;
-}
-
-static inline void drm_ctl_free(void *pt, size_t size, int area)
-{
- drm_free(pt, size, area);
- drm_free_memctl(size);
-}
-
-/*@}*/
-
-#endif /* __KERNEL__ */
-#endif
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
deleted file mode 100644
index 9f746a32..00000000
--- a/linux-core/drm_agpsupport.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/**
- * \file drm_agpsupport.c
- * DRM support for AGP/GART backend
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "drmP.h"
-#include <linux/module.h>
-
-#if __OS_HAS_AGP
-
-/**
- * Get AGP information.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a (output) drm_agp_info structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device has been initialized and acquired and fills in the
- * drm_agp_info structure with the information in drm_agp_head::agp_info.
- */
-int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
-{
- DRM_AGP_KERN *kern;
-
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
-
- kern = &dev->agp->agp_info;
- info->agp_version_major = kern->version.major;
- info->agp_version_minor = kern->version.minor;
- info->mode = kern->mode;
- info->aperture_base = kern->aper_base;
- info->aperture_size = kern->aper_size * 1024 * 1024;
- info->memory_allowed = kern->max_memory << PAGE_SHIFT;
- info->memory_used = kern->current_memory << PAGE_SHIFT;
- info->id_vendor = kern->device->vendor;
- info->id_device = kern->device->device;
-
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_info);
-
-int drm_agp_info_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_info *info = data;
- int err;
-
- err = drm_agp_info(dev, info);
- if (err)
- return err;
-
- return 0;
-}
-
-/**
- * Acquire the AGP device.
- *
- * \param dev DRM device that is to acquire AGP.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device hasn't been acquired before and calls
- * \c agp_backend_acquire.
- */
-int drm_agp_acquire(struct drm_device * dev)
-{
- if (!dev->agp)
- return -ENODEV;
- if (dev->agp->acquired)
- return -EBUSY;
- if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev)))
- return -ENODEV;
-
- dev->agp->acquired = 1;
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_acquire);
-
-/**
- * Acquire the AGP device (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg user argument.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device hasn't been acquired before and calls
- * \c agp_backend_acquire.
- */
-int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- return drm_agp_acquire((struct drm_device *) file_priv->minor->dev);
-}
-
-/**
- * Release the AGP device.
- *
- * \param dev DRM device that is to release AGP.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device has been acquired and calls \c agp_backend_release.
- */
-int drm_agp_release(struct drm_device *dev)
-{
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
- agp_backend_release(dev->agp->bridge);
- dev->agp->acquired = 0;
- return 0;
-
-}
-EXPORT_SYMBOL(drm_agp_release);
-
-int drm_agp_release_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- return drm_agp_release(dev);
-}
-
-/**
- * Enable the AGP bus.
- *
- * \param dev DRM device that has previously acquired AGP.
- * \param mode Requested AGP mode.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device has been acquired but not enabled, and calls
- * \c agp_enable.
- */
-int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
-{
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
-
- dev->agp->mode = mode.mode;
- agp_enable(dev->agp->bridge, mode.mode);
- dev->agp->enabled = 1;
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_enable);
-
-int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_mode *mode = data;
-
- return drm_agp_enable(dev, *mode);
-}
-
-/**
- * Allocate AGP memory.
- *
- * \param inode device inode.
- * \param file_priv file private pointer.
- * \param cmd command.
- * \param arg pointer to a drm_agp_buffer structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device is present and has been acquired, allocates the
- * memory via alloc_agp() and creates a drm_agp_mem entry for it.
- */
-int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
-{
- struct drm_agp_mem *entry;
- DRM_AGP_MEM *memory;
- unsigned long pages;
- u32 type;
-
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
- if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
- return -ENOMEM;
-
- memset(entry, 0, sizeof(*entry));
-
- pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
- type = (u32) request->type;
- if (!(memory = drm_alloc_agp(dev, pages, type))) {
- drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
- return -ENOMEM;
- }
-
- entry->handle = (unsigned long)memory->key + 1;
- entry->memory = memory;
- entry->bound = 0;
- entry->pages = pages;
- list_add(&entry->head, &dev->agp->memory);
-
- request->handle = entry->handle;
- request->physical = memory->physical;
-
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_alloc);
-
-
-int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_buffer *request = data;
-
- return drm_agp_alloc(dev, request);
-}
-
-/**
- * Search for the AGP memory entry associated with a handle.
- *
- * \param dev DRM device structure.
- * \param handle AGP memory handle.
- * \return pointer to the drm_agp_mem structure associated with \p handle.
- *
- * Walks through drm_agp_head::memory until finding a matching handle.
- */
-static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
- unsigned long handle)
-{
- struct drm_agp_mem *entry;
-
- list_for_each_entry(entry, &dev->agp->memory, head) {
- if (entry->handle == handle)
- return entry;
- }
- return NULL;
-}
-
-/**
- * Unbind AGP memory from the GATT (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_agp_binding structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device is present and acquired, looks-up the AGP memory
- * entry and passes it to the unbind_agp() function.
- */
-int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
-{
- struct drm_agp_mem *entry;
- int ret;
-
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
- if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
- return -EINVAL;
- if (!entry->bound)
- return -EINVAL;
- ret = drm_unbind_agp(entry->memory);
- if (ret == 0)
- entry->bound = 0;
- return ret;
-}
-EXPORT_SYMBOL(drm_agp_unbind);
-
-
-int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_binding *request = data;
-
- return drm_agp_unbind(dev, request);
-}
-
-
-/**
- * Bind AGP memory into the GATT (ioctl)
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_agp_binding structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device is present and has been acquired and that no memory
- * is currently bound into the GATT. Looks-up the AGP memory entry and passes
- * it to bind_agp() function.
- */
-int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
-{
- struct drm_agp_mem *entry;
- int retcode;
- int page;
-
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
- if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
- return -EINVAL;
- if (entry->bound)
- return -EINVAL;
- page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE;
- if ((retcode = drm_bind_agp(entry->memory, page)))
- return retcode;
- entry->bound = dev->agp->base + (page << PAGE_SHIFT);
- DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
- dev->agp->base, entry->bound);
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_bind);
-
-
-int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_binding *request = data;
-
- return drm_agp_bind(dev, request);
-}
-
-
-/**
- * Free AGP memory (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_agp_buffer structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the AGP device is present and has been acquired and looks up the
- * AGP memory entry. If the memory it's currently bound, unbind it via
- * unbind_agp(). Frees it via free_agp() as well as the entry itself
- * and unlinks from the doubly linked list it's inserted in.
- */
-int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
-{
- struct drm_agp_mem *entry;
-
- if (!dev->agp || !dev->agp->acquired)
- return -EINVAL;
- if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
- return -EINVAL;
- if (entry->bound)
- drm_unbind_agp(entry->memory);
-
- list_del(&entry->head);
-
- drm_free_agp(entry->memory, entry->pages);
- drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
- return 0;
-}
-EXPORT_SYMBOL(drm_agp_free);
-
-
-
-int drm_agp_free_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_agp_buffer *request = data;
-
- return drm_agp_free(dev, request);
-}
-
-
-/**
- * Initialize the AGP resources.
- *
- * \return pointer to a drm_agp_head structure.
- *
- * Gets the drm_agp_t structure which is made available by the agpgart module
- * via the inter_module_* functions. Creates and initializes a drm_agp_head
- * structure.
- */
-struct drm_agp_head *drm_agp_init(struct drm_device *dev)
-{
- struct drm_agp_head *head = NULL;
-
- if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
- return NULL;
- memset((void *)head, 0, sizeof(*head));
-
- head->bridge = agp_find_bridge(dev->pdev);
- if (!head->bridge) {
- if (!(head->bridge = agp_backend_acquire(dev->pdev))) {
- drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
- return NULL;
- }
- agp_copy_info(head->bridge, &head->agp_info);
- agp_backend_release(head->bridge);
- } else {
- agp_copy_info(head->bridge, &head->agp_info);
- }
-
- if (head->agp_info.chipset == NOT_SUPPORTED) {
- drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
- return NULL;
- }
- INIT_LIST_HEAD(&head->memory);
- head->cant_use_aperture = head->agp_info.cant_use_aperture;
- head->page_mask = head->agp_info.page_mask;
- head->base = head->agp_info.aper_base;
- return head;
-}
-
-/** Calls agp_allocate_memory() */
-DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge,
- size_t pages, u32 type)
-{
- return agp_allocate_memory(bridge, pages, type);
-}
-
-/** Calls agp_free_memory() */
-int drm_agp_free_memory(DRM_AGP_MEM * handle)
-{
- if (!handle)
- return 0;
- agp_free_memory(handle);
- return 1;
-}
-
-/** Calls agp_bind_memory() */
-int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
-{
- if (!handle)
- return -EINVAL;
- return agp_bind_memory(handle, start);
-}
-EXPORT_SYMBOL(drm_agp_bind_memory);
-
-/** Calls agp_unbind_memory() */
-int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
-{
- if (!handle)
- return -EINVAL;
- return agp_unbind_memory(handle);
-}
-
-/**
- * Binds a collection of pages into AGP memory at the given offset, returning
- * the AGP memory structure containing them.
- *
- * No reference is held on the pages during this time -- it is up to the
- * caller to handle that.
- */
-DRM_AGP_MEM *
-drm_agp_bind_pages(struct drm_device *dev,
- struct page **pages,
- unsigned long num_pages,
- uint32_t gtt_offset)
-{
- DRM_AGP_MEM *mem;
- int ret, i;
-
- DRM_DEBUG("drm_agp_populate_ttm\n");
- mem = drm_agp_allocate_memory(dev->agp->bridge, num_pages,
- AGP_USER_MEMORY);
- if (mem == NULL) {
- DRM_ERROR("Failed to allocate memory for %ld pages\n",
- num_pages);
- return NULL;
- }
-
- for (i = 0; i < num_pages; i++)
- mem->memory[i] = phys_to_gart(page_to_phys(pages[i]));
- mem->page_count = num_pages;
-
- mem->is_flushed = true;
- ret = drm_agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
- if (ret != 0) {
- DRM_ERROR("Failed to bind AGP memory: %d\n", ret);
- agp_free_memory(mem);
- return NULL;
- }
-
- return mem;
-}
-EXPORT_SYMBOL(drm_agp_bind_pages);
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
-void drm_agp_chipset_flush(struct drm_device *dev)
-{
- agp_flush_chipset(dev->agp->bridge);
-}
-EXPORT_SYMBOL(drm_agp_chipset_flush);
-#endif
-
-#endif /* __OS_HAS_AGP */
diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c
deleted file mode 100644
index c904a91d..00000000
--- a/linux-core/drm_auth.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * \file drm_auth.c
- * IOCTLs for authentication
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "drmP.h"
-
-/**
- * Find the file with the given magic number.
- *
- * \param dev DRM device.
- * \param magic magic number.
- *
- * Searches in drm_device::magiclist within all files with the same hash key
- * the one with matching magic number, while holding the drm_device::struct_mutex
- * lock.
- */
-static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic)
-{
- struct drm_file *retval = NULL;
- struct drm_magic_entry *pt;
- struct drm_hash_item *hash;
-
- mutex_lock(&dev->struct_mutex);
- if (!drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) {
- pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
- retval = pt->priv;
- }
- mutex_unlock(&dev->struct_mutex);
- return retval;
-}
-
-/**
- * Adds a magic number.
- *
- * \param dev DRM device.
- * \param priv file private data.
- * \param magic magic number.
- *
- * Creates a drm_magic_entry structure and appends to the linked list
- * associated the magic number hash key in drm_device::magiclist, while holding
- * the drm_device::struct_mutex lock.
- */
-static int drm_add_magic(struct drm_device * dev, struct drm_file * priv,
- drm_magic_t magic)
-{
- struct drm_magic_entry *entry;
-
- DRM_DEBUG("%d\n", magic);
-
- entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
- if (!entry)
- return -ENOMEM;
- memset(entry, 0, sizeof(*entry));
- entry->priv = priv;
- entry->hash_item.key = (unsigned long)magic;
- mutex_lock(&dev->struct_mutex);
- drm_ht_insert_item(&dev->magiclist, &entry->hash_item);
- list_add_tail(&entry->head, &dev->magicfree);
- mutex_unlock(&dev->struct_mutex);
-
- return 0;
-}
-
-/**
- * Remove a magic number.
- *
- * \param dev DRM device.
- * \param magic magic number.
- *
- * Searches and unlinks the entry in drm_device::magiclist with the magic
- * number hash key, while holding the drm_device::struct_mutex lock.
- */
-static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
-{
- struct drm_magic_entry *pt;
- struct drm_hash_item *hash;
-
- DRM_DEBUG("%d\n", magic);
-
- mutex_lock(&dev->struct_mutex);
- if (drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) {
- mutex_unlock(&dev->struct_mutex);
- return -EINVAL;
- }
- pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
- drm_ht_remove_item(&dev->magiclist, hash);
- list_del(&pt->head);
- mutex_unlock(&dev->struct_mutex);
-
- drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
-
- return 0;
-}
-
-/**
- * Get a unique magic number (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a resulting drm_auth structure.
- * \return zero on success, or a negative number on failure.
- *
- * If there is a magic number in drm_file::magic then use it, otherwise
- * searches an unique non-zero magic number and add it associating it with \p
- * file_priv.
- */
-int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- static drm_magic_t sequence = 0;
- static DEFINE_SPINLOCK(lock);
- struct drm_auth *auth = data;
-
- /* Find unique magic */
- if (file_priv->magic) {
- auth->magic = file_priv->magic;
- } else {
- do {
- spin_lock(&lock);
- if (!sequence)
- ++sequence; /* reserve 0 */
- auth->magic = sequence++;
- spin_unlock(&lock);
- } while (drm_find_file(dev, auth->magic));
- file_priv->magic = auth->magic;
- drm_add_magic(dev, file_priv, auth->magic);
- }
-
- DRM_DEBUG("%u\n", auth->magic);
-
- return 0;
-}
-
-/**
- * Authenticate with a magic.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_auth structure.
- * \return zero if authentication successed, or a negative number otherwise.
- *
- * Checks if \p file_priv is associated with the magic number passed in \arg.
- */
-int drm_authmagic(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_auth *auth = data;
- struct drm_file *file;
-
- DRM_DEBUG("%u\n", auth->magic);
- if ((file = drm_find_file(dev, auth->magic))) {
- file->authenticated = 1;
- drm_remove_magic(dev, auth->magic);
- return 0;
- }
- return -EINVAL;
-}
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
deleted file mode 100644
index 75c75c2f..00000000
--- a/linux-core/drm_bufs.c
+++ /dev/null
@@ -1,1608 +0,0 @@
-/**
- * \file drm_bufs.c
- * Generic buffer template
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com
- *
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <linux/vmalloc.h>
-#include "drmP.h"
-
-unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource)
-{
- return pci_resource_start(dev->pdev, resource);
-}
-EXPORT_SYMBOL(drm_get_resource_start);
-
-unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource)
-{
- return pci_resource_len(dev->pdev, resource);
-}
-EXPORT_SYMBOL(drm_get_resource_len);
-
-struct drm_map_list *drm_find_matching_map(struct drm_device *dev, drm_local_map_t *map)
-{
- struct drm_map_list *entry;
- list_for_each_entry(entry, &dev->maplist, head) {
- if (entry->map && map->type == entry->map->type &&
- ((entry->map->offset == map->offset) ||
- (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) {
- return entry;
- }
- }
-
- return NULL;
-}
-EXPORT_SYMBOL(drm_find_matching_map);
-
-static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
- unsigned long user_token, int hashed_handle)
-{
- int use_hashed_handle;
-
-#if (BITS_PER_LONG == 64)
- use_hashed_handle = ((user_token & 0xFFFFFFFF00000000UL) || hashed_handle);
-#elif (BITS_PER_LONG == 32)
- use_hashed_handle = hashed_handle;
-#else
-#error Unsupported long size. Neither 64 nor 32 bits.
-#endif
-
- if (!use_hashed_handle) {
- int ret;
- hash->key = user_token >> PAGE_SHIFT;
- ret = drm_ht_insert_item(&dev->map_hash, hash);
- if (ret != -EINVAL)
- return ret;
- }
- return drm_ht_just_insert_please(&dev->map_hash, hash,
- user_token, 32 - PAGE_SHIFT - 3,
- 0, DRM_MAP_HASH_OFFSET >> PAGE_SHIFT);
-}
-
-/**
- * Ioctl to specify a range of memory that is available for mapping by a non-root process.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_map structure.
- * \return zero on success or a negative value on error.
- *
- * Adjusts the memory offset to its absolute value according to the mapping
- * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
- * applicable and if supported by the kernel.
- */
-static int drm_addmap_core(struct drm_device *dev, unsigned int offset,
- unsigned int size, enum drm_map_type type,
- enum drm_map_flags flags,
- struct drm_map_list **maplist)
-{
- struct drm_map *map;
- struct drm_map_list *list;
- drm_dma_handle_t *dmah;
- unsigned long user_token;
- int ret;
-
- map = drm_alloc(sizeof(*map), DRM_MEM_MAPS);
- if (!map)
- return -ENOMEM;
-
- map->offset = offset;
- map->size = size;
- map->flags = flags;
- map->type = type;
-
- /* Only allow shared memory to be removable since we only keep enough
- * book keeping information about shared memory to allow for removal
- * when processes fork.
- */
- if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
- DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n",
- map->offset, map->size, map->type);
- if ((map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
- map->mtrr = -1;
- map->handle = NULL;
-
- switch (map->type) {
- case _DRM_REGISTERS:
- case _DRM_FRAME_BUFFER:
-#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__)
- if (map->offset + (map->size - 1) < map->offset ||
- map->offset < virt_to_phys(high_memory)) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
-#endif
-#ifdef __alpha__
- map->offset += dev->hose->mem_space->start;
-#endif
- /* Some drivers preinitialize some maps, without the X Server
- * needing to be aware of it. Therefore, we just return success
- * when the server tries to create a duplicate map.
- */
- list = drm_find_matching_map(dev, map);
- if (list != NULL) {
- if (list->map->size != map->size) {
- DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size,
- list->map->size);
- list->map->size = map->size;
- }
-
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- *maplist = list;
- return 0;
- }
-
- if (drm_core_has_MTRR(dev)) {
- if (map->type == _DRM_FRAME_BUFFER ||
- (map->flags & _DRM_WRITE_COMBINING)) {
- map->mtrr = mtrr_add(map->offset, map->size,
- MTRR_TYPE_WRCOMB, 1);
- }
- }
- if (map->type == _DRM_REGISTERS) {
- map->handle = ioremap(map->offset, map->size);
- if (!map->handle) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -ENOMEM;
- }
- }
- break;
- case _DRM_SHM:
- list = drm_find_matching_map(dev, map);
- if (list != NULL) {
- if(list->map->size != map->size) {
- DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size, list->map->size);
- list->map->size = map->size;
- }
-
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- *maplist = list;
- return 0;
- }
- map->handle = vmalloc_user(map->size);
- DRM_DEBUG("%lu %d %p\n",
- map->size, drm_order(map->size), map->handle);
- if (!map->handle) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -ENOMEM;
- }
- map->offset = (unsigned long)map->handle;
- if (map->flags & _DRM_CONTAINS_LOCK) {
- /* Prevent a 2nd X Server from creating a 2nd lock */
- if (dev->lock.hw_lock != NULL) {
- vfree(map->handle);
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EBUSY;
- }
- dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */
- }
- break;
- case _DRM_AGP: {
- struct drm_agp_mem *entry;
- int valid = 0;
-
- if (!drm_core_has_AGP(dev)) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
-#ifdef __alpha__
- map->offset += dev->hose->mem_space->start;
-#endif
- /* In some cases (i810 driver), user space may have already
- * added the AGP base itself, because dev->agp->base previously
- * only got set during AGP enable. So, only add the base
- * address if the map's offset isn't already within the
- * aperture.
- */
- if (map->offset < dev->agp->base ||
- map->offset > dev->agp->base +
- dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
- map->offset += dev->agp->base;
- }
- map->mtrr = dev->agp->agp_mtrr; /* for getmap */
-
- /* This assumes the DRM is in total control of AGP space.
- * It's not always the case as AGP can be in the control
- * of user space (i.e. i810 driver). So this loop will get
- * skipped and we double check that dev->agp->memory is
- * actually set as well as being invalid before EPERM'ing
- */
- list_for_each_entry(entry, &dev->agp->memory, head) {
- if ((map->offset >= entry->bound) &&
- (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
- valid = 1;
- break;
- }
- }
- if (!list_empty(&dev->agp->memory) && !valid) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EPERM;
- }
- DRM_DEBUG("AGP offset = 0x%08lx, size = 0x%08lx\n", map->offset, map->size);
- break;
- }
- case _DRM_SCATTER_GATHER:
- if (!dev->sg) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
- map->offset += (unsigned long)dev->sg->virtual;
- break;
- case _DRM_CONSISTENT:
- /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
- * As we're limiting the address to 2^32-1 (or less),
- * casting it down to 32 bits is no problem, but we
- * need to point to a 64bit variable first. */
- dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
- if (!dmah) {
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -ENOMEM;
- }
- map->handle = dmah->vaddr;
- map->offset = (unsigned long)dmah->busaddr;
- kfree(dmah);
- break;
- default:
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
-
- list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
- if (!list) {
- if (map->type == _DRM_REGISTERS)
- iounmap(map->handle);
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- return -EINVAL;
- }
- memset(list, 0, sizeof(*list));
- list->map = map;
-
- mutex_lock(&dev->struct_mutex);
- list_add(&list->head, &dev->maplist);
-
- /* Assign a 32-bit handle */
-
- user_token = (map->type == _DRM_SHM) ? (unsigned long) map->handle :
- map->offset;
- ret = drm_map_handle(dev, &list->hash, user_token, 0);
-
- if (ret) {
- if (map->type == _DRM_REGISTERS)
- iounmap(map->handle);
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
- drm_free(list, sizeof(*list), DRM_MEM_MAPS);
- mutex_unlock(&dev->struct_mutex);
- return ret;
- }
-
- list->user_token = list->hash.key << PAGE_SHIFT;
- mutex_unlock(&dev->struct_mutex);
-
- *maplist = list;
- return 0;
-}
-
-int drm_addmap(struct drm_device *dev, unsigned int offset,
- unsigned int size, enum drm_map_type type,
- enum drm_map_flags flags, drm_local_map_t ** map_ptr)
-{
- struct drm_map_list *list;
- int rc;
-
- rc = drm_addmap_core(dev, offset, size, type, flags, &list);
- if (!rc)
- *map_ptr = list->map;
- return rc;
-}
-
-EXPORT_SYMBOL(drm_addmap);
-
-int drm_addmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_map *map = data;
- struct drm_map_list *maplist;
- int err;
-
- if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP))
- return -EPERM;
-
- err = drm_addmap_core(dev, map->offset, map->size, map->type,
- map->flags, &maplist);
-
- if (err)
- return err;
-
- /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */
- map->handle = (void *)(unsigned long)maplist->user_token;
- return 0;
-}
-
-/**
- * Remove a map private from list and deallocate resources if the mapping
- * isn't in use.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a struct drm_map structure.
- * \return zero on success or a negative value on error.
- *
- * Searches the map on drm_device::maplist, removes it from the list, see if
- * its being used, and free any associate resource (such as MTRR's) if it's not
- * being on use.
- *
- * \sa drm_addmap
- */
-int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
-{
- struct drm_map_list *r_list = NULL, *list_t;
- drm_dma_handle_t dmah;
- int found = 0;
-
- /* Find the list entry for the map and remove it */
- list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
- if (r_list->map == map) {
- list_del(&r_list->head);
- drm_ht_remove_key(&dev->map_hash,
- r_list->user_token >> PAGE_SHIFT);
- drm_free(r_list, sizeof(*r_list), DRM_MEM_MAPS);
- found = 1;
- break;
- }
- }
-
- if (!found)
- return -EINVAL;
-
- /* List has wrapped around to the head pointer, or it's empty and we
- * didn't find anything.
- */
-
- switch (map->type) {
- case _DRM_REGISTERS:
- iounmap(map->handle);
- /* FALLTHROUGH */
- case _DRM_FRAME_BUFFER:
- if (drm_core_has_MTRR(dev) && map->mtrr >= 0) {
- int retcode;
- retcode = mtrr_del(map->mtrr, map->offset, map->size);
- DRM_DEBUG("mtrr_del=%d\n", retcode);
- }
- break;
- case _DRM_SHM:
- vfree(map->handle);
- break;
- case _DRM_AGP:
- case _DRM_SCATTER_GATHER:
- break;
- case _DRM_CONSISTENT:
- dmah.vaddr = map->handle;
- dmah.busaddr = map->offset;
- dmah.size = map->size;
- __drm_pci_free(dev, &dmah);
- break;
- case _DRM_TTM:
- BUG_ON(1);
- }
- drm_free(map, sizeof(*map), DRM_MEM_MAPS);
-
- return 0;
-}
-EXPORT_SYMBOL(drm_rmmap_locked);
-
-int drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
-{
- int ret;
-
- mutex_lock(&dev->struct_mutex);
- ret = drm_rmmap_locked(dev, map);
- mutex_unlock(&dev->struct_mutex);
-
- return ret;
-}
-EXPORT_SYMBOL(drm_rmmap);
-
-/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on
- * the last close of the device, and this is necessary for cleanup when things
- * exit uncleanly. Therefore, having userland manually remove mappings seems
- * like a pointless exercise since they're going away anyway.
- *
- * One use case might be after addmap is allowed for normal users for SHM and
- * gets used by drivers that the server doesn't need to care about. This seems
- * unlikely.
- */
-int drm_rmmap_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_map *request = data;
- drm_local_map_t *map = NULL;
- struct drm_map_list *r_list;
- int ret;
-
- mutex_lock(&dev->struct_mutex);
- list_for_each_entry(r_list, &dev->maplist, head) {
- if (r_list->map &&
- r_list->user_token == (unsigned long)request->handle &&
- r_list->map->flags & _DRM_REMOVABLE) {
- map = r_list->map;
- break;
- }
- }
-
- /* List has wrapped around to the head pointer, or its empty we didn't
- * find anything.
- */
- if (list_empty(&dev->maplist) || !map) {
- mutex_unlock(&dev->struct_mutex);
- return -EINVAL;
- }
-
- /* Register and framebuffer maps are permanent */
- if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) {
- mutex_unlock(&dev->struct_mutex);
- return 0;
- }
-
- ret = drm_rmmap_locked(dev, map);
-
- mutex_unlock(&dev->struct_mutex);
-
- return ret;
-}
-
-/**
- * Cleanup after an error on one of the addbufs() functions.
- *
- * \param dev DRM device.
- * \param entry buffer entry where the error occurred.
- *
- * Frees any pages and buffers associated with the given entry.
- */
-static void drm_cleanup_buf_error(struct drm_device *dev,
- struct drm_buf_entry *entry)
-{
- int i;
-
- if (entry->seg_count) {
- for (i = 0; i < entry->seg_count; i++) {
- if (entry->seglist[i]) {
- drm_pci_free(dev, entry->seglist[i]);
- }
- }
- drm_free(entry->seglist,
- entry->seg_count *
- sizeof(*entry->seglist), DRM_MEM_SEGS);
-
- entry->seg_count = 0;
- }
-
- if (entry->buf_count) {
- for (i = 0; i < entry->buf_count; i++) {
- if (entry->buflist[i].dev_private) {
- drm_free(entry->buflist[i].dev_private,
- entry->buflist[i].dev_priv_size,
- DRM_MEM_BUFS);
- }
- }
- drm_free(entry->buflist,
- entry->buf_count *
- sizeof(*entry->buflist), DRM_MEM_BUFS);
-
- entry->buf_count = 0;
- }
-}
-
-#if __OS_HAS_AGP
-/**
- * Add AGP buffers for DMA transfers.
- *
- * \param dev struct drm_device to which the buffers are to be added.
- * \param request pointer to a struct drm_buf_desc describing the request.
- * \return zero on success or a negative number on failure.
- *
- * After some sanity checks creates a drm_buf structure for each buffer and
- * reallocates the buffer list of the same size order to accommodate the new
- * buffers.
- */
-int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_entry *entry;
- struct drm_agp_mem *agp_entry;
- struct drm_buf *buf;
- unsigned long offset;
- unsigned long agp_offset;
- int count;
- int order;
- int size;
- int alignment;
- int page_order;
- int total;
- int byte_count;
- int i, valid;
- struct drm_buf **temp_buflist;
-
- if (!dma)
- return -EINVAL;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? PAGE_ALIGN(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- byte_count = 0;
- agp_offset = dev->agp->base + request->agp_start;
-
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %lx\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
-
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return -EINVAL;
- if (dev->queue_count)
- return -EBUSY; /* Not while in use */
-
- /* Make sure buffers are located in AGP memory that we own */
- valid = 0;
- list_for_each_entry(agp_entry, &dev->agp->memory, head) {
- if ((agp_offset >= agp_entry->bound) &&
- (agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) {
- valid = 1;
- break;
- }
- }
- if (!list_empty(&dev->agp->memory) && !valid) {
- DRM_DEBUG("zone invalid\n");
- return -EINVAL;
- }
- spin_lock(&dev->count_lock);
- if (dev->buf_use) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- atomic_inc(&dev->buf_alloc);
- spin_unlock(&dev->count_lock);
-
- mutex_lock(&dev->struct_mutex);
- entry = &dma->bufs[order];
- if (entry->buf_count) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM; /* May only call once for each order */
- }
-
- if (count < 0 || count > 4096) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -EINVAL;
- }
-
- entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
- DRM_MEM_BUFS);
- if (!entry->buflist) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(entry->buflist, 0, count * sizeof(*entry->buflist));
-
- entry->buf_size = size;
- entry->page_order = page_order;
-
- offset = 0;
-
- while (entry->buf_count < count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
-
- buf->offset = (dma->byte_count + offset);
- buf->bus_address = agp_offset + offset;
- buf->address = (void *)(agp_offset + offset);
- buf->next = NULL;
- buf->waiting = 0;
- buf->pending = 0;
- init_waitqueue_head(&buf->dma_wait);
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->dev_priv_size;
- buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
- if (!buf->dev_private) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(buf->dev_private, 0, buf->dev_priv_size);
-
- DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
-
- offset += alignment;
- entry->buf_count++;
- byte_count += PAGE_SIZE << page_order;
- }
-
- DRM_DEBUG("byte_count: %d\n", byte_count);
-
- temp_buflist = drm_realloc(dma->buflist,
- dma->buf_count * sizeof(*dma->buflist),
- (dma->buf_count + entry->buf_count)
- * sizeof(*dma->buflist), DRM_MEM_BUFS);
- if (!temp_buflist) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- dma->buf_count += entry->buf_count;
- dma->seg_count += entry->seg_count;
- dma->page_count += byte_count >> PAGE_SHIFT;
- dma->byte_count += byte_count;
-
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
-
- mutex_unlock(&dev->struct_mutex);
-
- request->count = entry->buf_count;
- request->size = size;
-
- dma->flags = _DRM_DMA_USE_AGP;
-
- atomic_dec(&dev->buf_alloc);
- return 0;
-}
-EXPORT_SYMBOL(drm_addbufs_agp);
-#endif /* __OS_HAS_AGP */
-
-int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request)
-{
- struct drm_device_dma *dma = dev->dma;
- int count;
- int order;
- int size;
- int total;
- int page_order;
- struct drm_buf_entry *entry;
- drm_dma_handle_t *dmah;
- struct drm_buf *buf;
- int alignment;
- unsigned long offset;
- int i;
- int byte_count;
- int page_count;
- unsigned long *temp_pagelist;
- struct drm_buf **temp_buflist;
-
- if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- DRM_DEBUG("count=%d, size=%d (%d), order=%d, queue_count=%d\n",
- request->count, request->size, size, order, dev->queue_count);
-
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return -EINVAL;
- if (dev->queue_count)
- return -EBUSY; /* Not while in use */
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? PAGE_ALIGN(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- spin_lock(&dev->count_lock);
- if (dev->buf_use) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- atomic_inc(&dev->buf_alloc);
- spin_unlock(&dev->count_lock);
-
- mutex_lock(&dev->struct_mutex);
- entry = &dma->bufs[order];
- if (entry->buf_count) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM; /* May only call once for each order */
- }
-
- if (count < 0 || count > 4096) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -EINVAL;
- }
-
- entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
- DRM_MEM_BUFS);
- if (!entry->buflist) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(entry->buflist, 0, count * sizeof(*entry->buflist));
-
- entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
- DRM_MEM_SEGS);
- if (!entry->seglist) {
- drm_free(entry->buflist,
- count * sizeof(*entry->buflist), DRM_MEM_BUFS);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(entry->seglist, 0, count * sizeof(*entry->seglist));
-
- /* Keep the original pagelist until we know all the allocations
- * have succeeded
- */
- temp_pagelist = drm_alloc((dma->page_count + (count << page_order))
- * sizeof(*dma->pagelist), DRM_MEM_PAGES);
- if (!temp_pagelist) {
- drm_free(entry->buflist,
- count * sizeof(*entry->buflist), DRM_MEM_BUFS);
- drm_free(entry->seglist,
- count * sizeof(*entry->seglist), DRM_MEM_SEGS);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memcpy(temp_pagelist,
- dma->pagelist, dma->page_count * sizeof(*dma->pagelist));
- DRM_DEBUG("pagelist: %d entries\n",
- dma->page_count + (count << page_order));
-
- entry->buf_size = size;
- entry->page_order = page_order;
- byte_count = 0;
- page_count = 0;
-
- while (entry->buf_count < count) {
-
- dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
-
- if (!dmah) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- entry->seg_count = count;
- drm_cleanup_buf_error(dev, entry);
- drm_free(temp_pagelist,
- (dma->page_count + (count << page_order))
- * sizeof(*dma->pagelist), DRM_MEM_PAGES);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- entry->seglist[entry->seg_count++] = dmah;
- for (i = 0; i < (1 << page_order); i++) {
- DRM_DEBUG("page %d @ 0x%08lx\n",
- dma->page_count + page_count,
- (unsigned long)dmah->vaddr + PAGE_SIZE * i);
- temp_pagelist[dma->page_count + page_count++]
- = (unsigned long)dmah->vaddr + PAGE_SIZE * i;
- }
- for (offset = 0;
- offset + size <= total && entry->buf_count < count;
- offset += alignment, ++entry->buf_count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
- buf->offset = (dma->byte_count + byte_count + offset);
- buf->address = (void *)(dmah->vaddr + offset);
- buf->bus_address = dmah->busaddr + offset;
- buf->next = NULL;
- buf->waiting = 0;
- buf->pending = 0;
- init_waitqueue_head(&buf->dma_wait);
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->dev_priv_size;
- buf->dev_private = drm_alloc(buf->dev_priv_size,
- DRM_MEM_BUFS);
- if (!buf->dev_private) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- entry->seg_count = count;
- drm_cleanup_buf_error(dev, entry);
- drm_free(temp_pagelist,
- (dma->page_count +
- (count << page_order))
- * sizeof(*dma->pagelist),
- DRM_MEM_PAGES);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(buf->dev_private, 0, buf->dev_priv_size);
-
- DRM_DEBUG("buffer %d @ %p\n",
- entry->buf_count, buf->address);
- }
- byte_count += PAGE_SIZE << page_order;
- }
-
- temp_buflist = drm_realloc(dma->buflist,
- dma->buf_count * sizeof(*dma->buflist),
- (dma->buf_count + entry->buf_count)
- * sizeof(*dma->buflist), DRM_MEM_BUFS);
- if (!temp_buflist) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- drm_free(temp_pagelist,
- (dma->page_count + (count << page_order))
- * sizeof(*dma->pagelist), DRM_MEM_PAGES);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- /* No allocations failed, so now we can replace the orginal pagelist
- * with the new one.
- */
- if (dma->page_count) {
- drm_free(dma->pagelist,
- dma->page_count * sizeof(*dma->pagelist),
- DRM_MEM_PAGES);
- }
- dma->pagelist = temp_pagelist;
-
- dma->buf_count += entry->buf_count;
- dma->seg_count += entry->seg_count;
- dma->page_count += entry->seg_count << page_order;
- dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
-
- mutex_unlock(&dev->struct_mutex);
-
- request->count = entry->buf_count;
- request->size = size;
-
- if (request->flags & _DRM_PCI_BUFFER_RO)
- dma->flags = _DRM_DMA_USE_PCI_RO;
-
- atomic_dec(&dev->buf_alloc);
- return 0;
-
-}
-EXPORT_SYMBOL(drm_addbufs_pci);
-
-static int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_entry *entry;
- struct drm_buf *buf;
- unsigned long offset;
- unsigned long agp_offset;
- int count;
- int order;
- int size;
- int alignment;
- int page_order;
- int total;
- int byte_count;
- int i;
- struct drm_buf **temp_buflist;
-
- if (!drm_core_check_feature(dev, DRIVER_SG))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? PAGE_ALIGN(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- byte_count = 0;
- agp_offset = request->agp_start;
-
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %lu\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
-
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return -EINVAL;
- if (dev->queue_count)
- return -EBUSY; /* Not while in use */
-
- spin_lock(&dev->count_lock);
- if (dev->buf_use) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- atomic_inc(&dev->buf_alloc);
- spin_unlock(&dev->count_lock);
-
- mutex_lock(&dev->struct_mutex);
- entry = &dma->bufs[order];
- if (entry->buf_count) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM; /* May only call once for each order */
- }
-
- if (count < 0 || count > 4096) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -EINVAL;
- }
-
- entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
- DRM_MEM_BUFS);
- if (!entry->buflist) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(entry->buflist, 0, count * sizeof(*entry->buflist));
-
- entry->buf_size = size;
- entry->page_order = page_order;
-
- offset = 0;
-
- while (entry->buf_count < count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
-
- buf->offset = (dma->byte_count + offset);
- buf->bus_address = agp_offset + offset;
- buf->address = (void *)(agp_offset + offset
- + (unsigned long)dev->sg->virtual);
- buf->next = NULL;
- buf->waiting = 0;
- buf->pending = 0;
- init_waitqueue_head(&buf->dma_wait);
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->dev_priv_size;
- buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
- if (!buf->dev_private) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
-
- memset(buf->dev_private, 0, buf->dev_priv_size);
-
- DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
-
- offset += alignment;
- entry->buf_count++;
- byte_count += PAGE_SIZE << page_order;
- }
-
- DRM_DEBUG("byte_count: %d\n", byte_count);
-
- temp_buflist = drm_realloc(dma->buflist,
- dma->buf_count * sizeof(*dma->buflist),
- (dma->buf_count + entry->buf_count)
- * sizeof(*dma->buflist), DRM_MEM_BUFS);
- if (!temp_buflist) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- dma->buf_count += entry->buf_count;
- dma->seg_count += entry->seg_count;
- dma->page_count += byte_count >> PAGE_SHIFT;
- dma->byte_count += byte_count;
-
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
-
- mutex_unlock(&dev->struct_mutex);
-
- request->count = entry->buf_count;
- request->size = size;
-
- dma->flags = _DRM_DMA_USE_SG;
-
- atomic_dec(&dev->buf_alloc);
- return 0;
-}
-
-int drm_addbufs_fb(struct drm_device *dev, struct drm_buf_desc *request)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_entry *entry;
- struct drm_buf *buf;
- unsigned long offset;
- unsigned long agp_offset;
- int count;
- int order;
- int size;
- int alignment;
- int page_order;
- int total;
- int byte_count;
- int i;
- struct drm_buf **temp_buflist;
-
- if (!drm_core_check_feature(dev, DRIVER_FB_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
- count = request->count;
- order = drm_order(request->size);
- size = 1 << order;
-
- alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? PAGE_ALIGN(size) : size;
- page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
- total = PAGE_SIZE << page_order;
-
- byte_count = 0;
- agp_offset = request->agp_start;
-
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %lu\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
-
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return -EINVAL;
- if (dev->queue_count)
- return -EBUSY; /* Not while in use */
-
- spin_lock(&dev->count_lock);
- if (dev->buf_use) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- atomic_inc(&dev->buf_alloc);
- spin_unlock(&dev->count_lock);
-
- mutex_lock(&dev->struct_mutex);
- entry = &dma->bufs[order];
- if (entry->buf_count) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM; /* May only call once for each order */
- }
-
- if (count < 0 || count > 4096) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -EINVAL;
- }
-
- entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
- DRM_MEM_BUFS);
- if (!entry->buflist) {
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(entry->buflist, 0, count * sizeof(*entry->buflist));
-
- entry->buf_size = size;
- entry->page_order = page_order;
-
- offset = 0;
-
- while (entry->buf_count < count) {
- buf = &entry->buflist[entry->buf_count];
- buf->idx = dma->buf_count + entry->buf_count;
- buf->total = alignment;
- buf->order = order;
- buf->used = 0;
-
- buf->offset = (dma->byte_count + offset);
- buf->bus_address = agp_offset + offset;
- buf->address = (void *)(agp_offset + offset);
- buf->next = NULL;
- buf->waiting = 0;
- buf->pending = 0;
- init_waitqueue_head(&buf->dma_wait);
- buf->file_priv = NULL;
-
- buf->dev_priv_size = dev->driver->dev_priv_size;
- buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
- if (!buf->dev_private) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- memset(buf->dev_private, 0, buf->dev_priv_size);
-
- DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
-
- offset += alignment;
- entry->buf_count++;
- byte_count += PAGE_SIZE << page_order;
- }
-
- DRM_DEBUG("byte_count: %d\n", byte_count);
-
- temp_buflist = drm_realloc(dma->buflist,
- dma->buf_count * sizeof(*dma->buflist),
- (dma->buf_count + entry->buf_count)
- * sizeof(*dma->buflist), DRM_MEM_BUFS);
- if (!temp_buflist) {
- /* Free the entry because it isn't valid */
- drm_cleanup_buf_error(dev, entry);
- mutex_unlock(&dev->struct_mutex);
- atomic_dec(&dev->buf_alloc);
- return -ENOMEM;
- }
- dma->buflist = temp_buflist;
-
- for (i = 0; i < entry->buf_count; i++) {
- dma->buflist[i + dma->buf_count] = &entry->buflist[i];
- }
-
- dma->buf_count += entry->buf_count;
- dma->seg_count += entry->seg_count;
- dma->page_count += byte_count >> PAGE_SHIFT;
- dma->byte_count += byte_count;
-
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
-
- mutex_unlock(&dev->struct_mutex);
-
- request->count = entry->buf_count;
- request->size = size;
-
- dma->flags = _DRM_DMA_USE_FB;
-
- atomic_dec(&dev->buf_alloc);
- return 0;
-}
-EXPORT_SYMBOL(drm_addbufs_fb);
-
-
-/**
- * Add buffers for DMA transfers (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a struct drm_buf_desc request.
- * \return zero on success or a negative number on failure.
- *
- * According with the memory type specified in drm_buf_desc::flags and the
- * build options, it dispatches the call either to addbufs_agp(),
- * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
- * PCI memory respectively.
- */
-int drm_addbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_buf_desc *request = data;
- int ret;
-
- if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
- return -EINVAL;
-
-#if __OS_HAS_AGP
- if (request->flags & _DRM_AGP_BUFFER)
- ret = drm_addbufs_agp(dev, request);
- else
-#endif
- if (request->flags & _DRM_SG_BUFFER)
- ret = drm_addbufs_sg(dev, request);
- else if (request->flags & _DRM_FB_BUFFER)
- ret = drm_addbufs_fb(dev, request);
- else
- ret = drm_addbufs_pci(dev, request);
-
- return ret;
-}
-
-/**
- * Get information about the buffer mappings.
- *
- * This was originally mean for debugging purposes, or by a sophisticated
- * client library to determine how best to use the available buffers (e.g.,
- * large buffers can be used for image transfer).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_buf_info structure.
- * \return zero on success or a negative number on failure.
- *
- * Increments drm_device::buf_use while holding the drm_device::count_lock
- * lock, preventing of allocating more buffers after this call. Information
- * about each requested buffer is then copied into user space.
- */
-int drm_infobufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_info *request = data;
- int i;
- int count;
-
- if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- spin_lock(&dev->count_lock);
- if (atomic_read(&dev->buf_alloc)) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- ++dev->buf_use; /* Can't allocate more after this call */
- spin_unlock(&dev->count_lock);
-
- for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
- if (dma->bufs[i].buf_count)
- ++count;
- }
-
- DRM_DEBUG("count = %d\n", count);
-
- if (request->count >= count) {
- for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
- if (dma->bufs[i].buf_count) {
- struct drm_buf_desc __user *to =
- &request->list[count];
- struct drm_buf_entry *from = &dma->bufs[i];
- struct drm_freelist *list = &dma->bufs[i].freelist;
- if (copy_to_user(&to->count,
- &from->buf_count,
- sizeof(from->buf_count)) ||
- copy_to_user(&to->size,
- &from->buf_size,
- sizeof(from->buf_size)) ||
- copy_to_user(&to->low_mark,
- &list->low_mark,
- sizeof(list->low_mark)) ||
- copy_to_user(&to->high_mark,
- &list->high_mark,
- sizeof(list->high_mark)))
- return -EFAULT;
-
- DRM_DEBUG("%d %d %d %d %d\n",
- i,
- dma->bufs[i].buf_count,
- dma->bufs[i].buf_size,
- dma->bufs[i].freelist.low_mark,
- dma->bufs[i].freelist.high_mark);
- ++count;
- }
- }
- }
- request->count = count;
-
- return 0;
-}
-
-/**
- * Specifies a low and high water mark for buffer allocation
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg a pointer to a drm_buf_desc structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies that the size order is bounded between the admissible orders and
- * updates the respective drm_device_dma::bufs entry low and high water mark.
- *
- * \note This ioctl is deprecated and mostly never used.
- */
-int drm_markbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_desc *request = data;
- int order;
- struct drm_buf_entry *entry;
-
- if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- DRM_DEBUG("%d, %d, %d\n",
- request->size, request->low_mark, request->high_mark);
- order = drm_order(request->size);
- if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
- return -EINVAL;
- entry = &dma->bufs[order];
-
- if (request->low_mark < 0 || request->low_mark > entry->buf_count)
- return -EINVAL;
- if (request->high_mark < 0 || request->high_mark > entry->buf_count)
- return -EINVAL;
-
- entry->freelist.low_mark = request->low_mark;
- entry->freelist.high_mark = request->high_mark;
-
- return 0;
-}
-
-/**
- * Unreserve the buffers in list, previously reserved using drmDMA.
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_buf_free structure.
- * \return zero on success or a negative number on failure.
- *
- * Calls free_buffer() for each used buffer.
- * This function is primarily used for debugging.
- */
-int drm_freebufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_device_dma *dma = dev->dma;
- struct drm_buf_free *request = data;
- int i;
- int idx;
- struct drm_buf *buf;
-
- if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- DRM_DEBUG("%d\n", request->count);
- for (i = 0; i < request->count; i++) {
- if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
- return -EFAULT;
- if (idx < 0 || idx >= dma->buf_count) {
- DRM_ERROR("Index %d (of %d max)\n",
- idx, dma->buf_count - 1);
- return -EINVAL;
- }
- buf = dma->buflist[idx];
- if (buf->file_priv != file_priv) {
- DRM_ERROR("Process %d freeing buffer not owned\n",
- current->pid);
- return -EINVAL;
- }
- drm_free_buffer(dev, buf);
- }
-
- return 0;
-}
-
-/**
- * Maps all of the DMA buffers into client-virtual space (ioctl).
- *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a drm_buf_map structure.
- * \return zero on success or a negative number on failure.
- *
- * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information
- * about each buffer into user space. For PCI buffers, it calls do_mmap() with
- * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
- * drm_mmap_dma().
- */
-int drm_mapbufs(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_device_dma *dma = dev->dma;
- int retcode = 0;
- const int zero = 0;
- unsigned long virtual;
- unsigned long address;
- struct drm_buf_map *request = data;
- int i;
-
- if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
- return -EINVAL;
-
- if (!dma)
- return -EINVAL;
-
- spin_lock(&dev->count_lock);
- if (atomic_read(&dev->buf_alloc)) {
- spin_unlock(&dev->count_lock);
- return -EBUSY;
- }
- dev->buf_use++; /* Can't allocate more after this call */
- spin_unlock(&dev->count_lock);
-
- if (request->count >= dma->buf_count) {
- if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP))
- || (drm_core_check_feature(dev, DRIVER_SG)
- && (dma->flags & _DRM_DMA_USE_SG))
- || (drm_core_check_feature(dev, DRIVER_FB_DMA)
- && (dma->flags & _DRM_DMA_USE_FB))) {
- struct drm_map *map = dev->agp_buffer_map;
- unsigned long token = dev->agp_buffer_token;
-
- if (!map) {
- retcode = -EINVAL;
- goto done;
- }
- down_write(&current->mm->mmap_sem);
- virtual = do_mmap(file_priv->filp, 0, map->size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- token);
- up_write(&current->mm->mmap_sem);
- } else {
- down_write(&current->mm->mmap_sem);
- virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, 0);
- up_write(&current->mm->mmap_sem);
- }
- if (virtual > -1024UL) {
- /* Real error */
- retcode = (signed long)virtual;
- goto done;
- }
- request->virtual = (void __user *)virtual;
-
- for (i = 0; i < dma->buf_count; i++) {
- if (copy_to_user(&request->list[i].idx,
- &dma->buflist[i]->idx,
- sizeof(request->list[0].idx))) {
- retcode = -EFAULT;
- goto done;
- }
- if (copy_to_user(&request->list[i].total,
- &dma->buflist[i]->total,
- sizeof(request->list[0].total))) {
- retcode = -EFAULT;
- goto done;
- }
- if (copy_to_user(&request->list[i].used,
- &zero, sizeof(zero))) {
- retcode = -EFAULT;
- goto done;
- }
- address = virtual + dma->buflist[i]->offset; /* *** */
- if (copy_to_user(&request->list[i].address,
- &address, sizeof(address))) {
- retcode = -EFAULT;
- goto done;
- }
- }
- }
- done:
- request->count = dma->buf_count;
- DRM_DEBUG("%d buffers, retcode = %d\n", request->count, retcode);
-
- return retcode;
-}
-
-/**
- * Compute size order. Returns the exponent of the smaller power of two which
- * is greater or equal to given number.
- *
- * \param size size.
- * \return order.
- *
- * \todo Can be made faster.
- */
-int drm_order(unsigned long size)
-{
- int order;
- unsigned long tmp;
-
- for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ;
-
- if (size & (size - 1))
- ++order;
-
- return order;
-}
-EXPORT_SYMBOL(drm_order);
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
deleted file mode 100644
index 3bf9d100..00000000
--- a/linux-core/drm_compat.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/**************************************************************************
- *
- * This kernel module is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- **************************************************************************/
-/*
- * This code provides access to unexported mm kernel features. It is necessary
- * to use the new DRM memory manager code with kernels that don't support it
- * directly.
- *
- * Authors: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
- * Linux kernel mm subsystem authors.
- * (Most code taken from there).
- */
-
-#include "drmP.h"
-
-#ifdef DRM_IDR_COMPAT_FN
-/* only called when idp->lock is held */
-static void __free_layer(struct idr *idp, struct idr_layer *p)
-{
- p->ary[0] = idp->id_free;
- idp->id_free = p;
- idp->id_free_cnt++;
-}
-
-static void free_layer(struct idr *idp, struct idr_layer *p)
-{
- unsigned long flags;
-
- /*
- * Depends on the return element being zeroed.
- */
- spin_lock_irqsave(&idp->lock, flags);
- __free_layer(idp, p);
- spin_unlock_irqrestore(&idp->lock, flags);
-}
-
-/**
- * idr_for_each - iterate through all stored pointers
- * @idp: idr handle
- * @fn: function to be called for each pointer
- * @data: data passed back to callback function
- *
- * Iterate over the pointers registered with the given idr. The
- * callback function will be called for each pointer currently
- * registered, passing the id, the pointer and the data pointer passed
- * to this function. It is not safe to modify the idr tree while in
- * the callback, so functions such as idr_get_new and idr_remove are
- * not allowed.
- *
- * We check the return of @fn each time. If it returns anything other
- * than 0, we break out and return that value.
- *
-* The caller must serialize idr_find() vs idr_get_new() and idr_remove().
- */
-int idr_for_each(struct idr *idp,
- int (*fn)(int id, void *p, void *data), void *data)
-{
- int n, id, max, error = 0;
- struct idr_layer *p;
- struct idr_layer *pa[MAX_LEVEL];
- struct idr_layer **paa = &pa[0];
-
- n = idp->layers * IDR_BITS;
- p = idp->top;
- max = 1 << n;
-
- id = 0;
- while (id < max) {
- while (n > 0 && p) {
- n -= IDR_BITS;
- *paa++ = p;
- p = p->ary[(id >> n) & IDR_MASK];
- }
-
- if (p) {
- error = fn(id, (void *)p, data);
- if (error)
- break;
- }
-
- id += 1 << n;
- while (n < fls(id)) {
- n += IDR_BITS;
- p = *--paa;
- }
- }
-
- return error;
-}
-EXPORT_SYMBOL(idr_for_each);
-
-/**
- * idr_remove_all - remove all ids from the given idr tree
- * @idp: idr handle
- *
- * idr_destroy() only frees up unused, cached idp_layers, but this
- * function will remove all id mappings and leave all idp_layers
- * unused.
- *
- * A typical clean-up sequence for objects stored in an idr tree, will
- * use idr_for_each() to free all objects, if necessay, then
- * idr_remove_all() to remove all ids, and idr_destroy() to free
- * up the cached idr_layers.
- */
-void idr_remove_all(struct idr *idp)
-{
- int n, id, max, error = 0;
- struct idr_layer *p;
- struct idr_layer *pa[MAX_LEVEL];
- struct idr_layer **paa = &pa[0];
-
- n = idp->layers * IDR_BITS;
- p = idp->top;
- max = 1 << n;
-
- id = 0;
- while (id < max && !error) {
- while (n > IDR_BITS && p) {
- n -= IDR_BITS;
- *paa++ = p;
- p = p->ary[(id >> n) & IDR_MASK];
- }
-
- id += 1 << n;
- while (n < fls(id)) {
- if (p) {
- memset(p, 0, sizeof *p);
- free_layer(idp, p);
- }
- n += IDR_BITS;
- p = *--paa;
- }
- }
- idp->top = NULL;
- idp->layers = 0;
-}
-EXPORT_SYMBOL(idr_remove_all);
-
-#endif /* DRM_IDR_COMPAT_FN */
diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h
deleted file mode 100644
index 78bcacd6..00000000
--- a/linux-core/drm_compat.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/**
- * \file drm_compat.h
- * Backward compatability definitions for Direct Rendering Manager
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-/*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_COMPAT_H_
-#define _DRM_COMPAT_H_
-
-#ifndef minor
-#define minor(x) MINOR((x))
-#endif
-
-#ifndef MODULE_LICENSE
-#define MODULE_LICENSE(x)
-#endif
-
-#ifndef preempt_disable
-#define preempt_disable()
-#define preempt_enable()
-#endif
-
-#ifndef pte_offset_map
-#define pte_offset_map pte_offset
-#define pte_unmap(pte)
-#endif
-
-#ifndef module_param
-#define module_param(name, type, perm)
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-#define current_euid() (current->euid)
-#else
-#include <linux/cred.h>
-#endif
-
-#ifndef list_for_each_safe
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-#endif
-
-#ifndef list_for_each_entry
-#define list_for_each_entry(pos, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-#endif
-
-#ifndef list_for_each_entry_safe
-#define list_for_each_entry_safe(pos, n, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \</