Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2 Create the nouveau device object so th...



details:   https://anonhg.NetBSD.org/src/rev/8827a7b4d095
branches:  trunk
changeset: 336575:8827a7b4d095
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Mar 06 15:39:28 2015 +0000

description:
Create the nouveau device object so the driver can start.

I get a lot of messages on the console and then it hangs.  Progress!

Next to try with a breakfast console.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c |   8 ++--
 sys/external/bsd/drm2/nouveau/nouveau_pci.c          |  33 ++++++++++++++++---
 2 files changed, 32 insertions(+), 9 deletions(-)

diffs (132 lines):

diff -r b476f8d587d1 -r 8827a7b4d095 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Fri Mar 06 15:09:50 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Fri Mar 06 15:39:28 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $        */
+/*     $NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $        */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.4 2015/03/06 01:43:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $");
 
 #include <linux/console.h>
 #include <linux/module.h>
@@ -64,11 +64,11 @@
 #include "nouveau_debugfs.h"
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
-static char *nouveau_config;
+char *nouveau_config;
 module_param_named(config, nouveau_config, charp, 0400);
 
 MODULE_PARM_DESC(debug, "debug string to pass to driver core");
-static char *nouveau_debug;
+char *nouveau_debug;
 module_param_named(debug, nouveau_debug, charp, 0400);
 
 MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration");
diff -r b476f8d587d1 -r 8827a7b4d095 sys/external/bsd/drm2/nouveau/nouveau_pci.c
--- a/sys/external/bsd/drm2/nouveau/nouveau_pci.c       Fri Mar 06 15:09:50 2015 +0000
+++ b/sys/external/bsd/drm2/nouveau/nouveau_pci.c       Fri Mar 06 15:39:28 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_pci.c,v 1.2 2015/03/06 15:08:02 riastradh Exp $        */
+/*     $NetBSD: nouveau_pci.c,v 1.3 2015/03/06 15:39:28 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.2 2015/03/06 15:08:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.3 2015/03/06 15:39:28 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/device.h>
@@ -39,6 +39,8 @@
 
 #include <drm/drmP.h>
 
+#include <engine/device.h>
+
 #include "nouveau_drm.h"
 #include "nouveau_pci.h"
 
@@ -56,6 +58,7 @@
        }                       sc_task_u;
        struct drm_device       *sc_drm_dev;
        struct pci_dev          sc_pci_dev;
+       struct nouveau_device   *sc_nv_dev;
 };
 
 static int     nouveau_match(device_t, cfdata_t, void *);
@@ -96,11 +99,15 @@
        return 6;               /* XXX Beat genfb_pci...  */
 }
 
+extern char *nouveau_config;
+extern char *nouveau_debug;
+
 static void
 nouveau_attach(device_t parent, device_t self, void *aux)
 {
        struct nouveau_softc *const sc = device_private(self);
        const struct pci_attach_args *const pa = aux;
+       uint64_t devname;
        int error;
 
        pci_aprint_devinfo(pa, NULL);
@@ -114,6 +121,18 @@
        sc->sc_task_state = NOUVEAU_TASK_ATTACH;
        SIMPLEQ_INIT(&sc->sc_task_u.attach);
 
+       devname = (uint64_t)device_unit(device_parent(self)) << 32;
+       devname |= pa->pa_bus << 16;
+       /* XXX errno Linux->NetBSD */
+       error = -nouveau_device_create(&sc->sc_pci_dev, NOUVEAU_BUS_PCI,
+           devname, device_xname(self), nouveau_config, nouveau_debug,
+           &sc->sc_nv_dev);
+       if (error) {
+               aprint_error_dev(self, "unable to create nouveau device: %d\n",
+                   error);
+               return;
+       }
+
        /* XXX errno Linux->NetBSD */
        error = -drm_pci_attach(self, pa, &sc->sc_pci_dev, nouveau_drm_driver,
            0, &sc->sc_drm_dev);
@@ -153,14 +172,17 @@
                return error;
 
        if (sc->sc_task_state == NOUVEAU_TASK_ATTACH)
-               goto out;
+               goto out0;
        if (sc->sc_task_u.workqueue != NULL) {
                workqueue_destroy(sc->sc_task_u.workqueue);
                sc->sc_task_u.workqueue = NULL;
        }
 
+       if (sc->sc_nv_dev == NULL)
+               goto out0;
+
        if (sc->sc_drm_dev == NULL)
-               goto out;
+               goto out1;
        /* XXX errno Linux->NetBSD */
        error = -drm_pci_detach(sc->sc_drm_dev, flags);
        if (error)
@@ -168,7 +190,8 @@
                return error;
        sc->sc_drm_dev = NULL;
 
-out:   pmf_device_deregister(self);
+out1:  nouveau_object_ref(NULL, (void *)&sc->sc_nv_dev);
+out0:  pmf_device_deregister(self);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index