projects
/
b43-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ssb-sprom: Add warnings.
[b43-tools.git]
/
ssb_sprom
/
ssb_sprom.c
diff --git
a/ssb_sprom/ssb_sprom.c
b/ssb_sprom/ssb_sprom.c
index 2b05e9feba3e1bf5e1aebcd8c12d99f07dc70605..10952775eec72e68028ebed4acd0c9e92efda88f 100644
(file)
--- a/
ssb_sprom/ssb_sprom.c
+++ b/
ssb_sprom/ssb_sprom.c
@@
-2,7
+2,7
@@
Broadcom Sonics Silicon Backplane bus SPROM data modification tool
Broadcom Sonics Silicon Backplane bus SPROM data modification tool
- Copyright (c) 2006-200
7
Michael Buesch <mb@bu3sch.de>
+ Copyright (c) 2006-200
8
Michael Buesch <mb@bu3sch.de>
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
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
@@
-16,7
+16,7
@@
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
+ the Free Software Foundation, Inc., 51 Franklin St
r
eet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
Boston, MA 02110-1301, USA.
*/
@@
-293,10
+293,16
@@
static int modify_value(uint8_t *sprom,
sprom[SPROM_BOARDREV + 1] |= (1 << 5);
break;
case VALUE_ANTGA:
sprom[SPROM_BOARDREV + 1] |= (1 << 5);
break;
case VALUE_ANTGA:
- sprom[SPROM_ANTENNA_GAIN + 0] = (v & 0xFF);
+ if (sprom_rev != 4)
+ sprom[SPROM_ANTENNA_GAIN + 1] = (v & 0xFF);
+ else
+ sprom[SPROM4_ANTENNA_GAIN + 1] = (v & 0xFF);
break;
case VALUE_ANTGBG:
break;
case VALUE_ANTGBG:
- sprom[SPROM_ANTENNA_GAIN + 1] = (v & 0xFF);
+ if (sprom_rev != 4)
+ sprom[SPROM_ANTENNA_GAIN] = (v & 0xFF);
+ else
+ sprom[SPROM4_ANTENNA_GAIN] = (v & 0xFF);
break;
case VALUE_PA0B0:
sprom[SPROM_PA0B0 + 0] = (v & 0x00FF);
break;
case VALUE_PA0B0:
sprom[SPROM_PA0B0 + 0] = (v & 0x00FF);
@@
-398,7
+404,7
@@
static void display_value(const uint8_t *sprom,
value = sprom[offset];
break;
case VALUE_SUBP:
value = sprom[offset];
break;
case VALUE_SUBP:
- desc = "Subsytem product ID";
+ desc = "Subsy
s
tem product ID";
if (sprom_rev == 4)
offset = SPROM4_SUBP;
else
if (sprom_rev == 4)
offset = SPROM4_SUBP;
else
@@
-574,7
+580,7
@@
static void display_value(const uint8_t *sprom,
case VALUE_ANTGA:
if (sprom_rev != 4) {
desc = "A PHY antenna gain";
case VALUE_ANTGA:
if (sprom_rev != 4) {
desc = "A PHY antenna gain";
- offset = SPROM_ANTENNA_GAIN
+ 1
;
+ offset = SPROM_ANTENNA_GAIN;
} else {
desc = "Antenna 1 Gain";
offset = SPROM4_ANTENNA_GAIN;
} else {
desc = "Antenna 1 Gain";
offset = SPROM4_ANTENNA_GAIN;
@@
-912,7
+918,12
@@
static int open_outfile(int *fd)
static void print_banner(int forceprint)
{
static void print_banner(int forceprint)
{
- const char *str = "Broadcom-SSB SPROM data modification tool version " VERSION "\n";
+ const char *str = "Broadcom-SSB SPROM data modification tool.\n"
+ "\n"
+ "Copyright (C) Michael Buesch\n"
+ "Licensed under the GNU/GPL version 2 or later\n"
+ "\n"
+ "DO NOT USE THIS TOOL. YOU WILL BRICK YOUR DEVICE.\n";
if (forceprint)
prdata(str);
else
if (forceprint)
prdata(str);
else
@@
-937,7
+948,7
@@
static void print_usage(int argc, char *argv[])
prdata(" -g|--rawget OFF Get a value at a byte-OFFset\n");
prdata("\n");
prdata("Predefined values (for displaying (GET) or modification):\n");
prdata(" -g|--rawget OFF Get a value at a byte-OFFset\n");
prdata("\n");
prdata("Predefined values (for displaying (GET) or modification):\n");
- prdata(" --subp [0xFFFF] Subsytem product ID for PCI\n");
+ prdata(" --subp [0xFFFF] Subsy
s
tem product ID for PCI\n");
prdata(" --subv [0xFFFF] Subsystem vendor ID for PCI\n");
prdata(" --ppid [0xFFFF] Product ID for PCI\n");
prdata(" --bflhi [0xFFFF] High 16 bits of boardflags (only if spromversion > 1)\n");
prdata(" --subv [0xFFFF] Subsystem vendor ID for PCI\n");
prdata(" --ppid [0xFFFF] Product ID for PCI\n");
prdata(" --bflhi [0xFFFF] High 16 bits of boardflags (only if spromversion > 1)\n");
@@
-1016,12
+1027,12
@@
static int do_cmp_arg(char **argv, int *pos,
}
if (strcmp(arg, template) == 0) {
if (param) {
}
if (strcmp(arg, template) == 0) {
if (param) {
- /* Skip the parameter on the next iteration. */
- (*pos)++;
if (*param == 0) {
prerror("%s needs a parameter\n", arg);
return ARG_ERROR;
}
if (*param == 0) {
prerror("%s needs a parameter\n", arg);
return ARG_ERROR;
}
+ /* Skip the parameter on the next iteration. */
+ (*pos)++;
}
return ARG_MATCH;
}
}
return ARG_MATCH;
}
@@
-1511,7
+1522,8
@@
static int parse_args(int argc, char *argv[])
if (err)
goto error;
} else {
if (err)
goto error;
} else {
- prerror("Unrecognized argument: %s\n", argv[i]);
+ if (!parse_err)
+ prerror("Unrecognized argument: %s\n", argv[i]);
goto out_usage;
}
if (parse_err)
goto out_usage;
}
if (parse_err)