Skip to content

Commit 3615c78

Browse files
jwrdegoedeardbiesheuvel
authored andcommitted
efi: sysfb_efi: Fix DMI quirks not working for simpledrm
Commit 8633ef8 ("drivers/firmware: consolidate EFI framebuffer setup for all arches") moved the sysfb_apply_efi_quirks() call in sysfb_init() from before the [sysfb_]parse_mode() call to after it. But sysfb_apply_efi_quirks() modifies the global screen_info struct which [sysfb_]parse_mode() parses, so doing it later is too late. This has broken all DMI based quirks for correcting wrong firmware efifb settings when simpledrm is used. To fix this move the sysfb_apply_efi_quirks() call back to its old place and split the new setup of the efifb_fwnode (which requires the platform_device) into its own function and call that at the place of the moved sysfb_apply_efi_quirks(pd) calls. Fixes: 8633ef8 ("drivers/firmware: consolidate EFI framebuffer setup for all arches") Cc: [email protected] Cc: Javier Martinez Canillas <[email protected]> Cc: Thomas Zimmermann <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent f59a7ec commit 3615c78

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

drivers/firmware/efi/sysfb_efi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static const struct fwnode_operations efifb_fwnode_ops = {
341341
#ifdef CONFIG_EFI
342342
static struct fwnode_handle efifb_fwnode;
343343

344-
__init void sysfb_apply_efi_quirks(struct platform_device *pd)
344+
__init void sysfb_apply_efi_quirks(void)
345345
{
346346
if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
347347
!(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
@@ -355,7 +355,10 @@ __init void sysfb_apply_efi_quirks(struct platform_device *pd)
355355
screen_info.lfb_height = temp;
356356
screen_info.lfb_linelength = 4 * screen_info.lfb_width;
357357
}
358+
}
358359

360+
__init void sysfb_set_efifb_fwnode(struct platform_device *pd)
361+
{
359362
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) {
360363
fwnode_init(&efifb_fwnode, &efifb_fwnode_ops);
361364
pd->dev.fwnode = &efifb_fwnode;

drivers/firmware/sysfb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ static __init int sysfb_init(void)
8181
if (disabled)
8282
goto unlock_mutex;
8383

84+
sysfb_apply_efi_quirks();
85+
8486
/* try to create a simple-framebuffer device */
8587
compatible = sysfb_parse_mode(si, &mode);
8688
if (compatible) {
@@ -107,7 +109,7 @@ static __init int sysfb_init(void)
107109
goto unlock_mutex;
108110
}
109111

110-
sysfb_apply_efi_quirks(pd);
112+
sysfb_set_efifb_fwnode(pd);
111113

112114
ret = platform_device_add_data(pd, si, sizeof(*si));
113115
if (ret)

drivers/firmware/sysfb_simplefb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ __init struct platform_device *sysfb_create_simplefb(const struct screen_info *s
141141
if (!pd)
142142
return ERR_PTR(-ENOMEM);
143143

144-
sysfb_apply_efi_quirks(pd);
144+
sysfb_set_efifb_fwnode(pd);
145145

146146
ret = platform_device_add_resources(pd, &res, 1);
147147
if (ret)

include/linux/sysfb.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ static inline void sysfb_disable(void)
7070
#ifdef CONFIG_EFI
7171

7272
extern struct efifb_dmi_info efifb_dmi_list[];
73-
void sysfb_apply_efi_quirks(struct platform_device *pd);
73+
void sysfb_apply_efi_quirks(void);
74+
void sysfb_set_efifb_fwnode(struct platform_device *pd);
7475

7576
#else /* CONFIG_EFI */
7677

77-
static inline void sysfb_apply_efi_quirks(struct platform_device *pd)
78+
static inline void sysfb_apply_efi_quirks(void)
79+
{
80+
}
81+
82+
static inline void sysfb_set_efifb_fwnode(struct platform_device *pd)
7883
{
7984
}
8085

0 commit comments

Comments
 (0)