Remove compatibility shims for FreeBSD versions older than 8.0.

This commit is contained in:
John Baldwin 2015-06-04 20:36:16 +00:00
parent 7077c42623
commit c2a51a4b0e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283999
13 changed files with 0 additions and 119 deletions

View File

@ -51,9 +51,7 @@ struct drm_file;
#include <sys/conf.h>
#include <sys/sglist.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>
@ -94,11 +92,7 @@ struct drm_file;
#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>
@ -227,11 +221,7 @@ enum {
#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

View File

@ -38,50 +38,15 @@ __FBSDID("$FreeBSD$");
#include "dev/drm/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_cap(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)

View File

@ -1066,15 +1066,9 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
}
vaddr = round_page((vm_offset_t)vms->vm_daddr + MAXDSIZ);
#if __FreeBSD_version >= 600023
retcode = vm_mmap(&vms->vm_map, &vaddr, size, VM_PROT_READ |
VM_PROT_WRITE, VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC, OBJT_DEVICE,
dev->devnode, foff);
#else
retcode = vm_mmap(&vms->vm_map, &vaddr, size, VM_PROT_READ |
VM_PROT_WRITE, VM_PROT_ALL, MAP_SHARED | MAP_NOSYNC,
SLIST_FIRST(&dev->devnode->si_hlist), foff);
#endif
if (retcode)
goto done;

View File

@ -161,19 +161,8 @@ 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)
@ -200,14 +189,7 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
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,
0,
DRM_DEV_UID,
@ -216,11 +198,7 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
"dri/card%d", unit);
dev->devnode->si_drv1 = dev;
#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);

View File

@ -175,15 +175,9 @@ int drm_irq_install(struct drm_device *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;

View File

@ -147,19 +147,11 @@ static device_method_t i915_methods[] = {
};
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);

View File

@ -130,9 +130,5 @@ static driver_t mach64_driver = {
};
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);

View File

@ -74,11 +74,7 @@ static int mga_driver_device_is_agp(struct drm_device * dev)
* 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)
@ -167,9 +163,5 @@ static driver_t mga_driver = {
};
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);

View File

@ -128,9 +128,5 @@ static driver_t r128_driver = {
};
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);

View File

@ -127,9 +127,5 @@ static driver_t radeon_driver = {
};
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);

View File

@ -113,9 +113,5 @@ static driver_t savage_driver = {
};
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);

View File

@ -107,9 +107,5 @@ static driver_t sis_driver = {
};
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);

View File

@ -109,9 +109,5 @@ static driver_t tdfx_driver = {
};
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);