diff options
-rw-r--r-- | sys/dev/pci/drm/drm.h | 20 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 23 |
2 files changed, 41 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm.h b/sys/dev/pci/drm/drm.h index 8bc4c52ef9a..0bde3617efd 100644 --- a/sys/dev/pci/drm/drm.h +++ b/sys/dev/pci/drm/drm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm.h,v 1.20 2015/09/23 23:12:11 kettenis Exp $ */ +/* $OpenBSD: drm.h,v 1.21 2016/11/25 23:33:39 jsg Exp $ */ /** * \file drm.h * Header for the Direct Rendering Manager @@ -706,6 +706,20 @@ struct drm_event_vblank { u_int32_t reserved; }; +#ifdef __OpenBSD__ +struct drm_pciinfo { + uint16_t domain; + uint8_t bus; + uint8_t dev; + uint8_t func; + uint16_t vendor_id; + uint16_t device_id; + uint16_t subvendor_id; + uint16_t subdevice_id; + uint8_t revision_id; +}; +#endif + #include "drm_mode.h" #define DRM_IOCTL_BASE 'd' @@ -734,7 +748,11 @@ struct drm_event_vblank { #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) +#ifdef __OpenBSD__ +#define DRM_IOCTL_GET_PCIINFO DRM_IOR( 0x15, struct drm_pciinfo) +#else #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) +#endif #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index fd273b55ba0..afd36baf2e5 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_drv.c,v 1.149 2016/09/15 02:00:17 dlg Exp $ */ +/* $OpenBSD: drm_drv.c,v 1.150 2016/11/25 23:33:39 jsg Exp $ */ /*- * Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org> * Copyright © 2008 Intel Corporation @@ -81,6 +81,7 @@ int drm_version(struct drm_device *, void *, struct drm_file *); int drm_setversion(struct drm_device *, void *, struct drm_file *); int drm_getmagic(struct drm_device *, void *, struct drm_file *); int drm_authmagic(struct drm_device *, void *, struct drm_file *); +int drm_getpciinfo(struct drm_device *, void *, struct drm_file *); int drm_file_cmp(struct drm_file *, struct drm_file *); SPLAY_PROTOTYPE(drm_file_tree, drm_file, link, drm_file_cmp); @@ -120,6 +121,8 @@ static struct drm_ioctl_desc drm_ioctls[] = { 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), #else + DRM_IOCTL_DEF(DRM_IOCTL_GET_PCIINFO, drm_getpciinfo, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX, drm_noop, DRM_AUTH), #endif @@ -1347,3 +1350,21 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask) PCI_VENDOR(id), PCI_PRODUCT(id), lnkcap, lnkcap2); return 0; } + +int +drm_getpciinfo(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + struct drm_pciinfo *info = data; + + info->domain = 0; + info->bus = dev->pdev->bus->number; + info->dev = PCI_SLOT(dev->pdev->devfn); + info->func = PCI_FUNC(dev->pdev->devfn); + info->vendor_id = dev->pdev->vendor; + info->device_id = dev->pdev->device; + info->subvendor_id = dev->pdev->subsystem_vendor; + info->subdevice_id = dev->pdev->subsystem_device; + info->revision_id = 0; + + return 0; +} |