On Tue, Feb 02, 2016 at 02:09:08AM -0500, James Hastings wrote:
> Testing UEFI booting. Willing to test patches and debug.
>
> 1) Encountered screen corruption immediately after EFIBOOT.
> http://imgur.com/mXURlgV
>
> 2) Kernel panic unless radeondrm(4) disabled.
> Provided dmesg, pcidump, acpidump from successful boot.
> http://pastebin.com/1JSxgBfT
>
> System boot results:
>
> legacy RAMDISK_CD: screen ok, boot ok
> legacy GENERIC.MP: screen ok, boot ok
> uefi RAMDISK_CD: screen garbage, boot ok
> uefi GENERIC.MP: screen garbage, kernel panic
> uefi GENERIC.MP disable radeondrm(4): screen garbage, boot ok
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:
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 07:33:05 -0000
@@ -41,6 +41,14 @@
extern int vga_console_attached;
#endif
+#ifdef __amd64__
+#include "efifb.h"
+#endif
+
+#if NEFIFB > 0
+#include <machine/efifbvar.h>
+#endif
+
#define DRIVER_NAME "radeon"
#define DRIVER_DESC "ATI Radeon"
#define DRIVER_DATE "20080613"
@@ -481,6 +489,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 +510,16 @@ radeondrm_attach_kms(struct device *pare
vga_console_attached = 1;
#endif
}
+#if NEFIFB > 0
+ if (efifb_is_console(pa)) {
+ rdev->console = 1;
+ /* XXX better test */
+ 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);