diff options
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_proc.c')
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_proc.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 3802c91f0b07..04a3506cf340 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -54,6 +54,49 @@ static void ahc_dump_device_state(struct info_str *info, | |||
54 | static int ahc_proc_write_seeprom(struct ahc_softc *ahc, | 54 | static int ahc_proc_write_seeprom(struct ahc_softc *ahc, |
55 | char *buffer, int length); | 55 | char *buffer, int length); |
56 | 56 | ||
57 | /* | ||
58 | * Table of syncrates that don't follow the "divisible by 4" | ||
59 | * rule. This table will be expanded in future SCSI specs. | ||
60 | */ | ||
61 | static struct { | ||
62 | u_int period_factor; | ||
63 | u_int period; /* in 100ths of ns */ | ||
64 | } scsi_syncrates[] = { | ||
65 | { 0x08, 625 }, /* FAST-160 */ | ||
66 | { 0x09, 1250 }, /* FAST-80 */ | ||
67 | { 0x0a, 2500 }, /* FAST-40 40MHz */ | ||
68 | { 0x0b, 3030 }, /* FAST-40 33MHz */ | ||
69 | { 0x0c, 5000 } /* FAST-20 */ | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * Return the frequency in kHz corresponding to the given | ||
74 | * sync period factor. | ||
75 | */ | ||
76 | static u_int | ||
77 | ahc_calc_syncsrate(u_int period_factor) | ||
78 | { | ||
79 | int i; | ||
80 | int num_syncrates; | ||
81 | |||
82 | num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); | ||
83 | /* See if the period is in the "exception" table */ | ||
84 | for (i = 0; i < num_syncrates; i++) { | ||
85 | |||
86 | if (period_factor == scsi_syncrates[i].period_factor) { | ||
87 | /* Period in kHz */ | ||
88 | return (100000000 / scsi_syncrates[i].period); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * Wasn't in the table, so use the standard | ||
94 | * 4 times conversion. | ||
95 | */ | ||
96 | return (10000000 / (period_factor * 4 * 10)); | ||
97 | } | ||
98 | |||
99 | |||
57 | static void | 100 | static void |
58 | copy_mem_info(struct info_str *info, char *data, int len) | 101 | copy_mem_info(struct info_str *info, char *data, int len) |
59 | { | 102 | { |
@@ -106,7 +149,7 @@ ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | |||
106 | speed = 3300; | 149 | speed = 3300; |
107 | freq = 0; | 150 | freq = 0; |
108 | if (tinfo->offset != 0) { | 151 | if (tinfo->offset != 0) { |
109 | freq = aic_calc_syncsrate(tinfo->period); | 152 | freq = ahc_calc_syncsrate(tinfo->period); |
110 | speed = freq; | 153 | speed = freq; |
111 | } | 154 | } |
112 | speed *= (0x01 << tinfo->width); | 155 | speed *= (0x01 << tinfo->width); |