platform/kernel/u-boot.git
3 years agofs: fat: eliminate DIRENTSPERBLOCK() macro
Heinrich Schuchardt [Fri, 25 Dec 2020 13:30:04 +0000 (14:30 +0100)]
fs: fat: eliminate DIRENTSPERBLOCK() macro

The FAT filesystem implementation uses several marcros referring to a magic
variable name mydata which renders the code less readable. Eliminate one of
them which is only used for a debug() statement.

Use log_debug() instead of debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: Extra checks while opening an OPTEE session
Ilias Apalodimas [Wed, 23 Dec 2020 11:25:00 +0000 (13:25 +0200)]
efi_loader: Extra checks while opening an OPTEE session

When opening an OP-TEE session we need to check the internal return
value of OP-TEE call arguments as well the return code of the
function itself.
The code was also ignoring to close the OP-TEE session in case the
shared memory registration failed.

Fixes: f042e47e8fb43 ("efi_loader: Implement EFI variable handling via OP-TEE")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make variable store size customizable
Heinrich Schuchardt [Sun, 20 Dec 2020 10:05:38 +0000 (11:05 +0100)]
efi_loader: make variable store size customizable

Currently the size of the buffer to keep UEFI variables in memory is fixed
at 16384 bytes. This size has proven to be too small for some use cases.

Make the size of the memory buffer for UEFI variables customizable.

Reported-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoMerge tag 'dm-next-23dec20' of git://git.denx.de/u-boot-dm into next
Tom Rini [Wed, 23 Dec 2020 23:10:15 +0000 (18:10 -0500)]
Merge tag 'dm-next-23dec20' of git://git.denx.de/u-boot-dm into next

dm: New sequence number implementation
SPI handling of bus with different-speed devices
patman supression of sign-offs

3 years agodm: core: Inline a few ofnode functions in SPL
Simon Glass [Thu, 17 Dec 2020 00:25:06 +0000 (17:25 -0700)]
dm: core: Inline a few ofnode functions in SPL

A recent change to unify the flattree/livetree code introduced a small
size increase in SPL on some boards. For example SPL code size for
px30-core-ctouch2-px30 increased by 40 bytes.

To address this we can take advantage of the fact that some of the ofnode
functions are only called a few times in SPL, so it is worth inlining
them.

Add new Kconfig options to control this. These functions are not inlined
for U-Boot proper, since this increases code size.

Fixes: 2ebea5eaebf ("dm: core: Combine the flattree and livetree binding code")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Remove output binaries before building
Simon Glass [Thu, 17 Dec 2020 00:24:17 +0000 (17:24 -0700)]
buildman: Remove output binaries before building

Buildman reuses build directories from previous builds to avoid the cost
of 'make mrproper' for every build. If the previous build produced an SPL
image but the current one does not, the SPL image will remain and buildman
will think it is a result of building the current board.

Remove these files before building, to avoid this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: spi: Fix spi_free_slave() freed memory write
Niel Fourie [Wed, 16 Dec 2020 11:11:52 +0000 (12:11 +0100)]
dm: spi: Fix spi_free_slave() freed memory write

Remove setting slave->dev to NULL after the device_remove() call.

The slave pointer points to dev->parent_priv, which has already
been freed by device_free(), called from device_remove() in the
preceding line. Writing to slave->dev may cause corruption of the
dlmalloc free chunk forward pointer of the previously freed chunk.

Signed-off-by: Niel Fourie <lusus@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: dm: spi: Add testcase for spi_claim_bus()
Ovidiu Panait [Mon, 14 Dec 2020 17:06:51 +0000 (19:06 +0200)]
test: dm: spi: Add testcase for spi_claim_bus()

Add testcase for spi_claim_bus(), which checks that sandbox spi bus
speed/mode settings are updated correctly when multiple slaves use
the bus consecutively. The following configurations are used for the
two spi slaves involved:
  * different max_hz / different modes
  * different max_hz / same modes
  * different modes / same max_hz

asm/test.h header is added in order to be able to retrieve the current
speed/mode of the sandbox spi bus, via sandbox_spi_get_{speed, mode}.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agospi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic
Ovidiu Panait [Mon, 14 Dec 2020 17:06:50 +0000 (19:06 +0200)]
spi: spi-uclass: Fix spi_claim_bus() speed/mode setup logic

Currently, when different spi slaves claim the bus consecutively using
spi_claim_bus(), spi_set_speed_mode() will only be executed on the first
two calls, leaving the bus in a bad state starting with the third call.

This patch drops spi_slave->speed member and adds caching of bus
speed/mode in dm_spi_bus struct. It also updates spi_claim_bus() to call
spi_set_speed_mode() if either speed or mode is different from what the
bus is currently configured for. Current behavior is to only take into
account the speed, but not the mode, which seems wrong.

