From 661cdaa79d961248bc8290f421d9cf3eb8defffd Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 2 Sep 2022 13:57:49 +0200 Subject: cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET This patch integrates the main function responsible for calling all registered cyclic functions cyclic_run() into the common WATCHDOG_RESET macro. This guarantees that cyclic_run() is executed very often, which is necessary for the cyclic functions to get scheduled and executed at their configured periods. If CONFIG_WATCHDOG is not enabled, only cyclic_run() without calling watchdog_reset(). This guarantees that the cyclic functionality does not rely on CONFIG_WATCHDOG being enabled. Signed-off-by: Stefan Roese Reviewed-by: Simon Glass --- fs/cramfs/uncompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c index f431cc46c1..38e10e2e44 100644 --- a/fs/cramfs/uncompress.c +++ b/fs/cramfs/uncompress.c @@ -62,7 +62,7 @@ int cramfs_uncompress_init (void) stream.avail_in = 0; #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - stream.outcb = (cb_func) WATCHDOG_RESET; + stream.outcb = (cb_func)watchdog_reset_func; #else stream.outcb = Z_NULL; #endif /* CONFIG_HW_WATCHDOG */ -- cgit v1.2.3 From a51eb8de31492d2139e66a7e66b8fb3f03ddca50 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 11 Aug 2022 19:34:45 -0600 Subject: blk: Use a function for whether block devices are available At present we use HAVE_BLOCK_DEVICE to indicate when block devices are available. This is a very strange option, since it partially duplicates the BLK option used by driver model. It also covers both U-Boot proper and SPL, even though one might have block devices and another not. As a first step towards correcting this, create a new inline function called blk_enabled() which indicates if block devices are available. This cannot be used in Makefiles, or #if clauses, but can be used in C code. A function is useful because we cannot use CONFIG_IS_ENABLED(BLK) to decide if block devices are needed, since we must consider the legacy block interface, enabled by HAVE_BLOCK_DEVICE Update a few places where it can be used and drop some unnecessary #if checks around some functions in disk/part.c - rely on the compiler's dead-code elimination instead. Signed-off-by: Simon Glass --- disk/part.c | 80 +++++++++++++++++++--------------------------- drivers/block/blk-uclass.c | 3 +- fs/fat/fat.c | 2 +- include/blk.h | 5 +++ 4 files changed, 40 insertions(+), 50 deletions(-) (limited to 'fs') diff --git a/disk/part.c b/disk/part.c index 79955c7fb0..9594bb432c 100644 --- a/disk/part.c +++ b/disk/part.c @@ -54,12 +54,13 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc) return NULL; } -#ifdef CONFIG_HAVE_BLOCK_DEVICE static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) { struct blk_desc *dev_desc; int ret; + if (!blk_enabled()) + return NULL; dev_desc = blk_get_devnum_by_typename(ifname, dev); if (!dev_desc) { debug("%s: No device for iface '%s', dev %d\n", __func__, @@ -78,21 +79,11 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) struct blk_desc *blk_get_dev(const char *ifname, int dev) { - return get_dev_hwpart(ifname, dev, 0); -} -#else -struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) -{ - return NULL; -} + if (!blk_enabled()) + return NULL; -struct blk_desc *blk_get_dev(const char *ifname, int dev) -{ - return NULL; + return get_dev_hwpart(ifname, dev, 0); } -#endif - -#ifdef CONFIG_HAVE_BLOCK_DEVICE /* ------------------------------------------------------------------------- */ /* @@ -228,9 +219,6 @@ void dev_print (struct blk_desc *dev_desc) puts (" Capacity: not available\n"); } } -#endif - -#ifdef CONFIG_HAVE_BLOCK_DEVICE void part_init(struct blk_desc *dev_desc) { @@ -325,38 +313,36 @@ void part_print(struct blk_desc *dev_desc) drv->print(dev_desc); } -#endif /* CONFIG_HAVE_BLOCK_DEVICE */ - int part_get_info(struct blk_desc *dev_desc, int part, struct disk_partition *info) { -#ifdef CONFIG_HAVE_BLOCK_DEVICE struct part_driver *drv; + if (blk_enabled()) { #if CONFIG_IS_ENABLED(PARTITION_UUIDS) - /* The common case is no UUID support */ - info->uuid[0] = 0; + /* The common case is no UUID support */ + info->uuid[0] = 0; #endif #ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; + info->type_guid[0] = 0; #endif - drv = part_driver_lookup_type(dev_desc); - if (!drv) { - debug("## Unknown partition table type %x\n", - dev_desc->part_type); - return -EPROTONOSUPPORT; - } - if (!drv->get_info) { - PRINTF("## Driver %s does not have the get_info() method\n", - drv->name); - return -ENOSYS; - } - if (drv->get_info(dev_desc, part, info) == 0) { - PRINTF("## Valid %s partition found ##\n", drv->name); - return 0; + drv = part_driver_lookup_type(dev_desc); + if (!drv) { + debug("## Unknown partition table type %x\n", + dev_desc->part_type); + return -EPROTONOSUPPORT; + } + if (!drv->get_info) { + PRINTF("## Driver %s does not have the get_info() method\n", + drv->name); + return -ENOSYS; + } + if (drv->get_info(dev_desc, part, info) == 0) { + PRINTF("## Valid %s partition found ##\n", drv->name); + return 0; + } } -#endif /* CONFIG_HAVE_BLOCK_DEVICE */ return -ENOENT; } @@ -424,15 +410,15 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, goto cleanup; } -#ifdef CONFIG_HAVE_BLOCK_DEVICE - /* - * Updates the partition table for the specified hw partition. - * Always should be done, otherwise hw partition 0 will return stale - * data after displaying a non-zero hw partition. - */ - if ((*dev_desc)->if_type == IF_TYPE_MMC) - part_init(*dev_desc); -#endif + if (blk_enabled()) { + /* + * Updates the partition table for the specified hw partition. + * Always should be done, otherwise hw partition 0 will return + * stale data after displaying a non-zero hw partition. + */ + if ((*dev_desc)->if_type == IF_TYPE_MMC) + part_init(*dev_desc); + } cleanup: free(dup_str); diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 21c5209bb6..1a6e8f8c29 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -743,8 +743,7 @@ int blk_unbind_all(int if_type) static int blk_post_probe(struct udevice *dev) { - if (CONFIG_IS_ENABLED(PARTITIONS) && - IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) { + if (CONFIG_IS_ENABLED(PARTITIONS) && blk_enabled()) { struct blk_desc *desc = dev_get_uclass_plat(dev); part_init(desc); diff --git a/fs/fat/fat.c b/fs/fat/fat.c index df9ea2c028..c64e253abd 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1144,7 +1144,7 @@ int file_fat_detectfs(void) return 1; } - if (IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) { + if (blk_enabled()) { printf("Interface: %s\n", blk_get_if_type_name(cur_dev->if_type)); printf(" Device %d: ", cur_dev->devnum); dev_print(cur_dev); diff --git a/include/blk.h b/include/blk.h index 9503369db8..332481a90b 100644 --- a/include/blk.h +++ b/include/blk.h @@ -21,6 +21,11 @@ typedef ulong lbaint_t; struct udevice; +static inline bool blk_enabled(void) +{ + return CONFIG_IS_ENABLED(BLK) || IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE); +} + /* Interface types: */ enum if_type { IF_TYPE_UNKNOWN = 0, -- cgit v1.2.3 From 29caf9305b6fafe8f6d6b18fa1f825dff8686e61 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 2 Sep 2022 14:10:46 +0200 Subject: cyclic: Use schedule() instead of WATCHDOG_RESET() Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese Reviewed-by: Simon Glass Tested-by: Tom Rini [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm] --- arch/arm/mach-at91/phy.c | 2 +- arch/arm/mach-imx/i2c-mxv7.c | 2 +- arch/arm/mach-socfpga/spl_a10.c | 8 ++--- .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c | 6 ++-- arch/m68k/lib/time.c | 2 +- arch/powerpc/cpu/mpc8xx/cpu_init.c | 2 +- arch/powerpc/lib/bootm.c | 6 ++-- arch/powerpc/lib/cache.c | 2 +- arch/powerpc/lib/interrupts.c | 2 +- board/astro/mcf5373l/fpga.c | 4 +-- board/dhelectronics/dh_stm32mp1/board.c | 2 +- board/liebherr/display5/spl.c | 2 +- board/nokia/rx51/rx51.c | 2 +- board/st/stm32mp1/stm32mp1.c | 2 +- boot/bootretry.c | 2 +- boot/image-board.c | 2 +- cmd/fastboot.c | 2 +- cmd/mem.c | 16 +++++----- cmd/usb_mass_storage.c | 2 +- cmd/ximg.c | 2 +- common/board_f.c | 4 +-- common/board_r.c | 2 +- common/cli_readline.c | 4 +-- common/console.c | 2 +- common/dfu.c | 2 +- common/lcd.c | 10 +++--- common/menu.c | 6 ++-- common/usb_kbd.c | 2 +- common/xyzModem.c | 2 +- drivers/block/ide.c | 8 ++--- drivers/crypto/aspeed/aspeed_hace.c | 2 +- drivers/crypto/hash/hash_sw.c | 2 +- drivers/ddr/altera/sdram_arria10.c | 4 +-- drivers/ddr/altera/sdram_n5x.c | 4 +-- drivers/ddr/altera/sdram_soc64.c | 2 +- drivers/fpga/intel_sdm_mb.c | 8 ++--- drivers/fpga/socfpga_arria10.c | 8 ++--- drivers/i2c/mxc_i2c.c | 4 +-- drivers/mmc/octeontx_hsmmc.c | 12 ++++---- drivers/mmc/sh_mmcif.c | 6 ++-- drivers/mmc/stm32_sdmmc2.c | 2 +- drivers/mtd/cfi_flash.c | 4 +-- drivers/mtd/nand/core.c | 2 +- drivers/mtd/nand/raw/atmel_nand.c | 6 ++-- drivers/mtd/nand/raw/nand_base.c | 10 +++--- drivers/mtd/nand/raw/nand_util.c | 6 ++-- drivers/mtd/nand/spi/core.c | 4 +-- drivers/mtd/onenand/onenand_base.c | 4 +-- drivers/mtd/spi/spi-nor-core.c | 4 +-- drivers/net/octeontx2/nix.c | 2 +- drivers/net/octeontx2/nix_af.c | 32 +++++++++---------- drivers/ram/stm32mp1/stm32mp1_tests.c | 2 +- drivers/serial/atmel_usart.c | 2 +- drivers/serial/ns16550.c | 6 ++-- drivers/serial/serial-uclass.c | 2 +- drivers/serial/serial_bcm283x_mu.c | 2 +- drivers/serial/serial_lpuart.c | 8 ++--- drivers/serial/serial_mpc8xx.c | 4 +-- drivers/serial/serial_mt7620.c | 2 +- drivers/serial/serial_mtk.c | 4 +-- drivers/serial/serial_mxc.c | 6 ++-- drivers/serial/serial_octeon_bootcmd.c | 2 +- drivers/serial/serial_octeon_pcie_console.c | 4 +-- drivers/serial/serial_pl01x.c | 8 ++--- drivers/serial/serial_sifive.c | 2 +- drivers/serial/serial_zynq.c | 2 +- drivers/spi/mtk_snfi_spi.c | 2 +- drivers/spi/octeon_spi.c | 2 +- drivers/spi/stm32_qspi.c | 2 +- drivers/timer/mpc83xx_timer.c | 4 +-- drivers/usb/eth/lan7x.h | 4 +-- drivers/usb/gadget/f_acm.c | 4 +-- drivers/usb/gadget/f_sdp.c | 4 +-- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/musb-new/musb_uboot.c | 2 +- drivers/video/video_bmp.c | 4 +-- env/common.c | 2 +- fs/cramfs/uncompress.c | 3 +- fs/jffs2/jffs2_1pass.c | 2 +- include/linux/compat.h | 2 +- include/wait_bit.h | 2 +- include/watchdog.h | 8 ----- lib/bzip2/bzlib.c | 2 +- lib/bzip2/bzlib_decompress.c | 8 ++--- lib/crc32.c | 2 +- lib/efi_loader/efi_boottime.c | 4 +-- lib/gunzip.c | 2 +- lib/lzma/LzmaDec.c | 16 +++++----- lib/lzma/LzmaTools.c | 2 +- lib/md5.c | 2 +- lib/sha1.c | 2 +- lib/sha256.c | 2 +- lib/sha512.c | 4 +-- lib/time.c | 2 +- lib/zlib/inflate.c | 8 ++--- net/net.c | 2 +- post/cpu/mpc83xx/ecc.c | 2 +- post/drivers/memory.c | 36 +++++++++++----------- post/lib_powerpc/cpu.c | 16 +++++----- post/lib_powerpc/fpu/fpu.c | 4 +-- post/post.c | 4 +-- test/common/cyclic.c | 2 +- test/dm/wdt.c | 9 +++--- 103 files changed, 235 insertions(+), 241 deletions(-) (limited to 'fs') diff --git a/arch/arm/mach-at91/phy.c b/arch/arm/mach-at91/phy.c index 6101eee358..f4484a77c7 100644 --- a/arch/arm/mach-at91/phy.c +++ b/arch/arm/mach-at91/phy.c @@ -42,7 +42,7 @@ void at91_phy_reset(void) /* Wait for end of hardware reset */ while (!(readl(&rstc->sr) & AT91_RSTC_SR_NRSTL)) { /* avoid shutdown by watchdog */ - WATCHDOG_RESET(); + schedule(); mdelay(10); /* timeout for not getting stuck in an endless loop */ diff --git a/arch/arm/mach-imx/i2c-mxv7.c b/arch/arm/mach-imx/i2c-mxv7.c index d36347d8e8..85d648b56e 100644 --- a/arch/arm/mach-imx/i2c-mxv7.c +++ b/arch/arm/mach-imx/i2c-mxv7.c @@ -46,7 +46,7 @@ int force_idle_bus(void *priv) scl = gpio_get_value(p->scl.gp); if ((sda & scl) == 1) break; - WATCHDOG_RESET(); + schedule(); elapsed = get_timer(start_time); if (elapsed > (CONFIG_SYS_HZ / 5)) { /* .2 seconds */ ret = -EBUSY; diff --git a/arch/arm/mach-socfpga/spl_a10.c b/arch/arm/mach-socfpga/spl_a10.c index ec67a5b0eb..2c567edd50 100644 --- a/arch/arm/mach-socfpga/spl_a10.c +++ b/arch/arm/mach-socfpga/spl_a10.c @@ -117,7 +117,7 @@ void spl_board_init(void) /* enable console uart printing */ preloader_console_init(); - WATCHDOG_RESET(); + schedule(); arch_early_init_r(); @@ -203,7 +203,7 @@ void spl_board_init(void) */ set_regular_boot(true); - WATCHDOG_RESET(); + schedule(); reset_cpu(); } @@ -268,11 +268,11 @@ void board_init_f(ulong dummy) /* reconfigure and enable the watchdog */ hw_watchdog_init(); - WATCHDOG_RESET(); + schedule(); #endif /* CONFIG_HW_WATCHDOG */ config_dedicated_pins(gd->fdt_blob); - WATCHDOG_RESET(); + schedule(); } /* board specific function prior loading SSBL / U-Boot proper */ diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index 2932eae757..1a69bc3897 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -247,7 +247,7 @@ static int stm32prog_serial_getc_err(void) err = ops->getc(down_serial_dev); if (err == -EAGAIN) { ctrlc(); - WATCHDOG_RESET(); + schedule(); } } while ((err == -EAGAIN) && (!had_ctrlc())); @@ -276,7 +276,7 @@ static bool stm32prog_serial_get_buffer(u8 *buffer, u32 *count) *count -= 1; } else if (err == -EAGAIN) { ctrlc(); - WATCHDOG_RESET(); + schedule(); if (get_timer(start) > TIMEOUT_SERIAL_BUFFER) { err = -ETIMEDOUT; break; @@ -852,7 +852,7 @@ bool stm32prog_serial_loop(struct stm32prog_data *data) stm32prog_serial_result(ACK_BYTE); cmd_func[counter](data); } - WATCHDOG_RESET(); + schedule(); } /* clean device */ diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c index ebb2ac54db..cd7437b3e2 100644 --- a/arch/m68k/lib/time.c +++ b/arch/m68k/lib/time.c @@ -72,7 +72,7 @@ void dtimer_interrupt(void *not_used) #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) if (CONFIG_SYS_WATCHDOG_FREQ && (timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) { - WATCHDOG_RESET (); + schedule(); } #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ return; diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c index c8d06b0508..86b08a6174 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c @@ -31,7 +31,7 @@ void cpu_init_f(immap_t __iomem *immr) out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE); #endif - WATCHDOG_RESET(); + schedule(); /* SIUMCR - contains debug pin configuration (11-6) */ setbits_be32(&immr->im_siu_conf.sc_siumcr, CONFIG_SYS_SIUMCR); diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index e52aa75703..b92df9543e 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -84,7 +84,7 @@ static void boot_jump_linux(bootm_headers_t *images) * r9: 0 */ debug(" Booting using OF flat tree...\n"); - WATCHDOG_RESET (); + schedule(); (*kernel) ((struct bd_info *)of_flat_tree, 0, 0, EPAPR_MAGIC, env_get_bootm_mapsize(), 0, 0); /* does not return */ @@ -108,7 +108,7 @@ static void boot_jump_linux(bootm_headers_t *images) struct bd_info *kbd = images->kbd; debug(" Booting using board info...\n"); - WATCHDOG_RESET (); + schedule(); (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end, 0, 0); /* does not return */ @@ -319,7 +319,7 @@ void boot_jump_vxworks(bootm_headers_t *images) * r9: 0 * TCR: WRC = 0, no watchdog timer reset will occur */ - WATCHDOG_RESET(); + schedule(); ((void (*)(void *, ulong, ulong, ulong, ulong, ulong, ulong))images->ep)(images->ft_addr, diff --git a/arch/powerpc/lib/cache.c b/arch/powerpc/lib/cache.c index 19162511ce..c4c5c2d451 100644 --- a/arch/powerpc/lib/cache.c +++ b/arch/powerpc/lib/cache.c @@ -13,7 +13,7 @@ static ulong maybe_watchdog_reset(ulong flushed) { flushed += CONFIG_SYS_CACHELINE_SIZE; if (flushed >= CONFIG_CACHE_FLUSH_WATCHDOG_THRESHOLD) { - WATCHDOG_RESET(); + schedule(); flushed = 0; } return flushed; diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c index 5ba4cd0c13..bdb8030c27 100644 --- a/arch/powerpc/lib/interrupts.c +++ b/arch/powerpc/lib/interrupts.c @@ -81,7 +81,7 @@ void timer_interrupt(struct pt_regs *regs) #if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) if (CONFIG_SYS_WATCHDOG_FREQ && (timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) - WATCHDOG_RESET (); + schedule(); #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ #ifdef CONFIG_LED_STATUS diff --git a/board/astro/mcf5373l/fpga.c b/board/astro/mcf5373l/fpga.c index 50a3830b85..f85737432b 100644 --- a/board/astro/mcf5373l/fpga.c +++ b/board/astro/mcf5373l/fpga.c @@ -123,7 +123,7 @@ int altera_write_fn(const void *buf, size_t len, int flush, int cookie) if (bytecount % len_40 == 0) { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK putc('.'); /* let them know we are alive */ @@ -343,7 +343,7 @@ int xilinx_fastwr_config_fn(void *buf, size_t len, int flush, int cookie) } if (bytecount % len_40 == 0) { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK putc('.'); /* let them know we are alive */ diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index e3c7ed1049..7e4f3ff157 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -423,7 +423,7 @@ static void __maybe_unused led_error_blink(u32 nb_blink) for (i = 0; i < 2 * nb_blink; i++) { led_set_state(led, LEDST_TOGGLE); mdelay(125); - WATCHDOG_RESET(); + schedule(); } } #endif diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 5c1af1a772..4219d002fe 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -329,7 +329,7 @@ void board_init_f(ulong dummy) /* Initialize and reset WDT in SPL */ #ifdef CONFIG_SPL_WATCHDOG hw_watchdog_init(); - WATCHDOG_RESET(); + schedule(); #endif /* load/boot image from boot device */ diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c index 460d248eaa..9548c3c7be 100644 --- a/board/nokia/rx51/rx51.c +++ b/board/nokia/rx51/rx51.c @@ -722,7 +722,7 @@ static int rx51_kp_getc(struct udevice *dev) { keybuf_head %= KEYBUF_SIZE; while (!rx51_kp_tstc(dev)) - WATCHDOG_RESET(); + schedule(); return keybuf[keybuf_head++]; } diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 9496890d16..6028a0b6de 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -289,7 +289,7 @@ static void __maybe_unused led_error_blink(u32 nb_blink) for (i = 0; i < 2 * nb_blink; i++) { led_set_state(led, LEDST_TOGGLE); mdelay(125); - WATCHDOG_RESET(); + schedule(); } led_set_state(led, LEDST_ON); } diff --git a/boot/bootretry.c b/boot/bootretry.c index 2bc9c6866e..8d850df9d4 100644 --- a/boot/bootretry.c +++ b/boot/bootretry.c @@ -44,7 +44,7 @@ int bootretry_tstc_timeout(void) while (!tstc()) { /* while no incoming data */ if (retry_time >= 0 && get_ticks() > endtime) return -ETIMEDOUT; - WATCHDOG_RESET(); + schedule(); } return 0; diff --git a/boot/image-board.c b/boot/image-board.c index 1be0a359ab..98f903f93f 100644 --- a/boot/image-board.c +++ b/boot/image-board.c @@ -181,7 +181,7 @@ void memmove_wd(void *to, void *from, size_t len, ulong chunksz) while (len > 0) { size_t tail = (len > chunksz) ? chunksz : len; - WATCHDOG_RESET(); + schedule(); if (to > from) { to -= tail; from -= tail; diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 033a2c95e8..dd223b1554 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -76,7 +76,7 @@ static int do_fastboot_usb(int argc, char *const argv[], break; if (ctrlc()) break; - WATCHDOG_RESET(); + schedule(); usb_gadget_handle_interrupts(controller_index); } diff --git a/cmd/mem.c b/cmd/mem.c index 6a7b4014ed..1e39348195 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -300,7 +300,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, /* reset watchdog from time to time */ if ((ngood % (64 << 10)) == 0) - WATCHDOG_RESET(); + schedule(); } unmap_sysmem(buf1); unmap_sysmem(buf2); @@ -848,7 +848,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, } } addr[test_offset] = pattern; - WATCHDOG_RESET(); + schedule(); /* * Check for addr bits stuck low or shorted. @@ -890,7 +890,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Fill memory with a known pattern. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - WATCHDOG_RESET(); + schedule(); addr[offset] = pattern; } @@ -898,7 +898,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Check each location and invert it for the second pass. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - WATCHDOG_RESET(); + schedule(); temp = addr[offset]; if (temp != pattern) { printf("\nFAILURE (read/write) @ 0x%.8lx:" @@ -918,7 +918,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Check each location for the inverted pattern and zero it. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - WATCHDOG_RESET(); + schedule(); anti_pattern = ~pattern; temp = addr[offset]; if (temp != anti_pattern) { @@ -972,7 +972,7 @@ static ulong test_bitflip_comparison(volatile unsigned long *bufa, for (k = 0; k < max; k++) { q = 0x00000001L << k; for (j = 0; j < 8; j++) { - WATCHDOG_RESET(); + schedule(); q = ~q; p1 = (volatile unsigned long *)bufa; p2 = (volatile unsigned long *)bufb; @@ -1033,7 +1033,7 @@ static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr, pattern, ""); for (addr = buf, val = pattern; addr < end; addr++) { - WATCHDOG_RESET(); + schedule(); *addr = val; val += incr; } @@ -1041,7 +1041,7 @@ static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr, puts("Reading..."); for (addr = buf, val = pattern; addr < end; addr++) { - WATCHDOG_RESET(); + schedule(); readback = *addr; if (readback != val) { ulong offset = addr - buf; diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index d4e619b842..b7daaa6e8e 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -231,7 +231,7 @@ static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag, goto cleanup_register; } - WATCHDOG_RESET(); + schedule(); } cleanup_register: diff --git a/cmd/ximg.c b/cmd/ximg.c index 65ba41320a..8533d0d238 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -200,7 +200,7 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) while (l > 0) { tail = (l > CHUNKSZ) ? CHUNKSZ : l; - WATCHDOG_RESET(); + schedule(); memmove(to, from, tail); to += tail; from += tail; diff --git a/common/board_f.c b/common/board_f.c index deb46be182..f92d7b9faf 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -114,14 +114,14 @@ static int init_func_watchdog_init(void) hw_watchdog_init(); puts(" Watchdog enabled\n"); # endif - WATCHDOG_RESET(); + schedule(); return 0; } int init_func_watchdog_reset(void) { - WATCHDOG_RESET(); + schedule(); return 0; } diff --git a/common/board_r.c b/common/board_r.c index 062bc3e688..50670b5615 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -341,7 +341,7 @@ static int initr_flash(void) /* * Compute and print flash CRC if flashchecksum is set to 'y' * - * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX + * NOTE: Maybe we should add some schedule()? XXX */ if (env_get_yesno("flashchecksum") == 1) { const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE; diff --git a/common/cli_readline.c b/common/cli_readline.c index f883b7ffac..f6e2bcdece 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -274,7 +274,7 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, while (!tstc()) { /* while no incoming data */ if (get_ticks() >= etime) return -2; /* timed out */ - WATCHDOG_RESET(); + schedule(); } first = 0; } @@ -595,7 +595,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, for (;;) { if (bootretry_tstc_timeout()) return -2; /* timed out */ - WATCHDOG_RESET(); /* Trigger watchdog, if needed */ + schedule(); /* Trigger watchdog, if needed */ c = getchar(); diff --git a/common/console.c b/common/console.c index bde9412239..66b9813b3a 100644 --- a/common/console.c +++ b/common/console.c @@ -480,7 +480,7 @@ int fgetc(int file) * Effectively poll for input wherever it may be available. */ for (;;) { - WATCHDOG_RESET(); + schedule(); if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { /* * Upper layer may have already called tstc() so diff --git a/common/dfu.c b/common/dfu.c index 16bd1ba588..96190889ab 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -101,7 +101,7 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) if (dfu_reinit_needed) goto exit; - WATCHDOG_RESET(); + schedule(); usb_gadget_handle_interrupts(usbctrl_index); } exit: diff --git a/common/lcd.c b/common/lcd.c index 0898bc025d..a462b22a47 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -294,9 +294,9 @@ void lcd_logo_plot(int x, int y) BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS); if (bpix < 12) { - WATCHDOG_RESET(); + schedule(); lcd_logo_set_cmap(); - WATCHDOG_RESET(); + schedule(); for (i = 0; i < BMP_LOGO_HEIGHT; ++i) { memcpy(fb, bmap, BMP_LOGO_WIDTH); @@ -320,7 +320,7 @@ void lcd_logo_plot(int x, int y) } } - WATCHDOG_RESET(); + schedule(); lcd_sync(); } #else @@ -459,7 +459,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) byte_width = width * 2; for (i = 0; i < height; ++i) { - WATCHDOG_RESET(); + schedule(); for (j = 0; j < width; j++) { if (bpix != 16) { fb_put_byte(&fb, &bmap); @@ -488,7 +488,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) #if defined(CONFIG_BMP_16BPP) case 16: for (i = 0; i < height; ++i) { - WATCHDOG_RESET(); + schedule(); for (j = 0; j < width; j++) fb_put_word(&fb, &bmap); diff --git a/common/menu.c b/common/menu.c index 0d19601cf5..8fe00965c0 100644 --- a/common/menu.c +++ b/common/menu.c @@ -435,7 +435,7 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu, printf("Hit any key to stop autoboot: %d ", menu->delay); for (i = 0; i < 100; ++i) { if (!tstc()) { - WATCHDOG_RESET(); + schedule(); mdelay(10); continue; } @@ -483,7 +483,7 @@ void bootmenu_loop(struct bootmenu_data *menu, if (tstc()) { c = getchar(); } else { - WATCHDOG_RESET(); + schedule(); mdelay(10); if (tstc()) c = getchar(); @@ -492,7 +492,7 @@ void bootmenu_loop(struct bootmenu_data *menu, } } else { while (!tstc()) { - WATCHDOG_RESET(); + schedule(); mdelay(10); } c = getchar(); diff --git a/common/usb_kbd.c b/common/usb_kbd.c index d385bea532..4cbc9acb73 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -446,7 +446,7 @@ static int usb_kbd_getc(struct stdio_dev *sdev) data = usb_kbd_dev->privptr; while (data->usb_in_pointer == data->usb_out_pointer) { - WATCHDOG_RESET(); + schedule(); usb_kbd_poll_for_event(usb_kbd_dev); } diff --git a/common/xyzModem.c b/common/xyzModem.c index a68d392902..fb319f7119 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -68,7 +68,7 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c) { ulong now = get_timer(0); - WATCHDOG_RESET(); + schedule(); while (!tstc ()) { if (get_timer(now) > xyzModem_CHAR_TIMEOUT) diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 73da29ad55..b8840d29c2 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -62,7 +62,7 @@ static void ide_reset(void) /* the reset signal shall be asserted for et least 25 us */ udelay(25); - WATCHDOG_RESET(); + schedule(); /* de-assert RESET signal */ ide_set_reset(0); @@ -695,7 +695,7 @@ void ide_init(void) unsigned char c; int i, bus; - WATCHDOG_RESET(); + schedule(); /* ATAPI Drives seems to need a proper IDE Reset */ ide_reset(); @@ -745,7 +745,7 @@ void ide_init(void) puts("OK "); ide_bus_ok[bus] = 1; } - WATCHDOG_RESET(); + schedule(); } putc('\n'); @@ -775,7 +775,7 @@ void ide_init(void) } #endif } - WATCHDOG_RESET(); + schedule(); #ifdef CONFIG_BLK struct udevice *dev; diff --git a/drivers/crypto/aspeed/aspeed_hace.c b/drivers/crypto/aspeed/aspeed_hace.c index 1178cc6a76..a1b0b9f564 100644 --- a/drivers/crypto/aspeed/aspeed_hace.c +++ b/drivers/crypto/aspeed/aspeed_hace.c @@ -302,7 +302,7 @@ static int aspeed_hace_digest_wd(struct udevice *dev, enum HASH_ALGO algo, return rc; cur += chunk; - WATCHDOG_RESET(); + schedule(); } } else { rc = aspeed_hace_update(dev, ctx, ibuf, ilen); diff --git a/drivers/crypto/hash/hash_sw.c b/drivers/crypto/hash/hash_sw.c index fea9d12609..553c068010 100644 --- a/drivers/crypto/hash/hash_sw.c +++ b/drivers/crypto/hash/hash_sw.c @@ -258,7 +258,7 @@ static int sw_hash_digest_wd(struct udevice *dev, enum HASH_ALGO algo, return rc; cur += chunk; - WATCHDOG_RESET(); + schedule(); } } else { rc = sw_hash_update(dev, ctx, ibuf, ilen); diff --git a/drivers/ddr/altera/sdram_arria10.c b/drivers/ddr/altera/sdram_arria10.c index 4a8f8dea1c..8ef5fa4c48 100644 --- a/drivers/ddr/altera/sdram_arria10.c +++ b/drivers/ddr/altera/sdram_arria10.c @@ -671,7 +671,7 @@ static int of_sdram_firewall_setup(const void *blob) int ddr_calibration_sequence(void) { - WATCHDOG_RESET(); + schedule(); /* Check to see if SDRAM cal was success */ if (sdram_startup()) { @@ -681,7 +681,7 @@ int ddr_calibration_sequence(void) puts("DDRCAL: Success\n"); - WATCHDOG_RESET(); + schedule(); /* initialize the MMR register */ sdram_mmr_init(); diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c index 737a4e2ff1..d9039443b9 100644 --- a/drivers/ddr/altera/sdram_n5x.c +++ b/drivers/ddr/altera/sdram_n5x.c @@ -517,7 +517,7 @@ static int ensure_retry_procedure_complete(phys_addr_t umctl2_base) DDR4_CRCPARSTAT_CMD_IN_ERR_WINDOW; udelay(1); - WATCHDOG_RESET(); + schedule(); } return 0; @@ -1349,7 +1349,7 @@ static int ddr_post_handoff_config(phys_addr_t umctl2_base, } udelay(1); - WATCHDOG_RESET(); + schedule(); /* Polling until SDRAM entered normal operating mode */ value = readl(umctl2_base + DDR4_STAT_OFFSET) & diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c index 9b1710c135..4716abfc9a 100644 --- a/drivers/ddr/altera/sdram_soc64.c +++ b/drivers/ddr/altera/sdram_soc64.c @@ -161,7 +161,7 @@ void sdram_init_ecc_bits(struct bd_info *bd) sdram_clear_mem(start_addr, size_init); size -= size_init; start_addr += size_init; - WATCHDOG_RESET(); + schedule(); } bank++; diff --git a/drivers/fpga/intel_sdm_mb.c b/drivers/fpga/intel_sdm_mb.c index f5fd9a14c2..903d143a36 100644 --- a/drivers/fpga/intel_sdm_mb.c +++ b/drivers/fpga/intel_sdm_mb.c @@ -44,7 +44,7 @@ static int reconfig_status_polling_resp(void) puts("."); udelay(RECONFIG_STATUS_INTERVAL_DELAY_US); - WATCHDOG_RESET(); + schedule(); } return -ETIMEDOUT; @@ -104,7 +104,7 @@ static int send_bitstream(const void *rbf_data, size_t rbf_size) udelay(20000); } - WATCHDOG_RESET(); + schedule(); } return 0; @@ -252,7 +252,7 @@ static int reconfig_status_polling_resp(void) puts("."); udelay(RECONFIG_STATUS_INTERVAL_DELAY_US); - WATCHDOG_RESET(); + schedule(); } return -ETIMEDOUT; @@ -378,7 +378,7 @@ static int send_reconfig_data(const void *rbf_data, size_t rbf_size, if (resp_err && !xfer_count) return resp_err; } - WATCHDOG_RESET(); + schedule(); } return 0; diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c index d8089122af..e86e3b7431 100644 --- a/drivers/fpga/socfpga_arria10.c +++ b/drivers/fpga/socfpga_arria10.c @@ -383,7 +383,7 @@ static int fpgamgr_program_poll_cd(void) printf("nstatus == 0 while waiting for condone\n"); return -EPERM; } - WATCHDOG_RESET(); + schedule(); } if (i == FPGA_TIMEOUT_CNT) @@ -534,7 +534,7 @@ static void get_rbf_image_info(struct rbf_info *rbf, u16 *buffer) rbf->section = unknown; break; - WATCHDOG_RESET(); + schedule(); } } @@ -635,7 +635,7 @@ static int first_loading_rbf_to_buffer(struct udevice *dev, break; } } - WATCHDOG_RESET(); + schedule(); } if (!fpga_node_name) { @@ -879,7 +879,7 @@ int socfpga_loadfs(fpga_fs_info *fpga_fsinfo, const void *buf, size_t bsize, total_sizeof_image += buffer_sizebytes_ori; - WATCHDOG_RESET(); + schedule(); } wait_for_fifo_empty(); diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index aa13af3ae1..f80ff5383b 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -199,7 +199,7 @@ static int wait_for_sr_state(struct mxc_i2c_bus *i2c_bus, unsigned state) } if ((sr & (state >> 8)) == (unsigned char)state) return sr; - WATCHDOG_RESET(); + schedule(); elapsed = get_timer(start_time); if (elapsed > (CONFIG_SYS_HZ / 10)) /* .1 seconds */ break; @@ -447,7 +447,7 @@ int i2c_idle_bus(struct mxc_i2c_bus *i2c_bus) sda = dm_gpio_get_value(sda_gpio); if ((sda & scl) == 1) break; - WATCHDOG_RESET(); + schedule(); elapsed = get_timer(start_time); if (elapsed > (CONFIG_SYS_HZ / 5)) { /* .2 seconds */ ret = -EBUSY; diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c index 6e9acf7310..4ee62df9d4 100644 --- a/drivers/mmc/octeontx_hsmmc.c +++ b/drivers/mmc/octeontx_hsmmc.c @@ -1023,7 +1023,7 @@ static void octeontx_mmc_cleanup_dma(struct mmc *mmc, start = get_timer(0); do { rsp_sts.u = read_csr(mmc, MIO_EMM_RSP_STS()); - WATCHDOG_RESET(); + schedule(); } while (get_timer(start) < 100 && (rsp_sts.s.dma_val || rsp_sts.s.dma_pend)); } while (retries-- >= 0 && rsp_sts.s.dma_pend); @@ -1107,7 +1107,7 @@ static int octeontx_mmc_wait_dma(struct mmc *mmc, bool write, ulong timeout, } else if (!rsp_sts.s.dma_val && emm_dma_int.s.done) { break; } - WATCHDOG_RESET(); + schedule(); timed_out = (get_timer(start_time) > timeout); } while (!timed_out); @@ -1219,7 +1219,7 @@ static int octeontx_mmc_read_blocks(struct mmc *mmc, struct mmc_cmd *cmd, } return blkcnt - count; } - WATCHDOG_RESET(); + schedule(); } while (--count); } #ifdef DEBUG @@ -1253,7 +1253,7 @@ static int octeontx_mmc_poll_ready(struct mmc *mmc, ulong timeout) } else if (cmd.response[0] & R1_READY_FOR_DATA) { return 0; } - WATCHDOG_RESET(); + schedule(); } while (get_timer(start) < timeout); if (not_ready) @@ -1328,7 +1328,7 @@ static ulong octeontx_mmc_write_blocks(struct mmc *mmc, struct mmc_cmd *cmd, read_csr(mmc, MIO_EMM_DMA())); return blkcnt - count; } - WATCHDOG_RESET(); + schedule(); } while (--count); } @@ -1491,7 +1491,7 @@ static int octeontx_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, start = get_timer(0); do { rsp_sts.u = read_csr(mmc, MIO_EMM_RSP_STS()); - WATCHDOG_RESET(); + schedule(); } while (!rsp_sts.s.cmd_done && !rsp_sts.s.rsp_timeout && (get_timer(start) < timeout + 10)); octeontx_mmc_print_rsp_errors(mmc, rsp_sts); diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c index 830e29cdd4..76dc1c68b8 100644 --- a/drivers/mmc/sh_mmcif.c +++ b/drivers/mmc/sh_mmcif.c @@ -242,7 +242,7 @@ static int sh_mmcif_multi_read(struct sh_mmcif_host *host, for (i = 0; i < blocksize / 4; i++) *p++ = sh_mmcif_read(&host->regs->ce_data); - WATCHDOG_RESET(); + schedule(); } return 0; } @@ -309,7 +309,7 @@ static int sh_mmcif_multi_write(struct sh_mmcif_host *host, for (i = 0; i < blocksize / 4; i++) sh_mmcif_write(*p++, &host->regs->ce_data); - WATCHDOG_RESET(); + schedule(); } return 0; } @@ -523,7 +523,7 @@ static int sh_mmcif_send_cmd_common(struct sh_mmcif_host *host, { int ret; - WATCHDOG_RESET(); + schedule(); switch (cmd->cmdidx) { case MMC_CMD_APP_CMD: diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index bfce8a2e4a..7ab4d949e7 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -445,7 +445,7 @@ static int stm32_sdmmc2_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, u32 cmdat = data ? SDMMC_CMD_CMDTRANS : 0; int ret, retry = 3; - WATCHDOG_RESET(); + schedule(); retry_cmd: ctx.data_length = 0; diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 4950410706..d34d8ee976 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -584,7 +584,7 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, reset_timer(); #endif start = get_timer(0); - WATCHDOG_RESET(); + schedule(); while (flash_is_busy(info, sector)) { if (get_timer(start) > tout) { printf("Flash %s timeout at address %lx data %lx\n", @@ -677,7 +677,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, reset_timer(); #endif start = get_timer(0); - WATCHDOG_RESET(); + schedule(); while (1) { switch (info->portwidth) { case FLASH_CFI_8BIT: diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 090834a495..99c29670c7 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -173,7 +173,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) nanddev_offs_to_pos(nand, einfo->addr, &pos); nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last); while (nanddev_pos_cmp(&pos, &last) <= 0) { - WATCHDOG_RESET(); + schedule(); ret = nanddev_erase(nand, &pos); if (ret) { einfo->fail_addr = nanddev_pos_to_offs(nand, &pos); diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c index 06bf5ac18f..61bfd175be 100644 --- a/drivers/mtd/nand/raw/atmel_nand.c +++ b/drivers/mtd/nand/raw/atmel_nand.c @@ -420,7 +420,7 @@ static int pmecc_err_location(struct mtd_info *mtd) while (--timeout) { if (pmecc_readl(host->pmerrloc, elisr) & PMERRLOC_CALC_DONE) break; - WATCHDOG_RESET(); + schedule(); udelay(1); } @@ -558,7 +558,7 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd, while (--timeout) { if (!(pmecc_readl(host->pmecc, sr) & PMECC_SR_BUSY)) break; - WATCHDOG_RESET(); + schedule(); udelay(1); } @@ -598,7 +598,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd, while (--timeout) { if (!(pmecc_readl(host->pmecc, sr) & PMECC_SR_BUSY)) break; - WATCHDOG_RESET(); + schedule(); udelay(1); } diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 1a1a757932..215b9ba84f 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -595,7 +595,7 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) if (status & NAND_STATUS_READY) break; - WATCHDOG_RESET(); + schedule(); } }; @@ -2342,7 +2342,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, while (1) { unsigned int ecc_failures = mtd->ecc_stats.failed; - WATCHDOG_RESET(); + schedule(); bytes = min(mtd->writesize - col, readlen); aligned = (bytes == mtd->writesize); @@ -2695,7 +2695,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, page = realpage & chip->pagemask; while (1) { - WATCHDOG_RESET(); + schedule(); if (ops->mode == MTD_OPS_RAW) ret = chip->ecc.read_oob_raw(mtd, chip, page); @@ -3263,7 +3263,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, else use_bufpoi = 0; - WATCHDOG_RESET(); + schedule(); /* Partial page write?, or need to use bounce buffer */ if (use_bufpoi) { pr_debug("%s: using write bounce buffer for buf@%p\n", @@ -3556,7 +3556,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, instr->state = MTD_ERASING; while (len) { - WATCHDOG_RESET(); + schedule(); /* Check if we have a bad block, we do not erase bad blocks! */ if (!instr->scrub && nand_block_checkbad(mtd, ((loff_t) page) << diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c index 5150607d8a..b2345dca7f 100644 --- a/drivers/mtd/nand/raw/nand_util.c +++ b/drivers/mtd/nand/raw/nand_util.c @@ -103,7 +103,7 @@ int nand_erase_opts(struct mtd_info *mtd, erased_length < erase_length; erase.addr += mtd->erasesize) { - WATCHDOG_RESET(); + schedule(); if (opts->lim && (erase.addr >= (opts->offset + opts->lim))) { puts("Size of erase exceeds limit\n"); @@ -638,7 +638,7 @@ int nand_write_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length, size_t block_offset = offset & (mtd->erasesize - 1); size_t write_size, truncated_write_size; - WATCHDOG_RESET(); + schedule(); if (nand_block_isbad(mtd, block_start)) { printf("Skip bad block 0x%08llx\n", block_start); @@ -753,7 +753,7 @@ int nand_read_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length, size_t block_offset = offset & (mtd->erasesize - 1); size_t read_length; - WATCHDOG_RESET(); + schedule(); if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) { printf("Skipping bad block 0x%08llx\n", diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index e5330958c7..134bf22c80 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -579,7 +579,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, #endif nanddev_io_for_each_page(nand, from, ops, &iter) { - WATCHDOG_RESET(); + schedule(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; @@ -631,7 +631,7 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, #endif nanddev_io_for_each_page(nand, to, ops, &iter) { - WATCHDOG_RESET(); + schedule(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index f94597c061..08fe7d427a 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -478,7 +478,7 @@ static int onenand_wait(struct mtd_info *mtd, int state) u32 timeo = (CONFIG_SYS_HZ * 20) / 1000; u32 time_start = get_timer(0); do { - WATCHDOG_RESET(); + schedule(); if (get_timer(time_start) > timeo) return -EIO; interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); @@ -1170,7 +1170,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state) u32 timeo = (CONFIG_SYS_HZ * 20) / 1000; u32 time_start = get_timer(0); do { - WATCHDOG_RESET(); + schedule(); if (get_timer(time_start) > timeo) return ONENAND_BBT_READ_FATAL_ERROR; interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index f236e87510..c73636d7d1 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -958,7 +958,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) addr_known = true; while (len) { - WATCHDOG_RESET(); + schedule(); if (!IS_ENABLED(CONFIG_SPL_BUILD) && ctrlc()) { addr_known = false; ret = -EINTR; @@ -1721,7 +1721,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; - WATCHDOG_RESET(); + schedule(); /* * If page_size is a power of two, the offset can be quickly diff --git a/drivers/net/octeontx2/nix.c b/drivers/net/octeontx2/nix.c index a5665a25f2..f596b6bca8 100644 --- a/drivers/net/octeontx2/nix.c +++ b/drivers/net/octeontx2/nix.c @@ -580,7 +580,7 @@ int nix_lf_xmit(struct udevice *dev, void *pkt, int pkt_len) __iowmb(); result = lmt_submit((u64)(nix->nix_base + NIXX_LF_OP_SENDX(0))); - WATCHDOG_RESET(); + schedule(); } while (result == 0); return 0; diff --git a/drivers/net/octeontx2/nix_af.c b/drivers/net/octeontx2/nix_af.c index cd098d6cd6..c945ea0f5f 100644 --- a/drivers/net/octeontx2/nix_af.c +++ b/drivers/net/octeontx2/nix_af.c @@ -65,7 +65,7 @@ int npa_attach_aura(struct nix_af *nix_af, int lf, start = get_timer(0); while ((res->s.compcode == NPA_AQ_COMP_E_NOTDONE) && (get_timer(start) < 1000)) - WATCHDOG_RESET(); + schedule(); if (res->s.compcode != NPA_AQ_COMP_E_GOOD) { printf("%s: Error: result 0x%x not good\n", __func__, res->s.compcode); @@ -111,7 +111,7 @@ int npa_attach_pool(struct nix_af *nix_af, int lf, start = get_timer(0); while ((res->s.compcode == NPA_AQ_COMP_E_NOTDONE) && (get_timer(start) < 1000)) - WATCHDOG_RESET(); + schedule(); if (res->s.compcode != NPA_AQ_COMP_E_GOOD) { printf("%s: Error: result 0x%x not good\n", @@ -136,7 +136,7 @@ int npa_lf_admin_setup(struct npa *npa, int lf, dma_addr_t aura_base) do { lf_rst.u = npa_af_reg_read(npa_af, NPA_AF_LF_RST()); - WATCHDOG_RESET(); + schedule(); } while (lf_rst.s.exec); /* Set Aura size and enable caching of contexts */ @@ -199,7 +199,7 @@ int npa_lf_admin_shutdown(struct nix_af *nix_af, int lf, u32 pool_count) start = get_timer(0); while ((res->s.compcode == NPA_AQ_COMP_E_NOTDONE) && (get_timer(start) < 1000)) - WATCHDOG_RESET(); + schedule(); if (res->s.compcode != NPA_AQ_COMP_E_GOOD) { printf("%s: Error: result 0x%x not good for lf %d\n" @@ -235,7 +235,7 @@ int npa_lf_admin_shutdown(struct nix_af *nix_af, int lf, u32 pool_count) start = get_timer(0); while ((res->s.compcode == NPA_AQ_COMP_E_NOTDONE) && (get_timer(start) < 1000)) - WATCHDOG_RESET(); + schedule(); if (res->s.compcode != NPA_AQ_COMP_E_GOOD) { printf("%s: Error: result 0x%x not good for lf %d\n" @@ -255,7 +255,7 @@ int npa_lf_admin_shutdown(struct nix_af *nix_af, int lf, u32 pool_count) do { lf_rst.u = npa_af_reg_read(npa, NPA_AF_LF_RST()); - WATCHDOG_RESET(); + schedule(); } while (lf_rst.s.exec); return 0; @@ -286,7 +286,7 @@ int npa_af_setup(struct npa_af *npa_af) /* Wait for reset to complete */ do { blk_rst.u = npa_af_reg_read(npa_af, NPA_AF_BLK_RST()); - WATCHDOG_RESET(); + schedule(); } while (blk_rst.s.busy); /* Set little Endian */ @@ -318,7 +318,7 @@ int npa_af_shutdown(struct npa_af *npa_af) /* Wait for reset to complete */ do { blk_rst.u = npa_af_reg_read(npa_af, NPA_AF_BLK_RST()); - WATCHDOG_RESET(); + schedule(); } while (blk_rst.s.busy); rvu_aq_free(&npa_af->aq); @@ -481,7 +481,7 @@ static int nix_aq_issue_command(struct nix_af *nix_af, start = get_timer(0); /* Wait for completion */ do { - WATCHDOG_RESET(); + schedule(); dsb(); } while (result->s.compcode == 0 && get_timer(start) < 2); @@ -645,7 +645,7 @@ int nix_lf_admin_setup(struct nix *nix) do { lf_rst.u = nix_af_reg_read(nix_af, NIXX_AF_LF_RST()); - WATCHDOG_RESET(); + schedule(); } while (lf_rst.s.exec); /* Config NIX RQ HW context and base*/ @@ -767,7 +767,7 @@ int nix_lf_admin_shutdown(struct nix_af *nix_af, int lf, do { sw_sync.u = nix_af_reg_read(nix_af, NIXX_AF_RX_SW_SYNC()); - WATCHDOG_RESET(); + schedule(); } while (sw_sync.s.ena); for (index = 0; index < rq_count; index++) { @@ -832,7 +832,7 @@ int nix_lf_admin_shutdown(struct nix_af *nix_af, int lf, do { lf_rst.u = nix_af_reg_read(nix_af, NIXX_AF_LF_RST()); - WATCHDOG_RESET(); + schedule(); } while (lf_rst.s.exec); return 0; @@ -972,7 +972,7 @@ int npc_af_shutdown(struct nix_af *nix_af) /* Wait for reset to complete */ do { blk_rst.u = npc_af_reg_read(nix_af, NPC_AF_BLK_RST()); - WATCHDOG_RESET(); + schedule(); } while (blk_rst.s.busy); debug("%s: npc af reset --\n", __func__); @@ -1008,7 +1008,7 @@ int nix_af_setup(struct nix_af *nix_af) /* Wait for reset to complete */ do { blk_rst.u = nix_af_reg_read(nix_af, NIXX_AF_BLK_RST()); - WATCHDOG_RESET(); + schedule(); } while (blk_rst.s.busy); /* Put in LE mode */ @@ -1031,7 +1031,7 @@ int nix_af_setup(struct nix_af *nix_af) /* Wait for calibration to complete */ do { af_status.u = nix_af_reg_read(nix_af, NIXX_AF_STATUS()); - WATCHDOG_RESET(); + schedule(); } while (af_status.s.calibrate_done == 0); af_cfg.u = nix_af_reg_read(nix_af, NIXX_AF_CFG()); @@ -1091,7 +1091,7 @@ int nix_af_shutdown(struct nix_af *nix_af) /* Wait for reset to complete */ do { blk_rst.u = nix_af_reg_read(nix_af, NIXX_AF_BLK_RST()); - WATCHDOG_RESET(); + schedule(); } while (blk_rst.s.busy); rvu_aq_free(&nix_af->aq); diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c b/drivers/ram/stm32mp1/stm32mp1_tests.c index 64262f1aa9..c5f3354414 100644 --- a/drivers/ram/stm32mp1/stm32mp1_tests.c +++ b/drivers/ram/stm32mp1/stm32mp1_tests.c @@ -169,7 +169,7 @@ static int test_loop_end(u32 *loop, u32 nb_loop, u32 progress) return 1; } printf("loop #%d\n", *loop); - WATCHDOG_RESET(); + schedule(); return 0; } diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 1fb9ee5cc9..90ccdf6b29 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -103,7 +103,7 @@ static int atmel_serial_getc(void) atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; while (!(readl(&usart->csr) & USART3_BIT(RXRDY))) - WATCHDOG_RESET(); + schedule(); return readl(&usart->rhr); } diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 47bad6f8e2..7592979cab 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -296,7 +296,7 @@ void ns16550_putc(struct ns16550 *com_port, char c) * in puts(). */ if (c == '\n') - WATCHDOG_RESET(); + schedule(); } #ifndef CONFIG_NS16550_MIN_FUNCTIONS @@ -307,7 +307,7 @@ char ns16550_getc(struct ns16550 *com_port) extern void usbtty_poll(void); usbtty_poll(); #endif - WATCHDOG_RESET(); + schedule(); } return serial_in(&com_port->rbr); } @@ -395,7 +395,7 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch) * in puts(). */ if (ch == '\n') - WATCHDOG_RESET(); + schedule(); return 0; } diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 30650e37b0..0d43e9b625 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -246,7 +246,7 @@ static int __serial_getc(struct udevice *dev) do { err = ops->getc(dev); if (err == -EAGAIN) - WATCHDOG_RESET(); + schedule(); } while (err == -EAGAIN); return err >= 0 ? err : 0; diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index f0756c37c8..493a42b4cc 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -114,7 +114,7 @@ static int bcm283x_mu_serial_pending(struct udevice *dev, bool input) lsr = readl(®s->lsr); if (input) { - WATCHDOG_RESET(); + schedule(); return (lsr & BCM283X_MU_LSR_RX_READY) ? 1 : 0; } else { return (lsr & BCM283X_MU_LSR_TX_IDLE) ? 0 : 1; diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index ca49ef7372..ff576da516 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -169,7 +169,7 @@ static int _lpuart_serial_getc(struct lpuart_serial_plat *plat) { struct lpuart_fsl *base = plat->reg; while (!(__raw_readb(&base->us1) & (US1_RDRF | US1_OR))) - WATCHDOG_RESET(); + schedule(); barrier(); @@ -182,7 +182,7 @@ static void _lpuart_serial_putc(struct lpuart_serial_plat *plat, struct lpuart_fsl *base = plat->reg; while (!(__raw_readb(&base->us1) & US1_TDRE)) - WATCHDOG_RESET(); + schedule(); __raw_writeb(c, &base->ud); } @@ -330,7 +330,7 @@ static int _lpuart32_serial_getc(struct lpuart_serial_plat *plat) lpuart_read32(plat->flags, &base->stat, &stat); while ((stat & STAT_RDRF) == 0) { lpuart_write32(plat->flags, &base->stat, STAT_FLAGS); - WATCHDOG_RESET(); + schedule(); lpuart_read32(plat->flags, &base->stat, &stat); } @@ -358,7 +358,7 @@ static void _lpuart32_serial_putc(struct lpuart_serial_plat *plat, if ((stat & STAT_TDRE)) break; - WATCHDOG_RESET(); + schedule(); } lpuart_write32(plat->flags, &base->data, c); diff --git a/drivers/serial/serial_mpc8xx.c b/drivers/serial/serial_mpc8xx.c index 0978930dcd..aeae6ae6cd 100644 --- a/drivers/serial/serial_mpc8xx.c +++ b/drivers/serial/serial_mpc8xx.c @@ -187,7 +187,7 @@ static int serial_mpc8xx_putc(struct udevice *dev, const char c) setbits_be16(&rtx->txbd.cbd_sc, BD_SC_READY); while (in_be16(&rtx->txbd.cbd_sc) & BD_SC_READY) - WATCHDOG_RESET(); + schedule(); return 0; } @@ -204,7 +204,7 @@ static int serial_mpc8xx_getc(struct udevice *dev) /* Wait for character to show up. */ while (in_be16(&rtx->rxbd.cbd_sc) & BD_SC_EMPTY) - WATCHDOG_RESET(); + schedule(); /* the characters are read one by one, * use the rxindex to know the next char to deliver diff --git a/drivers/serial/serial_mt7620.c b/drivers/serial/serial_mt7620.c index 5c5264bc96..b00e2f2c36 100644 --- a/drivers/serial/serial_mt7620.c +++ b/drivers/serial/serial_mt7620.c @@ -102,7 +102,7 @@ static int mt7620_serial_putc(struct udevice *dev, const char ch) writel(ch, &plat->regs->thr); if (ch == '\n') - WATCHDOG_RESET(); + schedule(); return 0; } diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index a84f39b3fa..22251c5f4c 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -141,7 +141,7 @@ static int _mtk_serial_putc(struct mtk_serial_priv *priv, const char ch) writel(ch, &priv->regs->thr); if (ch == '\n') - WATCHDOG_RESET(); + schedule(); return 0; } @@ -295,7 +295,7 @@ DECLARE_GLOBAL_DATA_PTR; do { \ err = _mtk_serial_getc(&mtk_hsuart##port); \ if (err == -EAGAIN) \ - WATCHDOG_RESET(); \ + schedule(); \ } while (err == -EAGAIN); \ return err >= 0 ? err : 0; \ } \ diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 70a0e5e919..315c136ef8 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -200,7 +200,7 @@ static void mxc_serial_setbrg(void) static int mxc_serial_getc(void) { while (readl(&mxc_base->ts) & UTS_RXEMPTY) - WATCHDOG_RESET(); + schedule(); return (readl(&mxc_base->rxd) & URXD_RX_DATA); /* mask out status from upper word */ } @@ -214,7 +214,7 @@ static void mxc_serial_putc(const char c) /* wait for transmitter to be ready */ while (!(readl(&mxc_base->ts) & UTS_TXEMPTY)) - WATCHDOG_RESET(); + schedule(); } /* Test whether a character is in the RX buffer */ @@ -384,7 +384,7 @@ static inline void _debug_uart_putc(int ch) struct mxc_uart *base = (struct mxc_uart *)CONFIG_VAL(DEBUG_UART_BASE); while (!(readl(&base->ts) & UTS_TXEMPTY)) - WATCHDOG_RESET(); + schedule(); writel(ch, &base->txd); } diff --git a/drivers/serial/serial_octeon_bootcmd.c b/drivers/serial/serial_octeon_bootcmd.c index 4bcff77eb8..eff5c43e2a 100644 --- a/drivers/serial/serial_octeon_bootcmd.c +++ b/drivers/serial/serial_octeon_bootcmd.c @@ -98,7 +98,7 @@ static int octeon_bootcmd_getc(struct udevice *dev) } while (!octeon_bootcmd_pending(dev, true)) { - WATCHDOG_RESET(); + schedule(); /* * ToDo: * The original code calls octeon_board_poll() here. We may diff --git a/drivers/serial/serial_octeon_pcie_console.c b/drivers/serial/serial_octeon_pcie_console.c index c76e787d03..b0eafe7ad8 100644 --- a/drivers/serial/serial_octeon_pcie_console.c +++ b/drivers/serial/serial_octeon_pcie_console.c @@ -134,7 +134,7 @@ static int octeon_pcie_console_read(struct udevice *dev, cons_ptr->input_write_index, cons_ptr->input_read_index))) { mdelay(10); - WATCHDOG_RESET(); + schedule(); } } @@ -210,7 +210,7 @@ static int octeon_pcie_console_write(struct udevice *dev, if (flags & OCT_PCI_CON_FLAG_NONBLOCK) goto done; - WATCHDOG_RESET(); + schedule(); mdelay(10); /* Delay if we are spinning */ } else { bytes_written = -1; diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 9b0d16f164..d3c3d3e2d1 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -70,7 +70,7 @@ static int pl01x_getc(struct pl01x_regs *regs) static int pl01x_tstc(struct pl01x_regs *regs) { - WATCHDOG_RESET(); + schedule(); return !(readl(®s->fr) & UART_PL01x_FR_RXFE); } @@ -227,7 +227,7 @@ static int pl01x_serial_getc(void) int ch = pl01x_getc(base_regs); if (ch == -EAGAIN) { - WATCHDOG_RESET(); + schedule(); continue; } @@ -247,9 +247,9 @@ static void pl01x_serial_setbrg(void) * crap in console */ while (!(readl(&base_regs->fr) & UART_PL01x_FR_TXFE)) - WATCHDOG_RESET(); + schedule(); while (readl(&base_regs->fr) & UART_PL01x_FR_BUSY) - WATCHDOG_RESET(); + schedule(); pl01x_serial_init_baud(gd->baudrate); } diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c index 4af1ff5060..c449f3fd02 100644 --- a/drivers/serial/serial_sifive.c +++ b/drivers/serial/serial_sifive.c @@ -225,7 +225,7 @@ static inline void _debug_uart_putc(int ch) (struct uart_sifive *)CONFIG_VAL(DEBUG_UART_BASE); while (_sifive_serial_putc(regs, ch) == -EAGAIN) - WATCHDOG_RESET(); + schedule(); } DEBUG_UART_FUNCS diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 295337a817..4b1818313a 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -307,7 +307,7 @@ static inline void _debug_uart_putc(int ch) struct uart_zynq *regs = (struct uart_zynq *)CONFIG_VAL(DEBUG_UART_BASE); while (_uart_zynq_serial_putc(regs, ch) == -EAGAIN) - WATCHDOG_RESET(); + schedule(); } DEBUG_UART_FUNCS diff --git a/drivers/spi/mtk_snfi_spi.c b/drivers/spi/mtk_snfi_spi.c index 65d0ce0981..5ea62776b4 100644 --- a/drivers/spi/mtk_snfi_spi.c +++ b/drivers/spi/mtk_snfi_spi.c @@ -202,7 +202,7 @@ static int mtk_snfi_exec_op(struct spi_slave *slave, int addr_sh; int ret; - WATCHDOG_RESET(); + schedule(); ret = mtk_snfi_mac_reset(priv); if (ret) diff --git a/drivers/spi/octeon_spi.c b/drivers/spi/octeon_spi.c index c2a7ee232b..4bc38beaa6 100644 --- a/drivers/spi/octeon_spi.c +++ b/drivers/spi/octeon_spi.c @@ -126,7 +126,7 @@ static void octeon_spi_wait_ready(struct udevice *dev) do { mpi_sts = readq(base + MPI_STS); - WATCHDOG_RESET(); + schedule(); } while (mpi_sts & MPI_STS_BUSY); debug("%s(%s)\n", __func__, dev->name); diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index ceba413727..90c207d518 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -172,7 +172,7 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv, static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr) { *val = readb(addr); - WATCHDOG_RESET(); + schedule(); } static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr) diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 952293195f..410bf723d6 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -176,7 +176,7 @@ void timer_interrupt(struct pt_regs *regs) #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) if (CONFIG_SYS_WATCHDOG_FREQ && (priv->timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) - WATCHDOG_RESET(); + schedule(); #endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ #ifdef CONFIG_LED_STATUS @@ -189,7 +189,7 @@ void wait_ticks(ulong ticks) ulong end = get_ticks() + ticks; while (end > get_ticks()) - WATCHDOG_RESET(); + schedule(); } static u64 mpc83xx_timer_get_count(struct udevice *dev) diff --git a/drivers/usb/eth/lan7x.h b/drivers/usb/eth/lan7x.h index f71e8c7268..9480f4f6d1 100644 --- a/drivers/usb/eth/lan7x.h +++ b/drivers/usb/eth/lan7x.h @@ -157,7 +157,7 @@ static inline int lan7x_wait_for_bit(struct usb_device *udev, } udelay(1); - WATCHDOG_RESET(); + schedule(); } debug("%s: Timeout (reg=0x%x mask=%08x wait_set=%i)\n", prefix, reg, @@ -199,7 +199,7 @@ static inline int lan7x_mdio_wait_for_bit(struct usb_device *udev, } udelay(1); - WATCHDOG_RESET(); + schedule(); } debug("%s: Timeout (reg=0x%x mask=%08x wait_set=%i)\n", prefix, reg, diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index 388f73d1bc..b2ddd1ada8 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -579,7 +579,7 @@ static int acm_stdio_getc(struct stdio_dev *dev) /* Wait for a character to arrive. */ while (!acm_stdio_tstc(dev)) - WATCHDOG_RESET(); + schedule(); buf_pop(&f_acm->rx_buf, &c, 1); @@ -639,7 +639,7 @@ static int acm_stdio_start(struct stdio_dev *dev) if (ctrlc()) return -ECANCELED; - WATCHDOG_RESET(); + schedule(); } return 0; diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 0fa7230b99..74548ab603 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -711,7 +711,7 @@ int sdp_init(int controller_index) return 1; } - WATCHDOG_RESET(); + schedule(); usb_gadget_handle_interrupts(controller_index); } @@ -927,7 +927,7 @@ int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, if (flag == SDP_EXIT) return 0; - WATCHDOG_RESET(); + schedule(); usb_gadget_handle_interrupts(controller_index); #ifdef CONFIG_SPL_BUILD diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index f033198a7c..d30f2a0d13 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -641,7 +641,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, token = hc32_to_cpu(vtd->qt_token); if (!(QT_TOKEN_GET_STATUS(token) & QT_TOKEN_STATUS_ACTIVE)) break; - WATCHDOG_RESET(); + schedule(); } while (get_timer(ts) < timeout); qhtoken = hc32_to_cpu(qh->qh_overlay.qt_token); diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index d186facc7e..62c5e8e5fa 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -378,7 +378,7 @@ static struct musb *gadget; int usb_gadget_handle_interrupts(int index) { - WATCHDOG_RESET(); + schedule(); if (!gadget || !gadget->isr) return -EINVAL; diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 4d2d961696..082895a50e 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -329,7 +329,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, byte_width = width; for (i = 0; i < height; ++i) { - WATCHDOG_RESET(); + schedule(); for (j = 0; j < width; j++) { write_pix8(fb, bpix, eformat, palette, bmap); bmap++; @@ -342,7 +342,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, case 16: if (IS_ENABLED(CONFIG_BMP_16BPP)) { for (i = 0; i < height; ++i) { - WATCHDOG_RESET(); + schedule(); for (j = 0; j < width; j++) { *fb++ = *bmap++; *fb++ = *bmap++; diff --git a/env/common.c b/env/common.c index f9226e0690..8dd05ff76d 100644 --- a/env/common.c +++ b/env/common.c @@ -115,7 +115,7 @@ char *env_get(const char *name) if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */ struct env_entry e, *ep; - WATCHDOG_RESET(); + schedule(); e.key = name; e.data = NULL; diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c index 38e10e2e44..0d071b69f4 100644 --- a/fs/cramfs/uncompress.c +++ b/fs/cramfs/uncompress.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -62,7 +63,7 @@ int cramfs_uncompress_init (void) stream.avail_in = 0; #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - stream.outcb = (cb_func)watchdog_reset_func; + stream.outcb = (cb_func)cyclic_run; #else stream.outcb = Z_NULL; #endif /* CONFIG_HW_WATCHDOG */ diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index ef7b302725..49ba82ef95 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -1523,7 +1523,7 @@ jffs2_1pass_build_lists(struct part_info * part) /* Set buf_size to maximum length */ buf_size = DEFAULT_EMPTY_SCAN_SIZE; - WATCHDOG_RESET(); + schedule(); #ifdef CONFIG_JFFS2_SUMMARY buf_len = sizeof(*sm); diff --git a/include/linux/compat.h b/include/linux/compat.h index 3d0acbd582..921e698f40 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -2,6 +2,7 @@ #define _LINUX_COMPAT_H_ #include +#include #include #include @@ -230,7 +231,6 @@ typedef unsigned long blkcnt_t; #define try_to_freeze(...) 0 #define set_current_state(...) do { } while (0) #define kthread_should_stop(...) 0 -#define schedule() do { } while (0) #define setup_timer(timer, func, data) do {} while (0) #define del_timer_sync(timer) do {} while (0) diff --git a/include/wait_bit.h b/include/wait_bit.h index dcc5c4fd39..f1d70aef87 100644 --- a/include/wait_bit.h +++ b/include/wait_bit.h @@ -63,7 +63,7 @@ static inline int wait_for_bit_##sfx(const void *reg, \ } \ \ udelay(1); \ - WATCHDOG_RESET(); \ + schedule(); \ } \ \ debug("%s: Timeout (reg=%p mask=%x wait_set=%i)\n", __func__, \ diff --git a/include/watchdog.h b/include/watchdog.h index 0a9777edcb..7a09346a09 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -88,14 +88,6 @@ int init_func_watchdog_reset(void); #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */ #endif /* CONFIG_HW_WATCHDOG */ -#if !defined(__ASSEMBLY__) -/* Currently only needed for fs/cramfs/uncompress.c */ -static inline void watchdog_reset_func(void) -{ - WATCHDOG_RESET(); -} -#endif - /* * Prototypes from $(CPU)/cpu.c. */ diff --git a/lib/bzip2/bzlib.c b/lib/bzip2/bzlib.c index 377b269b06..bd589aa810 100644 --- a/lib/bzip2/bzlib.c +++ b/lib/bzip2/bzlib.c @@ -844,7 +844,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) while (True) { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; if (s->state == BZ_X_OUTPUT) { diff --git a/lib/bzip2/bzlib_decompress.c b/lib/bzip2/bzlib_decompress.c index 4412b8a23e..3b417d57b2 100644 --- a/lib/bzip2/bzlib_decompress.c +++ b/lib/bzip2/bzlib_decompress.c @@ -418,7 +418,7 @@ Int32 BZ2_decompress ( DState* s ) while (True) { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif if (nextSym == EOB) break; @@ -503,7 +503,7 @@ Int32 BZ2_decompress ( DState* s ) kk = MTFA_SIZE-1; for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif for (jj = MTFL_SIZE-1; jj >= 0; jj--) { s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; @@ -568,7 +568,7 @@ Int32 BZ2_decompress ( DState* s ) while (i != s->origPtr); #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif s->tPos = s->origPtr; s->nblock_used = 0; @@ -583,7 +583,7 @@ Int32 BZ2_decompress ( DState* s ) } else { #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) - WATCHDOG_RESET(); + schedule(); #endif /*-- compute the T^(-1) vector --*/ for (i = 0; i < nblock; i++) { diff --git a/lib/crc32.c b/lib/crc32.c index 5a3127e03a..aa94d70ef3 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -255,7 +255,7 @@ uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len, chunk = chunk_sz; crc = crc32(crc, curr, chunk); curr += chunk; - WATCHDOG_RESET (); + schedule(); } #else crc = crc32(crc, buf, len); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 1233418e77..8da3bb29aa 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -828,7 +828,7 @@ void efi_timer_check(void) efi_signal_event(evt); } efi_process_event_queue(); - WATCHDOG_RESET(); + schedule(); } /** @@ -2193,7 +2193,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, /* Give the payload some time to boot */ efi_set_watchdog(0); - WATCHDOG_RESET(); + schedule(); out: if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) { if (ret != EFI_SUCCESS) diff --git a/lib/gunzip.c b/lib/gunzip.c index a8e498d98d..932e3e8036 100644 --- a/lib/gunzip.c +++ b/lib/gunzip.c @@ -251,7 +251,7 @@ int gzwrite(unsigned char *src, int len, puts("abort\n"); goto out; } - WATCHDOG_RESET(); + schedule(); } while (s.avail_out == 0); /* done when inflate() says it's done */ } while (r != Z_STREAM_END); diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c index 4f45f80fe2..341149f766 100644 --- a/lib/lzma/LzmaDec.c +++ b/lib/lzma/LzmaDec.c @@ -153,7 +153,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte UInt32 range = p->range; UInt32 code = p->code; - WATCHDOG_RESET(); + schedule(); do { @@ -177,7 +177,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte state -= (state < 4) ? state : 3; symbol = 1; - WATCHDOG_RESET(); + schedule(); do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); } @@ -188,7 +188,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte state -= (state < 10) ? 3 : 6; symbol = 1; - WATCHDOG_RESET(); + schedule(); do { @@ -321,7 +321,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte UInt32 mask = 1; unsigned i = 1; - WATCHDOG_RESET(); + schedule(); do { @@ -335,7 +335,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte { numDirectBits -= kNumAlignBits; - WATCHDOG_RESET(); + schedule(); do { @@ -409,7 +409,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte const Byte *lim = dest + curLen; dicPos += curLen; - WATCHDOG_RESET(); + schedule(); do *(dest) = (Byte)*(dest + src); @@ -418,7 +418,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte else { - WATCHDOG_RESET(); + schedule(); do { @@ -433,7 +433,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte } while (dicPos < limit && buf < bufLimit); - WATCHDOG_RESET(); + schedule(); NORMALIZE; p->buf = buf; diff --git a/lib/lzma/LzmaTools.c b/lib/lzma/LzmaTools.c index af88900d31..55f64cd289 100644 --- a/lib/lzma/LzmaTools.c +++ b/lib/lzma/LzmaTools.c @@ -104,7 +104,7 @@ int lzmaBuffToBuffDecompress(unsigned char *outStream, SizeT *uncompressedSize, /* Decompress */ outProcessed = min(outSizeFull, *uncompressedSize); - WATCHDOG_RESET(); + schedule(); res = LzmaDecode( outStream, &outProcessed, diff --git a/lib/md5.c b/lib/md5.c index 9d34465564..1636ab9366 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -304,7 +304,7 @@ md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16], chunk = chunk_sz; MD5Update(&context, curr, chunk); curr += chunk; - WATCHDOG_RESET (); + schedule(); } #else MD5Update(&context, input, len); diff --git a/lib/sha1.c b/lib/sha1.c index e5e42bc9fe..8d07407893 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -344,7 +344,7 @@ void sha1_csum_wd(const unsigned char *input, unsigned int ilen, chunk = chunk_sz; sha1_update (&ctx, curr, chunk); curr += chunk; - WATCHDOG_RESET (); + schedule(); } #else sha1_update (&ctx, input, ilen); diff --git a/lib/sha256.c b/lib/sha256.c index 50b0b51183..4d26aea1c8 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -293,7 +293,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen, chunk = chunk_sz; sha256_update(&ctx, curr, chunk); curr += chunk; - WATCHDOG_RESET(); + schedule(); } #else sha256_update(&ctx, input, ilen); diff --git a/lib/sha512.c b/lib/sha512.c index a421f249ba..fbe8d5f5bf 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -309,7 +309,7 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen, chunk = chunk_sz; sha384_update(&ctx, curr, chunk); curr += chunk; - WATCHDOG_RESET(); + schedule(); } #else sha384_update(&ctx, input, ilen); @@ -372,7 +372,7 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen, chunk = chunk_sz; sha512_update(&ctx, curr, chunk); curr += chunk; - WATCHDOG_RESET(); + schedule(); } #else sha512_update(&ctx, input, ilen); diff --git a/lib/time.c b/lib/time.c index bbf191f673..f3aaf472d1 100644 --- a/lib/time.c +++ b/lib/time.c @@ -198,7 +198,7 @@ void udelay(unsigned long usec) ulong kv; do { - WATCHDOG_RESET(); + schedule(); kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec; __udelay(kv); usec -= kv; diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index 6411c47932..30dfe15599 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -25,7 +25,7 @@ int ZEXPORT inflateReset(z_streamp strm) state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; - WATCHDOG_RESET(); + schedule(); Tracev((stderr, "inflate: reset\n")); return Z_OK; } @@ -543,7 +543,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; case TYPE: - WATCHDOG_RESET(); + schedule(); if (flush == Z_BLOCK) goto inf_leave; case TYPEDO: if (state->last) { @@ -721,7 +721,7 @@ int ZEXPORT inflate(z_streamp strm, int flush) Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: - WATCHDOG_RESET(); + schedule(); if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); @@ -933,7 +933,7 @@ int ZEXPORT inflateEnd(z_streamp strm) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) { - WATCHDOG_RESET(); + schedule(); ZFREE(strm, state->window); } ZFREE(strm, strm->state); diff --git a/net/net.c b/net/net.c index 81905f6315..f9d11c08d2 100644 --- a/net/net.c +++ b/net/net.c @@ -559,7 +559,7 @@ restart: * someone sets `net_state' to a state that terminates. */ for (;;) { - WATCHDOG_RESET(); + schedule(); if (arp_timeout_check() > 0) time_start = get_timer(0); diff --git a/post/cpu/mpc83xx/ecc.c b/post/cpu/mpc83xx/ecc.c index f88eff8998..edd7411567 100644 --- a/post/cpu/mpc83xx/ecc.c +++ b/post/cpu/mpc83xx/ecc.c @@ -73,7 +73,7 @@ int ecc_post_test(int flags) for (addr = (u64*)CONFIG_SYS_POST_ECC_START_ADDR, errbit=0; addr < (u64*)CONFIG_SYS_POST_ECC_STOP_ADDR; addr++, errbit++ ) { - WATCHDOG_RESET(); + schedule(); ecc_clear(ddr); diff --git a/post/drivers/memory.c b/post/drivers/memory.c index 4fb9355d60..d249942af0 100644 --- a/post/drivers/memory.c +++ b/post/drivers/memory.c @@ -279,7 +279,7 @@ static int memory_post_test1(unsigned long start, for (i = 0; i < size / sizeof (ulong); i++) { mem[i] = val; if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } for (i = 0; i < size / sizeof (ulong) && !ret; i++) { @@ -292,7 +292,7 @@ static int memory_post_test1(unsigned long start, break; } if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } return ret; @@ -308,7 +308,7 @@ static int memory_post_test2(unsigned long start, unsigned long size) for (i = 0; i < size / sizeof (ulong); i++) { mem[i] = 1 << (i % 32); if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } for (i = 0; i < size / sizeof (ulong) && !ret; i++) { @@ -321,7 +321,7 @@ static int memory_post_test2(unsigned long start, unsigned long size) break; } if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } return ret; @@ -337,7 +337,7 @@ static int memory_post_test3(unsigned long start, unsigned long size) for (i = 0; i < size / sizeof (ulong); i++) { mem[i] = i; if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } for (i = 0; i < size / sizeof (ulong) && !ret; i++) { @@ -350,7 +350,7 @@ static int memory_post_test3(unsigned long start, unsigned long size) break; } if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } return ret; @@ -366,7 +366,7 @@ static int memory_post_test4(unsigned long start, unsigned long size) for (i = 0; i < size / sizeof (ulong); i++) { mem[i] = ~i; if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } for (i = 0; i < size / sizeof (ulong) && !ret; i++) { @@ -379,7 +379,7 @@ static int memory_post_test4(unsigned long start, unsigned long size) break; } if (i % 1024 == 0) - WATCHDOG_RESET(); + schedule(); } return ret; @@ -390,15 +390,15 @@ static int memory_post_test_lines(unsigned long start, unsigned long size) int ret = 0; ret = memory_post_dataline((unsigned long long *)start); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_addrline((ulong *)start, (ulong *)start, size); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_addrline((ulong *)(start+size-8), (ulong *)start, size); - WATCHDOG_RESET(); + schedule(); return ret; } @@ -408,25 +408,25 @@ static int memory_post_test_patterns(unsigned long start, unsigned long size) int ret = 0; ret = memory_post_test1(start, size, 0x00000000); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test1(start, size, 0xffffffff); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test1(start, size, 0x55555555); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test1(start, size, 0xaaaaaaaa); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test2(start, size); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test3(start, size); - WATCHDOG_RESET(); + schedule(); if (!ret) ret = memory_post_test4(start, size); - WATCHDOG_RESET(); + schedule(); return ret; } diff --git a/post/lib_powerpc/cpu.c b/post/lib_powerpc/cpu.c index 8506fd6b71..1d47107342 100644 --- a/post/lib_powerpc/cpu.c +++ b/post/lib_powerpc/cpu.c @@ -61,7 +61,7 @@ int cpu_post_test (int flags) int ic = icache_status(); int ret = 0; - WATCHDOG_RESET(); + schedule(); if (ic) icache_disable(); @@ -73,7 +73,7 @@ int cpu_post_test (int flags) ret = cpu_post_test_two (); if (ret == 0) ret = cpu_post_test_twox (); - WATCHDOG_RESET(); + schedule(); if (ret == 0) ret = cpu_post_test_three (); if (ret == 0) @@ -82,7 +82,7 @@ int cpu_post_test (int flags) ret = cpu_post_test_threei (); if (ret == 0) ret = cpu_post_test_andi (); - WATCHDOG_RESET(); + schedule(); if (ret == 0) ret = cpu_post_test_srawi (); if (ret == 0) @@ -91,7 +91,7 @@ int cpu_post_test (int flags) ret = cpu_post_test_rlwinm (); if (ret == 0) ret = cpu_post_test_rlwimi (); - WATCHDOG_RESET(); + schedule(); if (ret == 0) ret = cpu_post_test_store (); if (ret == 0) @@ -100,20 +100,20 @@ int cpu_post_test (int flags) ret = cpu_post_test_cr (); if (ret == 0) ret = cpu_post_test_b (); - WATCHDOG_RESET(); + schedule(); if (ret == 0) ret = cpu_post_test_multi (); - WATCHDOG_RESET(); + schedule(); if (ret == 0) ret = cpu_post_test_string (); if (ret == 0) ret = cpu_post_test_complex (); - WATCHDOG_RESET(); + schedule(); if (ic) icache_enable(); - WATCHDOG_RESET(); + schedule(); return ret; } diff --git a/post/lib_powerpc/fpu/fpu.c b/post/lib_powerpc/fpu/fpu.c index 0de76ce051..bd65f623d5 100644 --- a/post/lib_powerpc/fpu/fpu.c +++ b/post/lib_powerpc/fpu/fpu.c @@ -43,7 +43,7 @@ int fpu_post_test (int flags) int ret = 0; - WATCHDOG_RESET (); + schedule(); if (!fpu) fpu_enable (); @@ -66,7 +66,7 @@ int fpu_post_test (int flags) if (!fpu) fpu_disable (); - WATCHDOG_RESET (); + schedule(); return ret; } diff --git a/post/post.c b/post/post.c index d67c43ed8a..b81425d8cf 100644 --- a/post/post.c +++ b/post/post.c @@ -245,7 +245,7 @@ static int post_run_single(struct post_test *test, { if ((flags & test_flags & POST_ALWAYS) && (flags & test_flags & POST_MEM)) { - WATCHDOG_RESET(); + schedule(); if (!(flags & POST_REBOOT)) { if ((test_flags & POST_REBOOT) && @@ -350,7 +350,7 @@ int post_run(char *name, int flags) } if (i < post_list_size) { - WATCHDOG_RESET(); + schedule(); return post_run_single(post_list + i, test_flags[i], flags, i); diff --git a/test/common/cyclic.c b/test/common/cyclic.c index a5c4e78989..6e758e89db 100644 --- a/test/common/cyclic.c +++ b/test/common/cyclic.c @@ -27,7 +27,7 @@ static int dm_test_cyclic_running(struct unit_test_state *uts) NULL)); /* Execute all registered cyclic functions */ - WATCHDOG_RESET(); + schedule(); ut_asserteq(true, cyclic_active); return 0; diff --git a/test/dm/wdt.c b/test/dm/wdt.c index 535f00a874..653d7b1c8b 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -130,7 +131,7 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts) /* Neither device should be "started", so watchdog_reset() should be a no-op. */ reset_count = state->wdt.reset_count; val = sandbox_gpio_get_value(gpio, offset); - watchdog_reset(); + cyclic_run(); ut_asserteq(reset_count, state->wdt.reset_count); ut_asserteq(val, sandbox_gpio_get_value(gpio, offset)); @@ -140,19 +141,19 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts) /* Make sure both devices have just been pinged. */ timer_test_add_offset(100); - watchdog_reset(); + cyclic_run(); reset_count = state->wdt.reset_count; val = sandbox_gpio_get_value(gpio, offset); /* The gpio watchdog should be pinged, the sandbox one not. */ timer_test_add_offset(30); - watchdog_reset(); + cyclic_run(); ut_asserteq(reset_count, state->wdt.reset_count); ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset)); /* After another ~30ms, both devices should get pinged. */ timer_test_add_offset(30); - watchdog_reset(); + cyclic_run(); ut_asserteq(reset_count + 1, state->wdt.reset_count); ut_asserteq(val, sandbox_gpio_get_value(gpio, offset)); -- cgit v1.2.3 From 8149b1500d805b56f2e3e42fb31c5554a2011745 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 17 Sep 2022 09:00:09 -0600 Subject: blk: Rename if_type to uclass_id Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass --- board/st/common/stm32mp_dfu.c | 2 +- cmd/bcb.c | 4 +- cmd/blk_common.c | 18 +++--- cmd/lsblk.c | 2 +- cmd/mmc.c | 4 +- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 6 +- disk/disk-uclass.c | 8 +-- disk/part.c | 14 ++-- doc/usage/partitions.rst | 2 +- drivers/ata/sata.c | 2 +- drivers/block/blk-uclass.c | 145 +++++++++++++++++++++--------------------- drivers/block/blk_legacy.c | 58 ++++++++--------- drivers/block/ide.c | 8 +-- drivers/block/sandbox.c | 8 +-- drivers/mmc/mmc-uclass.c | 2 +- drivers/mmc/mmc_legacy.c | 8 +-- drivers/net/fsl_enetc.c | 12 ++-- drivers/net/fsl_enetc.h | 2 +- drivers/scsi/scsi.c | 6 +- drivers/virtio/virtio_blk.c | 2 +- drivers/xen/pvblock.c | 2 +- fs/fat/fat.c | 2 +- include/blk.h | 122 +++++++++++++++++------------------ include/efi_loader.h | 4 +- lib/efi_loader/efi_disk.c | 12 ++-- lib/efi_loader/efi_var_file.c | 4 +- 28 files changed, 231 insertions(+), 232 deletions(-) (limited to 'fs') diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index fa48b2a35e..0096f71dfc 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -37,7 +37,7 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf) if (!desc) return; - name = blk_get_if_type_name(desc->if_type); + name = blk_get_uclass_name(desc->uclass_id); devnum = desc->devnum; len = strlen(buf); diff --git a/cmd/bcb.c b/cmd/bcb.c index 8b87aa062f..1622a90c97 100644 --- a/cmd/bcb.c +++ b/cmd/bcb.c @@ -122,7 +122,7 @@ static int __bcb_load(int devnum, const char *partp) char *endp; int part, ret; - desc = blk_get_devnum_by_type(UCLASS_MMC, devnum); + desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, devnum); if (!desc) { ret = -ENODEV; goto err_read_fail; @@ -287,7 +287,7 @@ static int __bcb_store(void) u64 cnt; int ret; - desc = blk_get_devnum_by_type(UCLASS_MMC, bcb_dev); + desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, bcb_dev); if (!desc) { ret = -ENODEV; goto err; diff --git a/cmd/blk_common.c b/cmd/blk_common.c index 369c5ae4bb..75a072caf5 100644 --- a/cmd/blk_common.c +++ b/cmd/blk_common.c @@ -12,10 +12,10 @@ #include #include -int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, +int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id, int *cur_devnump) { - const char *if_name = blk_get_if_type_name(if_type); + const char *if_name = blk_get_uclass_name(uclass_id); switch (argc) { case 0: @@ -23,16 +23,16 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, return CMD_RET_USAGE; case 2: if (strncmp(argv[1], "inf", 3) == 0) { - blk_list_devices(if_type); + blk_list_devices(uclass_id); return 0; } else if (strncmp(argv[1], "dev", 3) == 0) { - if (blk_print_device_num(if_type, *cur_devnump)) { + if (blk_print_device_num(uclass_id, *cur_devnump)) { printf("\nno %s devices available\n", if_name); return CMD_RET_FAILURE; } return 0; } else if (strncmp(argv[1], "part", 4) == 0) { - if (blk_list_part(if_type)) + if (blk_list_part(uclass_id)) printf("\nno %s partition table available\n", if_name); return 0; @@ -42,7 +42,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, if (strncmp(argv[1], "dev", 3) == 0) { int dev = (int)dectoul(argv[2], NULL); - if (!blk_show_device(if_type, dev)) { + if (!blk_show_device(uclass_id, dev)) { *cur_devnump = dev; printf("... is now current device\n"); } else { @@ -52,7 +52,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, } else if (strncmp(argv[1], "part", 4) == 0) { int dev = (int)dectoul(argv[2], NULL); - if (blk_print_part_devnum(if_type, dev)) { + if (blk_print_part_devnum(uclass_id, dev)) { printf("\n%s device %d not available\n", if_name, dev); return CMD_RET_FAILURE; @@ -71,7 +71,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, printf("\n%s read: device %d block # "LBAFU", count %lu ... ", if_name, *cur_devnump, blk, cnt); - n = blk_read_devnum(if_type, *cur_devnump, blk, cnt, + n = blk_read_devnum(uclass_id, *cur_devnump, blk, cnt, (ulong *)addr); printf("%ld blocks read: %s\n", n, @@ -86,7 +86,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, printf("\n%s write: device %d block # "LBAFU", count %lu ... ", if_name, *cur_devnump, blk, cnt); - n = blk_write_devnum(if_type, *cur_devnump, blk, cnt, + n = blk_write_devnum(uclass_id, *cur_devnump, blk, cnt, (ulong *)addr); printf("%ld blocks written: %s\n", n, diff --git a/cmd/lsblk.c b/cmd/lsblk.c index 6a1c8f5ef4..d214dafc3b 100644 --- a/cmd/lsblk.c +++ b/cmd/lsblk.c @@ -36,7 +36,7 @@ static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv continue; desc = dev_get_uclass_plat(udev); printf("%c %s %u", i ? ',' : ':', - blk_get_if_type_name(desc->if_type), + blk_get_uclass_name(desc->uclass_id), desc->devnum); i++; } diff --git a/cmd/mmc.c b/cmd/mmc.c index 0f1f4e0a71..c79d940798 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -154,7 +154,7 @@ static struct mmc *__init_mmc_device(int dev, bool force_init, #ifdef CONFIG_BLOCK_CACHE struct blk_desc *bd = mmc_get_blk_desc(mmc); - blkcache_invalidate(bd->if_type, bd->devnum); + blkcache_invalidate(bd->uclass_id, bd->devnum); #endif return mmc; @@ -530,7 +530,7 @@ static int do_mmc_part(struct cmd_tbl *cmdtp, int flag, if (!mmc) return CMD_RET_FAILURE; - mmc_dev = blk_get_devnum_by_type(UCLASS_MMC, curr_device); + mmc_dev = blk_get_devnum_by_uclass_id(UCLASS_MMC, curr_device); if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) { part_print(mmc_dev); return CMD_RET_SUCCESS; diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index ea9f1756c0..6c36f2ca66 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -71,7 +71,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, /* try to recognize storage devices immediately */ scsi_scan(false); - stor_dev = blk_get_devnum_by_type(UCLASS_SCSI, 0); + stor_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0); if (!stor_dev) return -ENODEV; diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index 63c00f872b..479e2dc182 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -41,7 +41,7 @@ int spl_usb_load(struct spl_image_info *spl_image, /* try to recognize storage devices immediately */ usb_stor_curr_dev = usb_stor_scan(1); - stor_dev = blk_get_devnum_by_type(UCLASS_USB, usb_stor_curr_dev); + stor_dev = blk_get_devnum_by_uclass_id(UCLASS_USB, usb_stor_curr_dev); if (!stor_dev) return -ENODEV; diff --git a/common/usb_storage.c b/common/usb_storage.c index 7d420160cd..e59c819bac 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -279,7 +279,7 @@ static int usb_stor_probe_device(struct usb_device *udev) blkdev = &usb_dev_desc[usb_max_devs]; memset(blkdev, '\0', sizeof(struct blk_desc)); - blkdev->if_type = UCLASS_USB; + blkdev->uclass_id = UCLASS_USB; blkdev->devnum = usb_max_devs; blkdev->part_type = PART_TYPE_UNKNOWN; blkdev->target = 0xff; @@ -1577,8 +1577,8 @@ U_BOOT_DRIVER(usb_storage_blk) = { }; #else U_BOOT_LEGACY_BLK(usb) = { - .if_typename = "usb", - .if_type = UCLASS_USB, + .uclass_idname = "usb", + .uclass_id = UCLASS_USB, .max_devs = USB_MAX_STOR_DEV, .desc = usb_dev_desc, }; diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c index 9351a5cfa6..551f8b1dca 100644 --- a/disk/disk-uclass.c +++ b/disk/disk-uclass.c @@ -191,12 +191,12 @@ unsigned long dev_read(struct udevice *dev, lbaint_t start, start_in_disk += part->gpt_part_info.start; } - if (blkcache_read(block_dev->if_type, block_dev->devnum, + if (blkcache_read(block_dev->uclass_id, block_dev->devnum, start_in_disk, blkcnt, block_dev->blksz, buffer)) return blkcnt; blks_read = ops->read(dev, start, blkcnt, buffer); if (blks_read == blkcnt) - blkcache_fill(block_dev->if_type, block_dev->devnum, + blkcache_fill(block_dev->uclass_id, block_dev->devnum, start_in_disk, blkcnt, block_dev->blksz, buffer); return blks_read; @@ -216,7 +216,7 @@ unsigned long dev_write(struct udevice *dev, lbaint_t start, if (!ops->write) return -ENOSYS; - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return ops->write(dev, start, blkcnt, buffer); } @@ -235,7 +235,7 @@ unsigned long dev_erase(struct udevice *dev, lbaint_t start, if (!ops->erase) return -ENOSYS; - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return ops->erase(dev, start, blkcnt); } diff --git a/disk/part.c b/disk/part.c index 47214c0ee9..f982b30f97 100644 --- a/disk/part.c +++ b/disk/part.c @@ -61,7 +61,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) if (!blk_enabled()) return NULL; - dev_desc = blk_get_devnum_by_typename(ifname, dev); + dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev); if (!dev_desc) { debug("%s: No device for iface '%s', dev %d\n", __func__, ifname, dev); @@ -120,7 +120,7 @@ void dev_print(struct blk_desc *dev_desc) return; } - switch (dev_desc->if_type) { + switch (dev_desc->uclass_id) { case UCLASS_SCSI: printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", dev_desc->target,dev_desc->lun, @@ -155,7 +155,7 @@ void dev_print(struct blk_desc *dev_desc) puts("device type unknown\n"); return; default: - printf("Unhandled device type: %i\n", dev_desc->if_type); + printf("Unhandled device type: %i\n", dev_desc->uclass_id); return; } puts (" Type: "); @@ -225,7 +225,7 @@ void part_init(struct blk_desc *dev_desc) const int n_ents = ll_entry_count(struct part_driver, part_driver); struct part_driver *entry; - blkcache_invalidate(dev_desc->if_type, dev_desc->devnum); + blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum); dev_desc->part_type = PART_TYPE_UNKNOWN; for (entry = drv; entry != drv + n_ents; entry++) { @@ -248,7 +248,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) CONFIG_IS_ENABLED(AMIGA_PARTITION) || \ CONFIG_IS_ENABLED(EFI_PARTITION) puts ("\nPartition Map for "); - switch (dev_desc->if_type) { + switch (dev_desc->uclass_id) { case UCLASS_IDE: puts ("IDE"); break; @@ -408,7 +408,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, * Always should be done, otherwise hw partition 0 will return * stale data after displaying a non-zero hw partition. */ - if ((*dev_desc)->if_type == UCLASS_MMC) + if ((*dev_desc)->uclass_id == UCLASS_MMC) part_init(*dev_desc); } @@ -762,7 +762,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc, { char *devtype; - switch (dev_desc->if_type) { + switch (dev_desc->uclass_id) { case UCLASS_IDE: case UCLASS_AHCI: devtype = "hd"; diff --git a/doc/usage/partitions.rst b/doc/usage/partitions.rst index 2c1a12b6bf..628469bbec 100644 --- a/doc/usage/partitions.rst +++ b/doc/usage/partitions.rst @@ -20,7 +20,7 @@ generic syntax. interface The interface used to access the partition's device, like ``mmc`` or ``scsi``. For a full list of supported interfaces, consult the - ``if_typename_str`` array in ``drivers/block/blk-uclass.c`` + ``uclass_idname_str`` array in ``drivers/block/blk-uclass.c`` devnum The device number. This defaults to 0. diff --git a/drivers/ata/sata.c b/drivers/ata/sata.c index 604c721cfd..ce3e9b5a40 100644 --- a/drivers/ata/sata.c +++ b/drivers/ata/sata.c @@ -79,7 +79,7 @@ int __sata_initialize(void) for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) { memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc)); - sata_dev_desc[i].if_type = UCLASS_AHCI; + sata_dev_desc[i].uclass_id = UCLASS_AHCI; sata_dev_desc[i].devnum = i; sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN; sata_dev_desc[i].type = DEV_TYPE_HARDDISK; diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index a9a85aa37f..7d12d5413f 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -20,7 +20,7 @@ static struct { enum uclass_id id; const char *name; -} if_typename_str[] = { +} uclass_idname_str[] = { { UCLASS_IDE, "ide" }, { UCLASS_SCSI, "scsi" }, { UCLASS_USB, "usb" }, @@ -34,19 +34,19 @@ static struct { { UCLASS_PVBLOCK, "pvblock" }, }; -static enum uclass_id if_typename_to_iftype(const char *if_typename) +static enum uclass_id uclass_name_to_iftype(const char *uclass_idname) { int i; - for (i = 0; i < ARRAY_SIZE(if_typename_str); i++) { - if (!strcmp(if_typename, if_typename_str[i].name)) - return if_typename_str[i].id; + for (i = 0; i < ARRAY_SIZE(uclass_idname_str); i++) { + if (!strcmp(uclass_idname, uclass_idname_str[i].name)) + return uclass_idname_str[i].id; } return UCLASS_INVALID; } -static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type) +static enum uclass_id conv_uclass_id(enum uclass_id uclass_id) { /* * This strange adjustment is used because we use UCLASS_MASS_STORAGE @@ -65,31 +65,30 @@ static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type) * - rename UCLASS_USB name to "usb_ctlr" * - use UCLASS_MASS_STORAGE instead of UCLASS_USB in if_typename_str */ - if (if_type == UCLASS_USB) + if (uclass_id == UCLASS_USB) return UCLASS_MASS_STORAGE; - - return if_type; + return uclass_id; } -const char *blk_get_if_type_name(enum uclass_id if_type) +const char *blk_get_uclass_name(enum uclass_id uclass_id) { int i; - for (i = 0; i < ARRAY_SIZE(if_typename_str); i++) { - if (if_typename_str[i].id == if_type) - return if_typename_str[i].name; + for (i = 0; i < ARRAY_SIZE(uclass_idname_str); i++) { + if (uclass_idname_str[i].id == uclass_id) + return uclass_idname_str[i].name; } return "(none)"; } -struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum) +struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum) { struct blk_desc *desc; struct udevice *dev; int ret; - ret = blk_get_device(if_type, devnum, &dev); + ret = blk_get_device(uclass_id, devnum, &dev); if (ret) return NULL; desc = dev_get_uclass_plat(dev); @@ -102,7 +101,7 @@ struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum) * name in a local table. This gives us an interface type which we can match * against the uclass of the block device's parent. */ -struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) +struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname, int devnum) { enum uclass_id uclass_id; enum uclass_id type; @@ -110,16 +109,16 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) struct uclass *uc; int ret; - type = if_typename_to_iftype(if_typename); + type = uclass_name_to_iftype(uclass_idname); if (type == UCLASS_INVALID) { debug("%s: Unknown interface type '%s'\n", __func__, - if_typename); + uclass_idname); return NULL; } - uclass_id = if_type_to_uclass_id(type); + uclass_id = conv_uclass_id(type); if (uclass_id == UCLASS_INVALID) { debug("%s: Unknown uclass for interface type'\n", - blk_get_if_type_name(type)); + blk_get_uclass_name(type)); return NULL; } @@ -129,8 +128,8 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) uclass_foreach_dev(dev, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, - type, devnum, dev->name, desc->if_type, desc->devnum); + debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__, + type, devnum, dev->name, desc->uclass_id, desc->devnum); if (desc->devnum != devnum) continue; @@ -178,14 +177,14 @@ struct blk_desc *blk_get_by_device(struct udevice *dev) /** * get_desc() - Get the block device descriptor for the given device number * - * @if_type: Interface type + * @uclass_id: Interface type * @devnum: Device number (0 = first) * @descp: Returns block device descriptor on success * Return: 0 on success, -ENODEV if there is no such device and no device * with a higher device number, -ENOENT if there is no such device but there * is one with a higher number, or other -ve on other error. */ -static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc **descp) +static int get_desc(enum uclass_id uclass_id, int devnum, struct blk_desc **descp) { bool found_more = false; struct udevice *dev; @@ -199,9 +198,9 @@ static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc **descp) uclass_foreach_dev(dev, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, - if_type, devnum, dev->name, desc->if_type, desc->devnum); - if (desc->if_type == if_type) { + debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__, + uclass_id, devnum, dev->name, desc->uclass_id, desc->devnum); + if (desc->uclass_id == uclass_id) { if (desc->devnum == devnum) { ret = device_probe(dev); if (ret) @@ -218,26 +217,26 @@ static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc **descp) return found_more ? -ENOENT : -ENODEV; } -int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart) +int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart) { struct udevice *dev; int ret; - ret = blk_get_device(if_type, devnum, &dev); + ret = blk_get_device(uclass_id, devnum, &dev); if (ret) return ret; return blk_select_hwpart(dev, hwpart); } -int blk_list_part(enum uclass_id if_type) +int blk_list_part(enum uclass_id uclass_id) { struct blk_desc *desc; int devnum, ok; int ret; for (ok = 0, devnum = 0;; ++devnum) { - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret == -ENODEV) break; else if (ret) @@ -255,12 +254,12 @@ int blk_list_part(enum uclass_id if_type) return 0; } -int blk_print_part_devnum(enum uclass_id if_type, int devnum) +int blk_print_part_devnum(enum uclass_id uclass_id, int devnum) { struct blk_desc *desc; int ret; - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret) return ret; if (desc->type == DEV_TYPE_UNKNOWN) @@ -270,14 +269,14 @@ int blk_print_part_devnum(enum uclass_id if_type, int devnum) return 0; } -void blk_list_devices(enum uclass_id if_type) +void blk_list_devices(enum uclass_id uclass_id) { struct blk_desc *desc; int ret; int i; for (i = 0;; ++i) { - ret = get_desc(if_type, i, &desc); + ret = get_desc(uclass_id, i, &desc); if (ret == -ENODEV) break; else if (ret) @@ -289,12 +288,12 @@ void blk_list_devices(enum uclass_id if_type) } } -int blk_print_device_num(enum uclass_id if_type, int devnum) +int blk_print_device_num(enum uclass_id uclass_id, int devnum) { struct blk_desc *desc; int ret; - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret) return ret; printf("\nIDE device %d: ", devnum); @@ -303,13 +302,13 @@ int blk_print_device_num(enum uclass_id if_type, int devnum) return 0; } -int blk_show_device(enum uclass_id if_type, int devnum) +int blk_show_device(enum uclass_id uclass_id, int devnum) { struct blk_desc *desc; int ret; printf("\nDevice %d: ", devnum); - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret == -ENODEV || ret == -ENOENT) { printf("unknown device\n"); return -ENODEV; @@ -324,14 +323,14 @@ int blk_show_device(enum uclass_id if_type, int devnum) return 0; } -ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, void *buffer) { struct blk_desc *desc; ulong n; int ret; - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret) return ret; n = blk_dread(desc, start, blkcnt, buffer); @@ -341,13 +340,13 @@ ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start, return n; } -ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, const void *buffer) { struct blk_desc *desc; int ret; - ret = get_desc(if_type, devnum, &desc); + ret = get_desc(uclass_id, devnum, &desc); if (ret) return ret; return blk_dwrite(desc, start, blkcnt, buffer); @@ -370,7 +369,7 @@ int blk_dselect_hwpart(struct blk_desc *desc, int hwpart) return blk_select_hwpart(desc->bdev, hwpart); } -int blk_first_device(int if_type, struct udevice **devp) +int blk_first_device(int uclass_id, struct udevice **devp) { struct blk_desc *desc; int ret; @@ -382,7 +381,7 @@ int blk_first_device(int if_type, struct udevice **devp) return -ENODEV; do { desc = dev_get_uclass_plat(*devp); - if (desc->if_type == if_type) + if (desc->uclass_id == uclass_id) return 0; ret = uclass_find_next_device(devp); if (ret) @@ -395,10 +394,10 @@ int blk_first_device(int if_type, struct udevice **devp) int blk_next_device(struct udevice **devp) { struct blk_desc *desc; - int ret, if_type; + int ret, uclass_id; desc = dev_get_uclass_plat(*devp); - if_type = desc->if_type; + uclass_id = desc->uclass_id; do { ret = uclass_find_next_device(devp); if (ret) @@ -406,12 +405,12 @@ int blk_next_device(struct udevice **devp) if (!*devp) return -ENODEV; desc = dev_get_uclass_plat(*devp); - if (desc->if_type == if_type) + if (desc->uclass_id == uclass_id) return 0; } while (1); } -int blk_find_device(int if_type, int devnum, struct udevice **devp) +int blk_find_device(int uclass_id, int devnum, struct udevice **devp) { struct uclass *uc; struct udevice *dev; @@ -423,9 +422,9 @@ int blk_find_device(int if_type, int devnum, struct udevice **devp) uclass_foreach_dev(dev, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, - if_type, devnum, dev->name, desc->if_type, desc->devnum); - if (desc->if_type == if_type && desc->devnum == devnum) { + debug("%s: uclass_id=%d, devnum=%d: %s, %d, %d\n", __func__, + uclass_id, devnum, dev->name, desc->uclass_id, desc->devnum); + if (desc->uclass_id == uclass_id && desc->devnum == devnum) { *devp = dev; return 0; } @@ -434,11 +433,11 @@ int blk_find_device(int if_type, int devnum, struct udevice **devp) return -ENODEV; } -int blk_get_device(int if_type, int devnum, struct udevice **devp) +int blk_get_device(int uclass_id, int devnum, struct udevice **devp) { int ret; - ret = blk_find_device(if_type, devnum, devp); + ret = blk_find_device(uclass_id, devnum, devp); if (ret) return ret; @@ -455,12 +454,12 @@ unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, if (!ops->read) return -ENOSYS; - if (blkcache_read(block_dev->if_type, block_dev->devnum, + if (blkcache_read(block_dev->uclass_id, block_dev->devnum, start, blkcnt, block_dev->blksz, buffer)) return blkcnt; blks_read = ops->read(dev, start, blkcnt, buffer); if (blks_read == blkcnt) - blkcache_fill(block_dev->if_type, block_dev->devnum, + blkcache_fill(block_dev->uclass_id, block_dev->devnum, start, blkcnt, block_dev->blksz, buffer); return blks_read; @@ -475,7 +474,7 @@ unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, if (!ops->write) return -ENOSYS; - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return ops->write(dev, start, blkcnt, buffer); } @@ -488,7 +487,7 @@ unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, if (!ops->erase) return -ENOSYS; - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return ops->erase(dev, start, blkcnt); } @@ -525,7 +524,7 @@ const char *blk_get_devtype(struct udevice *dev) return uclass_get_name(device_get_uclass_id(parent)); }; -int blk_find_max_devnum(enum uclass_id if_type) +int blk_find_max_devnum(enum uclass_id uclass_id) { struct udevice *dev; int max_devnum = -ENODEV; @@ -538,18 +537,18 @@ int blk_find_max_devnum(enum uclass_id if_type) uclass_foreach_dev(dev, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - if (desc->if_type == if_type && desc->devnum > max_devnum) + if (desc->uclass_id == uclass_id && desc->devnum > max_devnum) max_devnum = desc->devnum; } return max_devnum; } -int blk_next_free_devnum(enum uclass_id if_type) +int blk_next_free_devnum(enum uclass_id uclass_id) { int ret; - ret = blk_find_max_devnum(if_type); + ret = blk_find_max_devnum(uclass_id); if (ret == -ENODEV) return 0; if (ret < 0) @@ -631,7 +630,7 @@ int blk_count_devices(enum blk_flag_t flag) return count; } -static int blk_claim_devnum(enum uclass_id if_type, int devnum) +static int blk_claim_devnum(enum uclass_id uclass_id, int devnum) { struct udevice *dev; struct uclass *uc; @@ -643,8 +642,8 @@ static int blk_claim_devnum(enum uclass_id if_type, int devnum) uclass_foreach_dev(dev, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - if (desc->if_type == if_type && desc->devnum == devnum) { - int next = blk_next_free_devnum(if_type); + if (desc->uclass_id == uclass_id && desc->devnum == devnum) { + int next = blk_next_free_devnum(uclass_id); if (next < 0) return next; @@ -657,7 +656,7 @@ static int blk_claim_devnum(enum uclass_id if_type, int devnum) } int blk_create_device(struct udevice *parent, const char *drv_name, - const char *name, int if_type, int devnum, int blksz, + const char *name, int uclass_id, int devnum, int blksz, lbaint_t lba, struct udevice **devp) { struct blk_desc *desc; @@ -665,9 +664,9 @@ int blk_create_device(struct udevice *parent, const char *drv_name, int ret; if (devnum == -1) { - devnum = blk_next_free_devnum(if_type); + devnum = blk_next_free_devnum(uclass_id); } else { - ret = blk_claim_devnum(if_type, devnum); + ret = blk_claim_devnum(uclass_id, devnum); if (ret < 0 && ret != -ENOENT) return ret; } @@ -677,7 +676,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, if (ret) return ret; desc = dev_get_uclass_plat(dev); - desc->if_type = if_type; + desc->uclass_id = uclass_id; desc->blksz = blksz; desc->log2blksz = LOG2(desc->blksz); desc->lba = lba; @@ -690,7 +689,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, } int blk_create_devicef(struct udevice *parent, const char *drv_name, - const char *name, int if_type, int devnum, int blksz, + const char *name, int uclass_id, int devnum, int blksz, lbaint_t lba, struct udevice **devp) { char dev_name[30], *str; @@ -701,7 +700,7 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, if (!str) return -ENOMEM; - ret = blk_create_device(parent, drv_name, str, if_type, devnum, + ret = blk_create_device(parent, drv_name, str, uclass_id, devnum, blksz, lba, devp); if (ret) { free(str); @@ -725,7 +724,7 @@ int blk_probe_or_unbind(struct udevice *dev) return ret; } -int blk_unbind_all(int if_type) +int blk_unbind_all(int uclass_id) { struct uclass *uc; struct udevice *dev, *next; @@ -737,7 +736,7 @@ int blk_unbind_all(int if_type) uclass_foreach_dev_safe(dev, next, uc) { struct blk_desc *desc = dev_get_uclass_plat(dev); - if (desc->if_type == if_type) { + if (desc->uclass_id == uclass_id) { ret = device_remove(dev, DM_REMOVE_NORMAL); if (ret) return ret; diff --git a/drivers/block/blk_legacy.c b/drivers/block/blk_legacy.c index 8c6f9cb208..5bf1d04715 100644 --- a/drivers/block/blk_legacy.c +++ b/drivers/block/blk_legacy.c @@ -9,14 +9,14 @@ #include #include -struct blk_driver *blk_driver_lookup_type(int if_type) +struct blk_driver *blk_driver_lookup_type(int uclass_id) { struct blk_driver *drv = ll_entry_start(struct blk_driver, blk_driver); const int n_ents = ll_entry_count(struct blk_driver, blk_driver); struct blk_driver *entry; for (entry = drv; entry != drv + n_ents; entry++) { - if (if_type == entry->if_type) + if (uclass_id == entry->uclass_id) return entry; } @@ -24,14 +24,14 @@ struct blk_driver *blk_driver_lookup_type(int if_type) return NULL; } -static struct blk_driver *blk_driver_lookup_typename(const char *if_typename) +static struct blk_driver *blk_driver_lookup_typename(const char *uclass_idname) { struct blk_driver *drv = ll_entry_start(struct blk_driver, blk_driver); const int n_ents = ll_entry_count(struct blk_driver, blk_driver); struct blk_driver *entry; for (entry = drv; entry != drv + n_ents; entry++) { - if (!strcmp(if_typename, entry->if_typename)) + if (!strcmp(uclass_idname, entry->uclass_idname)) return entry; } @@ -39,11 +39,11 @@ static struct blk_driver *blk_driver_lookup_typename(const char *if_typename) return NULL; } -const char *blk_get_if_type_name(enum uclass_id if_type) +const char *blk_get_uclass_name(enum uclass_id uclass_id) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); - return drv ? drv->if_typename : NULL; + return drv ? drv->uclass_idname : NULL; } /** @@ -70,14 +70,14 @@ static int get_desc(struct blk_driver *drv, int devnum, struct blk_desc **descp) return drv->get_dev(devnum, descp); } -int blk_list_part(enum uclass_id if_type) +int blk_list_part(enum uclass_id uclass_id) { struct blk_driver *drv; struct blk_desc *desc; int devnum, ok; bool first = true; - drv = blk_driver_lookup_type(if_type); + drv = blk_driver_lookup_type(uclass_id); if (!drv) return -ENOSYS; for (ok = 0, devnum = 0; devnum < drv->max_devs; ++devnum) { @@ -97,9 +97,9 @@ int blk_list_part(enum uclass_id if_type) return 0; } -int blk_print_part_devnum(enum uclass_id if_type, int devnum) +int blk_print_part_devnum(enum uclass_id uclass_id, int devnum) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int ret; @@ -115,9 +115,9 @@ int blk_print_part_devnum(enum uclass_id if_type, int devnum) return 0; } -void blk_list_devices(enum uclass_id if_type) +void blk_list_devices(enum uclass_id uclass_id) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int i; @@ -133,9 +133,9 @@ void blk_list_devices(enum uclass_id if_type) } } -int blk_print_device_num(enum uclass_id if_type, int devnum) +int blk_print_device_num(enum uclass_id uclass_id, int devnum) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int ret; @@ -144,15 +144,15 @@ int blk_print_device_num(enum uclass_id if_type, int devnum) ret = get_desc(drv, devnum, &desc); if (ret) return ret; - printf("\n%s device %d: ", drv->if_typename, devnum); + printf("\n%s device %d: ", drv->uclass_idname, devnum); dev_print(desc); return 0; } -int blk_show_device(enum uclass_id if_type, int devnum) +int blk_show_device(enum uclass_id uclass_id, int devnum) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int ret; @@ -174,9 +174,9 @@ int blk_show_device(enum uclass_id if_type, int devnum) return 0; } -struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum) +struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; if (!drv) @@ -190,7 +190,7 @@ struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum) int blk_dselect_hwpart(struct blk_desc *desc, int hwpart) { - struct blk_driver *drv = blk_driver_lookup_type(desc->if_type); + struct blk_driver *drv = blk_driver_lookup_type(desc->uclass_id); if (!drv) return -ENOSYS; @@ -200,9 +200,9 @@ int blk_dselect_hwpart(struct blk_desc *desc, int hwpart) return 0; } -struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) +struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname, int devnum) { - struct blk_driver *drv = blk_driver_lookup_typename(if_typename); + struct blk_driver *drv = blk_driver_lookup_typename(uclass_idname); struct blk_desc *desc; if (!drv) @@ -214,10 +214,10 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) return desc; } -ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, void *buffer) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; ulong n; int ret; @@ -234,10 +234,10 @@ ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start, return n; } -ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, const void *buffer) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int ret; @@ -249,9 +249,9 @@ ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start, return desc->block_write(desc, start, blkcnt, buffer); } -int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart) +int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart) { - struct blk_driver *drv = blk_driver_lookup_type(if_type); + struct blk_driver *drv = blk_driver_lookup_type(uclass_id); struct blk_desc *desc; int ret; diff --git a/drivers/block/ide.c b/drivers/block/ide.c index b8840d29c2..eaa58d859c 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -537,7 +537,7 @@ static void ide_ident(struct blk_desc *dev_desc) /* Select device */ ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); - dev_desc->if_type = UCLASS_IDE; + dev_desc->uclass_id = UCLASS_IDE; #ifdef CONFIG_ATAPI retries = 0; @@ -752,7 +752,7 @@ void ide_init(void) for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; ++i) { ide_dev_desc[i].type = DEV_TYPE_UNKNOWN; - ide_dev_desc[i].if_type = UCLASS_IDE; + ide_dev_desc[i].uclass_id = UCLASS_IDE; ide_dev_desc[i].devnum = i; ide_dev_desc[i].part_type = PART_TYPE_UNKNOWN; ide_dev_desc[i].blksz = 0; @@ -1143,8 +1143,8 @@ UCLASS_DRIVER(ide) = { }; #else U_BOOT_LEGACY_BLK(ide) = { - .if_typename = "ide", - .if_type = UCLASS_IDE, + .uclass_idname = "ide", + .uclass_id = UCLASS_IDE, .max_devs = CONFIG_SYS_IDE_MAXDEVICE, .desc = ide_dev_desc, }; diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 2de12e0a93..f2aae89716 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -150,7 +150,7 @@ int host_dev_bind(int devnum, char *filename, bool removable) goto err_file; } - desc = blk_get_devnum_by_type(UCLASS_ROOT, devnum); + desc = blk_get_devnum_by_uclass_id(UCLASS_ROOT, devnum); desc->removable = removable; snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(desc->product, BLK_PRD_SIZE, "hostfile"); @@ -192,7 +192,7 @@ int host_dev_bind(int dev, char *filename, bool removable) } struct blk_desc *blk_dev = &host_dev->blk_dev; - blk_dev->if_type = UCLASS_ROOT; + blk_dev->uclass_id = UCLASS_ROOT; blk_dev->priv = host_dev; blk_dev->blksz = 512; blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz; @@ -262,8 +262,8 @@ U_BOOT_DRIVER(sandbox_host_blk) = { }; #else U_BOOT_LEGACY_BLK(sandbox_host) = { - .if_typename = "host", - .if_type = UCLASS_ROOT, + .uclass_idname = "host", + .uclass_id = UCLASS_ROOT, .max_devs = SANDBOX_HOST_MAX_DEVICES, .get_dev = host_get_dev_err, }; diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index b1bd4ae1bc..759a6b728c 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -472,7 +472,7 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart) ret = mmc_switch_part(mmc, hwpart); if (!ret) - blkcache_invalidate(desc->if_type, desc->devnum); + blkcache_invalidate(desc->uclass_id, desc->devnum); return ret; } diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c index 4e0891e5df..a101ee43fd 100644 --- a/drivers/mmc/mmc_legacy.c +++ b/drivers/mmc/mmc_legacy.c @@ -132,7 +132,7 @@ static struct mmc mmc_static = { .dsr_imp = 0, .dsr = 0xffffffff, .block_dev = { - .if_type = UCLASS_MMC, + .uclass_id = UCLASS_MMC, .removable = 1, .devnum = 0, .block_read = mmc_bread, @@ -194,7 +194,7 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv) mmc->dsr = 0xffffffff; /* Setup the universal parts of the block interface just once */ bdesc = mmc_get_blk_desc(mmc); - bdesc->if_type = UCLASS_MMC; + bdesc->uclass_id = UCLASS_MMC; bdesc->removable = 1; bdesc->devnum = mmc_get_next_devnum(); bdesc->block_read = mmc_bread; @@ -253,8 +253,8 @@ static int mmc_get_dev(int dev, struct blk_desc **descp) } U_BOOT_LEGACY_BLK(mmc) = { - .if_typename = "mmc", - .if_type = UCLASS_MMC, + .uclass_idname = "mmc", + .uclass_id = UCLASS_MMC, .max_devs = -1, .get_dev = mmc_get_dev, .select_hwpart = mmc_select_hwpartp, diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c index 835e5bd8bd..d43a85b498 100644 --- a/drivers/net/fsl_enetc.c +++ b/drivers/net/fsl_enetc.c @@ -146,7 +146,7 @@ static int enetc_init_sgmii(struct udevice *dev) if (!enetc_has_imdio(dev)) return 0; - if (priv->if_type == PHY_INTERFACE_MODE_2500BASEX) + if (priv->uclass_id == PHY_INTERFACE_MODE_2500BASEX) is2500 = true; /* @@ -221,7 +221,7 @@ static void enetc_setup_mac_iface(struct udevice *dev, struct enetc_priv *priv = dev_get_priv(dev); u32 if_mode; - switch (priv->if_type) { + switch (priv->uclass_id) { case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_RXID: @@ -278,14 +278,14 @@ static void enetc_start_pcs(struct udevice *dev) return; } - priv->if_type = dev_read_phy_mode(dev); - if (priv->if_type == PHY_INTERFACE_MODE_NA) { + priv->uclass_id = dev_read_phy_mode(dev); + if (priv->uclass_id == PHY_INTERFACE_MODE_NA) { enetc_dbg(dev, "phy-mode property not found, defaulting to SGMII\n"); - priv->if_type = PHY_INTERFACE_MODE_SGMII; + priv->uclass_id = PHY_INTERFACE_MODE_SGMII; } - switch (priv->if_type) { + switch (priv->uclass_id) { case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_2500BASEX: enetc_init_sgmii(dev); diff --git a/drivers/net/fsl_enetc.h b/drivers/net/fsl_enetc.h index 69f2f4aaff..f2acf367aa 100644 --- a/drivers/net/fsl_enetc.h +++ b/drivers/net/fsl_enetc.h @@ -158,7 +158,7 @@ struct enetc_priv { struct bd_ring tx_bdr; struct bd_ring rx_bdr; - int if_type; + int uclass_id; struct mii_dev imdio; struct phy_device *phy; }; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 99be5aef87..3e769b0843 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -456,7 +456,7 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) { dev_desc->lba = 0; dev_desc->blksz = 0; - dev_desc->if_type = UCLASS_SCSI; + dev_desc->uclass_id = UCLASS_SCSI; dev_desc->devnum = devnum; dev_desc->part_type = PART_TYPE_UNKNOWN; @@ -706,8 +706,8 @@ U_BOOT_DRIVER(scsi_blk) = { }; #else U_BOOT_LEGACY_BLK(scsi) = { - .if_typename = "scsi", - .if_type = UCLASS_SCSI, + .uclass_idname = "scsi", + .uclass_id = UCLASS_SCSI, .max_devs = SCSI_MAX_DEVICE, .desc = scsi_dev_desc, }; diff --git a/drivers/virtio/virtio_blk.c b/drivers/virtio/virtio_blk.c index 9710b79117..30cfc56725 100644 --- a/drivers/virtio/virtio_blk.c +++ b/drivers/virtio/virtio_blk.c @@ -75,7 +75,7 @@ static int virtio_blk_bind(struct udevice *dev) struct blk_desc *desc = dev_get_uclass_plat(dev); int devnum; - desc->if_type = UCLASS_VIRTIO; + desc->uclass_id = UCLASS_VIRTIO; /* * Initialize the devnum to -ENODEV. This is to make sure that * blk_next_free_devnum() works as expected, since the default diff --git a/drivers/xen/pvblock.c b/drivers/xen/pvblock.c index 1090e528d0..970182cd90 100644 --- a/drivers/xen/pvblock.c +++ b/drivers/xen/pvblock.c @@ -665,7 +665,7 @@ static int pvblock_blk_bind(struct udevice *udev) struct blk_desc *desc = dev_get_uclass_plat(udev); int devnum; - desc->if_type = UCLASS_PVBLOCK; + desc->uclass_id = UCLASS_PVBLOCK; /* * Initialize the devnum to -ENODEV. This is to make sure that * blk_next_free_devnum() works as expected, since the default diff --git a/fs/fat/fat.c b/fs/fat/fat.c index c64e253abd..a945904785 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1145,7 +1145,7 @@ int file_fat_detectfs(void) } if (blk_enabled()) { - printf("Interface: %s\n", blk_get_if_type_name(cur_dev->if_type)); + printf("Interface: %s\n", blk_get_uclass_name(cur_dev->uclass_id)); printf(" Device %d: ", cur_dev->devnum); dev_print(cur_dev); } diff --git a/include/blk.h b/include/blk.h index 279f9ea4a9..8806c382d4 100644 --- a/include/blk.h +++ b/include/blk.h @@ -54,7 +54,7 @@ struct blk_desc { * TODO: With driver model we should be able to use the parent * device's uclass instead. */ - enum uclass_id if_type; /* type of the interface */ + enum uclass_id uclass_id; /* type of the interface */ int devnum; /* device number */ unsigned char part_type; /* partition type */ unsigned char target; /* target SCSI ID */ @@ -114,7 +114,7 @@ int blkcache_init(void); /** * blkcache_read() - attempt to read a set of blocks from cache * - * @param iftype - IF_TYPE_x for type of device + * @param iftype - uclass_id_x for type of device * @param dev - device index of particular type * @param start - starting block number * @param blkcnt - number of blocks to read @@ -131,7 +131,7 @@ int blkcache_read(int iftype, int dev, * blkcache_fill() - make data read from a block device available * to the block cache * - * @param iftype - IF_TYPE_x for type of device + * @param iftype - uclass_id_x for type of device * @param dev - device index of particular type * @param start - starting block number * @param blkcnt - number of blocks available @@ -147,7 +147,7 @@ void blkcache_fill(int iftype, int dev, * blkcache_invalidate() - discard the cache for a set of blocks * because of a write or device (re)initialization. * - * @param iftype - IF_TYPE_x for type of device + * @param iftype - uclass_id_x for type of device * @param dev - device index of particular type */ void blkcache_invalidate(int iftype, int dev); @@ -279,22 +279,22 @@ unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, * This function does not activate the device. The device will be returned * whether or not it is activated. * - * @if_type: Interface type (enum uclass_id_t) + * @uclass_id: Interface type (enum uclass_id_t) * @devnum: Device number (specific to each interface type) * @devp: the device, if found * Return: 0 if found, -ENODEV if no device found, or other -ve error value */ -int blk_find_device(int if_type, int devnum, struct udevice **devp); +int blk_find_device(int uclass_id, int devnum, struct udevice **devp); /** * blk_get_device() - Find and probe a block device ready for use * - * @if_type: Interface type (enum uclass_id_t) + * @uclass_id: Interface type (enum uclass_id_t) * @devnum: Device number (specific to each interface type) * @devp: the device, if found * Return: 0 if found, -ENODEV if no device found, or other -ve error value */ -int blk_get_device(int if_type, int devnum, struct udevice **devp); +int blk_get_device(int uclass_id, int devnum, struct udevice **devp); /** * blk_first_device() - Find the first device for a given interface @@ -305,7 +305,7 @@ int blk_get_device(int if_type, int devnum, struct udevice **devp); * @devp: the device, if found * Return: 0 if found, -ENODEV if no device, or other -ve error value */ -int blk_first_device(int if_type, struct udevice **devp); +int blk_first_device(int uclass_id, struct udevice **devp); /** * blk_next_device() - Find the next device for a given interface @@ -327,7 +327,7 @@ int blk_next_device(struct udevice **devp); * @parent: Parent of the new device * @drv_name: Driver name to use for the block device * @name: Name for the device - * @if_type: Interface type (enum uclass_id_t) + * @uclass_id: Interface type (enum uclass_id_t) * @devnum: Device number, specific to the interface type, or -1 to * allocate the next available number * @blksz: Block size of the device in bytes (typically 512) @@ -335,7 +335,7 @@ int blk_next_device(struct udevice **devp); * @devp: the new device (which has not been probed) */ int blk_create_device(struct udevice *parent, const char *drv_name, - const char *name, int if_type, int devnum, int blksz, + const char *name, int uclass_id, int devnum, int blksz, lbaint_t lba, struct udevice **devp); /** @@ -344,7 +344,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, * @parent: Parent of the new device * @drv_name: Driver name to use for the block device * @name: Name for the device (parent name is prepended) - * @if_type: Interface type (enum uclass_id_t) + * @uclass_id: Interface type (enum uclass_id_t) * @devnum: Device number, specific to the interface type, or -1 to * allocate the next available number * @blksz: Block size of the device in bytes (typically 512) @@ -352,7 +352,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, * @devp: the new device (which has not been probed) */ int blk_create_devicef(struct udevice *parent, const char *drv_name, - const char *name, int if_type, int devnum, int blksz, + const char *name, int uclass_id, int devnum, int blksz, lbaint_t lba, struct udevice **devp); /** @@ -372,33 +372,33 @@ int blk_probe_or_unbind(struct udevice *dev); * * The devices are removed and then unbound. * - * @if_type: Interface type to unbind + * @uclass_id: Interface type to unbind * Return: 0 if OK, -ve on error */ -int blk_unbind_all(int if_type); +int blk_unbind_all(int uclass_id); /** * blk_find_max_devnum() - find the maximum device number for an interface type * - * Finds the last allocated device number for an interface type @if_type. The + * Finds the last allocated device number for an interface type @uclass_id. The * next number is safe to use for a newly allocated device. * - * @if_type: Interface type to scan + * @uclass_id: Interface type to scan * Return: maximum device number found, or -ENODEV if none, or other -ve on * error */ -int blk_find_max_devnum(enum uclass_id if_type); +int blk_find_max_devnum(enum uclass_id uclass_id); /** * blk_next_free_devnum() - get the next device number for an interface type * * Finds the next number that is safe to use for a newly allocated device for - * an interface type @if_type. + * an interface type @uclass_id. * - * @if_type: Interface type to scan + * @uclass_id: Interface type to scan * Return: next device number safe to use, or -ve on error */ -int blk_next_free_devnum(enum uclass_id if_type); +int blk_next_free_devnum(enum uclass_id uclass_id); /** * blk_select_hwpart() - select a hardware partition @@ -447,7 +447,7 @@ static inline ulong blk_dread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, void *buffer) { ulong blks_read; - if (blkcache_read(block_dev->if_type, block_dev->devnum, + if (blkcache_read(block_dev->uclass_id, block_dev->devnum, start, blkcnt, block_dev->blksz, buffer)) return blkcnt; @@ -458,7 +458,7 @@ static inline ulong blk_dread(struct blk_desc *block_dev, lbaint_t start, */ blks_read = block_dev->block_read(block_dev, start, blkcnt, buffer); if (blks_read == blkcnt) - blkcache_fill(block_dev->if_type, block_dev->devnum, + blkcache_fill(block_dev->uclass_id, block_dev->devnum, start, blkcnt, block_dev->blksz, buffer); return blks_read; @@ -467,14 +467,14 @@ static inline ulong blk_dread(struct blk_desc *block_dev, lbaint_t start, static inline ulong blk_dwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, const void *buffer) { - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return block_dev->block_write(block_dev, start, blkcnt, buffer); } static inline ulong blk_derase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt) { - blkcache_invalidate(block_dev->if_type, block_dev->devnum); + blkcache_invalidate(block_dev->uclass_id, block_dev->devnum); return block_dev->block_erase(block_dev, start, blkcnt); } @@ -485,15 +485,15 @@ static inline ulong blk_derase(struct blk_desc *block_dev, lbaint_t start, * driver should be provided using U_BOOT_LEGACY_BLK() for each interface * type that is to be supported. * - * @if_typename: Interface type name - * @if_type: Interface type + * @uclass_idname: Interface type name + * @uclass_id: Interface type * @max_devs: Maximum number of devices supported * @desc: Pointer to list of devices for this interface type, * or NULL to use @get_dev() instead */ struct blk_driver { - const char *if_typename; - enum uclass_id if_type; + const char *uclass_idname; + enum uclass_id uclass_id; int max_devs; struct blk_desc *desc; /** @@ -540,33 +540,33 @@ struct blk_driver { #define U_BOOT_LEGACY_BLK(__name) \ ll_entry_declare(struct blk_driver, __name, blk_driver) -struct blk_driver *blk_driver_lookup_type(int if_type); +struct blk_driver *blk_driver_lookup_type(int uclass_id); #endif /* !CONFIG_BLK */ /** - * blk_get_devnum_by_typename() - Get a block device by type and number + * blk_get_devnum_by_uclass_idname() - Get a block device by type and number * * This looks through the available block devices of the given type, returning * the one with the given @devnum. * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * Return: point to block device descriptor, or NULL if not found */ -struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum); +struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum); /** - * blk_get_devnum_by_type() - Get a block device by type name, and number + * blk_get_devnum_by_uclass_id() - Get a block device by type name, and number * - * This looks up the block device type based on @if_typename, then calls - * blk_get_devnum_by_type(). + * This looks up the block device type based on @uclass_idname, then calls + * blk_get_devnum_by_uclass_id(). * - * @if_typename: Block device type name + * @uclass_idname: Block device type name * @devnum: Device number * Return: point to block device descriptor, or NULL if not found */ -struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, +struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname, int devnum); /** @@ -585,34 +585,34 @@ int blk_dselect_hwpart(struct blk_desc *desc, int hwpart); /** * blk_list_part() - list the partitions for block devices of a given type * - * This looks up the partition type for each block device of type @if_type, + * This looks up the partition type for each block device of type @uclass_id, * then displays a list of partitions. * - * @if_type: Block device type + * @uclass_id: Block device type * Return: 0 if OK, -ENODEV if there is none of that type */ -int blk_list_part(enum uclass_id if_type); +int blk_list_part(enum uclass_id uclass_id); /** * blk_list_devices() - list the block devices of a given type * - * This lists each block device of the type @if_type, showing the capacity + * This lists each block device of the type @uclass_id, showing the capacity * as well as type-specific information. * - * @if_type: Block device type + * @uclass_id: Block device type */ -void blk_list_devices(enum uclass_id if_type); +void blk_list_devices(enum uclass_id uclass_id); /** * blk_show_device() - show information about a given block device * * This shows the block device capacity as well as type-specific information. * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * Return: 0 if OK, -ENODEV for invalid device number */ -int blk_show_device(enum uclass_id if_type, int devnum); +int blk_show_device(enum uclass_id uclass_id, int devnum); /** * blk_print_device_num() - show information about a given block device @@ -620,45 +620,45 @@ int blk_show_device(enum uclass_id if_type, int devnum); * This is similar to blk_show_device() but returns an error if the block * device type is unknown. * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * Return: 0 if OK, -ENODEV for invalid device number, -ENOENT if the block * device is not connected */ -int blk_print_device_num(enum uclass_id if_type, int devnum); +int blk_print_device_num(enum uclass_id uclass_id, int devnum); /** * blk_print_part_devnum() - print the partition information for a device * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * Return: 0 if OK, -ENOENT if the block device is not connected, -ENOSYS if * the interface type is not supported, other -ve on other error */ -int blk_print_part_devnum(enum uclass_id if_type, int devnum); +int blk_print_part_devnum(enum uclass_id uclass_id, int devnum); /** * blk_read_devnum() - read blocks from a device * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * @blkcnt: Number of blocks to read * @buffer: Address to write data to * Return: number of blocks read, or -ve error number on error */ -ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_read_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, void *buffer); /** * blk_write_devnum() - write blocks to a device * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * @blkcnt: Number of blocks to write * @buffer: Address to read data from * Return: number of blocks written, or -ve error number on error */ -ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start, +ulong blk_write_devnum(enum uclass_id uclass_id, int devnum, lbaint_t start, lbaint_t blkcnt, const void *buffer); /** @@ -667,31 +667,31 @@ ulong blk_write_devnum(enum uclass_id if_type, int devnum, lbaint_t start, * This is similar to blk_dselect_hwpart() but it looks up the interface and * device number. * - * @if_type: Block device type + * @uclass_id: Block device type * @devnum: Device number * @hwpart: Partition number to select * Return: 0 if OK, -ve on error */ -int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart); +int blk_select_hwpart_devnum(enum uclass_id uclass_id, int devnum, int hwpart); /** - * blk_get_if_type_name() - Get the name of an interface type + * blk_get_uclass_name() - Get the name of an interface type * - * @if_type: Interface type to check + * @uclass_id: Interface type to check * Return: name of interface, or NULL if none */ -const char *blk_get_if_type_name(enum uclass_id if_type); +const char *blk_get_uclass_name(enum uclass_id uclass_id); /** * blk_common_cmd() - handle common commands with block devices * * @args: Number of arguments to the command (argv[0] is the command itself) * @argv: Command arguments - * @if_type: Interface type + * @uclass_id: Interface type * @cur_devnump: Current device number for this interface type * Return: 0 if OK, CMD_RET_ERROR on error */ -int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type, +int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id, int *cur_devnump); enum blk_flag_t { diff --git a/include/efi_loader.h b/include/efi_loader.h index 7554f3b7db..ad01395b39 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -161,7 +161,7 @@ extern bool efi_st_keep_devices; /* EFI system partition */ extern struct efi_system_partition { - enum uclass_id if_type; + enum uclass_id uclass_id; int devnum; u8 part; } efi_system_partition; @@ -562,7 +562,7 @@ efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size, struct efi_loaded_image *loaded_image_info); /* Create handles and protocols for the partitions of a block device */ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, - const char *if_typename, int diskid, + const char *uclass_idname, int diskid, const char *pdevname); /* Called by bootefi to make GOP (graphical) interface available */ efi_status_t efi_gop_register(void); diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index e39968a3f3..39ea1a68a6 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -498,13 +498,13 @@ static efi_status_t efi_disk_add_dev( diskobj->media.last_block); /* Store first EFI system partition */ - if (part && !efi_system_partition.if_type) { + if (part && !efi_system_partition.uclass_id) { if (part_info->bootable & PART_EFI_SYSTEM_PARTITION) { - efi_system_partition.if_type = desc->if_type; + efi_system_partition.uclass_id = desc->uclass_id; efi_system_partition.devnum = desc->devnum; efi_system_partition.part = part; EFI_PRINT("EFI system partition: %s %x:%x\n", - blk_get_if_type_name(desc->if_type), + blk_get_uclass_name(desc->uclass_id), desc->devnum, part); } } @@ -640,7 +640,7 @@ static int efi_disk_probe(void *ctx, struct event *event) * has already created an efi_disk at this moment. */ desc = dev_get_uclass_plat(dev); - if (desc->if_type != UCLASS_EFI_LOADER) { + if (desc->uclass_id != UCLASS_EFI_LOADER) { ret = efi_disk_create_raw(dev); if (ret) return -1; @@ -675,7 +675,7 @@ static int efi_disk_delete_raw(struct udevice *dev) return -1; desc = dev_get_uclass_plat(dev); - if (desc->if_type != UCLASS_EFI_LOADER) { + if (desc->uclass_id != UCLASS_EFI_LOADER) { diskobj = container_of(handle, struct efi_disk_obj, header); efi_free_pool(diskobj->dp); } @@ -794,7 +794,7 @@ efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int } else { return EFI_INVALID_PARAMETER; } - if_typename = blk_get_if_type_name(desc->if_type); + if_typename = blk_get_uclass_name(desc->uclass_id); diskid = desc->devnum; if (is_partition) { diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c index 994e66392f..3d58caa13d 100644 --- a/lib/efi_loader/efi_var_file.c +++ b/lib/efi_loader/efi_var_file.c @@ -38,13 +38,13 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void) char part_str[PART_STR_LEN]; int r; - if (efi_system_partition.if_type == UCLASS_INVALID) { + if (efi_system_partition.uclass_id == UCLASS_INVALID) { log_err("No EFI system partition\n"); return EFI_DEVICE_ERROR; } snprintf(part_str, PART_STR_LEN, "%x:%x", efi_system_partition.devnum, efi_system_partition.part); - r = fs_set_blk_dev(blk_get_if_type_name(efi_system_partition.if_type), + r = fs_set_blk_dev(blk_get_uclass_name(efi_system_partition.uclass_id), part_str, FS_TYPE_ANY); if (r) { log_err("Cannot read EFI system partition\n"); -- cgit v1.2.3