On Wed, Apr 18, 2018 at 06:59:42PM -0700, Carlos Cardenas wrote:
> On Thu, Apr 19, 2018 at 09:35:19AM +1000, Jonathan Gray wrote:
> > On Wed, Apr 18, 2018 at 03:29:10PM -0700, Carlos Cardenas wrote:
> > > Howdy.
> > > 
> > > Please excuse this poor bug report, I'm not able to obtain more info as
> > > the system locks hard (below is transcribed by hand).
> > > 
> > > On a clean install, with the latest snap (as of time of email):
> > > OpenBSD 6.3-current (GENERIC.MP) #207: Wed Apr 18 11:37:15 MDT 2018
> > > 
> > > CPU: AMD A8-7670K Radeon R7 aka Kaveri
> > > 
> > > extent_free(ffffffff819489f8,100,1000,7e281000) at extent_free+0x110
> > > bus_space_unmap(0,ffff8000000de000,0) at bus_space_unmap+0x110
> > > radeon_device_fini(ffff8000000de000) at radeon_device_fini+0x43
> > > radeondrm_detach_kms(0,ffff8000000de000) at radeondrm_detach_kms+0x33
> > > config_detach(ffff8000000dd600,ffff8000000de000) at config_detach+0x14e
> > > radeondrm_attachhook(ffffffff81bf9420) at radeondrm_attachhook+0x9d
> > > config_process_deferred_mountroot() at 
> > > config_process_deferred_mountroot+0x56
> > > main(6dd84e08) at main+0x80f
> > 
> > See the other thread on bugs.  Not sure when a snapshot with the fix
> > will go out.
> 
> I'm tracking bluhm's thread as well.
> 
> With snap #209 (which has that patch), we get further along from a clean
> install:
> 
> initializing kernel modesetting (KAVERI 0x1002:0x1313 0x1462:0x7969).
> cik_cp: Failed to load firmware "radeon/KAVERI_pfp.bin"
> error: [drm:pid0:cik_init] *ERROR* Failed to load Firmware!
> drm:pid0:radeondrm_attachhook *ERROR* Fatal error during GPU init
> ttm_pool_mm_shrink_fini: stub
> drm0 detached
> radeondrm0 detached
> vendor "ATI", unknown product 0x1313 (class display subclass VGA, rev 0xd4) at
> pci0 dev 1 function 0 not configured
> init: can't open /dev/console: Device not configured
> init: can't open /dev/console: Device not configured
> init: can't open /dev/console: Device not configured
> [repeats]

So I'm quite sure you are booting via uefi with efifb here.
There was previously no code that reprobed efifb as efifb isn't probed
via pci devices.

The following on top of radeon.diff.2 works here when removing the
firmware and booting via efiboot on a mullins system.

diff --git sys/arch/amd64/amd64/efifb.c sys/arch/amd64/amd64/efifb.c
index 609de484ae0..42ae666540a 100644
--- sys/arch/amd64/amd64/efifb.c
+++ sys/arch/amd64/amd64/efifb.c
@@ -484,6 +484,12 @@ efifb_cndetach(void)
        efifb_console.detached = 1;
 }
 
+void
+efifb_cnreattach(void)
+{
+       efifb_console.detached = 0;
+}
+
 int
 efifb_cb_cnattach(void)
 {
diff --git sys/arch/amd64/amd64/mainbus.c sys/arch/amd64/amd64/mainbus.c
index ed6ab059329..835e798ef2b 100644
--- sys/arch/amd64/amd64/mainbus.c
+++ sys/arch/amd64/amd64/mainbus.c
@@ -261,6 +261,20 @@ mainbus_attach(struct device *parent, struct device *self, 
void *aux)
 #endif
 }
 
+void
+mainbus_efifb_reattach(void)
+{
+       union mainbus_attach_args mba;
+       struct device *self = device_mainbus();
+#if NEFIFB > 0
+       if (bios_efiinfo != NULL || efifb_cb_found()) {
+               efifb_cnreattach();
+               mba.mba_eaa.eaa_name = "efifb";
+               config_found(self, &mba, mainbus_print);
+       }
+#endif
+}
+
 int
 mainbus_print(void *aux, const char *pnp)
 {
diff --git sys/arch/amd64/include/efifbvar.h sys/arch/amd64/include/efifbvar.h
index f5e2bb26cae..a213811cba6 100644
--- sys/arch/amd64/include/efifbvar.h
+++ sys/arch/amd64/include/efifbvar.h
@@ -28,6 +28,7 @@ struct pci_attach_args;
 int efifb_cnattach(void);
 int efifb_is_console(struct pci_attach_args *);
 void efifb_cndetach(void);
+void efifb_cnreattach(void);
 
 int efifb_cb_found(void);
 int efifb_cb_cnattach(void);
diff --git sys/dev/pci/drm/radeon/radeon_kms.c 
sys/dev/pci/drm/radeon/radeon_kms.c
index 6523819ba04..ce2ac47fb84 100644
--- sys/dev/pci/drm/radeon/radeon_kms.c
+++ sys/dev/pci/drm/radeon/radeon_kms.c
@@ -47,6 +47,7 @@ extern int vga_console_attached;
 
 #ifdef __amd64__
 #include "efifb.h"
+#include <machine/biosvar.h>
 #endif
 
 #if NEFIFB > 0
@@ -642,6 +643,8 @@ radeondrm_attach_kms(struct device *parent, struct device 
*self, void *aux)
        config_mountroot(self, radeondrm_attachhook);
 }
 
+extern void mainbus_efifb_reattach(void);
+
 int
 radeondrm_forcedetach(struct radeon_device *rdev)
 {
@@ -653,8 +656,19 @@ radeondrm_forcedetach(struct radeon_device *rdev)
                vga_console_attached = 0;
 #endif
 
-       config_detach(&rdev->self, 0);
-       return pci_probe_device(sc, tag, NULL, NULL);
+       /* reprobe pci device for non efi systems */
+#if NEFIFB > 0
+       if (bios_efiinfo == NULL && !efifb_cb_found()) {
+#endif
+               config_detach(&rdev->self, 0);
+               return pci_probe_device(sc, tag, NULL, NULL);
+#if NEFIFB > 0
+       } else if (rdev->console) {
+               mainbus_efifb_reattach();
+       }
+#endif
+
+       return 0;
 }
 
 void

Reply via email to