Fixes: 60e2809a848 ("dm: spi: Avoid setting the speed with every transfer")
Reviewed-by: Simon Glass <sjg@chromium.org>
Reported-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reported-by: Moshe, Yaniv <yanivmo@amazon.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
3 years agotest: spi: Add sandbox_spi_get_{speed, mode} interface
Ovidiu Panait [Mon, 14 Dec 2020 17:06:49 +0000 (19:06 +0200)]
test: spi: Add sandbox_spi_get_{speed, mode} interface

Introduce sandbox_spi_get_{speed, mode} public interface to retrieve the
sandbox spi bus internal state. They are meant to be used in sandbox spi
testcases.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agospi: sandbox_spi: Implement speed/mode setup
Ovidiu Panait [Mon, 14 Dec 2020 17:06:48 +0000 (19:06 +0200)]
spi: sandbox_spi: Implement speed/mode setup

Implement sandbox_spi_set_{speed, mode} routines, to be able to keep track
of the current bus speed/mode. This will help determine whether the values
passed from dm_spi_claim_bus() are valid.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
3 years agosandbox: test: Add a second SPI slave on sandbox_spi bus
Ovidiu Panait [Mon, 14 Dec 2020 17:06:47 +0000 (19:06 +0200)]
sandbox: test: Add a second SPI slave on sandbox_spi bus

Place a second spi slave on the sandbox_spi bus, to be used by the
spi_claim_bus() testcase we are about to introduce. We need to make sure
that jumping between slaves calling spi_claim_bus() sets the bus speed and
mode appropriately. Use different max-hz and mode properties for this new
slave.

Also, update sandbox_spi cs_info call to allow activity on CS0/CS1 and
adapt dm_test_spi_find() testcase for this new setup.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: spi: Drop unused sandbox_spi_parse_spec function
Ovidiu Panait [Mon, 14 Dec 2020 17:06:46 +0000 (19:06 +0200)]
sandbox: spi: Drop unused sandbox_spi_parse_spec function

Commit 1289e96797bf ("sandbox: spi: Drop command-line SPI option") dropped
support for specifying SPI devices on the command line, removing the only
user of sandbox_spi_parse_spec(). Remove the function too.

Fixes: 1289e96797bf ("sandbox: spi: Drop command-line SPI option")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: implement invalidate_icache_all()
Heinrich Schuchardt [Wed, 9 Dec 2020 18:42:44 +0000 (19:42 +0100)]
sandbox: implement invalidate_icache_all()

Before executing code that we have loaded from a file we need to flush the
data cache and invalidate the instruction flash.

Implement functions flush_cache() and invalidate_icache_all().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofdt: Use phandle to distinguish DT nodes with same name
Aswath Govindraju [Thu, 3 Dec 2020 05:25:45 +0000 (10:55 +0530)]
fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoCommon:fdt: Check for error return value
Hongwei Zhang [Wed, 2 Dec 2020 19:47:03 +0000 (14:47 -0500)]
Common:fdt: Check for error return value

Check for negative return value of fdt_noffset from calling
boot_get_fdt_fit().

Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: implement runtime system reset
Heinrich Schuchardt [Wed, 2 Dec 2020 15:22:11 +0000 (16:22 +0100)]
sandbox: implement runtime system reset

Implement a reset function that we can call after ExitBootServices(),
when all driver model devices are gone.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconfigs: sandbox: activate DEBUG_UART
Patrick Delaunay [Fri, 27 Nov 2020 10:49:29 +0000 (11:49 +0100)]
configs: sandbox: activate DEBUG_UART

Add CONFIG_DEBUG_UART=y for all sandbox defconfig
as it is already done in sandbox_defconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Add project-default for 'gcc'
Philipp Tomsich [Tue, 24 Nov 2020 17:14:53 +0000 (18:14 +0100)]
patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Add --no-signoff to suppress adding signoffs
Philipp Tomsich [Tue, 24 Nov 2020 17:14:52 +0000 (18:14 +0100)]
patman: Add --no-signoff to suppress adding signoffs

To enable use of patman with FSF/GNU projects, such as GCC or
Binutils, no Signed-off-by may be added.  This adds a command
line flag '--no-signoff' to suppress adding signoffs in patman
when processing commits.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix patman testBranch() test:
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Update documentation for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:33 +0000 (21:20 -0700)]
dm: Update documentation for new sequence numbers

Update the driver model documention to describe how sequence numbers now
work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Drop seq and req_seq
Simon Glass [Thu, 17 Dec 2020 04:20:32 +0000 (21:20 -0700)]
dm: core: Drop seq and req_seq

