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/file.c | |
parent | 17c22dbd6b011211a040dc2839d2e3e560fa0806 (diff) | |
download | skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.zip skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.tar.gz skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.tar.bz2 |
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/file.c')
-rw-r--r-- | libflash/file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libflash/file.c b/libflash/file.c index 478bc13..946726c 100644 --- a/libflash/file.c +++ b/libflash/file.c @@ -59,7 +59,7 @@ static int file_reacquire(struct blocklevel_device *bl) return 0; } -static int file_read(struct blocklevel_device *bl, uint32_t pos, void *buf, uint32_t len) +static int file_read(struct blocklevel_device *bl, uint64_t pos, void *buf, uint64_t len) { struct file_data *file_data = container_of(bl, struct file_data, bl); int rc, count = 0; @@ -81,8 +81,8 @@ static int file_read(struct blocklevel_device *bl, uint32_t pos, void *buf, uint return 0; } -static int file_write(struct blocklevel_device *bl, uint32_t dst, const void *src, - uint32_t len) +static int file_write(struct blocklevel_device *bl, uint64_t dst, const void *src, + uint64_t len) { struct file_data *file_data = container_of(bl, struct file_data, bl); int rc, count = 0; @@ -111,7 +111,7 @@ static int file_write(struct blocklevel_device *bl, uint32_t dst, const void *sr * Also, erasing flash leaves all the bits set to 1. This may be expected * by higher level functions so this function should also emulate that */ -static int file_erase(struct blocklevel_device *bl, uint32_t dst, uint32_t len) +static int file_erase(struct blocklevel_device *bl, uint64_t dst, uint64_t len) { unsigned long long int d = ULLONG_MAX; int i = 0; @@ -127,7 +127,7 @@ static int file_erase(struct blocklevel_device *bl, uint32_t dst, uint32_t len) return 0; } -static int mtd_erase(struct blocklevel_device *bl, uint32_t dst, uint32_t len) +static int mtd_erase(struct blocklevel_device *bl, uint64_t dst, uint64_t len) { struct file_data *file_data = container_of(bl, struct file_data, bl); struct erase_info_user erase_info = { @@ -177,7 +177,7 @@ static int get_info_name(struct file_data *file_data, char **name) static int mtd_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 file_data *file_data = container_of(bl, struct file_data, bl); struct mtd_info_user mtd_info; @@ -204,7 +204,7 @@ static int mtd_get_info(struct blocklevel_device *bl, const char **name, } static int file_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 file_data *file_data = container_of(bl, struct file_data, bl); struct stat st; |