blob: 3f1d98b17b0cebac24005e541ffd15e55ec03521 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk38635852002-08-27 05:55:31 +00002/*
3 * (C) Copyright 2000
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk38635852002-08-27 05:55:31 +00005 */
6
7/*
8 * Boot support
9 */
10#include <common.h>
11#include <command.h>
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020012#include <stdio_dev.h>
wdenk38635852002-08-27 05:55:31 +000013
wdenk38635852002-08-27 05:55:31 +000014extern void _do_coninfo (void);
Kim Phillips088f1b12012-10-29 13:34:31 +000015static int do_coninfo(cmd_tbl_t *cmd, int flag, int argc, char * const argv[])
wdenk38635852002-08-27 05:55:31 +000016{
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020017 int l;
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020018 struct list_head *list = stdio_get_list();
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020019 struct list_head *pos;
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020020 struct stdio_dev *dev;
wdenk38635852002-08-27 05:55:31 +000021
22 /* Scan for valid output and input devices */
23
wdenkaa5590b2004-06-09 12:42:26 +000024 puts ("List of available devices:\n");
wdenk38635852002-08-27 05:55:31 +000025
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020026 list_for_each(pos, list) {
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020027 dev = list_entry(pos, struct stdio_dev, list);
wdenk38635852002-08-27 05:55:31 +000028
Bin Meng1caf9342015-11-03 23:23:37 -080029 printf ("%-8s %08x %c%c ",
wdenk38635852002-08-27 05:55:31 +000030 dev->name,
31 dev->flags,
wdenk38635852002-08-27 05:55:31 +000032 (dev->flags & DEV_FLAGS_INPUT) ? 'I' : '.',
33 (dev->flags & DEV_FLAGS_OUTPUT) ? 'O' : '.');
34
35 for (l = 0; l < MAX_FILES; l++) {
36 if (stdio_devices[l] == dev) {
37 printf ("%s ", stdio_names[l]);
38 }
39 }
40 putc ('\n');
41 }
42 return 0;
43}
wdenk8bde7f72003-06-27 21:31:46 +000044
45
46/***************************************************/
47
wdenk0d498392003-07-01 21:06:45 +000048U_BOOT_CMD(
49 coninfo, 3, 1, do_coninfo,
Peter Tyser2fb26042009-01-27 18:03:12 -060050 "print console devices and information",
wdenk8bde7f72003-06-27 21:31:46 +000051 ""
52);