Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/external/bsd/drm2/pci Pull up following revision(s) (...



details:   https://anonhg.NetBSD.org/src/rev/6a82247aff63
branches:  netbsd-8
changeset: 434165:6a82247aff63
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Aug 01 23:12:06 2017 +0000

description:
Pull up following revision(s) (requested by nonaka in ticket #163):
        sys/external/bsd/drm2/pci/drm_pci.c: revision 1.18
PR/52409: Avoid panic at resume.

diffstat:

 sys/external/bsd/drm2/pci/drm_pci.c |  31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diffs (65 lines):

diff -r a63c45da847f -r 6a82247aff63 sys/external/bsd/drm2/pci/drm_pci.c
--- a/sys/external/bsd/drm2/pci/drm_pci.c       Tue Aug 01 23:10:00 2017 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci.c       Tue Aug 01 23:12:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_pci.c,v 1.17 2017/06/01 02:45:12 chs Exp $ */
+/*     $NetBSD: drm_pci.c,v 1.17.2.1 2017/08/01 23:12:06 snj Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.17 2017/06/01 02:45:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.17.2.1 2017/08/01 23:12:06 snj Exp $");
 
 #include <sys/types.h>
 #include <sys/errno.h>
@@ -243,11 +243,23 @@
        irq_cookie = kmem_alloc(sizeof(*irq_cookie), KM_SLEEP);
 
        if (dev->pdev->msi_enabled) {
-               irq_cookie->intr_handles = dev->pdev->intr_handles;
-               dev->pdev->intr_handles = NULL;
+               if (dev->pdev->intr_handles == NULL) {
+                       if (pci_msi_alloc_exact(pa, &irq_cookie->intr_handles,
+                           1)) {
+                               aprint_error_dev(dev->dev,
+                                   "couldn't allocate MSI (%s)\n", name);
+                               goto error;
+                       }
+               } else {
+                       irq_cookie->intr_handles = dev->pdev->intr_handles;
+                       dev->pdev->intr_handles = NULL;
+               }
        } else {
-               if (pci_intx_alloc(pa, &irq_cookie->intr_handles))
-                       return -ENOENT;
+               if (pci_intx_alloc(pa, &irq_cookie->intr_handles)) {
+                       aprint_error_dev(dev->dev,
+                           "couldn't allocate INTx interrupt (%s)\n", name);
+                       goto error;
+               }
        }
 
        intrstr = pci_intr_string(pa->pa_pc, irq_cookie->intr_handles[0],
@@ -257,12 +269,17 @@
        if (irq_cookie->ih_cookie == NULL) {
                aprint_error_dev(dev->dev,
                    "couldn't establish interrupt at %s (%s)\n", intrstr, name);
-               return -ENOENT;
+               pci_intr_release(pa->pa_pc, irq_cookie->intr_handles, 1);
+               goto error;
        }
 
        aprint_normal_dev(dev->dev, "interrupting at %s (%s)\n", intrstr, name);
        *cookiep = irq_cookie;
        return 0;
+
+error:
+       kmem_free(irq_cookie, sizeof(*irq_cookie));
+       return -ENOENT;
 }
 
 static void



Home | Main Index | Thread Index | Old Index