lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Nov 2014 12:14:21 -0500
From:	Alex Deucher <alexdeucher@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>,
	Maling list - DRI developers 
	<dri-devel@...ts.freedesktop.org>,
	Alex Deucher <alexander.deucher@....com>,
	Christian König <christian.koenig@....com>,
	David Airlie <airlied@...ux.ie>,
	Matthew Garrett <mjg59@...f.ucam.org>
Subject: Re: [PATCH] radeon: acquire BIOS via firmware subsystem if everything
 else failed

On Sat, Nov 22, 2014 at 2:30 PM, Wilfried Klaebe
<w-lkml@...enslange-mailadresse.de> wrote:
> At least Apple's MacBook Pro 8,2 booting EFI -> GRUB2 -> Linux (without
> BIOS emulation) seems to have no Radeon BIOS accessible via conventional
> means. Loading one via firmware system previously dumped (with
> "dd if=/dev/mem of=/lib/firmware/radeon/vbios.bin bs=65536 skip=12 count=1")
> when booted with BIOS emulation works. I carry this patch around since
> about 3.8 and never had any problems, not even with several dozen cycles
> of suspend2ram and resume. Also, I tested every new release if this patch
> was still necessary, and it always was.
>
> Thanks to Stefan Dösinger and others at
> https://www.libreoffice.org/bugzilla/show_bug.cgi?id=26891
>
> Signed-off-by: Wilfried Klaebe <w-lkml@...enslange-mailadresse.de>

NACK.  This mac specific and is not something I want to support in radeon.

The vbios image is available via ACPI prior to the OS taking over.
IIRC, Matthew Garret fixed up the bootloader to fetch the vbios image
prior to loading Linux so that it could be accessed after the OS
loaded.

Alex

>
> ---
>
> Note: I'm not subscribed to dri-devel@...ts.freedesktop.org, please cc:
> me if replying there.
>
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index 63ccb8f..cf55e0e 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -29,6 +29,7 @@
>  #include "radeon_reg.h"
>  #include "radeon.h"
>  #include "atom.h"
> +#include <linux/firmware.h>
>
>  #include <linux/vga_switcheroo.h>
>  #include <linux/slab.h>
> @@ -74,6 +75,44 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
>         return true;
>  }
>
> +static bool radeon_read_bios_from_firmware(struct radeon_device *rdev)
> +{
> +       const uint8_t __iomem *bios;
> +       resource_size_t size;
> +       const struct firmware *fw = NULL;
> +       char *err = NULL;
> +
> +       request_firmware(&fw, "radeon/vbios.bin", rdev->dev);
> +       if (!fw) {
> +               err = "firmware request returned NULL\n";
> +               goto out;
> +       }
> +       size = fw->size;
> +       bios = fw->data;
> +
> +       if (size == 0 || !bios) {
> +               err = "firmware request returned zero sized or NULL data\n";
> +               goto out;
> +       }
> +
> +       if (bios[0] != 0x55 || bios[1] != 0xaa) {
> +               err = "wrong signature on firmware\n";
> +               goto out;
> +       }
> +       rdev->bios = kmalloc(size, GFP_KERNEL);
> +       if (rdev->bios == NULL) {
> +               err = "failed to kmalloc() memory for firmware\n";
> +               goto out;
> +       }
> +       memcpy(rdev->bios, bios, size);
> +out:
> +       if (err)
> +               DRM_ERROR(err);
> +       if (fw)
> +               release_firmware(fw);
> +       return !err;
> +}
> +
>  static bool radeon_read_bios(struct radeon_device *rdev)
>  {
>         uint8_t __iomem *bios;
> @@ -662,6 +701,8 @@ bool radeon_get_bios(struct radeon_device *rdev)
>                 r = radeon_read_disabled_bios(rdev);
>         if (r == false)
>                 r = radeon_read_platform_bios(rdev);
> +       if (r == false)
> +               r = radeon_read_bios_from_firmware(rdev);
>         if (r == false || rdev->bios == NULL) {
>                 DRM_ERROR("Unable to locate a BIOS ROM\n");
>                 rdev->bios = NULL;
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