Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2 Handle attach failure and don...
details: https://anonhg.NetBSD.org/src/rev/09bbdd272a90
branches: riastradh-drm2
changeset: 788642:09bbdd272a90
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Mar 05 14:42:27 2014 +0000
description:
Handle attach failure and don't try a framebuffer in i915 on failure.
diffstat:
sys/external/bsd/drm2/dist/include/drm/drmP.h | 2 +-
sys/external/bsd/drm2/drm/drm_drv.c | 34 ++++++++++++++++++++------
sys/external/bsd/drm2/i915drm/i915_pci.c | 12 +++++++--
3 files changed, 36 insertions(+), 12 deletions(-)
diffs (148 lines):
diff -r a7f296fa84d9 -r 09bbdd272a90 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h Wed Mar 05 08:45:06 2014 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h Wed Mar 05 14:42:27 2014 +0000
@@ -1469,7 +1469,7 @@
#endif
#ifdef __NetBSD__
-extern void drm_config_found(device_t, /* XXXX const */ struct drm_driver *,
+extern int drm_config_found(device_t, /* XXX const */ struct drm_driver *,
unsigned long, struct drm_device *);
#endif
diff -r a7f296fa84d9 -r 09bbdd272a90 sys/external/bsd/drm2/drm/drm_drv.c
--- a/sys/external/bsd/drm2/drm/drm_drv.c Wed Mar 05 08:45:06 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_drv.c Wed Mar 05 14:42:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_drv.c,v 1.1.2.36 2014/03/04 20:45:16 riastradh Exp $ */
+/* $NetBSD: drm_drv.c,v 1.1.2.37 2014/03/05 14:42:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.1.2.36 2014/03/04 20:45:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.1.2.37 2014/03/05 14:42:27 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -49,6 +49,8 @@
#include <uvm/uvm_extern.h>
+#include <prop/proplib.h>
+
#include <drm/drmP.h>
#include "ioconf.h"
@@ -327,6 +329,7 @@
if (device_unit(self) >= 64) { /* XXX Need to do something here! */
aprint_error_dev(self, "can't handle >=64 drm devices!");
+ error = ENFILE; /* XXX */
goto fail0;
}
@@ -373,8 +376,11 @@
/* XXX errno Linux->NetBSD */
error = -drm_mode_group_init_legacy_group(dev,
&dev->primary->mode_group);
- if (error)
+ if (error) {
+ aprint_error_dev(parent, "unable to init legacy group"
+ ": %d\n", error);
goto fail2;
+ }
}
/* Success! */
@@ -384,7 +390,8 @@
fail2: if (dev->driver->unload != NULL)
(*dev->driver->unload)(dev);
fail1: drm_undo_fill_in_dev(dev);
-fail0: return;
+fail0: prop_dictionary_set_int64(device_properties(self), "error",
+ (int64_t)error);
}
static int
@@ -893,22 +900,33 @@
return error;
}
-void
+int
drm_config_found(device_t parent, struct drm_driver *driver,
unsigned long flags, struct drm_device *dev)
{
static const struct drm_attach_args zero_daa;
struct drm_attach_args daa = zero_daa;
+ device_t child;
+ int64_t error64;
+ int error = 0;
daa.daa_drm_dev = dev;
daa.daa_driver = driver;
daa.daa_flags = flags;
dev->driver = driver;
- if (config_found_ia(parent, "drmkmsbus", &daa, NULL) == NULL) {
- aprint_error_dev(parent, "unable to attach drm\n");
- return;
+
+ child = config_found_ia(parent, "drmkmsbus", &daa, NULL);
+ if (child == NULL) {
+ aprint_error_dev(parent, "no drm pseudo-device found\n");
+ return ENOENT;
}
+
+ if (prop_dictionary_get_int64(device_properties(child), "error",
+ &error64))
+ error = (int)error64;
+
+ return error;
}
struct drm_local_map *
diff -r a7f296fa84d9 -r 09bbdd272a90 sys/external/bsd/drm2/i915drm/i915_pci.c
--- a/sys/external/bsd/drm2/i915drm/i915_pci.c Wed Mar 05 08:45:06 2014 +0000
+++ b/sys/external/bsd/drm2/i915drm/i915_pci.c Wed Mar 05 14:42:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_pci.c,v 1.1.2.12 2014/01/29 19:48:14 riastradh Exp $ */
+/* $NetBSD: i915_pci.c,v 1.1.2.13 2014/03/05 14:42:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.1.2.12 2014/01/29 19:48:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.1.2.13 2014/03/05 14:42:27 riastradh Exp $");
#include <sys/types.h>
#ifndef _MODULE
@@ -153,6 +153,7 @@
const struct intel_device_info *const info = i915drm_pci_lookup(pa);
const unsigned long flags =
(unsigned long)(uintptr_t)(const void *)info;
+ int error;
KASSERT(info != NULL);
@@ -171,7 +172,12 @@
drm_pci_attach(self, pa, &sc->sc_pci_dev, &sc->sc_drm_dev);
/* Attach the drm driver. */
- drm_config_found(self, i915_drm_driver, flags, &sc->sc_drm_dev);
+ error = drm_config_found(self, i915_drm_driver, flags,
+ &sc->sc_drm_dev);
+ if (error) {
+ aprint_error_dev(self, "unable to attach drm: %d\n", error);
+ return;
+ }
/* Attach a framebuffer, but not until interrupts work. */
config_interrupts(self, &i915drm_attach_framebuffer);
Home |
Main Index |
Thread Index |
Old Index