Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159995299
D54436.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54436.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D54436: asmc: improve asmc_dumpall to read actual SMC key count
Attached
Detach File
Event Timeline
Log In to Comment