dm: core: Add an option to support SPL in read-only memory
Some systems (e.g. x86 APL) run SPL from read-only memory. The device instances created by dtoc are therefore not writeable. To make things work we would need to copy the devices to read/write memory. To avoid this, add an option to use a separate runtime struct for devices, just as is done for drivers. This can be used to hold information that changes at runtime, avoiding the need for a copy. Also add a Kconfig option for read-only SPL, which selects this feature. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
6c914e4232
commit
95a5825f31
@ -276,6 +276,19 @@ config SPL_SEPARATE_BSS
|
|||||||
location is used. Normally we put the device tree at the end of BSS
|
location is used. Normally we put the device tree at the end of BSS
|
||||||
but with this option enabled, it goes at _image_binary_end.
|
but with this option enabled, it goes at _image_binary_end.
|
||||||
|
|
||||||
|
config SPL_READ_ONLY
|
||||||
|
bool
|
||||||
|
depends on SPL_OF_PLATDATA
|
||||||
|
# Bind cannot be supported because the udevice structs are in read-only
|
||||||
|
# memory so we cannot update the linked lists.
|
||||||
|
select SPL_OF_PLATDATA_NO_BIND
|
||||||
|
select SPL_OF_PLATDATA_RT
|
||||||
|
help
|
||||||
|
Some platforms (e.g. x86 Apollo Lake) load SPL into a read-only
|
||||||
|
section of memory. This means that of-platdata must make a copy (in
|
||||||
|
writeable memory) of anything it wants to modify, such as
|
||||||
|
device-private data.
|
||||||
|
|
||||||
config SPL_BANNER_PRINT
|
config SPL_BANNER_PRINT
|
||||||
bool "Enable output of the SPL banner 'U-Boot SPL ...'"
|
bool "Enable output of the SPL banner 'U-Boot SPL ...'"
|
||||||
default y
|
default y
|
||||||
@ -1440,6 +1453,17 @@ config TPL_STACK
|
|||||||
The address of the initial stack-pointer for the TPL stage.
|
The address of the initial stack-pointer for the TPL stage.
|
||||||
Usually this will be the (aligned) top-of-stack.
|
Usually this will be the (aligned) top-of-stack.
|
||||||
|
|
||||||
|
config TPL_READ_ONLY
|
||||||
|
bool
|
||||||
|
depends on TPL_OF_PLATDATA
|
||||||
|
select TPL_OF_PLATDATA_NO_BIND
|
||||||
|
select TPL_OF_PLATDATA_RT
|
||||||
|
help
|
||||||
|
Some platforms (e.g. x86 Apollo Lake) load SPL into a read-only
|
||||||
|
section of memory. This means that of-platdata must make a copy (in
|
||||||
|
writeable memory) of anything it wants to modify, such as
|
||||||
|
device-private data.
|
||||||
|
|
||||||
config TPL_BOOTROM_SUPPORT
|
config TPL_BOOTROM_SUPPORT
|
||||||
bool "Support returning to the BOOTROM (from TPL)"
|
bool "Support returning to the BOOTROM (from TPL)"
|
||||||
help
|
help
|
||||||
|
22
dts/Kconfig
22
dts/Kconfig
@ -380,6 +380,17 @@ config SPL_OF_PLATDATA_NO_BIND
|
|||||||
some code space in U-Boot. This can be disabled if binding is needed,
|
some code space in U-Boot. This can be disabled if binding is needed,
|
||||||
at the code of some code size increase.
|
at the code of some code size increase.
|
||||||
|
|
||||||
|
config SPL_OF_PLATDATA_RT
|
||||||
|
bool "Use a separate struct for device runtime data"
|
||||||
|
depends on SPL_OF_PLATDATA_INST
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
For systems running SPL from read-only memory it is convenient to
|
||||||
|
separate out the runtime information, so that the devices don't need
|
||||||
|
to be copied before being used. This moves the read-write parts of
|
||||||
|
struct udevice (at present just the flags) into a separate struct,
|
||||||
|
which is allocated at runtime.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config TPL_OF_PLATDATA
|
config TPL_OF_PLATDATA
|
||||||
@ -429,6 +440,17 @@ config TPL_OF_PLATDATA_NO_BIND
|
|||||||
some code space in U-Boot. This can be disabled if binding is needed,
|
some code space in U-Boot. This can be disabled if binding is needed,
|
||||||
at the code of some code size increase.
|
at the code of some code size increase.
|
||||||
|
|
||||||
|
config TPL_OF_PLATDATA_RT
|
||||||
|
bool "Use a separate struct for device runtime data"
|
||||||
|
depends on TPL_OF_PLATDATA_INST
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
For systems running TPL from read-only memory it is convenient to
|
||||||
|
separate out the runtime information, so that the devices don't need
|
||||||
|
to be copied before being used. This moves the read-write parts of
|
||||||
|
struct udevice (at present just the flags) into a separate struct,
|
||||||
|
which is allocated at runtime.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
Loading…
Reference in New Issue
Block a user