[edk2] [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag

Ard Biesheuvel posted 1 patch 6 years, 3 months ago
Failed in applying to current master (apply log)
Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 22 +++++++-------------
1 file changed, 8 insertions(+), 14 deletions(-)
[edk2] [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag
Posted by Ard Biesheuvel 6 years, 3 months ago
From: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>

Now that we incorporated NorFlashInfoLib into the Fip006Dxe driver,
replace the code that explicitly enables flag status register polling
for Micron NOR flash with a test of the flags field provided by
NorFlashInfoLib, which carries the same information.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
index a521b1f3d167..8d6bca8739d0 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
@@ -1129,6 +1129,7 @@ NorFlashCreateInstance (
 {
   EFI_STATUS Status;
   NOR_FLASH_INSTANCE* Instance;
+  NOR_FLASH_INFO *FlashInfo;
   UINT8 JedecId[3];
 
   ASSERT(NorFlashInstance != NULL);
@@ -1157,23 +1158,15 @@ NorFlashCreateInstance (
   NorFlashReset (Instance);
 
   NorFlashReadID (Instance, JedecId);
+  Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
+  if (EFI_ERROR (Status)) {
+    goto FreeInstance;
+  }
 
-  DEBUG_CODE_BEGIN ();
-    {
-      NOR_FLASH_INFO    *FlashInfo;
-
-      Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
-      if (EFI_ERROR (Status)) {
-        goto FreeInstance;
-      }
-
-      NorFlashPrintInfo (FlashInfo);
-      FreePool (FlashInfo);
-    }
-  DEBUG_CODE_END ();
+  NorFlashPrintInfo (FlashInfo);
 
   Instance->Flags = 0;
-  if (JedecId[0] == NOR_FLASH_ID_STMICRO) {
+  if (FlashInfo->Flags & NOR_FLASH_WRITE_FSR) {
     Instance->Flags = NOR_FLASH_POLL_FSR;
   }
 
@@ -1198,6 +1191,7 @@ NorFlashCreateInstance (
   }
 
   *NorFlashInstance = Instance;
+  FreePool (FlashInfo);
   return EFI_SUCCESS;
 
 FreeInstance:
-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag
Posted by Leif Lindholm 6 years, 3 months ago
On Thu, Nov 30, 2017 at 06:58:28PM +0000, Ard Biesheuvel wrote:
> From: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
> 
> Now that we incorporated NorFlashInfoLib into the Fip006Dxe driver,
> replace the code that explicitly enables flag status register polling
> for Micron NOR flash with a test of the flags field provided by
> NorFlashInfoLib, which carries the same information.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 22 +++++++-------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
> index a521b1f3d167..8d6bca8739d0 100644
> --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
> +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c
> @@ -1129,6 +1129,7 @@ NorFlashCreateInstance (
>  {
>    EFI_STATUS Status;
>    NOR_FLASH_INSTANCE* Instance;
> +  NOR_FLASH_INFO *FlashInfo;
>    UINT8 JedecId[3];
>  
>    ASSERT(NorFlashInstance != NULL);
> @@ -1157,23 +1158,15 @@ NorFlashCreateInstance (
>    NorFlashReset (Instance);
>  
>    NorFlashReadID (Instance, JedecId);
> +  Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
> +  if (EFI_ERROR (Status)) {
> +    goto FreeInstance;
> +  }
>  
> -  DEBUG_CODE_BEGIN ();
> -    {
> -      NOR_FLASH_INFO    *FlashInfo;
> -
> -      Status = NorFlashGetInfo (JedecId, &FlashInfo, FALSE);
> -      if (EFI_ERROR (Status)) {
> -        goto FreeInstance;
> -      }
> -
> -      NorFlashPrintInfo (FlashInfo);
> -      FreePool (FlashInfo);
> -    }
> -  DEBUG_CODE_END ();
> +  NorFlashPrintInfo (FlashInfo);
>  
>    Instance->Flags = 0;
> -  if (JedecId[0] == NOR_FLASH_ID_STMICRO) {
> +  if (FlashInfo->Flags & NOR_FLASH_WRITE_FSR) {
>      Instance->Flags = NOR_FLASH_POLL_FSR;
>    }
>  
> @@ -1198,6 +1191,7 @@ NorFlashCreateInstance (
>    }
>  
>    *NorFlashInstance = Instance;
> +  FreePool (FlashInfo);
>    return EFI_SUCCESS;
>  
>  FreeInstance:
> -- 
> 2.11.0
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms] Silicon/Fip006Dxe: map NOR_FLASH_INFO FSR flag with instance flag
Posted by Ard Biesheuvel 6 years, 3 months ago
On 1 December 2017 at 12:59, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Nov 30, 2017 at 06:58:28PM +0000, Ard Biesheuvel wrote:
>> From: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
>>
>> Now that we incorporated NorFlashInfoLib into the Fip006Dxe driver,
>> replace the code that explicitly enables flag status register polling
>> for Micron NOR flash with a test of the flags field provided by
>> NorFlashInfoLib, which carries the same information.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Pipat Methavanitpong <methavanitpong.pipat@socionext.com>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks. Pushed as  bfde902ae7bf
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel