lib: Add devtree_update bootstate hook
Provide a weak devtree_update() hook and invoke it early in ramstage at BS_PRE_DEVICE. Mainboards can override devtree_update() to enable/disable devices at runtime based on CMOS/NVRAM settings. Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: Ic84ddb25e1da050543c230ea457042b8a8a3061f Reviewed-on: https://review.coreboot.org/c/coreboot/+/91250 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
69242d5bb1
commit
f8494fbeae
3 changed files with 31 additions and 0 deletions
14
src/include/devtree_update.h
Normal file
14
src/include/devtree_update.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef __DEVTREE_UPDATE_H__
|
||||
#define __DEVTREE_UPDATE_H__
|
||||
|
||||
/*
|
||||
* Optional mainboard hook to update devicetree runtime enable/disable state
|
||||
* based on CMOS/NVRAM settings.
|
||||
*
|
||||
* This function is called early in ramstage at BS_PRE_DEVICE.
|
||||
*/
|
||||
void devtree_update(void);
|
||||
|
||||
#endif /* __DEVTREE_UPDATE_H__ */
|
||||
|
|
@ -155,6 +155,7 @@ ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
|
|||
ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
|
||||
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
|
||||
ramstage-$(CONFIG_COVERAGE) += libgcov.c
|
||||
ramstage-y += devtree_update.c
|
||||
ramstage-y += dp_aux.c
|
||||
ramstage-y += framebuffer_info.c
|
||||
ramstage-y += edid.c
|
||||
|
|
|
|||
16
src/lib/devtree_update.c
Normal file
16
src/lib/devtree_update.c
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <bootstate.h>
|
||||
#include <commonlib/bsd/compiler.h>
|
||||
#include <devtree_update.h>
|
||||
|
||||
__weak void devtree_update(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void run_devtree_update(void *unused)
|
||||
{
|
||||
devtree_update();
|
||||
}
|
||||
|
||||
BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, run_devtree_update, NULL);
|
||||
Loading…
Add table
Add a link
Reference in a new issue