tech-x11 archive

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

Workaround for Xorg 1.6.x + radeondrm "wait idle failed" hangs



I've finally got to the bottom of the reasons why Xorg 1.6.x + radeondrm
on my ATI Radeon X300 Mobility M22 caused the dreaded spew of "wait idle
failed 0x80010140 0x00000000" from the radeondrm driver and eventually a
machine lockup.  Thanks to Matt Green and Michael Hitch's discussions re:
libpciaccess changes in 1.6.x, I found that the new Xorg didn't enable the
bus-master-enable bit in the X300's PCI config, thus causing all attempts
at bus-mastering to... well, fail.

This should probably be fixed better, but for the time being this gets DRM
working on my T43.

--rafal

diff --git a/sys/external/bsd/drm/dist/bsd-core/drm_drv.c 
b/sys/external/bsd/drm/dist/bsd-core/drm_drv.c
index ddec017..15e3eb0 100644
--- a/sys/external/bsd/drm/dist/bsd-core/drm_drv.c
+++ b/sys/external/bsd/drm/dist/bsd-core/drm_drv.c
@@ -337,6 +337,7 @@ drm_attach(device_t kdev, struct pci_attach_args *pa, 
drm_pci_id_list_t *idlist)
        device_t parent_dev;
        struct drm_device *dev;
        int unit, parent_unit;
+       u_int16_t command;
 
        unit = device_unit(kdev);
        if (unit < 0 || unit >= DRM_MAXUNITS)
@@ -360,6 +361,18 @@ drm_attach(device_t kdev, struct pci_attach_args *pa, 
drm_pci_id_list_t *idlist)
        dev->device = kdev;
        drm_units[unit] = dev;
 
+       command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+       command |= PCI_COMMAND_MASTER_ENABLE;
+       pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, command);
+       command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+       DRM_DEBUG("pci command status reg 0x08x ");
+
+#if 0
+       /* XXXrkb: panic seems extreme, but there's no way to signal error */
+       if ((command & PCI_COMMAND_MASTER_ENABLE) == 0)
+               panic("drm_attach: can't enable bus-master feature\n");
+#endif
+
        for (unit = 0; unit < DRM_MAX_PCI_RESOURCE; unit++)
        {
                dev->pci_map_data[unit].mapped = 0;

-- 
  Time is an illusion; lunchtime, doubly so.     |/\/\|           Rafal Boni
                   -- Ford Prefect               |\/\/|      
rafal%pobox.com@localhost


Home | Main Index | Thread Index | Old Index