Now that migration to the new sequence numbers is complete, drop the old
fields. Add a test that covers the new behaviour.

Also drop the check for OF_PRIOR_STAGE since we always assign sequence
numbers now.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocmd: Drop use of old sequence numbers in commands
Simon Glass [Thu, 17 Dec 2020 04:20:31 +0000 (21:20 -0700)]
cmd: Drop use of old sequence numbers in commands

Several commands use sequence numbers. Update them to use the new ones.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update uclass_find_next_free_req_seq() for new scheme
Simon Glass [Thu, 17 Dec 2020 04:20:30 +0000 (21:20 -0700)]
dm: core: Update uclass_find_next_free_req_seq() for new scheme

This function current deals with req_seq which is deprecated. Update it to
use the new sequence numbers, putting them above existing aliases. Rename
the function to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Drop the unused arg in uclass_find_device_by_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:29 +0000 (21:20 -0700)]
dm: Drop the unused arg in uclass_find_device_by_seq()

Now that there is only one sequence number (rather than both requested and
assigned ones) we can simplify this function. Also update its caller to
simplify the logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Drop uclass_resolve_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:28 +0000 (21:20 -0700)]
dm: Drop uclass_resolve_seq()

This function is not needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: test: Add a test for DM_UC_FLAG_NO_AUTO_SEQ
Simon Glass [Thu, 17 Dec 2020 04:20:27 +0000 (21:20 -0700)]
dm: test: Add a test for DM_UC_FLAG_NO_AUTO_SEQ

Check that this flag operates as expected. This patch is not earlier in
this series since is uses the new behaviour of dev_seq().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Switch over to use new sequence number for dev_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:26 +0000 (21:20 -0700)]
dm: Switch over to use new sequence number for dev_seq()

Update this function to use the new sequence number and fix up the test
that deals with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopinctrl: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:25 +0000 (21:20 -0700)]
pinctrl: Update for new sequence numbers

Use the dev_seq() sequence number in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:24 +0000 (21:20 -0700)]
gpio: Update for new sequence numbers

Use the dev_seq() sequence number in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Simplify acpi_device_infer_name()
Simon Glass [Thu, 17 Dec 2020 04:20:23 +0000 (21:20 -0700)]
x86: Simplify acpi_device_infer_name()

There is no-longer any need to check if sequence numbers are valid, since
this is ensured by driver model. Drop the unwanted logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Drop unnecessary mp_init logic
Simon Glass [Thu, 17 Dec 2020 04:20:22 +0000 (21:20 -0700)]
x86: Drop unnecessary mp_init logic

Now that sequence numbers are set up when devices are bound, this code is
not needed. Also, we should use dev_seq() instead of req_seq. Update the
whole file accordingly.

Also fix up APL cpu while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agousb: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:21 +0000 (21:20 -0700)]
usb: Update for new sequence numbers

Use the new sequence number in all cases. Since all devices are assigned
a number when bound, this hack should not be needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agousb: ehci-mx6: Drop assignment of sequence number
Simon Glass [Thu, 17 Dec 2020 04:20:20 +0000 (21:20 -0700)]
usb: ehci-mx6: Drop assignment of sequence number

This hack cannot work in the new sequence-numbering scheme. Remove it
while we wait for the maintainer to complete DM conversion as noted in
the existing comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospi: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:19 +0000 (21:20 -0700)]
spi: Update for new sequence numbers

Use the new sequence number in all cases. Drop the rockchip case because
the sequence number should be 0 anyway, and assigning to the sequence
number is not permitted.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopci: Update to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:18 +0000 (21:20 -0700)]
pci: Update to use new sequence numbers

Now that we know the sequence number at bind time, there is no need for
special-case code in dm_pci_hose_probe_bus().

Note: the PCI_CAP_ID_EA code may need a look, but there are no test
failures so I have left it as is.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Allow manual sequence numbering
Simon Glass [Thu, 17 Dec 2020 04:20:17 +0000 (21:20 -0700)]
dm: core: Allow manual sequence numbering

Some buses have their own rules which require assigning sequence numbers
with a bus-specific algorithm. For example, PCI requires that sub-buses
are numbered higher than their parent buses, meaning effectively that
parent buses must be numbered only after all of their child buses have
been numbered.

Add a uclass flag to indicate that driver model should not assign sequence
numbers. In this case, the uclass must do it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agonet: Update to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:16 +0000 (21:20 -0700)]
net: Update to use new sequence numbers

Checking for seq == -1 is effectively checking that the device is
activated. The new sequence numbers are never -1 for a bound device, so
update the check.

