soc/mediatek/common: Conditionally set up framebuffer
To save memory, only allocate and configure the framebuffer when display output is required during boot. This is achieved by: 1. Making the `framebuffer` memory region optional. 2. Guarding the framebuffer's uncached MMU configuration with a `display_init_required()` check. This ensures the framebuffer is prepared only when needed, saving memory on boot paths that do not require display. BUG=b:319511268 BRANCH=none TEST=emerge-rauru coreboot Change-Id: I3808031160e421de7c21f585f4b79d42bfddccc4 Signed-off-by: Yidi Lin <yidilin@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/89541 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
5271ac7ac5
commit
0ff213d711
3 changed files with 12 additions and 2 deletions
|
|
@ -75,7 +75,7 @@ DECLARE_REGION(ttb)
|
|||
DECLARE_OPTIONAL_REGION(ttb_subtables)
|
||||
DECLARE_REGION(dma_coherent)
|
||||
DECLARE_REGION(soc_registers)
|
||||
DECLARE_REGION(framebuffer)
|
||||
DECLARE_OPTIONAL_REGION(framebuffer)
|
||||
DECLARE_REGION(pdpt)
|
||||
DECLARE_OPTIONAL_REGION(opensbi)
|
||||
DECLARE_OPTIONAL_REGION(bl31)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <soc/dsi.h>
|
||||
#include <soc/mtcmos.h>
|
||||
#include <stdio.h>
|
||||
#include <symbols.h>
|
||||
|
||||
static struct panel_serializable_data *get_mipi_cmd_from_cbfs(struct panel_description *desc)
|
||||
{
|
||||
|
|
@ -70,6 +71,7 @@ int mtk_display_init(void)
|
|||
struct fb_info *info;
|
||||
const char *name;
|
||||
struct panel_description *panel = get_active_panel();
|
||||
uintptr_t fb_addr;
|
||||
|
||||
if (!panel || panel->disp_path == DISP_PATH_NONE) {
|
||||
printk(BIOS_ERR, "%s: Failed to get the active panel\n", __func__);
|
||||
|
|
@ -143,7 +145,10 @@ int mtk_display_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
info = fb_new_framebuffer_info_from_edid(&edid, (uintptr_t)0);
|
||||
fb_addr = (REGION_SIZE(framebuffer)) ? (uintptr_t)_framebuffer : 0;
|
||||
|
||||
info = fb_new_framebuffer_info_from_edid(&edid, fb_addr);
|
||||
|
||||
if (info)
|
||||
fb_set_orientation(info, panel->orientation);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <arch/mmu.h>
|
||||
#include <bootmode.h>
|
||||
#include <symbols.h>
|
||||
#include <soc/emi.h>
|
||||
#include <soc/mmu_operations.h>
|
||||
|
|
@ -51,6 +52,10 @@ void mtk_mmu_after_dram(void)
|
|||
|
||||
mmu_config_range(_dram_dma, REGION_SIZE(dram_dma), NONSECURE_UNCACHED_MEM);
|
||||
|
||||
if (display_init_required())
|
||||
mmu_config_range(_framebuffer, REGION_SIZE(framebuffer),
|
||||
NONSECURE_UNCACHED_MEM);
|
||||
|
||||
mtk_soc_after_dram();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue