Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * Boot support |
| 9 | */ |
| 10 | #include <common.h> |
| 11 | #include <command.h> |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 12 | #include <stdio_dev.h> |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 13 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 14 | extern void _do_coninfo (void); |
Kim Phillips | dc00a68 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 15 | static int do_coninfo(cmd_tbl_t *cmd, int flag, int argc, char * const argv[]) |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 16 | { |
Jean-Christophe PLAGNIOL-VILLARD | 8a4a784 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 17 | int l; |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 18 | struct list_head *list = stdio_get_list(); |
Jean-Christophe PLAGNIOL-VILLARD | 8a4a784 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 19 | struct list_head *pos; |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 20 | struct stdio_dev *dev; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 21 | |
| 22 | /* Scan for valid output and input devices */ |
| 23 | |
wdenk | 6568eaa | 2004-06-09 12:42:26 +0000 | [diff] [blame] | 24 | puts ("List of available devices:\n"); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 25 | |
Jean-Christophe PLAGNIOL-VILLARD | 8a4a784 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 26 | list_for_each(pos, list) { |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 27 | dev = list_entry(pos, struct stdio_dev, list); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 28 | |
Bin Meng | 6abe4b6 | 2015-11-03 23:23:37 -0800 | [diff] [blame] | 29 | printf ("%-8s %08x %c%c ", |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 30 | dev->name, |
| 31 | dev->flags, |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 32 | (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 | } |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 44 | |
| 45 | |
| 46 | /***************************************************/ |
| 47 | |
wdenk | f287a24 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 48 | U_BOOT_CMD( |
| 49 | coninfo, 3, 1, do_coninfo, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 50 | "print console devices and information", |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 51 | "" |
| 52 | ); |