]> Git Repo - J-u-boot.git/blame - cmd/ide.c
Merge patch series "Resolve issues with booting distros on x86"
[J-u-boot.git] / cmd / ide.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
c609719b 2/*
34c202c7 3 * (C) Copyright 2000-2011
c609719b 4 * Wolfgang Denk, DENX Software Engineering, [email protected].
c609719b
WD
5 */
6
7/*
8 * IDE support
9 */
113bfe48 10
c609719b 11#include <common.h>
2a981dc2 12#include <blk.h>
80778f50 13#include <dm.h>
c609719b
WD
14#include <config.h>
15#include <watchdog.h>
16#include <command.h>
17#include <image.h>
18#include <asm/byteorder.h>
f98984cb 19#include <asm/io.h>
80778f50
SG
20#include <dm/device-internal.h>
21#include <dm/uclass-internal.h>
735dd97b 22
c609719b
WD
23#include <ide.h>
24#include <ata.h>
735dd97b 25
2d8d190c 26#ifdef CONFIG_LED_STATUS
c609719b
WD
27# include <status_led.h>
28#endif
735dd97b 29
c609719b 30/* Current I/O Device */
584f316f 31static int curr_device;
c609719b 32
09140113 33int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ed73508d 34{
09ed0d61 35 if (argc == 2) {
ed73508d 36 if (strncmp(argv[1], "res", 3) == 0) {
80778f50
SG
37 struct udevice *dev;
38 int ret;
39
5b8e76c3 40 puts("\nReset IDE: ");
80778f50
SG
41 ret = uclass_find_first_device(UCLASS_IDE, &dev);
42 ret = device_remove(dev, DM_REMOVE_NORMAL);
43 if (!ret)
44 ret = device_chld_unbind(dev, NULL);
45 if (ret) {
46 printf("Cannot remove IDE (err=%dE)\n", ret);
47 return CMD_RET_FAILURE;
48 }
49
50 ret = uclass_first_device_err(UCLASS_IDE, &dev);
51 if (ret) {
52 printf("Init failed (err=%dE)\n", ret);
53 return CMD_RET_FAILURE;
54 }
55
ed73508d 56 return 0;
ed73508d 57 }
ed73508d 58 }
09ed0d61 59
e33a5c6b 60 return blk_common_cmd(argc, argv, UCLASS_IDE, &curr_device);
ed73508d 61}
c40b2956 62
09140113 63int do_diskboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ed73508d
SG
64{
65 return common_diskboot(cmdtp, "ide", argc, argv);
66}
c609719b 67
34c202c7
WD
68U_BOOT_CMD(ide, 5, 1, do_ide,
69 "IDE sub-system",
70 "reset - reset IDE controller\n"
71 "ide info - show available IDE devices\n"
72 "ide device [dev] - show or set current device\n"
73 "ide part [dev] - print partition table of one or all IDE devices\n"
74 "ide read addr blk# cnt\n"
75 "ide write addr blk# cnt - read/write `cnt'"
76 " blocks starting at block `blk#'\n"
77 " to/from memory address `addr'");
78
79U_BOOT_CMD(diskboot, 3, 1, do_diskboot,
80 "boot from IDE device", "loadAddr dev:part");
This page took 0.561763 seconds and 4 git commands to generate.