Skip to content

Commit

Permalink
core/flash: Unlock around blocklevel calls in NVRAM accessors
Browse files Browse the repository at this point in the history
[ Upstream commit c0b8454 ]

This ensures progress when we don't have interrupts available for IPMI.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
amboar authored and stewartsmith committed Oct 31, 2018
1 parent f976e77 commit 67531d1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ static int flash_nvram_start_read(void *dst, uint32_t src, uint32_t len)
goto out;
}

nvram_flash->busy = true;
unlock(&flash_lock);

rc = blocklevel_read(nvram_flash->bl, nvram_offset + src, dst, len);

lock(&flash_lock);
nvram_flash->busy = false;
out:
unlock(&flash_lock);
if (!rc)
Expand Down Expand Up @@ -147,8 +152,14 @@ static int flash_nvram_write(uint32_t dst, void *src, uint32_t len)
rc = OPAL_PARAMETER;
goto out;
}

nvram_flash->busy = true;
unlock(&flash_lock);

rc = blocklevel_write(nvram_flash->bl, nvram_offset + dst, src, len);

lock(&flash_lock);
nvram_flash->busy = false;
out:
unlock(&flash_lock);
return rc;
Expand Down

0 comments on commit 67531d1

Please sign in to comment.