spl: sata: Rework the loading case it not use IS_ENABLED(...)
In this case, using IS_ENABLED(...) to attempt to load the image results in harder to read and less useful code, along with having to define a CONFIG value that would be unused. To maintain the current albeit slightly odd behavior, maintain that if we have both SPL_FS_FAT and SPL_SATA_RAW_U_BOOT_USE_SECTOR enabled, we use SPL_FS_FAT for the load. Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
d35e44fbe7
commit
6e73ab32d8
|
|
@ -17,11 +17,6 @@
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
|
||||||
#ifndef CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR
|
|
||||||
/* Dummy value to make the compiler happy */
|
|
||||||
#define CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR 0x100
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
|
static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
|
||||||
struct spl_boot_device *bootdev,
|
struct spl_boot_device *bootdev,
|
||||||
struct blk_desc *stor_dev, unsigned long sector)
|
struct blk_desc *stor_dev, unsigned long sector)
|
||||||
|
|
@ -62,7 +57,7 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
|
||||||
static int spl_sata_load_image(struct spl_image_info *spl_image,
|
static int spl_sata_load_image(struct spl_image_info *spl_image,
|
||||||
struct spl_boot_device *bootdev)
|
struct spl_boot_device *bootdev)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = -ENOSYS;
|
||||||
struct blk_desc *stor_dev;
|
struct blk_desc *stor_dev;
|
||||||
|
|
||||||
/* try to recognize storage devices immediately */
|
/* try to recognize storage devices immediately */
|
||||||
|
|
@ -77,16 +72,14 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
|
||||||
CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
|
CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
err = -ENOSYS;
|
#ifdef CONFIG_SPL_FS_FAT
|
||||||
|
err = spl_load_image_fat(spl_image, bootdev, stor_dev,
|
||||||
if (IS_ENABLED(CONFIG_SPL_FS_FAT)) {
|
CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
|
||||||
err = spl_load_image_fat(spl_image, bootdev, stor_dev,
|
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
|
||||||
CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
|
#elif defined(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)
|
||||||
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
|
err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev,
|
||||||
} else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) {
|
CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
|
||||||
err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev,
|
#endif
|
||||||
CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
puts("Error loading sata device\n");
|
puts("Error loading sata device\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue