diff --git a/arch/x86/core/common.S b/arch/x86/core/common.S index c58aaa4b7e4..856ae7b2e0e 100644 --- a/arch/x86/core/common.S +++ b/arch/x86/core/common.S @@ -4,6 +4,7 @@ */ #include +#include /* * This is included by ia32/crt0.S and intel64/locore.S @@ -45,12 +46,12 @@ .long MULTIBOOT_HEADER_MAGIC .long MULTIBOOT_HEADER_FLAGS .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) -#ifdef CONFIG_INTEL_MULTIBOOTFB_DISPLAY - .fill 5,4,0 /* (unused exec layout) */ - .long 0 /* linear graphics mode */ - .long CONFIG_INTEL_MULTIBOOTFB_X /* width */ - .long CONFIG_INTEL_MULTIBOOTFB_Y /* height */ - .long 32 /* depth */ -#endif /* CONFIG_INTEL_MULTIBOOTFB_DISPLAY */ +#if DT_HAS_COMPAT_STATUS_OKAY(intel_multiboot_framebuffer) + .fill 5,4,0 /* (unused exec layout) */ + .long 0 /* linear graphics mode */ + .long DT_PROP(DT_INST(0, intel_multiboot_framebuffer), width) /* width */ + .long DT_PROP(DT_INST(0, intel_multiboot_framebuffer), height) /* height */ + .long 32 /* depth */ +#endif 1: #endif diff --git a/drivers/display/Kconfig.intel_multibootfb b/drivers/display/Kconfig.intel_multibootfb index 492132fa59b..c35cb273ae8 100644 --- a/drivers/display/Kconfig.intel_multibootfb +++ b/drivers/display/Kconfig.intel_multibootfb @@ -4,18 +4,7 @@ config INTEL_MULTIBOOTFB_DISPLAY bool "Intel Multiboot Framebuffer" default y - depends on MULTIBOOT && MULTIBOOT_INFO + depends on MULTIBOOT && MULTIBOOT_INFO && \ + DT_HAS_INTEL_MULTIBOOT_FRAMEBUFFER_ENABLED help Enable Intel Multiboot framebuffer-based display driver. - -if INTEL_MULTIBOOTFB_DISPLAY - -config INTEL_MULTIBOOTFB_X - int "Multiboot framebuffer X pixels" - default 640 - -config INTEL_MULTIBOOTFB_Y - int "Multiboot framebuffer Y pixels" - default 480 - -endif # INTEL_MULTIBOOTFB_DISPLAY diff --git a/drivers/display/display_intel_multibootfb.c b/drivers/display/display_intel_multibootfb.c index 80381691b82..4841b4c10ec 100644 --- a/drivers/display/display_intel_multibootfb.c +++ b/drivers/display/display_intel_multibootfb.c @@ -7,15 +7,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT intel_multiboot_framebuffer + #include +#include #include #include +struct framebuf_dev_config { + uint16_t width; + uint16_t height; +}; + struct framebuf_dev_data { void *buffer; uint32_t pitch; - uint16_t width; - uint16_t height; }; static int framebuf_blanking_on(const struct device *dev) @@ -70,10 +76,10 @@ static int framebuf_set_orientation(const struct device *dev, static void framebuf_get_capabilities(const struct device *dev, struct display_capabilities *caps) { - struct framebuf_dev_data *data = dev->data; + const struct framebuf_dev_config *config = dev->config; - caps->x_resolution = data->width; - caps->y_resolution = data->height; + caps->x_resolution = config->width; + caps->y_resolution = config->height; caps->supported_pixel_formats = PIXEL_FORMAT_ARGB_8888; caps->screen_info = 0; caps->current_pixel_format = PIXEL_FORMAT_ARGB_8888; @@ -137,19 +143,15 @@ const struct display_driver_api framebuf_display_api = { .set_orientation = framebuf_set_orientation }; -static struct framebuf_dev_data multiboot_framebuf_data = { - .width = CONFIG_INTEL_MULTIBOOTFB_X, - .height = CONFIG_INTEL_MULTIBOOTFB_Y -}; - static int multiboot_framebuf_init(const struct device *dev) { + const struct framebuf_dev_config *config = dev->config; struct framebuf_dev_data *data = dev->data; struct multiboot_info *info = &multiboot_info; if ((info->flags & MULTIBOOT_INFO_FLAGS_FB) && - (info->fb_width >= CONFIG_INTEL_MULTIBOOTFB_X) && - (info->fb_height >= CONFIG_INTEL_MULTIBOOTFB_Y) && + (info->fb_width >= config->width) && + (info->fb_height >= config->height) && (info->fb_bpp == 32) && (info->fb_addr_hi == 0)) { /* * We have a usable multiboot framebuffer - it is 32 bpp @@ -161,8 +163,8 @@ static int multiboot_framebuf_init(const struct device *dev) uint16_t adj_y; uint32_t *buffer; - adj_x = info->fb_width -CONFIG_INTEL_MULTIBOOTFB_X; - adj_y = info->fb_height - CONFIG_INTEL_MULTIBOOTFB_Y; + adj_x = info->fb_width - config->width; + adj_y = info->fb_height - config->height; data->pitch = (info->fb_pitch / 4) + adj_x; adj_x /= 2U; adj_y /= 2U; @@ -176,6 +178,13 @@ static int multiboot_framebuf_init(const struct device *dev) } } -DEVICE_DEFINE(multiboot_framebuf, "FRAMEBUF", multiboot_framebuf_init, NULL, - &multiboot_framebuf_data, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &framebuf_display_api); +static const struct framebuf_dev_config config = { + .width = DT_INST_PROP(0, width), + .height = DT_INST_PROP(0, height), +}; + +static struct framebuf_dev_data data; + +DEVICE_DT_INST_DEFINE(0, multiboot_framebuf_init, NULL, &data, &config, + PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, + &framebuf_display_api); diff --git a/dts/bindings/display/intel,multiboot-framebuffer.yaml b/dts/bindings/display/intel,multiboot-framebuffer.yaml new file mode 100644 index 00000000000..bbd575d8708 --- /dev/null +++ b/dts/bindings/display/intel,multiboot-framebuffer.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2022 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Intel Multiboot Framebuffer + +compatible: "intel,multiboot-framebuffer" + +include: display-controller.yaml diff --git a/tests/arch/x86/info/app.overlay b/tests/arch/x86/info/app.overlay new file mode 100644 index 00000000000..1a6f36c1021 --- /dev/null +++ b/tests/arch/x86/info/app.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + framebuffer { + compatible = "intel,multiboot-framebuffer"; + width = <640>; + height = <480>; + }; +};