> Date: Tue, 2 Feb 2016 20:21:29 +1100
> From: Jonathan Gray <[email protected]>
> 
> On Tue, Feb 02, 2016 at 03:56:13AM -0500, James Hastings wrote:
> > On 2/2/16, Jonathan Gray <[email protected]> wrote:
> > >
> > > The bios may have to be fetched from the acpi VFCT table for the uefi 
> > > case.
> > >
> > > Here's a quick attempt at trying to avoid the crash at least:
> > >
> > 
> > Different panic this time.
> 
> Thanks.  Here is a version modified to have a better check for efi.
> Still may need some things shuffled around to deal with the root hook.
> 
> Index: radeon.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon.h,v
> retrieving revision 1.17
> diff -u -p -r1.17 radeon.h
> --- radeon.h  27 Sep 2015 11:09:26 -0000      1.17
> +++ radeon.h  2 Feb 2016 07:33:39 -0000
> @@ -1554,6 +1554,7 @@ struct radeon_device {
>       struct drm_device               *ddev;
>       struct pci_dev                  *pdev;
>  
> +     struct pci_attach_args          *pa;
>       pci_chipset_tag_t               pc;
>       pcitag_t                        pa_tag;
>       pci_intr_handle_t               intrh;
> @@ -1595,6 +1596,7 @@ struct radeon_device {
>       /* BIOS */
>       uint8_t                         *bios;
>       bool                            is_atom_bios;
> +     int                             uefi;
>       uint16_t                        bios_header_start;
>       struct radeon_bo                *stollen_vga_memory;
>       /* Register mmio */
> Index: radeon_bios.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_bios.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 radeon_bios.c
> --- radeon_bios.c     12 Apr 2015 12:14:30 -0000      1.6
> +++ radeon_bios.c     2 Feb 2016 07:34:17 -0000
> @@ -51,8 +51,10 @@ radeon_read_platform_bios(struct radeon_
>       bus_size_t size = 256 * 1024; /* ??? */
>       uint8_t *found = NULL;
>       int i;
> -     
> -     
> +
> +     if (rdev->uefi)
> +             return false;
> +
>       if (!(rdev->flags & RADEON_IS_IGP))
>               if (!radeon_card_posted(rdev))
>                       return false;
> Index: radeon_kms.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_kms.c,v
> retrieving revision 1.46
> diff -u -p -r1.46 radeon_kms.c
> --- radeon_kms.c      6 Jan 2016 19:56:08 -0000       1.46
> +++ radeon_kms.c      2 Feb 2016 09:16:40 -0000
> @@ -41,6 +41,15 @@
>  extern int vga_console_attached;
>  #endif
>  
> +#ifdef __amd64__
> +#include "efifb.h"
> +#endif
> +
> +#if NEFIFB > 0
> +#include <machine/biosvar.h>
> +#include <machine/efifbvar.h>
> +#endif
> +
>  #define DRIVER_NAME          "radeon"
>  #define DRIVER_DESC          "ATI Radeon"
>  #define DRIVER_DATE          "20080613"
> @@ -481,6 +490,7 @@ radeondrm_attach_kms(struct device *pare
>       id_entry = drm_find_description(PCI_VENDOR(pa->pa_id),
>           PCI_PRODUCT(pa->pa_id), radeondrm_pciidlist);
>       rdev->flags = id_entry->driver_data;
> +     rdev->pa = pa;
>       rdev->pc = pa->pa_pc;
>       rdev->pa_tag = pa->pa_tag;
>       rdev->iot = pa->pa_iot;
> @@ -501,6 +511,15 @@ radeondrm_attach_kms(struct device *pare
>               vga_console_attached = 1;
>  #endif
>       }
> +#if NEFIFB > 0
> +     if (efifb_is_console(pa))
> +             rdev->console = 1;
> +     if (bios_efiinfo != NULL)
> +             rdev->uefi = 1;
> +#else
> +     rdev->uefi = 0;
> +#endif
> +
>  #endif
>  
>  #define RADEON_PCI_MEM               0x10
> @@ -713,6 +732,12 @@ radeondrm_attachhook(struct device *self
>  #ifdef __sparc64__
>       fbwscons_setcolormap(&rdev->sf, radeondrm_setcolor);
>  #endif
> +
> +#if NEFIFB > 0
> +     if (efifb_is_console(rdev->pa))
> +             efifb_cndetach();
> +#endif
> +
>       drm_modeset_lock_all(rdev->ddev);
>       drm_fb_helper_restore_fbdev_mode((void *)rdev->mode_info.rfbdev);
>       drm_modeset_unlock_all(rdev->ddev);

The problem here is that radeondrm_attachhook() runs after efifb(4)
attaches.  So it tries to kick out efifb when it is too late.

I have a diff somewhere that does it earlier.  The problem with that
is that you end up without a console if attaching radeondrm(4) fails.

Reply via email to