NetBSD-Bugs archive

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

kern/48706: i915drmkms(4): Too late to have become console.



>Number:         48706
>Category:       kern
>Synopsis:       i915drmkms(4): Too late to have become console.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 04 13:55:00 +0000 2014
>Originator:     NONAKA Kimihiro
>Release:        6.99.39
>Organization:
>Environment:
NetBSD koharu.myhome.local 6.99.39 NetBSD 6.99.39 (KOHARU) #2230: Fri Apr  4 
21:13:54 JST 2014  
nonaka@koharu.myhome.local:/usr/obj.amd64/sys/arch/amd64/compile/KOHARU amd64
>Description:
I think i915drmkms(4) should become console at earlier stage.
>How-To-Repeat:
boot with DRMKMS kernel.
>Fix:
diff -uNr sys.orig/external/bsd/drm2/dist/drm/i915/intel_drv.h 
sys/external/bsd/drm2/dist/drm/i915/intel_drv.h
--- sys.orig/external/bsd/drm2/dist/drm/i915/intel_drv.h        18 Mar 2014 
18:20:42 -0000
+++ sys/external/bsd/drm2/dist/drm/i915/intel_drv.h     4 Apr 2014 12:11:20 
-0000
@@ -34,6 +34,59 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_dp_helper.h>
 
+#ifdef __NetBSD__
+#define _wait_for(COND, MS, W) ({ \
+       int ret__ = 0;                                                  \
+       if (cold) {                                                     \
+               int us = MS * 1000;                                     \
+               while (!(COND)) {                                       \
+                       if (--us < 0) {                                 \
+                               ret__ = -ETIMEDOUT;                     \
+                               break;                                  \
+                       }                                               \
+                       DELAY(1);                                       \
+               }                                                       \
+       } else {                                                        \
+               unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \
+               while (!(COND)) {                                       \
+                       if (time_after(jiffies, timeout__)) {           \
+                               ret__ = -ETIMEDOUT;                     \
+                               break;                                  \
+                       }                                               \
+                       if (W && drm_can_sleep())  {                    \
+                               msleep(W);                              \
+                       } else {                                        \
+                               cpu_relax();                            \
+                       }                                               \
+               }                                                       \
+       }                                                               \
+       ret__;                                                          \
+})
+
+#define wait_for_atomic_us(COND, US) ({ \
+       int ret__ = 0;                                                  \
+       if (cold) {                                                     \
+               int us = US;                                            \
+               while (!(COND)) {                                       \
+                       if (--us < 0) {                                 \
+                               ret__ = -ETIMEDOUT;                     \
+                               break;                                  \
+                       }                                               \
+                       DELAY(1);                                       \
+               }                                                       \
+       } else {                                                        \
+               unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \
+               while (!(COND)) {                                       \
+                       if (time_after(jiffies, timeout__)) {           \
+                               ret__ = -ETIMEDOUT;                     \
+                               break;                                  \
+                       }                                               \
+                       cpu_relax();                                    \
+               }                                                       \
+       }                                                               \
+       ret__;                                                          \
+})
+#else  /* !NetBSD */
 #define _wait_for(COND, MS, W) ({ \
        unsigned long timeout__ = jiffies + msecs_to_jiffies(MS);       \
        int ret__ = 0;                                                  \
@@ -63,6 +116,7 @@
        }                                                               \
        ret__;                                                          \
 })
+#endif /* NetBSD */
 
 #define wait_for(COND, MS) _wait_for(COND, MS, 1)
 #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
diff -uNr sys.orig/external/bsd/drm2/i915drm/i915_pci.c 
sys/external/bsd/drm2/i915drm/i915_pci.c
--- sys.orig/external/bsd/drm2/i915drm/i915_pci.c       2014-04-03 
22:09:45.000000000 +0900
+++ sys/external/bsd/drm2/i915drm/i915_pci.c    2014-04-03 22:17:45.000000000 
+0900
@@ -179,8 +179,8 @@
                return;
        }
 
-       /* Attach a framebuffer, but not until interrupts work.  */
-       config_interrupts(self, &i915drm_attach_framebuffer);
+       /* Attach a framebuffer */
+       i915drm_attach_framebuffer(self);
 }
 
 static int



Home | Main Index | Thread Index | Old Index