[Skiboot] [PATCH 06/13] core/flash: Remove alignment and size restrictions

Jeremy Kerr jk at ozlabs.org
Fri Feb 27 20:11:06 AEDT 2015


From: Joel Stanley <joel at jms.id.au>

libflash is able to perform reads and writes across page boundaries, so
this restriction is not required.

Signed-off-by: Joel Stanley <joel at jms.id.au>
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---
 core/flash.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/core/flash.c b/core/flash.c
index 2bb04f5..cef34d9 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -186,6 +186,8 @@ static struct dt_node *flash_add_dt_node(struct flash *flash, int id,
 static void setup_system_flash(struct flash *flash, struct dt_node *node,
 		const char *name, struct ffs_handle *ffs)
 {
+	char *path;
+
 	if (system_flash) {
 		prlog(PR_WARNING, "FLASH: attempted to register a second "
 				"system flash device %s\n", name);
@@ -199,7 +201,9 @@ static void setup_system_flash(struct flash *flash, struct dt_node *node,
 	}
 
 	system_flash = flash;
-	dt_add_property_string(dt_chosen, "ibm,system-flash", node->name);
+	path = dt_get_path(node);
+	dt_add_property_string(dt_chosen, "ibm,system-flash", path);
+	free(path);
 
 	prlog(PR_INFO, "FLASH: registered system flash device %s\n", name);
 
@@ -273,7 +277,6 @@ static int64_t opal_flash_op(enum flash_op op, uint64_t id, uint64_t offset,
 		uint64_t buf, uint64_t size, uint64_t token)
 {
 	struct flash *flash;
-	uint32_t mask;
 	int rc;
 
 	if (id >= ARRAY_SIZE(flashes))
@@ -294,12 +297,6 @@ static int64_t opal_flash_op(enum flash_op op, uint64_t id, uint64_t offset,
 		goto err;
 	}
 
-	mask = flash->block_size - 1;
-	if (size & mask || offset & mask) {
-		rc = OPAL_PARAMETER;
-		goto err;
-	}
-
 	switch (op) {
 	case FLASH_OP_READ:
 		rc = flash_read(flash->chip, offset, (void *)buf, size);


More information about the Skiboot mailing list