Also drop the note about valid sequence numbers so it is accurate with the
new approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoi2c: Update for new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:15 +0000 (21:20 -0700)]
i2c: Update for new sequence numbers

Use the new sequence number in all cases. Drop the logic to check for a
valid number in designware_i2c, since it will always be valid.

Also drop the numbering in the uclass, since we can rely on driver
model giving us the right sequence numbers.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoocteon: Don't attempt to set the sequence number
Simon Glass [Thu, 17 Dec 2020 04:20:14 +0000 (21:20 -0700)]
octeon: Don't attempt to set the sequence number

Several Octeon drivers operate by setting the sequence number of their
device. This should not be needed with the new sequence number setup. Also
it is not permitted. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: test: Drop assumptions of no sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:13 +0000 (21:20 -0700)]
dm: test: Drop assumptions of no sequence numbers

Drop code in a few tests which assumes that sequence numbers are only
valid when a device is probed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Fix return value in dev_read_alias_seq()
Simon Glass [Thu, 17 Dec 2020 04:20:12 +0000 (21:20 -0700)]
dm: Fix return value in dev_read_alias_seq()

This should return 0 on success but currently does not. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Switch binding to use new sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:11 +0000 (21:20 -0700)]
dm: core: Switch binding to use new sequence numbers

Update the core logic to use the new approach. For now the old code is
left as is. Update one test so it still passes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: test: Check all devices have a sequence numbers
Simon Glass [Thu, 17 Dec 2020 04:20:10 +0000 (21:20 -0700)]
dm: test: Check all devices have a sequence numbers

Add a test that the new sequence numbers work as expected. Every device
should get one.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a new sequence number for devices
Simon Glass [Thu, 17 Dec 2020 04:20:09 +0000 (21:20 -0700)]
dm: core: Add a new sequence number for devices

At present each device has two sequence numbers, with 'req_seq' being
set up at bind time and 'seq' at probe time. The idea is that devices
can 'request' a sequence number and then the conflicts are resolved when
the device is probed.

This makes things complicated in a few cases, since we don't really know
what the sequence number will end up being. We want to honour the
bind-time requests if at all possible, but in fact the only source of
these at present is the devicetree aliases. Since we have the devicetree
available at bind time, we may as well just use it, in the hope that the
required processing will turn out to be useful later (i.e. the device
actually gets used).

Add a new 'sqq' member, the bind-time sequence number. It operates in
parallel to the old values for now. All devices get a valid sqq value,
i.e. it is never -1.

Drop an #ifdef while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update uclass_find_next_free_req_seq() args
Simon Glass [Thu, 17 Dec 2020 04:20:08 +0000 (21:20 -0700)]
dm: core: Update uclass_find_next_free_req_seq() args

At present this is passed a uclass ID and it has to do a lookup. The
callers all have the uclass pointer, except for the I2C uclass where the
code will soon be deleted.

Update the argument to a uclass * instead of an ID since it is more
efficient.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Avoid accessing seq directly
Simon Glass [Thu, 17 Dec 2020 04:20:07 +0000 (21:20 -0700)]
dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agolinker_lists: Fix alignment issue
Simon Glass [Thu, 17 Dec 2020 04:20:06 +0000 (21:20 -0700)]
linker_lists: Fix alignment issue

The linker script uses alphabetic sorting to group the different linker
lists together. Each group has its own struct and potentially its own
alignment. But when the linker packs the structs together it cannot ensure
that a linker list starts on the expected alignment boundary.

For example, if the first list has a struct size of 8 and we place 3 of
them in the image, that means that the next struct will start at offset
0x18 from the start of the linker_list section. If the next struct has
a size of 16 then it will start at an 8-byte aligned offset, but not a
16-byte aligned offset.

With sandbox on x86_64, a reference to a linker list item using
ll_entry_get() can force alignment of that particular linker_list item,
if it is in the same file as the linker_list item is declared.

Consider this example, where struct driver is 0x80 bytes:

ll_entry_declare(struct driver, fred, driver)

...

void *p = ll_entry_get(struct driver, fred, driver)

If these two lines of code are in the same file, then the entry is forced
to be aligned at the 'struct driver' alignment, which is 16 bytes. If the
second line of code is in a different file, then no action is taken, since
the compiler cannot update the alignment of the linker_list item.

