Page MenuHomeFreeBSD

D54436.diff
No OneTemporary

D54436.diff

diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -823,10 +823,16 @@
#ifdef DEBUG
void asmc_dumpall(device_t dev)
{
+ struct asmc_softc *sc = device_get_softc(dev);
int i;
- /* XXX magic number */
- for (i=0; i < 0x100; i++)
+ if (sc->sc_nkeys == 0) {
+ device_printf(dev, "asmc_dumpall: key count not available\n");
+ return;
+ }
+
+ device_printf(dev, "asmc_dumpall: dumping %d keys\n", sc->sc_nkeys);
+ for (i = 0; i < sc->sc_nkeys; i++)
asmc_key_dump(dev, i);
}
#endif
@@ -914,12 +920,15 @@
sc->sc_nfan = ASMC_MAXFANS;
}
- if (bootverbose) {
- /*
- * The number of keys is a 32 bit buffer
- */
- asmc_key_read(dev, ASMC_NKEYS, buf, 4);
- device_printf(dev, "number of keys: %d\n", ntohl(*(uint32_t*)buf));
+ /*
+ * Read and cache the number of SMC keys (32 bit buffer)
+ */
+ if (asmc_key_read(dev, ASMC_NKEYS, buf, 4) == 0) {
+ sc->sc_nkeys = be32dec(buf);
+ if (bootverbose)
+ device_printf(dev, "number of keys: %d\n", sc->sc_nkeys);
+ } else {
+ sc->sc_nkeys = 0;
}
#ifdef DEBUG
diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h
--- a/sys/dev/asmc/asmcvar.h
+++ b/sys/dev/asmc/asmcvar.h
@@ -33,6 +33,7 @@
device_t sc_dev;
struct mtx sc_mtx;
int sc_nfan;
+ int sc_nkeys;
int16_t sms_rest_x;
int16_t sms_rest_y;
int16_t sms_rest_z;

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 21, 8:53 AM (12 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34144837
Default Alt Text
D54436.diff (1 KB)

Event Timeline