@@ -962,8 +962,6 @@ int ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
u_int start_addr, u_int count);
int ahd_verify_cksum(struct seeprom_config *sc);
-int ahd_acquire_seeprom(struct ahd_softc *ahd);
-void ahd_release_seeprom(struct ahd_softc *ahd);
/**************************** Message Buffer *********************************/
typedef enum {
@@ -10089,35 +10089,6 @@ ahd_verify_cksum(struct seeprom_config *sc)
}
}
-int
-ahd_acquire_seeprom(struct ahd_softc *ahd)
-{
- /*
- * We should be able to determine the SEEPROM type
- * from the flexport logic, but unfortunately not
- * all implementations have this logic and there is
- * no programatic method for determining if the logic
- * is present.
- */
- return (1);
-#if 0
- uint8_t seetype;
- int error;
-
- error = ahd_read_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, &seetype);
- if (error != 0
- || ((seetype & FLX_ROMSTAT_SEECFG) == FLX_ROMSTAT_SEE_NONE))
- return (0);
- return (1);
-#endif
-}
-
-void
-ahd_release_seeprom(struct ahd_softc *ahd)
-{
- /* Currently a no-op */
-}
-
/*
* Wait at most 2 seconds for flexport arbitration to succeed.
*/
@@ -507,60 +507,55 @@ ahd_check_extport(struct ahd_softc *ahd)
{
struct vpd_config vpd;
struct seeprom_config *sc;
- u_int adapter_control;
- int have_seeprom;
+ u_int adapter_control, start_addr;
+ int have_seeprom = 1;
int error;
sc = ahd->seep_config;
- have_seeprom = ahd_acquire_seeprom(ahd);
- if (have_seeprom) {
- u_int start_addr;
- /*
- * Fetch VPD for this function and parse it.
- */
- if (bootverbose)
- printk("%s: Reading VPD from SEEPROM...",
- ahd_name(ahd));
+ /*
+ * Fetch VPD for this function and parse it.
+ */
+ if (bootverbose)
+ printk("%s: Reading VPD from SEEPROM...",
+ ahd_name(ahd));
- /* Address is always in units of 16bit words */
- start_addr = ((2 * sizeof(*sc))
- + (sizeof(vpd) * (ahd->channel - 'A'))) / 2;
-
- error = ahd_read_seeprom(ahd, (uint16_t *)&vpd,
- start_addr, sizeof(vpd)/2,
- /*bytestream*/TRUE);
- if (error == 0)
- error = ahd_parse_vpddata(ahd, &vpd);
- if (bootverbose)
- printk("%s: VPD parsing %s\n",
- ahd_name(ahd),
- error == 0 ? "successful" : "failed");
-
- if (bootverbose)
- printk("%s: Reading SEEPROM...", ahd_name(ahd));
-
- /* Address is always in units of 16bit words */
- start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A');
-
- error = ahd_read_seeprom(ahd, (uint16_t *)sc,
- start_addr, sizeof(*sc)/2,
- /*bytestream*/FALSE);
-
- if (error != 0) {
- printk("Unable to read SEEPROM\n");
- have_seeprom = 0;
- } else {
- have_seeprom = ahd_verify_cksum(sc);
+ /* Address is always in units of 16bit words */
+ start_addr = ((2 * sizeof(*sc))
+ + (sizeof(vpd) * (ahd->channel - 'A'))) / 2;
- if (bootverbose) {
- if (have_seeprom == 0)
- printk ("checksum error\n");
- else
- printk ("done.\n");
- }
+ error = ahd_read_seeprom(ahd, (uint16_t *)&vpd,
+ start_addr, sizeof(vpd)/2,
+ /*bytestream*/TRUE);
+ if (error == 0)
+ error = ahd_parse_vpddata(ahd, &vpd);
+ if (bootverbose)
+ printk("%s: VPD parsing %s\n",
+ ahd_name(ahd),
+ error == 0 ? "successful" : "failed");
+
+ if (bootverbose)
+ printk("%s: Reading SEEPROM...", ahd_name(ahd));
+
+ /* Address is always in units of 16bit words */
+ start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A');
+
+ error = ahd_read_seeprom(ahd, (uint16_t *)sc,
+ start_addr, sizeof(*sc)/2,
+ /*bytestream*/FALSE);
+
+ if (error != 0) {
+ printk("Unable to read SEEPROM\n");
+ have_seeprom = 0;
+ } else {
+ have_seeprom = ahd_verify_cksum(sc);
+
+ if (bootverbose) {
+ if (have_seeprom == 0)
+ printk("checksum error\n");
+ else
+ printk("done.\n");
}
- ahd_release_seeprom(ahd);
}
if (!have_seeprom) {
@@ -213,6 +213,7 @@ ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)
u_long s;
int paused;
int written;
+ u_int start_addr;
/* Default to failure. */
written = -EINVAL;
@@ -234,31 +235,22 @@ ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)
goto done;
}
- have_seeprom = ahd_acquire_seeprom(ahd);
- if (!have_seeprom) {
- printk("ahd_proc_write_seeprom: No Serial EEPROM\n");
- goto done;
- } else {
- u_int start_addr;
-
+ if (ahd->seep_config == NULL) {
+ ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
if (ahd->seep_config == NULL) {
- ahd->seep_config = kmalloc(sizeof(*ahd->seep_config), GFP_ATOMIC);
- if (ahd->seep_config == NULL) {
- printk("aic79xx: Unable to allocate serial "
- "eeprom buffer. Write failing\n");
- goto done;
- }
+ printk("aic79xx: Unable to allocate serial "
+ "eeprom buffer. Write failing\n");
+ goto done;
}
- printk("aic79xx: Writing Serial EEPROM\n");
- start_addr = 32 * (ahd->channel - 'A');
- ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr,
- sizeof(struct seeprom_config)/2);
- ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config,
- start_addr, sizeof(struct seeprom_config)/2,
- /*ByteStream*/FALSE);
- ahd_release_seeprom(ahd);
- written = length;
}
+ printk("aic79xx: Writing Serial EEPROM\n");
+ start_addr = 32 * (ahd->channel - 'A');
+ ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr,
+ sizeof(struct seeprom_config)/2);
+ ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config,
+ start_addr, sizeof(struct seeprom_config)/2,
+ /*ByteStream*/FALSE);
+ written = length;
done:
ahd_restore_modes(ahd, saved_modes);