diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-26 01:29:56 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-26 01:29:56 +0000 |
commit | 2179efe7015e496ce223423bfd8932aa894478d0 (patch) | |
tree | 5eb613f283657046eb86bbe8bc28af85e7fd8d54 /sys/dev/ic | |
parent | 46863a45c58bc315bc67f33bcfded09c136a68ef (diff) |
reading the record skip the remainder of data we do not need. we are still screwed on writes though
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/an.c | 22 | ||||
-rw-r--r-- | sys/dev/ic/anvar.h | 4 |
2 files changed, 11 insertions, 15 deletions
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index d0f5ef5c2be..f4727c1959f 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.31 2003/09/25 22:32:27 mickey Exp $ */ +/* $OpenBSD: an.c,v 1.32 2003/09/26 01:29:55 mickey Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -607,9 +607,9 @@ an_read_record(sc, ltv) struct an_softc *sc; struct an_ltv_gen *ltv; { - u_int16_t *ptr, len; + u_int16_t *ptr, len, rlen, ltv_data_length; + volatile u_int16_t v; int i; - u_int16_t ltv_data_length; if (ltv->an_len < 4 || ltv->an_type == 0) return(EINVAL); @@ -633,7 +633,7 @@ an_read_record(sc, ltv) * matches what we expect (this verifies that we have enough * room to hold all of the returned data). */ - len = CSR_READ_2(sc, AN_DATA1); + rlen = len = CSR_READ_2(sc, AN_DATA1); /* * Work out record's data length, which is struct length - type word @@ -641,17 +641,15 @@ an_read_record(sc, ltv) */ ltv_data_length = ltv->an_len - sizeof(u_int16_t); - if (len > ltv_data_length) { - printf("%s: RID 0x%04x record length mismatch -- expected %d, " - "got %d\n", sc->sc_dev.dv_xname, ltv->an_type, - ltv_data_length, len); - return(ENOSPC); - } + if (rlen > ltv_data_length) + rlen = ltv_data_length; /* Now read the data. */ ptr = ltv->an_val; - for (i = 0; i < (len - 1) >> 1; i++) - ptr[i] = CSR_READ_2(sc, AN_DATA1); + for (i = 0; i < rlen; i += 2) + *ptr++ = CSR_READ_2(sc, AN_DATA1); + for (; i < len; i += 2) + v = CSR_READ_2(sc, AN_DATA1); #if BYTE_ORDER == BIG_ENDIAN switch (ltv->an_type) { diff --git a/sys/dev/ic/anvar.h b/sys/dev/ic/anvar.h index e7d95f7ddf8..50906ee759d 100644 --- a/sys/dev/ic/anvar.h +++ b/sys/dev/ic/anvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: anvar.h,v 1.13 2003/08/19 04:21:41 mickey Exp $ */ +/* $OpenBSD: anvar.h,v 1.14 2003/09/26 01:29:55 mickey Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -274,7 +274,6 @@ struct an_ltv_stats { u_int32_t an_uptime_usecs; /* 0x178 */ u_int32_t an_uptime_secs; /* 0x17C */ u_int32_t an_lostsync_better_ap; /* 0x180 */ - u_int32_t an_rsvd[10]; }; struct an_ltv_genconfig { @@ -504,7 +503,6 @@ struct an_ltv_caps { u_int16_t an_softcaps; /* 0x7C */ u_int16_t an_bootblockrev; /* 0x7E */ u_int16_t an_req_hw_support; /* 0x80 */ - u_int16_t an_rsvd1[21]; /* 0x82 */ }; /* |