From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70AA9C433F5 for ; Wed, 24 Nov 2021 03:10:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 143E482F95; Wed, 24 Nov 2021 04:10:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TL1E06UG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B06C82F97; Wed, 24 Nov 2021 04:10:42 +0100 (CET) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B2D9682F80 for ; Wed, 24 Nov 2021 04:10:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x1029.google.com with SMTP id v23so1252687pjr.5 for ; Tue, 23 Nov 2021 19:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=JnVnuxr3buMJ3vRkJmwfhZiUKtmMt+1XkDFwoo3a7TY=; b=TL1E06UGquHTcjhBCPOiPzVtaqv6rPANBjVbtvMoLlbbgDZXXCw2p9SEPV9aJ4drvH SSz6sIjFYXx7eA+fEdZFsjrrTb7RFGiiQfjAj8sQ8iyVvi7YGLN8fvVRRic5XD3g0vun iwbhPln6Qh53AmSZVOLwvRXdt1V9zl6XbiK270agr7L1K5xx9eD1dscY9GqDQFpHlIKk UgQBjQWjxkOAOqPZKbyYjb+pj84Ru04XwXYhXHZRWSkK235+l6FByfGarDP8bIkCRQWv WrrZ/y+QQL5rCktHOj+I7Oi+rG0pjYXCgQsYikjdDuuNxEwVsyfbUzrAsp4XHP7pDFAP EJdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=JnVnuxr3buMJ3vRkJmwfhZiUKtmMt+1XkDFwoo3a7TY=; b=gLwnd0qu7MDRYc18SbFbQlK4TkO7xwLcPXQ4wpen8fW8e/BtdmLVsjj51aKZ3mvhG7 l1741q9jlZ5JquY/40ruQdJE9V6/oTW4s5V6Zb1beiQePfb76r6/gJi4DqPP4OpnrzPU Pauy6xQWYLNOHQdkAAk1nSgdvXFaiIsrYfUVgXPEjeL7tpNHxpVuLoffwsRHi+ACjuGw j14xzqr+Nz4z1e+F4AnIC6l9PvTqphKjxsn9LIXKrd7vn+Bj7kX66TXflOmGx0P9aO9h 8OGahv/3brh0TWYrX2sRAbbHvbKrgUT0T+1Tj9UoSjXYqcOxyzDmdIv8KKVeDTf31iWt r3sw== X-Gm-Message-State: AOAM531suxbw+BLHKaMKhsu7WvU9c569CWxClqiowqtc5D75oUlyLYpn FYW1dIlIFCwY2/9a2Q6xEwNqEg== X-Google-Smtp-Source: ABdhPJwQkPivIyNlVEsKUnacycsK2I9hguQWw/BWYabQ8emIppypt4auvt6Vg7llkcMMS510EhJYgA== X-Received: by 2002:a17:90a:1b67:: with SMTP id q94mr3815613pjq.119.1637723436899; Tue, 23 Nov 2021 19:10:36 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:6daa:4b0a:ac7e:f30c]) by smtp.gmail.com with ESMTPSA id y32sm14037919pfa.145.2021.11.23.19.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 19:10:36 -0800 (PST) Date: Wed, 24 Nov 2021 12:10:32 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: Simon Glass , U-Boot Mailing List , Ilias Apalodimas , Alexander Graf Subject: Re: [BUG] efi_loader: incorrect creation of device paths Message-ID: <20211124031032.GB9598@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , Simon Glass , U-Boot Mailing List , Ilias Apalodimas , Alexander Graf References: <6df46f32-f76e-ef2d-aaee-d0349c480789@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6df46f32-f76e-ef2d-aaee-d0349c480789@gmx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Sat, Nov 20, 2021 at 01:54:30PM +0100, Heinrich Schuchardt wrote: > Hello Takahiro, > > in a prior mail we have discussed the creation of device paths for USB > mass storage devices. > > On the sand boxyou get the following devices after 'usb start': > > Class Index Probed Driver Name > ----------------------------------------------------------- > usb 0 [ + ] usb_sandbox |-- usb@1 > usb_hub 0 [ + ] usb_hub | `-- hub > usb_mass_s 0 [ + ] usb_mass_storage | |-- > usb_mass_storage > blk 3 [ ] usb_storage_blk | | `-- > usb_mass_storage.lun0 > usb_mass_s 1 [ + ] usb_mass_storage | |-- > usb_mass_storage > blk 4 [ ] usb_storage_blk | | `-- > usb_mass_storage.lun0 > usb_mass_s 2 [ + ] usb_mass_storage | `-- > usb_mass_storage > blk 5 [ ] usb_storage_blk | `-- > usb_mass_storage.lun0 > > For of these storage devices we try to create the same device path which > is not allowable: > > => usb start > starting USB... > Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found > scanning usb for storage devices... 3 Storage Device(s) found > => > => efidebug dh > Scanning disk mmc2.blk... > handle 0000000015e34f00, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > Scanning disk mmc1.blk... > handle 0000000015e36b30, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > Scanning disk mmc0.blk... > handle 0000000015e35b00, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > Scanning disk usb_mass_storage.lun0... > handle 0000000015e35c10, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x1234,0x5678,0x9,0x0,0x0)/UsbClass(0x1234,0x5678,0x0,0x0,0x0) > fs_devread read outside partition 2 > Failed to mount ext2 filesystem... > BTRFS: superblock end 69632 is larger than device size 512 > Scanning disk usb_mass_storage.lun0... > handle 0000000015e361f0, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x1234,0x5678,0x9,0x0,0x0)/UsbClass(0x1234,0x5678,0x0,0x0,0x0) > ERROR: failure to add disk device usb_mass_storage.lun0, r = 20 > Error: Cannot initialize UEFI sub-system, r = 20 > > I will provide a patch that will allow the first USB device to be used > and avoids stopping the boot process. But we really have to walk the dm > tree to create a device patch for USB devices based on port IDs. > > We should add a new field to struct uclass_driver: > > struct efi_device_path *get_node(udevice *dev); > > This function shall return a pointer to an freshly allocated buffer with > the device node for the device. To build the devicepath we can then walk > the dm tree. I'm not sure this is an acceptable solution. Let me make sure: The goal would be to create a device path like .../USB(0x1,0x0)/HD(1,...) instead of .../UsbHub(0x0,0x0,0x0,0x3)/UsbMassStorage(0x46f4,0x1,0x0,0x0)/HD(1,...) as we already see this format for SCSI: .../Scsi(0,0)/HD(1,..) Right? -Takahiro Akashi > To make migration easier: If the function pointer or the return value is > NULL we can create a CTRL() node as dummy using the uclass_id and the > device number. > > Best regards > > Heinrich