In the first case, an 8-byte 'fill' region is added:

 .u_boot_list_2_driver_2_testbus_drv
                0x0000000000270018       0x80 test/built-in.o
                0x0000000000270018                _u_boot_list_2_driver_2_testbus_drv
 .u_boot_list_2_driver_2_testfdt1_drv
                0x0000000000270098       0x80 test/built-in.o
                0x0000000000270098                _u_boot_list_2_driver_2_testfdt1_drv
 *fill*         0x0000000000270118        0x8
 .u_boot_list_2_driver_2_testfdt_drv
                0x0000000000270120       0x80 test/built-in.o
                0x0000000000270120                _u_boot_list_2_driver_2_testfdt_drv
 .u_boot_list_2_driver_2_testprobe_drv
                0x00000000002701a0       0x80 test/built-in.o
                0x00000000002701a0                _u_boot_list_2_driver_2_testprobe_drv

With this, the linker_list no-longer works since items after testfdt1_drv
are not at the expected address.

Ideally we would have a way to tell gcc not to align structs in this way.
It is not clear how we could do this, and in any case it would require us
to adjust every struct used by the linker_list feature.

One possible fix is to force each separate linker_list to start on the
largest possible boundary that can be required by the compiler. However
that does not seem to work on x86_64, which uses 16-byte alignment in this
case but needs 32-byte alignment.

So add a Kconfig option to handle this. Set the default value to 4 so
as to avoid changing platforms that don't need it.

Update the ll_entry_start() accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'dm-pull-14dec20' of git://git.denx.de/u-boot-dm into next
Tom Rini [Mon, 14 Dec 2020 23:57:57 +0000 (18:57 -0500)]
Merge tag 'dm-pull-14dec20' of git://git.denx.de/u-boot-dm into next

Driver model tidy-up for livetree
Driver model big rename for consistency
Python 3 clean-ups for patman
Update sandbox serial driver to use membuff

3 years agocheckpatch: Add warnings for unexpected struct names
Simon Glass [Thu, 3 Dec 2020 23:55:24 +0000 (16:55 -0700)]
checkpatch: Add warnings for unexpected struct names

As a way of keeping the driver declarations more consistent, add a warning
if the struct used does not end with _priv or _plat.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Rename ..._platdata variables to just ..._plat
Simon Glass [Thu, 3 Dec 2020 23:55:23 +0000 (16:55 -0700)]
dm: treewide: Rename ..._platdata variables to just ..._plat

Try to maintain some consistency between these variables by using _plat as
a suffix for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Update 'auto' declarations to be on one line
Simon Glass [Thu, 3 Dec 2020 23:55:22 +0000 (16:55 -0700)]
dm: treewide: Update 'auto' declarations to be on one line

Fix up the code style for those declarations that should now fit onto one
line, which is all of them that currently do not.

This is needed for dtoc to detect the structs correctly, at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Rename ofdata_to_platdata() to of_to_plat()
Simon Glass [Thu, 3 Dec 2020 23:55:21 +0000 (16:55 -0700)]
dm: treewide: Rename ofdata_to_platdata() to of_to_plat()

This name is far too long. Rename it to remove the 'data' bits. This makes
it consistent with the platdata->plat rename.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Rename dev_get_platdata() to dev_get_plat()
Simon Glass [Thu, 3 Dec 2020 23:55:20 +0000 (16:55 -0700)]
dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename 'platdata_size' to 'plat_size'
Simon Glass [Thu, 3 Dec 2020 23:55:19 +0000 (16:55 -0700)]
dm: Rename 'platdata_size' to 'plat_size'

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Rename 'platdata' variables to just 'plat'
Simon Glass [Thu, 3 Dec 2020 23:55:18 +0000 (16:55 -0700)]
dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: treewide: Rename auto_alloc_size members to be shorter
Simon Glass [Thu, 3 Dec 2020 23:55:17 +0000 (16:55 -0700)]
dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Tidy up more Python style in dtb_platdata
Simon Glass [Thu, 3 Dec 2020 23:55:16 +0000 (16:55 -0700)]
dtoc: Tidy up more Python style in dtb_platdata

Update this file to reduce the number of pylint warnings. Also add a few
missing comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Drop unused parameter from dm_extended_scan_fdt()
Simon Glass [Sun, 29 Nov 2020 00:50:10 +0000 (17:50 -0700)]
dm: core: Drop unused parameter from dm_extended_scan_fdt()

This doesn't need to be passed the devicetree anymore. Drop it.
Also rename the function to drop the _fdt suffix.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Drop unused parameter from dm_scan_fdt()
Simon Glass [Sun, 29 Nov 2020 00:50:09 +0000 (17:50 -0700)]
dm: core: Drop unused parameter from dm_scan_fdt()

This doesn't need to be passed the devicetree anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Combine the flattree and livetree binding code
Simon Glass [Sun, 29 Nov 2020 00:50:08 +0000 (17:50 -0700)]
dm: core: Combine the flattree and livetree binding code

