diff options
author | Michael Neuling <mikey@neuling.org> | 2016-07-28 17:15:32 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-08-02 18:12:49 +1000 |
commit | c043065cf92358104e617b5c6aabbe619de76b0b (patch) | |
tree | 8f523164baeb14c937ae71f549ae5daa438a1b6c /libflash/libflash.c | |
parent | 17c22dbd6b011211a040dc2839d2e3e560fa0806 (diff) | |
download | blackbird-skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.tar.gz blackbird-skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.zip |
flash: Make size 64 bit safe
This makes the size of flash 64 bit safe so that we can have flash
devices greater than 4GB. This is especially useful for mambo disks
passed through to Linux.
Fortunately the device tree interface and the linux device driver are
64bit safe so no changes are required there.
Userspace gard and flash tools are also updated to ensure "make check"
still passes.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/libflash.c')
-rw-r--r-- | libflash/libflash.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libflash/libflash.c b/libflash/libflash.c index d3e594a1..cf679a55 100644 --- a/libflash/libflash.c +++ b/libflash/libflash.c @@ -16,6 +16,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <inttypes.h> #include "libflash.h" #include "libflash-priv.h" @@ -124,7 +125,7 @@ int fl_wren(struct spi_flash_ctrl *ct) return FLASH_ERR_WREN_TIMEOUT; } -static int flash_read(struct blocklevel_device *bl, uint32_t pos, void *buf, uint32_t len) +static int flash_read(struct blocklevel_device *bl, uint64_t pos, void *buf, uint64_t len) { struct flash_chip *c = container_of(bl, struct flash_chip, bl); struct spi_flash_ctrl *ct = c->ctrl; @@ -228,7 +229,7 @@ static void fl_get_best_erase(struct flash_chip *c, uint32_t dst, uint32_t size, *cmd = CMD_BE; } -static int flash_erase(struct blocklevel_device *bl, uint32_t dst, uint32_t size) +static int flash_erase(struct blocklevel_device *bl, uint64_t dst, uint64_t size) { struct flash_chip *c = container_of(bl, struct flash_chip, bl); struct spi_flash_ctrl *ct = c->ctrl; @@ -244,7 +245,8 @@ static int flash_erase(struct blocklevel_device *bl, uint32_t dst, uint32_t size if ((dst | size) & c->min_erase_mask) return FLASH_ERR_ERASE_BOUNDARY; - FL_DBG("LIBFLASH: Erasing 0x%08x..0%08x...\n", dst, dst + size); + FL_DBG("LIBFLASH: Erasing 0x%" PRIx64"..0%" PRIx64 "...\n", + dst, dst + size); /* Use controller erase if supported */ if (ct->erase) @@ -479,7 +481,7 @@ static enum sm_comp_res flash_smart_comp(struct flash_chip *c, return is_same ? sm_no_change : sm_need_write; } -static int flash_smart_write(struct blocklevel_device *bl, uint32_t dst, const void *src, uint32_t size) +static int flash_smart_write(struct blocklevel_device *bl, uint64_t dst, const void *src, uint64_t size) { struct flash_chip *c = container_of(bl, struct flash_chip, bl); uint32_t er_size = c->min_erase_mask + 1; @@ -492,7 +494,7 @@ static int flash_smart_write(struct blocklevel_device *bl, uint32_t dst, const v return FLASH_ERR_PARM_ERROR; } - FL_DBG("LIBFLASH: Smart writing to 0x%08x..0%08x...\n", + FL_DBG("LIBFLASH: Smart writing to 0x%" PRIx64 "..0%" PRIx64 "...\n", dst, dst + size); /* As long as we have something to write ... */ @@ -792,7 +794,7 @@ static int flash_configure(struct flash_chip *c) } static int flash_get_info(struct blocklevel_device *bl, const char **name, - uint32_t *total_size, uint32_t *erase_granule) + uint64_t *total_size, uint32_t *erase_granule) { struct flash_chip *c = container_of(bl, struct flash_chip, bl); if (name) |