diff options
author | Christoph Hellwig <hch@lst.de> | 2005-08-19 12:57:13 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-09-04 20:46:07 -0400 |
commit | 1ff927306e08b356d764e605eff7c50079550bd2 (patch) | |
tree | e96b628ce6673694c615f57013fcc14f72a6677f /drivers/scsi/aic7xxx/aic7xxx_proc.c | |
parent | 77d71d222e871670300f3e3092e2a06f20c842f0 (diff) |
[SCSI] aic7xxx: remove aiclib.c
#include of C files and macro tricks to rename symbols are evil and just
cause trouble. Let's doublicate the two functions as they're going to
go away soon enough anyway.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
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); |