At present there are two copies of this code. With ofnode we can combine
them to reduce duplication. Update the dm_scan_fdt_node() function and
adjust its callers.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add an ofnode function to get the devicetree root
Simon Glass [Sun, 29 Nov 2020 00:50:07 +0000 (17:50 -0700)]
dm: core: Add an ofnode function to get the devicetree root

This is needed in at least one place. Avoid the conditional code in root.c
by adding this inline function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Drop device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:06 +0000 (17:50 -0700)]
dm: core: Drop device_bind_offset()

This function is not needed since the standard device_bind() can be used
instead. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Drop dev_set_of_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:05 +0000 (17:50 -0700)]
dm: core: Drop dev_set_of_offset()

This pre-livetree function is not needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Drop uses of dev_set_of_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:04 +0000 (17:50 -0700)]
dm: Drop uses of dev_set_of_offset()

The need for this can be avoided by passing the correct node to the
device_bind() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Remove uses of device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:03 +0000 (17:50 -0700)]
dm: Remove uses of device_bind_offset()

This function is not needed since the standard device_bind() can be used
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a livetree function to check node status
Simon Glass [Sun, 29 Nov 2020 00:50:02 +0000 (17:50 -0700)]
dm: core: Add a livetree function to check node status

Add a way to find out if a node is enabled or not, based on its 'status'
property.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename device_bind_ofnode() to device_bind()
Simon Glass [Sun, 29 Nov 2020 00:50:01 +0000 (17:50 -0700)]
dm: core: Rename device_bind_ofnode() to device_bind()

This is the standard function to use when binding devices. Drop the
'_ofnode' suffix to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename device_bind() to device_bind_offset()
Simon Glass [Sun, 29 Nov 2020 00:50:00 +0000 (17:50 -0700)]
dm: core: Rename device_bind() to device_bind_offset()

This function is not necessary anymore, since device_bind_ofnode() does
the same thing and works with both flattree and livetree.

Rename it to indicate that it is special.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: unit test for exception command
Heinrich Schuchardt [Wed, 11 Nov 2020 23:29:59 +0000 (00:29 +0100)]
test: unit test for exception command

Test that an exception SIGILL is answered by a reset on the sandbox if
CONFIG_SANDBOX_CRASH_RESET=y or by exiting to the OS otherwise.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_selftest: implement exception test for sandbox
Heinrich Schuchardt [Wed, 11 Nov 2020 23:29:58 +0000 (00:29 +0100)]
efi_selftest: implement exception test for sandbox

Provide a unit test that causes an illegal instruction to occur.

The test can be run with the following commands:

    => setenv efi_selftest exception
    => bootefi selftest

This might be the output:

    Executing 'exception'
    EFI application triggers exception.
    Illegal instruction
    pc = 0x1444d016, pc_reloc = 0xffffaa078e8dd016
    UEFI image [0x0000000000000000:0xffffffffffffffff] '/\selftest'
    UEFI image [0x000000001444b000:0x0000000014451fff] pc=0x2016 '/bug.efi'
    Resetting ...

It would tell us that the exception was triggered by an instruction
0x2016 bytes after the load address of the binary with filename /bug.efi.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: sandbox: implement exception command
Heinrich Schuchardt [Wed, 11 Nov 2020 23:29:57 +0000 (00:29 +0100)]
cmd: sandbox: implement exception command

Implement the commands

* exception undefined - execute an illegal instruction
* exception sigsegv - cause a segment violation

Here is a possible output:

    => exception undefined
    Illegal instruction
    pc = 0x55eb8d0a7575, pc_reloc = 0x57575
    Resetting ...

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: add handler for exceptions
Heinrich Schuchardt [Wed, 11 Nov 2020 23:29:56 +0000 (00:29 +0100)]
sandbox: add handler for exceptions

Add a handler for SIGILL, SIGBUS, SIGSEGV.

When an exception occurs print the program counter and the loaded
UEFI binaries and reset the system if CONFIG_SANDBOX_CRASH_RESET=y
or exit to the OS otherwise.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: serial: Update to use membuff
Simon Glass [Mon, 9 Nov 2020 03:36:50 +0000 (20:36 -0700)]
sandbox: serial: Update to use membuff

Rather than implementing our own circular queue, use membuff. This allows
us to read multiple bytes at once into the serial input.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: serial: Convert to livetree
Simon Glass [Mon, 9 Nov 2020 03:36:49 +0000 (20:36 -0700)]
sandbox: serial: Convert to livetree

Use a livetree function to read the colour.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoserial: sandbox: Drop unnecessary #ifdefs
Simon Glass [Mon, 9 Nov 2020 03:36:48 +0000 (20:36 -0700)]
serial: sandbox: Drop unnecessary #ifdefs

