Newer
Older
memcpy(&(pinfo->fsl_ddr_config_reg[dst_ctlr_num]),
&(pinfo->fsl_ddr_config_reg[src_ctlr_num]),
sizeof(pinfo->memctl_opts[0]));
break;
default:
printf("unexpected step_mask value\n");
}
continue;
}
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
if (strcmp(argv[0], "edit") == 0) {
unsigned int error = 0;
unsigned int step_mask = 0;
unsigned int ctlr_mask = 0;
unsigned int dimm_mask = 0;
char *p_element = NULL;
char *p_value = NULL;
unsigned int dimm_number_required = 0;
unsigned int ctrl_num;
unsigned int dimm_num;
if (argc == 1) {
/* Only the element and value must be last */
printf("edit <c#> <d#> "
"<spd|dimmparms|commonparms|opts|"
"addresses|regs> <element> <value>\n");
printf("for spd, specify byte number for "
"element\n");
continue;
}
error = fsl_ddr_parse_interactive_cmd(
argv, argc - 2,
&step_mask,
&ctlr_mask,
&dimm_mask,
&dimm_number_required
);
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
if (error)
continue;
/* Check arguments */
/* ERROR: If no steps were found */
if (step_mask == 0) {
printf("Error: No valid steps were specified "
"in argument.\n");
continue;
}
/* ERROR: If multiple steps were found */
if (step_mask & (step_mask - 1)) {
printf("Error: Multiple steps specified in "
"argument.\n");
continue;
}
/* ERROR: Controller not specified */
if (ctlr_mask == 0) {
printf("Error: controller number not "
"specified or no element and "
"value specified\n");
continue;
}
if (ctlr_mask & (ctlr_mask - 1)) {
printf("Error: multiple controllers "
"specified, %X\n", ctlr_mask);
continue;
}
/* ERROR: DIMM number not specified */
if (dimm_number_required && dimm_mask == 0) {
printf("Error: DIMM number number not "
"specified or no element and "
"value specified\n");
continue;
}
if (dimm_mask & (dimm_mask - 1)) {
printf("Error: multipled DIMMs specified\n");
continue;
}
p_element = argv[argc - 2];
p_value = argv[argc - 1];
ctrl_num = __ilog2(ctlr_mask);
dimm_num = __ilog2(dimm_mask);
switch (step_mask) {
case STEP_GET_SPD:
{
unsigned int element_num;
unsigned int value;
element_num = simple_strtoul(p_element,
NULL, 0);
value = simple_strtoul(p_value,
NULL, 0);
fsl_ddr_spd_edit(pinfo,
ctrl_num,
dimm_num,
element_num,
value);
next_step = STEP_COMPUTE_DIMM_PARMS;
}
break;
case STEP_COMPUTE_DIMM_PARMS:
fsl_ddr_dimm_parameters_edit(
pinfo, ctrl_num, dimm_num,
p_element, p_value);
next_step = STEP_COMPUTE_COMMON_PARMS;
break;
case STEP_COMPUTE_COMMON_PARMS:
lowest_common_dimm_parameters_edit(pinfo,
ctrl_num, p_element, p_value);
next_step = STEP_GATHER_OPTS;
break;
case STEP_GATHER_OPTS:
fsl_ddr_options_edit(pinfo, ctrl_num,
p_element, p_value);
next_step = STEP_ASSIGN_ADDRESSES;
break;
case STEP_ASSIGN_ADDRESSES:
printf("editing of address assignment "
"not yet implemented\n");
break;
case STEP_COMPUTE_REGS:
{
fsl_ddr_regs_edit(pinfo,
ctrl_num,
p_element,
p_value);
next_step = STEP_PROGRAM_REGS;
}
break;
default:
printf("programming error\n");
while (1)
;
break;
}
continue;
}
if (strcmp(argv[0], "reset") == 0) {
/*
* Reboot machine.
* Args don't seem to matter because this
* doesn't return
*/
do_reset(NULL, 0, 0, NULL);
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
}
if (strcmp(argv[0], "recompute") == 0) {
/*
* Recalculate everything, starting with
* loading SPD EEPROM from DIMMs
*/
next_step = STEP_GET_SPD;
ddrsize = fsl_ddr_compute(pinfo, next_step, 0);
continue;
}
if (strcmp(argv[0], "compute") == 0) {
/*
* Compute rest of steps starting at
* the current next_step/
*/
ddrsize = fsl_ddr_compute(pinfo, next_step, 0);
continue;
}
if (strcmp(argv[0], "print") == 0) {
unsigned int error = 0;
unsigned int step_mask = 0;
unsigned int ctlr_mask = 0;
unsigned int dimm_mask = 0;
unsigned int dimm_number_required = 0;
if (argc == 1) {
printf("print [c<n>] [d<n>] [spd] [dimmparms] "
"[commonparms] [opts] [addresses] [regs]\n");
continue;
}
error = fsl_ddr_parse_interactive_cmd(
argv, argc,
&step_mask,
&ctlr_mask,
&dimm_mask,
&dimm_number_required
);
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
if (error)
continue;
/* If no particular controller was found, print all */
if (ctlr_mask == 0)
ctlr_mask = 0xFF;
/* If no particular dimm was found, print all dimms. */
if (dimm_mask == 0)
dimm_mask = 0xFF;
/* If no steps were found, print all steps. */
if (step_mask == 0)
step_mask = STEP_ALL;
fsl_ddr_printinfo(pinfo, ctlr_mask,
dimm_mask, step_mask);
continue;
}
if (strcmp(argv[0], "go") == 0) {
if (next_step)
ddrsize = fsl_ddr_compute(pinfo, next_step, 0);
break;
}
printf("unknown command %s\n", argv[0]);
}
debug("end of memory = %llu\n", (u64)ddrsize);
return ddrsize;
}