aboutsummaryrefslogtreecommitdiff
path: root/libflash/ecc.h
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2016-07-28 17:15:32 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-08-02 18:12:49 +1000
commitc043065cf92358104e617b5c6aabbe619de76b0b (patch)
tree8f523164baeb14c937ae71f549ae5daa438a1b6c /libflash/ecc.h
parent17c22dbd6b011211a040dc2839d2e3e560fa0806 (diff)
downloadskiboot-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/ecc.h')
-rw-r--r--libflash/ecc.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/libflash/ecc.h b/libflash/ecc.h
index 1e14724..804b352 100644
--- a/libflash/ecc.h
+++ b/libflash/ecc.h
@@ -27,9 +27,9 @@ struct ecc64 {
uint8_t ecc;
} __attribute__((__packed__));
-extern int memcpy_from_ecc(uint64_t *dst, struct ecc64 *src, uint32_t len);
+extern int memcpy_from_ecc(uint64_t *dst, struct ecc64 *src, uint64_t len);
-extern int memcpy_to_ecc(struct ecc64 *dst, const uint64_t *src, uint32_t len);
+extern int memcpy_to_ecc(struct ecc64 *dst, const uint64_t *src, uint64_t len);
/*
* Calculate the size of a buffer if ECC is added
@@ -43,22 +43,22 @@ extern int memcpy_to_ecc(struct ecc64 *dst, const uint64_t *src, uint32_t len);
#define BYTES_PER_ECC 8
-static inline uint32_t ecc_size(uint32_t len)
+static inline uint64_t ecc_size(uint64_t len)
{
return ALIGN_UP(len, BYTES_PER_ECC) >> 3;
}
-static inline uint32_t ecc_buffer_size(uint32_t len)
+static inline uint64_t ecc_buffer_size(uint64_t len)
{
return ALIGN_UP(len, BYTES_PER_ECC) + ecc_size(len);
}
-static inline int ecc_buffer_size_check(uint32_t len)
+static inline int ecc_buffer_size_check(uint64_t len)
{
return len % (BYTES_PER_ECC + 1);
}
-static inline uint32_t ecc_buffer_size_minus_ecc(uint32_t len)
+static inline uint64_t ecc_buffer_size_minus_ecc(uint64_t len)
{
return len * BYTES_PER_ECC / (BYTES_PER_ECC + 1);
}