From patchwork Sun Aug 7 15:46:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1664360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=d9/nmbrl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M14gZ4W8cz9sFs for ; Mon, 8 Aug 2022 02:35:06 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B6D8184822; Sun, 7 Aug 2022 18:34:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="d9/nmbrl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C80183FEE; Sun, 7 Aug 2022 17:47:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (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 B75D684853 for ; Sun, 7 Aug 2022 17:47:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x232.google.com with SMTP id g187so6007680oia.2 for ; Sun, 07 Aug 2022 08:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=X2PuR5PoXnINkRROIScLQGw2r5MpJ2vIH1YRdaGEZ1s=; b=d9/nmbrlx5Vz88Du4LOaKnjTQKLrZZH8QTQDBw4YPkV3XKDg0v4RnTsGcFGqrmRue8 s9vLRE6i4HEQxl05y3HcPOItKwdeeyF1qZkUyGmkve6GvRoR90JlmhDsI/xNeBrWflsK 0JqpUxE7hgClNUxK4O7kqsyQt3qVlMOS9Kr5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=X2PuR5PoXnINkRROIScLQGw2r5MpJ2vIH1YRdaGEZ1s=; b=72SfXjjTz8qAyO0wh/1dy4qlGlP4+hEEonh3qCvWs2gFSmYZpM13+o8nv+tvZKhuzw sdMEyMbyiBWU+eCK8gmoy9MUGAYjZOCdbV8GSCvt9Gt7+nn0EvEporLyjqr7osv+X8XZ X58S1j8gw05HXf3W2X8cnmUSfLtoIaeQwFBimoWP+bgqDnkaFAyxvuzbV9UxsiMnqo26 GsxhGGHxQqpTI8ezwMFb1QZZGakcCq/iFZmDxNSfAlsYVWhWLhx+OYEsRPN91Ep3+b4S g44+1oyxdf0tOZU3MAO/9qhehIXEZFIDP3mQKlDZelHm13hzX6ApCSvhAf25zexfQyIN i1AA== X-Gm-Message-State: ACgBeo0Rm/ntVkM0qFEvDRhpCYPVfsJQeHUHK7fNgBWBSpLtIvZa1z30 dViNBiO2XEgKo7X6mX0YQ04aUON5UBkjww== X-Google-Smtp-Source: AA6agR51Kk4V07gNzeGMMtB5gQIFVwxxU94x/bARVu1fakxZhlLojcNSSzzXVHJPXbZ3V6dgqpTo1Q== X-Received: by 2002:a05:6808:305:b0:33a:e148:bcce with SMTP id i5-20020a056808030500b0033ae148bccemr9392637oie.114.1659887243095; Sun, 07 Aug 2022 08:47:23 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id y18-20020a056808131200b0034290c4ed01sm1553412oiv.41.2022.08.07.08.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 08:47:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Alexander Graf , Alexandru Gagniuc , Alexey Brodkin , Alper Nebi Yasak , Anastasiia Lukianenko , Andrew Davis , Andrew Scull , Artem Lapkin , Ashok Reddy Soma , Aswath Govindraju , Bharat Gooty , Bin Meng , Chris Morgan , Denys Drozdov , Fabio Estevam , Fabio Estevam , Francesco Dolcini , Gary Bisson , Heiko Schocher , Huang Jianan , Ilias Apalodimas , Jaehoon Chung , Jens Wiklander , Joe Hershberger , Judy Wang , Kever Yang , Loic Poulain , Lukasz Majewski , Marcel Ziswiler , =?utf-8?q?Marek_Beh=C3=BAn?= , Marek Vasut , Mark Kettenis , Masahisa Kojima , Max Merchel , Michal Simek , Oleksandr Andrushchenko , Oleksandr Suvorov , Oleksii Bidnichenko , Ovidiu Panait , =?utf-8?q?Pali_Roh=C3=A1r?= , Patrice Chotard , Patrick Delaunay , Peng Fan , Philippe Reynes , Philippe Schenker , Ramon Fried , Rayagonda Kokatanur , Ricardo Salveti , Rick Chen , Sean Anderson , Stefan Roese , Thomas Huth , Tony Dinh , TsiChung Liew , Wolfgang Denk , Ye Li , "Ying-Chun Liu (PaulLiu)" , schspa , uboot-stm32@st-md-mailman.stormreply.com Subject: [PATCH 00/23] blk: Rationalise the block interface Date: Sun, 7 Aug 2022 09:46:45 -0600 Message-Id: <20220807154708.1418967-1-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 07 Aug 2022 18:34:47 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean The block interface has two separate implementations, one using driver model and one not. The latter is really only needed for SPL, where size constraints allegedly don't allow use of driver model. Of course we still need space for filesystems and other code, so it isn't clear that driver model is anything more than the straw that breaks the camel's back. The driver model version uses a uclass ID for the interface time, but converts back and forth between that and if_type, which is the legacy type. The HAVE_BLOCK_DEVICE define is mostly a hangover from the old days. At present its main purpose is to enable the legacy block implementation in SPL. Finally the use of 'select' to enable BLK does not work very well. It causes kconfig errors when another option depends on BLK and it is not recommended by the kconfig style guide. This series aims to clean things up: - Enable BLK based on whether different media types are used, but still allow boards to disable it - Rename HAVE_BLOCK_DEVICE to indicates its real purpose - Drop if_type and use the uclass instead - Drop some obsolete if_type values An issue not resolved by this series is that the sandbox host interface does not actually have a device. At present it uses the root device, which was convenience for the driver model conversion but not really correct. It should be possible to clean this up, in a future series. Another minor issue is the use of UCLASS_USB for a mass-storage device. This has been the case for a while and is not addresed by this series, other than to add a comment. Note that this test relies on Tom Rini's series to drop various boards including warp and cm_t335 Finally, a patch is included to make binman put fake files in a subdirectory, since repeated runs of certain boards can cause unrelated failues (e.g. chromebook_coral) when fake files are left around. Simon Glass (23): binman: Put fake files in a subdirectory disk: Correct help for TPL_PARTITIONS blk: Enable CONFIG_BLK for all media ata: Fix an instance of SPL_SATA_SUPPORT sandbox: Avoid defining HAVE_BLOCK_DEVICE in Konfig disk: Use Makefile to omit partition drivers blk: Use a function for whether block devices are available cmd: Drop use of HAVE_BLOCK_DEVICE blk: Drop unnecessary #ifdef in in blk_legacy blk: Rename HAVE_BLOCK_DEVICE blk: Select SPL_LEGACY_BLOCK automatically blk: Drop unnecessary CONFIG_SPL_LEGACY_BLOCK in defconfigs blk: Hide the BLK and SPL_LEGACY_BLOCK options blk: Drop IF_TYPE_DOC ide: Use a flag for an ATAPI device blk: Drop IF_TYPE_ATAPI blk: Drop IF_TYPE_SD blk: Rename var in blk_get_devnum_by_typename() blk: Rewrite if_type to name functions efi: Correct assumption about if_type blk: Switch over to using uclass IDs blk: Drop if_type blk: Rename if_type to uclass_id arch/Kconfig | 1 - arch/arm/Kconfig | 1 - .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 4 +- board/st/common/stm32mp_dfu.c | 2 +- board/toradex/common/tdx-cfg-block.c | 4 +- cmd/Kconfig | 5 - cmd/Makefile | 2 +- cmd/bcb.c | 4 +- cmd/blk_common.c | 18 +- cmd/ide.c | 2 +- cmd/lsblk.c | 2 +- cmd/mmc.c | 10 +- cmd/mvebu/bubt.c | 2 +- cmd/nvme.c | 4 +- cmd/pvblock.c | 2 +- cmd/sata.c | 4 +- cmd/scsi.c | 2 +- cmd/usb.c | 2 +- cmd/virtio.c | 2 +- common/spl/Kconfig | 2 - common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 10 +- configs/M5253DEMO_defconfig | 1 + configs/axm_defconfig | 1 - configs/bcm968380gerg_ram_defconfig | 1 - .../gardena-smart-gateway-mt7688_defconfig | 1 - configs/nsim_hs38_defconfig | 1 - configs/qemu-ppce500_defconfig | 1 - disk/Kconfig | 4 +- disk/Makefile | 4 + disk/disk-uclass.c | 11 +- disk/part.c | 156 +++++-------- disk/part_amiga.c | 4 - disk/part_dos.c | 4 - disk/part_efi.c | 3 - disk/part_iso.c | 3 - disk/part_mac.c | 3 - doc/develop/driver-model/migration.rst | 2 +- doc/develop/uefi/uefi.rst | 2 +- doc/usage/partitions.rst | 2 +- drivers/Makefile | 3 +- drivers/ata/Kconfig | 4 +- drivers/ata/dwc_ahsata.c | 2 +- drivers/ata/fsl_sata.c | 2 +- drivers/ata/sata.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_sil.c | 2 +- drivers/block/Kconfig | 20 +- drivers/block/Makefile | 2 +- drivers/block/blk-uclass.c | 219 +++++++++--------- drivers/block/blk_legacy.c | 60 +++-- drivers/block/efi_blk.c | 2 +- drivers/block/ide.c | 16 +- drivers/block/sandbox.c | 14 +- drivers/dfu/dfu_mmc.c | 6 +- drivers/mmc/Kconfig | 1 - drivers/mmc/mmc-uclass.c | 12 +- drivers/mmc/mmc_legacy.c | 8 +- drivers/mmc/mmc_write.c | 4 +- drivers/net/fsl_enetc.c | 12 +- drivers/net/fsl_enetc.h | 2 +- drivers/nvme/Kconfig | 2 - drivers/nvme/nvme.c | 2 +- drivers/scsi/Kconfig | 2 - drivers/scsi/scsi.c | 12 +- drivers/tee/optee/rpmb.c | 4 +- drivers/virtio/Kconfig | 1 - drivers/virtio/virtio_blk.c | 4 +- drivers/xen/Kconfig | 1 - drivers/xen/pvblock.c | 6 +- env/mmc.c | 4 +- fs/fat/fat.c | 4 +- include/blk.h | 141 +++++------ include/efi_api.h | 4 +- include/efi_loader.h | 4 +- include/mmc.h | 2 +- lib/efi_driver/efi_block_device.c | 4 +- lib/efi_loader/Kconfig | 1 - lib/efi_loader/efi_device_path.c | 2 +- lib/efi_loader/efi_device_path_to_text.c | 4 +- lib/efi_loader/efi_disk.c | 28 +-- lib/efi_loader/efi_net.c | 2 +- lib/efi_loader/efi_var_file.c | 4 +- test/dm/blk.c | 24 +- tools/binman/control.py | 10 +- tools/binman/entry.py | 25 +- tools/binman/ftest.py | 30 ++- 88 files changed, 492 insertions(+), 523 deletions(-)