From patchwork Fri Feb 27 09:11:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 444216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 122B81400DD for ; Fri, 27 Feb 2015 20:11:45 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id EB30B1A011E for ; Fri, 27 Feb 2015 20:11:44 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id B83711A0071 for ; Fri, 27 Feb 2015 20:11:12 +1100 (AEDT) Received: by ozlabs.org (Postfix, from userid 1023) id 9BE5A140111; Fri, 27 Feb 2015 20:11:12 +1100 (AEDT) MIME-Version: 1.0 Message-Id: <1425028266.817834.734907331220.6.gpush@pablo> In-Reply-To: <1425028266.816963.907799920643.0.gpush@pablo> To: skiboot@lists.ozlabs.org From: Jeremy Kerr Date: Fri, 27 Feb 2015 17:11:06 +0800 Subject: [Skiboot] [PATCH 06/13] core/flash: Remove alignment and size restrictions X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Joel Stanley libflash is able to perform reads and writes across page boundaries, so this restriction is not required. Signed-off-by: Joel Stanley Signed-off-by: Jeremy Kerr --- 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);