aboutsummaryrefslogtreecommitdiff
path: root/include/spl.h
diff options
context:
space:
mode:
authorSean Anderson2023-10-14 16:47:54 -0400
committerTom Rini2023-10-17 20:50:52 -0400
commit93caa3efe25bb9d3e6265aa467dc5b6a2201819b (patch)
tree02c637fb5f2b374d5f6d2092aff3ce9273446204 /include/spl.h
parentacb96c170d7c9f9aed1755efe56387127a7dff0b (diff)
spl: Add callbacks to invalidate cached devices
Several SPL functions try to avoid performing initialization twice by caching devices. This is fine for regular boot, but does not work with UNIT_TEST, since all devices are torn down after each test. Add some functions to invalidate the caches which can be called before testing these load methods. Signed-off-by: Sean Anderson <seanga2@gmail.com>
Diffstat (limited to 'include/spl.h')
-rw-r--r--include/spl.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/spl.h b/include/spl.h
index 1d416b4c929..03a4a83eb24 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -674,6 +674,18 @@ static inline const char *spl_loader_name(const struct spl_image_loader *loader)
#endif
/* SPL FAT image functions */
+
+/**
+ * spl_fat_force_reregister() - Force reregistration of FAT block devices
+ *
+ * To avoid repeatedly looking up block devices, spl_load_image_fat keeps track
+ * of whether it has already registered a block device. This is fine for most
+ * cases, but when running unit tests all devices are removed and recreated
+ * in-between tests. This function will force re-registration of any block
+ * devices, ensuring that we don't try to use an invalid block device.
+ */
+void spl_fat_force_reregister(void);
+
int spl_load_image_fat(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev,
struct blk_desc *block_dev, int partition,
@@ -753,6 +765,16 @@ bool spl_was_boot_source(void);
*/
int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
+/**
+ * spl_mmc_clear_cache() - Clear cached MMC devices
+ *
+ * To avoid reinitializing MMCs, spl_mmc_load caches the most-recently-used MMC
+ * device. This is fine for most cases, but when running unit tests all devices
+ * are removed and recreated in-between tests. This function will clear any
+ * cached state, ensuring that we don't try to use an invalid MMC.
+ */
+void spl_mmc_clear_cache(void);
+
int spl_mmc_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev);