mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
drm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted
For now, keep the static array for i915. But eventually, it should be moved to a callback in the driver itself.
This commit is contained in:
parent
f7eda40d0e
commit
22f61fe5d4
2 changed files with 24 additions and 10 deletions
|
|
@ -698,6 +698,7 @@ struct drm_gem_object {
|
|||
|
||||
struct drm_driver_info {
|
||||
int (*load)(struct drm_device *, unsigned long flags);
|
||||
int (*use_msi)(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);
|
||||
|
|
@ -829,8 +830,10 @@ 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 */
|
||||
uint16_t pci_device; /* PCI device id */
|
||||
uint16_t pci_vendor; /* PCI vendor id */
|
||||
uint16_t pci_subdevice; /* PCI subsystem device id */
|
||||
uint16_t pci_subvendor; /* PCI subsystem vendor id */
|
||||
|
||||
char *unique; /* Unique identifier: e.g., busid */
|
||||
int unique_len; /* Length of unique field */
|
||||
|
|
|
|||
|
|
@ -209,13 +209,22 @@ static struct drm_msi_blacklist_entry drm_msi_blacklist[] = {
|
|||
{0, 0}
|
||||
};
|
||||
|
||||
static int drm_msi_is_blacklisted(int vendor, int device)
|
||||
static int drm_msi_is_blacklisted(struct drm_device *dev, unsigned long flags)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (dev->driver->use_msi != NULL) {
|
||||
int use_msi;
|
||||
|
||||
use_msi = dev->driver->use_msi(dev, flags);
|
||||
|
||||
return (!use_msi);
|
||||
}
|
||||
|
||||
/* TODO: Maybe move this to a callback in i915? */
|
||||
for (i = 0; drm_msi_blacklist[i].vendor != 0; i++) {
|
||||
if ((drm_msi_blacklist[i].vendor == vendor) &&
|
||||
(drm_msi_blacklist[i].device == device)) {
|
||||
if ((drm_msi_blacklist[i].vendor == dev->pci_vendor) &&
|
||||
(drm_msi_blacklist[i].device == dev->pci_device)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -264,10 +273,16 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
|
|||
|
||||
dev->pci_vendor = pci_get_vendor(dev->device);
|
||||
dev->pci_device = pci_get_device(dev->device);
|
||||
dev->pci_subvendor = pci_get_subvendor(dev->device);
|
||||
dev->pci_subdevice = pci_get_subdevice(dev->device);
|
||||
|
||||
id_entry = drm_find_description(dev->pci_vendor,
|
||||
dev->pci_device, idlist);
|
||||
dev->id_entry = id_entry;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) {
|
||||
if (drm_msi &&
|
||||
!drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) {
|
||||
!drm_msi_is_blacklisted(dev, dev->id_entry->driver_private)) {
|
||||
msicount = pci_msi_count(dev->device);
|
||||
DRM_DEBUG("MSI count = %d\n", msicount);
|
||||
if (msicount > 1)
|
||||
|
|
@ -297,10 +312,6 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
|
|||
mtx_init(&dev->event_lock, "drmev", NULL, MTX_DEF);
|
||||
sx_init(&dev->dev_struct_lock, "drmslk");
|
||||
|
||||
id_entry = drm_find_description(dev->pci_vendor,
|
||||
dev->pci_device, idlist);
|
||||
dev->id_entry = id_entry;
|
||||
|
||||
error = drm_load(dev);
|
||||
if (error == 0)
|
||||
error = drm_create_cdevs(kdev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue