From patchwork Sun May 19 10:09:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Bakulin X-Patchwork-Id: 244803 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5D6752C008F for ; Sun, 19 May 2013 20:46:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1262B4A036; Sun, 19 May 2013 12:46:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0mgDcEPQsI98; Sun, 19 May 2013 12:46:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3339E4A025; Sun, 19 May 2013 12:46:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7CE524A030 for ; Sun, 19 May 2013 12:16:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E633YUFATU6l for ; Sun, 19 May 2013 12:16:29 +0200 (CEST) X-Greylist: delayed 427 seconds by postgrey-1.27 at theia; Sun, 19 May 2013 12:16:22 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from olymp.kibab.com (olymp.kibab.com [5.9.14.202]) by theia.denx.de (Postfix) with ESMTP id 25B9F4A02D for ; Sun, 19 May 2013 12:16:22 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.5.2 olymp.kibab.com 2E59E3F438 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=bakulin.de; s=default; t=1368958159; bh=BfsZsrZFEr3bqXLk/y8wSH14pji6ya4Bg4bT88IISPs=; h=Date:From:To:Subject; b=oJ4gnSJSYlbltosG1d22xQbCh6lVZ2YZlQlHjcmaK7Q9oeTxO0U6qScqYvNFZ3oLt zUPM2uCP0eJN+jmVfC+Z078zzGiPfEfDnQqKcDQGBBogc01T/ykX7qrvKJni2dV8nh 7VFvgRJ6vzj94prDetSHTMlXScO0+FpLeeFMNang= Date: Sun, 19 May 2013 12:09:19 +0200 From: Ilya Bakulin To: u-boot@lists.denx.de Message-ID: <20130519100919.GA47317@olymp.kibab.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Sun, 19 May 2013 12:46:03 +0200 Subject: [U-Boot] [PATCH] Fix device detection for API consumers X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Hi list, I use U-Boot for starting FreeBSD/arm on Globalscale DreamPlug. On this platform FreeBSD uses "ubldr" second-stage bootloader, which is an U-Boot API consumer and uses U-Boot API to access block devices, network, etc. Dreamplug has several block devices accessible: internal SD card, SD card reader, and any number of USB-attached mass storage devices. But when I boot ubldr, I can see only one block device. I have traced down the problem and it seems to be in U-Boot API. When doing block device enumeration, the "more" flag is not set properly on first access. This patch fixes the problem for me. After applying the patch, FreeBSD ubldr is able to see and access all block devices that U-Boot self knows. diff --git a/api/api_storage.c b/api/api_storage.c index c535712..1147e79 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -129,6 +129,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) else found = 1; + if (specs[type].max_dev > 1) + *more = 1; + } else { for (i = 0; i < specs[type].max_dev; i++) if (di->cookie == (void *)get_dev(specs[type].name, i)) {