Here's a first shot at bug #91 (http://tracker.linuxbios.org/trac/LinuxBIOS/ticket/91), adding a --list-supported switch to superiotool.
I wasn't very sure about what the "wiki links" part of this feature entailed. I included the primary url for superiotool, but perhaps there's something more that needs to be done? In terms of formatting, I just grouped the chips by vendor. For chips that have dump support I added "(dump)" after their name. Signed-off-by: Robinson P. Tryon <[EMAIL PROTECTED]> Oh, and how should I go about getting an account on Trac? I'd be happy to take a stab at adding --list-supported to flashrom (#90) once this patch passes muster. --R
Index: fintek.c =================================================================== --- fintek.c (revision 3047) +++ fintek.c (working copy) @@ -3,6 +3,7 @@ * * Copyright (C) 2006 coresystems GmbH <[EMAIL PROTECTED]> * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,3 +100,8 @@ exit_conf_mode_winbond_fintek_ite_8787(port); } + +void print_fintek_chips(void) { + char name [] = "Fintek"; + print_vendor_chips(name, reg_table); +} Index: winbond.c =================================================================== --- winbond.c (revision 3047) +++ winbond.c (working copy) @@ -2,6 +2,7 @@ * This file is part of the superiotool project. * * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -445,3 +446,8 @@ probe_idregs_winbond_helper("(init=0x87,0x87) ", port); exit_conf_mode_winbond_fintek_ite_8787(port); } + +void print_winbond_chips(void) { + char name [] = "Winbond"; + print_vendor_chips(name, reg_table); +} Index: ite.c =================================================================== --- ite.c (revision 3047) +++ ite.c (working copy) @@ -3,6 +3,7 @@ * * Copyright (C) 2007 Carl-Daniel Hailfinger * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -380,3 +381,8 @@ probe_idregs_ite_helper("(init=0x87,0x87) ", port); exit_conf_mode_winbond_fintek_ite_8787(port); } + +void print_ite_chips(void) { + char name [] = "ITE"; + print_vendor_chips(name, reg_table); +} Index: nsc.c =================================================================== --- nsc.c (revision 3047) +++ nsc.c (working copy) @@ -3,6 +3,7 @@ * * Copyright (C) 2006 Ronald Minnich <[EMAIL PROTECTED]> * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -449,3 +450,8 @@ dump_superio("NSC", reg_table, port, id); } + +void print_nsc_chips(void) { + char name [] = "NSC"; + print_vendor_chips(name, reg_table); +} Index: superiotool.c =================================================================== --- superiotool.c (revision 3047) +++ superiotool.c (working copy) @@ -4,6 +4,7 @@ * Copyright (C) 2006 Ronald Minnich <[EMAIL PROTECTED]> * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> * Copyright (C) 2007 Carl-Daniel Hailfinger + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,6 +162,51 @@ vendor, info, port); } +/* Print information about a specific chip. */ +void print_chip(const struct superio_registers reg) { + printf(" %s", reg.name); + /* Unless the ldn is empty, assume this chip has a dump. */ + if(reg.ldn[0].ldn != EOT) + printf(" (dump)"); + printf("\n"); +} + +/* Print a list of all supported chips from the given vendor. */ +void print_vendor_chips(const char *vendor, + const struct superio_registers reg_table[]) { + int i, any_supported_chips = 0; + + printf(" Chips from %s:\n", vendor); + + for (i = 0; /* Nothing */; i++) { + if (reg_table[i].superio_id == EOT) + break; + + any_supported_chips = 1; + print_chip(reg_table[i]); + } + + if (!any_supported_chips) + printf(" None.\n"); +} + +/* Print a list of all chips supported by superiotool. */ +void print_list_of_supported_chips(void) +{ + int i; + + printf("Supported Super I/O Chips:\n"); + printf(" Notes:\n"); + printf(" - See http://linuxbios.org/Superiotool for more information.\n"); + printf(" - Chips with (dump) after them have support for dumping registers.\n"); + printf("\n"); + + for (i = 0; i < ARRAY_SIZE(vendor_print_functions); i++) { + vendor_print_functions[i].print_list(); + printf("\n"); + } +} + static void print_version(void) { printf("superiotool r%s\n", SUPERIOTOOL_VERSION); @@ -175,10 +221,11 @@ {"verbose", no_argument, NULL, 'V'}, {"version", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, + {"list-supported", no_argument, NULL, 'l'}, {0, 0, 0, 0} }; - while ((opt = getopt_long(argc, argv, "dVvh", + while ((opt = getopt_long(argc, argv, "dVvhl", long_options, &option_index)) != EOF) { switch (opt) { case 'd': @@ -195,6 +242,10 @@ printf(USAGE); exit(0); break; + case 'l': + print_list_of_supported_chips(); + exit(0); + break; default: /* Unknown option. */ exit(1); Index: ali.c =================================================================== --- ali.c (revision 3047) +++ ali.c (working copy) @@ -2,6 +2,7 @@ * This file is part of the superiotool project. * * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,3 +100,8 @@ exit_conf_mode_ali(port); } + +void print_ali_chips(void) { + char name [] = "ALi"; + print_vendor_chips(name, reg_table); +} Index: smsc.c =================================================================== --- smsc.c (revision 3047) +++ smsc.c (working copy) @@ -2,6 +2,7 @@ * This file is part of the superiotool project. * * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -546,3 +547,8 @@ probe_idregs_smsc_helper(port, DEVICE_ID_REG, DEVICE_REV_REG); probe_idregs_smsc_helper(port, DEVICE_ID_REG_OLD, DEVICE_REV_REG_OLD); } + +void print_smsc_chips(void) { + char name [] = "SMSC"; + print_vendor_chips(name, reg_table); +} Index: superiotool.h =================================================================== --- superiotool.h (revision 3047) +++ superiotool.h (working copy) @@ -3,6 +3,7 @@ * * Copyright (C) 2007 Carl-Daniel Hailfinger * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]> + * Copyright (C) 2008 Robinson P. Tryon <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,23 +82,34 @@ uint16_t port, uint16_t id); void probing_for(const char *vendor, const char *info, uint16_t port); +void print_chip(const struct superio_registers reg); +void print_vendor_chips(const char *vendor, + const struct superio_registers reg_table[]); +void print_list_of_supported_chips(void); + /* ali.c */ void probe_idregs_ali(uint16_t port); +void print_ali_chips(void); /* fintek.c */ void probe_idregs_fintek(uint16_t port); +void print_fintek_chips(void); /* ite.c */ void probe_idregs_ite(uint16_t port); +void print_ite_chips(void); /* nsc.c */ void probe_idregs_nsc(uint16_t port); +void print_nsc_chips(void); /* smsc.c */ void probe_idregs_smsc(uint16_t port); +void print_smsc_chips(void); /* winbond.c */ void probe_idregs_winbond(uint16_t port); +void print_winbond_chips(void); /** Table of which config ports to probe for each Super I/O family. */ static const struct { @@ -112,4 +124,16 @@ {probe_idregs_winbond, {0x2e, 0x4e, 0x3f0, 0x370, 0x250, EOT}}, }; + +/** Table of functions to print out supported Super I/O chips for each vendor */ +static const struct { + void (*print_list) (void); +} vendor_print_functions [] = { + {print_ali_chips}, + {print_fintek_chips}, + {print_ite_chips}, + {print_nsc_chips}, + {print_smsc_chips}, + {print_winbond_chips}}; + #endif
-- linuxbios mailing list linuxbios@linuxbios.org http://www.linuxbios.org/mailman/listinfo/linuxbios