]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aic7xxx/aiclib.c
Merge branch 'omap-clock-fixes' of git://git.pwsan.com/linux-2.6
[linux-2.6-omap-h63xx.git] / drivers / scsi / aic7xxx / aiclib.c
index 4d44a9211185db7ce9486076377693818f6cccda..828ae3d9a510f1a6861e57ca0ae6720082949005 100644 (file)
 
 #include "aiclib.h"
 
-
-/*
- * Table of syncrates that don't follow the "divisible by 4"
- * rule. This table will be expanded in future SCSI specs.
- */
-static struct {
-       u_int period_factor;
-       u_int period;   /* in 100ths of ns */
-} scsi_syncrates[] = {
-       { 0x08, 625 },  /* FAST-160 */
-       { 0x09, 1250 }, /* FAST-80 */
-       { 0x0a, 2500 }, /* FAST-40 40MHz */
-       { 0x0b, 3030 }, /* FAST-40 33MHz */
-       { 0x0c, 5000 }  /* FAST-20 */
-};
-
-/*
- * Return the frequency in kHz corresponding to the given
- * sync period factor.
- */
-u_int
-aic_calc_syncsrate(u_int period_factor)
-{
-       int i;
-       int num_syncrates;
-
-       num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]);
-       /* See if the period is in the "exception" table */
-       for (i = 0; i < num_syncrates; i++) {
-
-               if (period_factor == scsi_syncrates[i].period_factor) {
-                       /* Period in kHz */
-                       return (100000000 / scsi_syncrates[i].period);
-               }
-       }
-
-       /*
-        * Wasn't in the table, so use the standard
-        * 4 times conversion.
-        */
-       return (10000000 / (period_factor * 4 * 10));
-}
-
-char *
-aic_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
-                      aic_option_callback_t *callback, u_long callback_arg)
-{
-       char    *tok_end;
-       char    *tok_end2;
-       int      i;
-       int      instance;
-       int      targ;
-       int      done;
-       char     tok_list[] = {'.', ',', '{', '}', '\0'};
-
-       /* All options use a ':' name/arg separator */
-       if (*opt_arg != ':')
-               return (opt_arg);
-       opt_arg++;
-       instance = -1;
-       targ = -1;
-       done = FALSE;
-       /*
-        * Restore separator that may be in
-        * the middle of our option argument.
-        */
-       tok_end = strchr(opt_arg, '\0');
-       if (tok_end < end)
-               *tok_end = ',';
-       while (!done) {
-               switch (*opt_arg) {
-               case '{':
-                       if (instance == -1) {
-                               instance = 0;
-                       } else {
-                               if (depth > 1) {
-                                       if (targ == -1)
-                                               targ = 0;
-                               } else {
-                                       printf("Malformed Option %s\n",
-                                              opt_name);
-                                       done = TRUE;
-                               }
-                       }
-                       opt_arg++;
-                       break;
-               case '}':
-                       if (targ != -1)
-                               targ = -1;
-                       else if (instance != -1)
-                               instance = -1;
-                       opt_arg++;
-                       break;
-               case ',':
-               case '.':
-                       if (instance == -1)
-                               done = TRUE;
-                       else if (targ >= 0)
-                               targ++;
-                       else if (instance >= 0)
-                               instance++;
-                       opt_arg++;
-                       break;
-               case '\0':
-                       done = TRUE;
-                       break;
-               default:
-                       tok_end = end;
-                       for (i = 0; tok_list[i]; i++) {
-                               tok_end2 = strchr(opt_arg, tok_list[i]);
-                               if ((tok_end2) && (tok_end2 < tok_end))
-                                       tok_end = tok_end2;
-                       }
-                       callback(callback_arg, instance, targ,
-                                simple_strtol(opt_arg, NULL, 0));
-                       opt_arg = tok_end;
-                       break;
-               }
-       }
-       return (opt_arg);
-}