summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-08 21:34:40 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-08 21:34:40 +0000
commit1f0d2f4fea42e3c02c1e4387694da2f4e015dccb (patch)
treea95abfa536dc0162cb590b90077ca622c4c82226 /sys
parent72b635d79a8c0db07f9526a0761942a98e9b0974 (diff)
remove unused code and a some cleanup; deraadt@ and krw@ ok.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/smc93cx6.c92
-rw-r--r--sys/dev/ic/smc93cx6var.h10
2 files changed, 7 insertions, 95 deletions
diff --git a/sys/dev/ic/smc93cx6.c b/sys/dev/ic/smc93cx6.c
index 498cba4a248..d5a7a7868a9 100644
--- a/sys/dev/ic/smc93cx6.c
+++ b/sys/dev/ic/smc93cx6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc93cx6.c,v 1.13 2002/06/30 19:36:58 smurph Exp $ */
+/* $OpenBSD: smc93cx6.c,v 1.14 2003/08/08 21:34:39 fgsch Exp $ */
/* $FreeBSD: sys/dev/aic7xxx/93cx6.c,v 1.5 2000/01/07 23:08:17 gibbs Exp $ */
/*
* Interface for the 93C66/56/46/26/06 serial eeprom parts.
@@ -57,20 +57,10 @@
#include <sys/param.h>
#include <sys/systm.h>
-#if !(defined(__NetBSD__) || defined(__OpenBSD__))
-#include <machine/bus_memio.h>
-#include <machine/bus_pio.h>
-#endif
#include <machine/bus.h>
-#if defined(__OpenBSD__)
#include <dev/ic/aic7xxx_openbsd.h>
-#endif
#include <dev/ic/aic7xxx_inline.h>
-#if !(defined(__NetBSD__) || defined(__OpenBSD__))
-#include <dev/aic7xxx/93cx6.h>
-#else
#include <dev/ic/smc93cx6var.h>
-#endif
/*
* Right now, we only have to read the SEEPROM. But we make it easier to
@@ -81,10 +71,6 @@ static struct seeprom_cmd {
unsigned char bits[9];
} seeprom_read = {3, {1, 1, 0}};
-static struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
-static struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}};
-static struct seeprom_cmd seeprom_write = {3, {1, 0, 1}};
-
/*
* Wait for the SEERDY to go high; about 800 ns.
*/
@@ -212,78 +198,6 @@ read_seeprom(sd, buf, start_addr, count)
return (1);
}
-/*
- * Write the serial EEPROM and return 1 if successful and 0 if
- * not successful.
- */
-int
-write_seeprom(sd, buf, start_addr, count)
- struct seeprom_descriptor *sd;
- u_int16_t *buf;
- bus_size_t start_addr;
- bus_size_t count;
-{
- u_int16_t v;
- u_int8_t temp;
- int i, k;
-
- /* Place the chip into write-enable mode */
- send_seeprom_cmd(sd, &seeprom_ewen);
- reset_seeprom(sd);
-
- /* Write all requested data out to the seeprom. */
- temp = sd->sd_MS ^ sd->sd_CS;
- for (k = start_addr; k < count + start_addr; k++) {
- /* Send the write command */
- send_seeprom_cmd(sd, &seeprom_write);
-
- /* Send the 6 or 8 bit address (MSB first). */
- for (i = (sd->sd_chip - 1); i >= 0; i--) {
- if ((k & (1 << i)) != 0)
- temp ^= sd->sd_DO;
- SEEPROM_OUTB(sd, temp);
- CLOCK_PULSE(sd, sd->sd_RDY);
- SEEPROM_OUTB(sd, temp ^ sd->sd_CK);
- CLOCK_PULSE(sd, sd->sd_RDY);
- if ((k & (1 << i)) != 0)
- temp ^= sd->sd_DO;
- }
-
- /* Write the 16 bit value, MSB first */
- v = buf[k - start_addr];
- for (i = 15; i >= 0; i--) {
- if ((v & (1 << i)) != 0)
- temp ^= sd->sd_DO;
- SEEPROM_OUTB(sd, temp);
- CLOCK_PULSE(sd, sd->sd_RDY);
- SEEPROM_OUTB(sd, temp ^ sd->sd_CK);
- CLOCK_PULSE(sd, sd->sd_RDY);
- if ((v & (1 << i)) != 0)
- temp ^= sd->sd_DO;
- }
-
- /* Wait for the chip to complete the write */
- temp = sd->sd_MS;
- SEEPROM_OUTB(sd, temp);
- CLOCK_PULSE(sd, sd->sd_RDY);
- temp = sd->sd_MS ^ sd->sd_CS;
- do {
- SEEPROM_OUTB(sd, temp);
- CLOCK_PULSE(sd, sd->sd_RDY);
- SEEPROM_OUTB(sd, temp ^ sd->sd_CK);
- CLOCK_PULSE(sd, sd->sd_RDY);
- } while ((SEEPROM_DATA_INB(sd) & sd->sd_DI) == 0);
-
- reset_seeprom(sd);
- }
-
- /* Put the chip back into write-protect mode */
- send_seeprom_cmd(sd, &seeprom_ewds);
- reset_seeprom(sd);
-
- return (1);
-}
-
int
verify_cksum(struct seeprom_config *sc)
{
@@ -298,8 +212,8 @@ verify_cksum(struct seeprom_config *sc)
for (i = 0; i < maxaddr; i++)
checksum = checksum + scarray[i];
- if (checksum == 0
- || (checksum & 0xFFFF) != sc->checksum) {
+ if (checksum == 0 ||
+ (checksum & 0xFFFF) != sc->checksum) {
return (0);
} else {
return(1);
diff --git a/sys/dev/ic/smc93cx6var.h b/sys/dev/ic/smc93cx6var.h
index fc397b865e6..b03984b65fd 100644
--- a/sys/dev/ic/smc93cx6var.h
+++ b/sys/dev/ic/smc93cx6var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc93cx6var.h,v 1.12 2002/06/30 19:36:59 smurph Exp $ */
+/* $OpenBSD: smc93cx6var.h,v 1.13 2003/08/08 21:34:39 fgsch Exp $ */
/* $FreeBSD: sys/dev/aic7xxx/93cx6.h,v 1.3 1999/12/29 04:35:33 peter Exp $ */
/*
* Interface to the 93C46 serial EEPROM that is used to store BIOS
@@ -94,11 +94,9 @@ do { \
#define SEEPROM_DATA_INB(sd) \
ahc_inb(sd->sd_ahc, sd->sd_dataout_offset)
-int read_seeprom(struct seeprom_descriptor *sd, u_int16_t *buf,
- bus_size_t start_addr, bus_size_t count);
-int write_seeprom(struct seeprom_descriptor *sd, u_int16_t *buf,
- bus_size_t start_addr, bus_size_t count);
-int verify_cksum(struct seeprom_config *sc);
+int read_seeprom(struct seeprom_descriptor *, u_int16_t *,
+ bus_size_t, bus_size_t);
+int verify_cksum(struct seeprom_config *);
#endif /* _KERNEL */
#endif /* SMC93CX6VAR_H_ */