aboutsummaryrefslogtreecommitdiff
path: root/core/flash.c
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 /core/flash.c
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 'core/flash.c')
-rw-r--r--core/flash.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/flash.c b/core/flash.c
index e9c1f7d..da435a0 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -29,7 +29,7 @@ struct flash {
struct list_node list;
bool busy;
struct blocklevel_device *bl;
- uint32_t size;
+ uint64_t size;
uint32_t block_size;
int id;
};
@@ -192,7 +192,7 @@ static struct dt_node *flash_add_dt_node(struct flash *flash, int id)
flash_node = dt_new_addr(opal_node, "flash", id);
dt_add_property_strings(flash_node, "compatible", "ibm,opal-flash");
dt_add_property_cells(flash_node, "ibm,opal-id", id);
- dt_add_property_cells(flash_node, "reg", 0, flash->size);
+ dt_add_property_u64(flash_node, "reg", flash->size);
dt_add_property_cells(flash_node, "ibm,flash-block-size",
flash->block_size);
@@ -256,7 +256,8 @@ static int num_flashes(void)
int flash_register(struct blocklevel_device *bl, bool is_system_flash)
{
- uint32_t size, block_size;
+ uint64_t size;
+ uint32_t block_size;
struct ffs_handle *ffs;
struct dt_node *node;
struct flash *flash;
@@ -268,7 +269,7 @@ int flash_register(struct blocklevel_device *bl, bool is_system_flash)
return rc;
prlog(PR_INFO, "FLASH: registering flash device %s "
- "(size 0x%x, blocksize 0x%x)\n",
+ "(size 0x%llx, blocksize 0x%x)\n",
name ?: "(unnamed)", size, block_size);
lock(&flash_lock);