@@ -611,6 +611,7 @@ static int parse_port(char *line, Node * node, int type, int maxports)
int portnum, isalias = 0;
Port *port;
char *s;
+ char *p;
if (line[0] == '@') {
isalias = 1;
@@ -671,6 +672,7 @@ static int parse_port(char *line, Node * node, int type, int maxports)
}
parse_opt:
line = s;
+ p = s;
while (s && (s = strchr(s + 1, '='))) {
char *opt = s;
while (opt && !isalpha(*opt))
@@ -685,6 +687,52 @@ static int parse_port(char *line, Node * node, int type, int maxports)
IBWARN("cannot parse lid, lmc");
return -1;
}
+
+ /* parse width speed from '[0-9]*x[SDQ]DR' pattern */
+ /* also checking for valid width value */
+ char wstr[3];
+ char sstr[3];
+ s = p;
+ while (s && (s = strchr(s + 1, 'x'))) {
+ int width;
+ p = s - 1;
+ while (p && !isdigit(*p))
+ p--;
+ width = atoi(p);
+ switch (width) {
+ case 1: strcpy(wstr, "1");
+ break;
+ case 4: strcpy(wstr, "2");
+ break;
+ case 8: strcpy(wstr, "4");
+ break;
+ case 12: strcpy(wstr, "8");
+ break;
+ default: wstr[0] = sstr[0] = 0;
+ continue;
+ }
+ p = p + 2;
+ if (!strncmp("SDR", p, 3))
+ strcpy(sstr, "1");
+ else if (!strncmp("DDR", p, 3))
+ strcpy(sstr, "2");
+ else if (!strncmp("QDR", p, 3))
+ strcpy(sstr, "4");
+ else {
+ wstr[0] = sstr[0] = 0;
+ continue;
+ }
+ }
+
+ if (parse_port_opt(port, "w", wstr) < 0) {
+ IBWARN("bad port option");
+ return -1;
+ }
+
+ if (parse_port_opt(port, "s", sstr) < 0) {
+ IBWARN("bad port option");
+ return -1;
+ }
return 1;
}