wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * Boot support |
| 10 | */ |
| 11 | #include <common.h> |
| 12 | #include <command.h> |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 13 | #include <stdio_dev.h> |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 14 | |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 15 | extern void _do_coninfo (void); |
Kim Phillips | 088f1b1 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 16 | 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] | 17 | { |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 18 | int l; |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 19 | struct list_head *list = stdio_get_list(); |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 20 | struct list_head *pos; |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 21 | struct stdio_dev *dev; |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 22 | |
| 23 | /* Scan for valid output and input devices */ |
| 24 | |
wdenk | aa5590b | 2004-06-09 12:42:26 +0000 | [diff] [blame] | 25 | puts ("List of available devices:\n"); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 26 | |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 27 | list_for_each(pos, list) { |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 28 | dev = list_entry(pos, struct stdio_dev, list); |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 29 | |
Bin Meng | 1caf934 | 2015-11-03 23:23:37 -0800 | [diff] [blame] | 30 | printf ("%-8s %08x %c%c ", |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 31 | dev->name, |
| 32 | dev->flags, |
wdenk | 3863585 | 2002-08-27 05:55:31 +0000 | [diff] [blame] | 33 | (dev->flags & DEV_FLAGS_INPUT) ? 'I' : '.', |
| 34 | (dev->flags & DEV_FLAGS_OUTPUT) ? 'O' : '.'); |
| 35 | |
| 36 | for (l = 0; l < MAX_FILES; l++) { |
| 37 | if (stdio_devices[l] == dev) { |
| 38 | printf ("%s ", stdio_names[l]); |
| 39 | } |
| 40 | } |
| 41 | putc ('\n'); |
| 42 | } |
| 43 | return 0; |
| 44 | } |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 45 | |
| 46 | |
| 47 | /***************************************************/ |
| 48 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 49 | U_BOOT_CMD( |
| 50 | coninfo, 3, 1, do_coninfo, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 51 | "print console devices and information", |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 52 | "" |
| 53 | ); |