CONFIG_OF_CONTROL is always enabled for sandbox (as it should be for all
boards), so we can drop it. Also use IS_ENABLED() for the SPL check.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Tidy up Python style in dtb_platdata
Simon Glass [Mon, 9 Nov 2020 03:36:21 +0000 (20:36 -0700)]
dtoc: Tidy up Python style in dtb_platdata

Update this, mostly to add comments for argument and return types. It is
probably still too early to use type hinting since it was introduced in
3.5.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Drop tools.ToChar() and ToChars()
Simon Glass [Mon, 9 Nov 2020 03:36:20 +0000 (20:36 -0700)]
patman: Drop tools.ToChar() and ToChars()

This is useful anymore, since we always want to call chr() in Python 3.
Drop it and adjust callers to use chr().

Also drop ToChars() which is no-longer used.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Drop tools.ToByte()
Simon Glass [Mon, 9 Nov 2020 03:36:19 +0000 (20:36 -0700)]
patman: Drop tools.ToByte()

This is not needed in Python 3. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Drop unicode helper functions
Simon Glass [Mon, 9 Nov 2020 03:36:18 +0000 (20:36 -0700)]
patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdt: Use an Enum for the data type
Simon Glass [Mon, 9 Nov 2020 03:36:17 +0000 (20:36 -0700)]
fdt: Use an Enum for the data type

Use an Enum instead of the current ad-hoc constants, so that there is a
data type associated with each 'type' value.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi into...
Tom Rini [Thu, 10 Dec 2020 18:54:33 +0000 (13:54 -0500)]
Merge tag 'efi-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for UEFI sub-system for next

Bug fixes

* avoid corruption of FAT file system when using long names
* correct values for RuntimeServicesSupport concerning UEFI capsule update
* link partition to block device via EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

New feature

* support EFI_LOAD_FILE_PROTOCOL in LoadImage() boot service

3 years agoefi_loader: link partition to block device
Heinrich Schuchardt [Fri, 10 Jan 2020 11:36:01 +0000 (12:36 +0100)]
efi_loader: link partition to block device

We provide a UEFI driver for block devices. When ConnectController() is
called for a handle with the EFI_BLOCK_IO_PROTOCOL this driver creates the
partitions. When DisconnectController() is called the handles for the
partitions have to be deleted. This requires that the child controllers
(partitions) open the EFI_BLOCK_IO_PROTOCOL of the controller (block IO
device) with attribute EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make efi_protocol_open() non-static
Heinrich Schuchardt [Fri, 10 Jan 2020 11:33:59 +0000 (12:33 +0100)]
efi_loader: make efi_protocol_open() non-static

Provide efi_protocol_open() as library function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: test EFI_LOAD_FILE_PROTOCOL
Heinrich Schuchardt [Tue, 8 Dec 2020 14:55:01 +0000 (15:55 +0100)]
efi_selftest: test EFI_LOAD_FILE_PROTOCOL

A unit test is supplied to test the support for the EFI_LOAD_FILE_PROTOCOL
and the EFI_LOAD_FILE2_PROTOCOL by the LoadImage() boot service.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: clean up Makefile
Heinrich Schuchardt [Tue, 8 Dec 2020 06:12:10 +0000 (07:12 +0100)]
efi_selftest: clean up Makefile

Bring all obj-y entries together.

Sort *.o targets.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: support EFI_LOAD_FILE_PROTOCOL
Heinrich Schuchardt [Sun, 6 Dec 2020 12:00:15 +0000 (13:00 +0100)]
efi_loader: support EFI_LOAD_FILE_PROTOCOL

Support loading images via the EFI_LOAD_FILE_PROTOCOL and
EFI_LOAD_FILE2_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: carve out efi_load_image_from_file()
Heinrich Schuchardt [Sun, 6 Dec 2020 09:47:57 +0000 (10:47 +0100)]
efi_loader: carve out efi_load_image_from_file()

efi_load_image_from_file() should read via either of:

* EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
* EFI_LOAD_FILE_PROTOCOL
* EFI_LOAD_FILE2_PROTOCOL

To make the code readable carve out a function to load the image via the
file system protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: pass boot_policy to efi_load_image_from_path
Heinrich Schuchardt [Fri, 4 Dec 2020 08:27:41 +0000 (09:27 +0100)]
efi_loader: pass boot_policy to efi_load_image_from_path

Implementing support for loading images via the EFI_LOAD_FILE_PROTOCOL
requires the boot policy as input for efi_load_image_from_path().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: move EFI_LOAD_FILE2_PROTOCOL_GUID
Heinrich Schuchardt [Fri, 4 Dec 2020 02:33:41 +0000 (03:33 +0100)]
efi_loader: move EFI_LOAD_FILE2_PROTOCOL_GUID

