Skip to content

Commit

Permalink
x86/efi/efifb: Move DMI based quirks handling out of generic code
Browse files Browse the repository at this point in the history
The efifb quirks handling based on DMI identification of the platform is
specific to x86, so move it to x86 arch code.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Peter Jones <pjones@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1461614832-17633-19-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ard Biesheuvel authored and Ingo Molnar committed Apr 28, 2016
1 parent fc37206 commit 21289ec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions arch/x86/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ static inline bool efi_runtime_supported(void)
extern struct console early_efi_console;
extern void parse_efi_setup(u64 phys_addr, u32 data_len);

extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);

#ifdef CONFIG_EFI_MIXED
extern void efi_thunk_runtime_setup(void);
extern efi_status_t efi_thunk_set_virtual_address_map(
Expand Down
15 changes: 15 additions & 0 deletions arch/x86/kernel/sysfb_efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ struct efifb_dmi_info efifb_dmi_list[] = {
[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
};

void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
{
int i;

for (i = 0; i < M_UNKNOWN; i++) {
if (efifb_dmi_list[i].base != 0 &&
!strcmp(opt, efifb_dmi_list[i].optname)) {
si->lfb_base = efifb_dmi_list[i].base;
si->lfb_linelength = efifb_dmi_list[i].stride;
si->lfb_width = efifb_dmi_list[i].width;
si->lfb_height = efifb_dmi_list[i].height;
}
}
}

#define choose_value(dmivalue, fwvalue, field, flags) ({ \
typeof(fwvalue) _ret_ = fwvalue; \
if ((flags) & (field)) \
Expand Down
15 changes: 4 additions & 11 deletions drivers/video/fbdev/efifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/efi.h>
#include <linux/errno.h>
#include <linux/fb.h>
#include <linux/platform_device.h>
#include <linux/screen_info.h>
#include <linux/dmi.h>
#include <linux/pci.h>
#include <video/vga.h>
#include <asm/sysfb.h>
#include <asm/efi.h>

static bool request_mem_succeeded = false;

Expand Down Expand Up @@ -85,21 +86,13 @@ static struct fb_ops efifb_ops = {
static int efifb_setup(char *options)
{
char *this_opt;
int i;

if (options && *options) {
while ((this_opt = strsep(&options, ",")) != NULL) {
if (!*this_opt) continue;

for (i = 0; i < M_UNKNOWN; i++) {
if (efifb_dmi_list[i].base != 0 &&
!strcmp(this_opt, efifb_dmi_list[i].optname)) {
screen_info.lfb_base = efifb_dmi_list[i].base;
screen_info.lfb_linelength = efifb_dmi_list[i].stride;
screen_info.lfb_width = efifb_dmi_list[i].width;
screen_info.lfb_height = efifb_dmi_list[i].height;
}
}
efifb_setup_from_dmi(&screen_info, this_opt);

if (!strncmp(this_opt, "base:", 5))
screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
else if (!strncmp(this_opt, "stride:", 7))
Expand Down

0 comments on commit 21289ec

Please sign in to comment.