summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-07-06 18:38:57 +0000
committergibbs <gibbs@FreeBSD.org>1998-07-06 18:38:57 +0000
commitf38488a4b4695b81a9bdaa59be045a05fa67d52b (patch)
treec97597aad7ddd7df61e68ff6bca2398c6ae137b8 /sys
parentf687cfcdb02907a4d6edeb9483c0e985ba5f82c4 (diff)
downloadFreeBSD-src-f38488a4b4695b81a9bdaa59be045a05fa67d52b.zip
FreeBSD-src-f38488a4b4695b81a9bdaa59be045a05fa67d52b.tar.gz
Attempt to load serial eeprom contents in both 93c46 and 93c56/66 mode before
giving up. PR: 6966
Diffstat (limited to 'sys')
-rw-r--r--sys/pci/aic7870.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/sys/pci/aic7870.c b/sys/pci/aic7870.c
index 5146e82..c99a6fc 100644
--- a/sys/pci/aic7870.c
+++ b/sys/pci/aic7870.c
@@ -36,7 +36,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7870.c,v 1.53 1997/06/27 19:39:34 gibbs Exp $
+ * $Id: aic7870.c,v 1.54 1997/11/18 14:14:34 bde Exp $
*/
#if defined(__FreeBSD__)
@@ -693,6 +693,12 @@ load_seeprom(ahc, sxfrctl1)
sd.sd_ioh = ahc->sc_ioh;
sd.sd_offset = SEECTL;
#endif
+ /*
+ * For some multi-channel devices, the c46 is simply too
+ * small to work. For the other controller types, we can
+ * get our information from either SEEPROM type. Set the
+ * type to start our probe with accordingly.
+ */
if ((ahc->type & AHC_398) == AHC_398)
sd.sd_chip = C56_66;
else
@@ -704,30 +710,44 @@ load_seeprom(ahc, sxfrctl1)
sd.sd_DO = SEEDO;
sd.sd_DI = SEEDI;
- if (bootverbose)
- printf("%s: Reading SEEPROM...", ahc_name(ahc));
have_seeprom = acquire_seeprom(&sd);
if (have_seeprom) {
- have_seeprom = read_seeprom(&sd,
- (u_int16_t *)&sc,
- ahc->flags & (AHC_CHNLB|AHC_CHNLC),
- sizeof(sc)/2);
- release_seeprom(&sd);
- if (have_seeprom) {
- /* Check checksum */
- int i;
- int maxaddr = (sizeof(sc)/2) - 1;
-
- for (i = 0; i < maxaddr; i++)
- checksum = checksum + scarray[i];
- if (checksum != sc.checksum) {
- if(bootverbose)
- printf ("checksum error");
- have_seeprom = 0;
- } else if (bootverbose)
- printf("done.\n");
- }
+ if (bootverbose)
+ printf("%s: Reading SEEPROM...", ahc_name(ahc));
+
+ for (;;) {
+ u_int start_addr;
+
+ start_addr = ahc->flags & (AHC_CHNLB|AHC_CHNLC);
+
+ have_seeprom = read_seeprom(&sd, (u_int16_t *)&sc,
+ start_addr, sizeof(sc)/2);
+
+ if (have_seeprom) {
+ /* Check checksum */
+ int i;
+ int maxaddr = (sizeof(sc)/2) - 1;
+ u_int16_t *scarray = (u_int16_t *)&sc;
+
+ for (i = 0; i < maxaddr; i++)
+ checksum = checksum + scarray[i];
+ if (checksum == 0 || checksum != sc.checksum) {
+ if (bootverbose && sd.sd_chip == C56_66)
+ printf ("checksum error\n");
+ have_seeprom = 0;
+ } else {
+ if (bootverbose)
+ printf("done.\n");
+ break;
+ }
+ }
+
+ if (sd.sd_chip == C56_66)
+ break;
+ sd.sd_chip = C56_66;
+ }
}
+ release_seeprom(&sd);
if (!have_seeprom) {
if (bootverbose)
printf("\n%s: No SEEPROM available\n", ahc_name(ahc));
OpenPOWER on IntegriCloud