The EFI_LOAD_FILE_PROTOCOL_GUID and EFI_LOAD_FILE2_PROTOCOL_GUID are needed
to complement the implementation of the LoadFile() boot service.

Remove a duplicate declaration of a variable for the
EFI_LOAD_FILE2_PROTOCOL_GUID.
Move the remaining declaration to efi_boottime.c.
Add a variable for the EFI_LOAD_FILE_PROTOCOL_GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: resequence functions in efi_boottime.c
Heinrich Schuchardt [Fri, 4 Dec 2020 02:02:03 +0000 (03:02 +0100)]
efi_loader: resequence functions in efi_boottime.c

For implementing support for the EFI_LOAD_FILE_PROTOCOL in the LoadImage()
service we will have to call the LocateDevicePath() service. To avoid a
forward declaration resequence the functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: remove EFI_HII_CONFIG_ROUTING_PROTOCOL
Heinrich Schuchardt [Mon, 7 Dec 2020 17:20:57 +0000 (18:20 +0100)]
efi_loader: remove EFI_HII_CONFIG_ROUTING_PROTOCOL

Our implementation of the EFI_HII_CONFIG_ROUTING_PROTOCOL is a mere stub,
where all services return an error code. The protocol is neither needed for
the EFI shell nor for the UEFI SCT. To reduce the code size remove it from
the U-Boot binary.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: don't set EFI_RT_SUPPORTED_UPDATE_CAPSULE
Heinrich Schuchardt [Wed, 9 Dec 2020 06:38:46 +0000 (07:38 +0100)]
efi_loader: don't set EFI_RT_SUPPORTED_UPDATE_CAPSULE

The EFI_RT_PROPERTIES_TABLE configuration table indicates which runtime
services are available at runtime.

Even if CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y, we neither support
UpdateCapsule() nor QueryCapsuleCapabilities() at runtime. Thus we should
not set the corresponding flags EFI_RT_SUPPORTED_UPDATE_CAPSULE and
EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES in RuntimeServicesSupported.

Fixes: 2bc27ca8a04a ("efi_loader: define UpdateCapsule api")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: deletion of long file names
Heinrich Schuchardt [Thu, 19 Nov 2020 06:31:18 +0000 (07:31 +0100)]
fs: fat: deletion of long file names

Long file names are stored in multiple directory entries. When deleting a
file we must delete all of them.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: first dentry of long name in FAT iterator
Heinrich Schuchardt [Thu, 19 Nov 2020 06:44:08 +0000 (07:44 +0100)]
fs: fat: first dentry of long name in FAT iterator

A long name is split over multiple directory entries. When deleting a file
with a long name we need the first directory entry to be able to delete the
whole chain.

Add the necessary fields to the FAT iterator:

* cluster of first directory entry
* address of first directory entry
* remaining entries in cluster

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: use constant DELETED_FLAG
Heinrich Schuchardt [Thu, 19 Nov 2020 05:47:35 +0000 (06:47 +0100)]
fs: fat: use constant DELETED_FLAG

When deleting a directory entry 0xe5 is written to name[0].

We have a constant for this value and should use it consistently.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: search file should not allocate cluster
Heinrich Schuchardt [Thu, 26 Nov 2020 15:10:01 +0000 (16:10 +0100)]
fs: fat: search file should not allocate cluster

Searching for a file is not a write operation. So it should not lead to the
allocation of a new cluster to the directory.

If we reuse deleted entries, we might not even use the new cluster and due
to not flushing it the directory could be corrupted.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: reuse deleted directory entries
Heinrich Schuchardt [Sun, 22 Nov 2020 10:54:22 +0000 (11:54 +0100)]
fs: fat: reuse deleted directory entries

When creating new directory entries try to reuse entries marked as deleted.

In fill_dir_slot() do not allocate new clusters as this has already been
done in fat_find_empty_dentries().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: fat_find_empty_dentries()
Heinrich Schuchardt [Sun, 22 Nov 2020 08:58:44 +0000 (09:58 +0100)]
fs: fat: fat_find_empty_dentries()

Provide a function to find a series of empty directory entries.

The current directory is scanned for deleted entries.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: flush new directory cluster
Heinrich Schuchardt [Thu, 26 Nov 2020 18:06:55 +0000 (19:06 +0100)]
fs: fat: flush new directory cluster

When handling long file names directory entries may be split over multiple
clusters. We must make sure that new clusters are zero filled on disk.

When allocating a new cluster for a directory flush it.

The flushing should be executed before updating the FAT. This way if
flushing fails, we still have a valid directory structure.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>