From 097bf5dcf79a3fc461c3e27102113cac7372afcf Mon Sep 17 00:00:00 2001 From: Ye Li Date: Mon, 22 Jul 2019 18:23:05 -0700 Subject: [PATCH] MLK-22293-5 env: Update SATA env location driver to use SCSI When DM SCSI is enabled with AHCI, use SCSI device to replace SATA device to access the peripheral. Signed-off-by: Ye Li --- env/sata.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/env/sata.c b/env/sata.c index 556ded592c..7febbfd255 100644 --- a/env/sata.c +++ b/env/sata.c @@ -14,6 +14,9 @@ #include #include #include +#ifdef CONFIG_DM_SCSI +#include +#endif #if defined(CONFIG_ENV_SIZE_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND) #error ENV REDUND not supported @@ -48,12 +51,19 @@ static int env_sata_save(void) struct blk_desc *sata = NULL; int env_sata, ret; +#ifndef CONFIG_DM_SCSI if (sata_initialize()) return 1; env_sata = sata_get_env_dev(); sata = sata_get_dev(env_sata); +#else + scsi_scan(false); + env_sata = sata_get_env_dev(); + + sata = blk_get_dev("scsi", env_sata); +#endif if (sata == NULL) { printf("Unknown SATA(%d) device for environment!\n", env_sata); @@ -94,12 +104,20 @@ static int env_sata_load(void) struct blk_desc *sata = NULL; int env_sata; +#ifndef CONFIG_DM_SCSI if (sata_initialize()) return -EIO; env_sata = sata_get_env_dev(); sata = sata_get_dev(env_sata); +#else + scsi_scan(false); + env_sata = sata_get_env_dev(); + + sata = blk_get_dev("scsi", env_sata); +#endif + if (sata == NULL) { printf("Unknown SATA(%d) device for environment!\n", env_sata); return -EIO; -- 2.17.1