diff options
author | Jonathan Gray | 2016-11-30 22:18:42 -0600 |
---|---|---|
committer | Emil Velikov | 2016-12-05 11:53:05 -0600 |
commit | fd190564daa4cd530833a94606646730a5c0ee6c (patch) | |
tree | 01dc3c2e199f12f185a728da7c3e852411acbf2c | |
parent | c0ef1d078800a43611136e65be3c9c7472ac9d3f (diff) | |
download | external-libdrm-fd190564daa4cd530833a94606646730a5c0ee6c.tar.gz external-libdrm-fd190564daa4cd530833a94606646730a5c0ee6c.tar.xz external-libdrm-fd190564daa4cd530833a94606646730a5c0ee6c.zip |
xf86drm: implement drmParsePciBusInfo for OpenBSD
Implement drmParsePciBusInfo for OpenBSD by using the new
DRM_IOCTL_GET_PCIINFO ioctl.
v2: use drmGetMinorType to get node type instead of always
using DRM_NODE_PRIMARY.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r-- | xf86drm.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -2947,6 +2947,30 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info) | |||
2947 | info->func = func; | 2947 | info->func = func; |
2948 | 2948 | ||
2949 | return 0; | 2949 | return 0; |
2950 | #elif defined(__OpenBSD__) | ||
2951 | struct drm_pciinfo pinfo; | ||
2952 | int fd, type; | ||
2953 | |||
2954 | type = drmGetMinorType(min); | ||
2955 | if (type == -1) | ||
2956 | return -ENODEV; | ||
2957 | |||
2958 | fd = drmOpenMinor(min, 0, type); | ||
2959 | if (fd < 0) | ||
2960 | return -errno; | ||
2961 | |||
2962 | if (drmIoctl(fd, DRM_IOCTL_GET_PCIINFO, &pinfo)) { | ||
2963 | close(fd); | ||
2964 | return -errno; | ||
2965 | } | ||
2966 | close(fd); | ||
2967 | |||
2968 | info->domain = pinfo.domain; | ||
2969 | info->bus = pinfo.bus; | ||
2970 | info->dev = pinfo.dev; | ||
2971 | info->func = pinfo.func; | ||
2972 | |||
2973 | return 0; | ||
2950 | #else | 2974 | #else |
2951 | #warning "Missing implementation of drmParsePciBusInfo" | 2975 | #warning "Missing implementation of drmParsePciBusInfo" |
2952 | return -EINVAL; | 2976 | return -EINVAL; |