Using the superiotool code to detect SuperI/O chips can be really useful even for applications besides superiotool, e.g. flashrom. The biggest hurdle right now is the excessive size of the superiotool binary (>2.2 MB) which is still ~15 kB after lzma compression. That's simply unacceptable for a library.
This minimally invasive patch makes all dumping code optional and reduces binary size for the probe-only case (libsuperiodetect) a lot. Binary sizes: 2268258 (before) 31600 (after) 98.6% reduction LZMA compressed and stripped binary sizes: 14778 (before) 6709 (after) 54.6% reduction
To test compilation of superiotool with probe-only functionality, run make CONFIG_LIB=yes
This patch is the first step towards libsuperiodetect, and more will have to follow. IMHO the {EOT} markers should be killed in libsuperiodetect, at least for the LDNs. Such an operation would have increased the size of the patch and would have reduced readability as well. Due to that, I skipped it, but I plan to do that in a later operation.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: superiotool_libsuperiodetect/fintek.c =================================================================== --- superiotool_libsuperiodetect/fintek.c (Revision 5651) +++ superiotool_libsuperiodetect/fintek.c (Arbeitskopie) @@ -31,6 +31,7 @@
static const struct superio_registers reg_table[] = { {0x0106, "F71862FG / F71863FG", { /* Same ID? Datasheet typo? */ +#ifndef LIBSUPERIODETECT /* We assume reserved bits are read as 0. */ {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a, @@ -75,11 +76,13 @@ {0xa, "PME, ACPI", {0x30,0xf0,0xf1,0xf4,0xf5,0xf7,EOT}, {0x00,0x00,NANA,0x06,0x1c,0x01,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x4103, "F71872F/FG / F71806F/FG", { /* Same ID? Datasheet typo? */ {EOT}}}, {0x4105, "F71882FG/F71883FG", { /* Same ID? Datasheet typo? */ /* We assume reserved bits are read as 0. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a, 0x2b,0x2c,0x2d,EOT}, @@ -121,9 +124,11 @@ {0xa, "PME, ACPI", {0x30,0xf0,0xf1,0xf4,0xf5,EOT}, {0x00,0x00,0x01,0x06,0x1c,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x0604, "F71805F/FG", { /* We assume reserved bits are read as 0. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,EOT}, {0x04,0x06,0x19,0x34,0x00,0x00,0x3f,0x08,0x00,EOT}}, @@ -150,6 +155,7 @@ {0xa, "PME", {0x30,0xf0,0xf1,EOT}, {0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x0581, "F8000", { /* Fintek/ASUS F8000 */ {EOT}}}, @@ -181,7 +187,9 @@ get_superio_name(reg_table, did), vid, did, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("Fintek", reg_table, port, did, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_winbond_fintek_ite_8787(port); } Index: superiotool_libsuperiodetect/winbond.c =================================================================== --- superiotool_libsuperiodetect/winbond.c (Revision 5651) +++ superiotool_libsuperiodetect/winbond.c (Arbeitskopie) @@ -40,6 +40,7 @@ {0x527, "W83977CTF", { /* TODO: Not yet in sensors-detect */ {EOT}}}, {0x52f, "W83977EF/EG", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -78,10 +79,12 @@ 0xf0,0xf1,0xf3,0xf4,0xf6,0xf7,0xf9,0xfe,0xff,EOT}, {0x00,0x00,0x00,0x00,MISC,MISC,MISC,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,RSVD,RSVD,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x595, "W83627SF", { /* TODO: Not yet in sensors-detect */ {EOT}}}, {0x601, "W83697HF/F/HG", { /* No G version? */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29, 0x2a,EOT}, @@ -126,12 +129,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x610, "W83L517D/D-F", { {EOT}}}, {0x708, "W83637HF/HG", { {EOT}}}, {0x828, "W83627THF/THG", { /* We assume rev is bits 3..0 of 0x21. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -175,12 +180,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, #if 0 {0x85x, "W83687THF", { /* TODO: sensors-detect: 0x85 */ {EOT}}}, #endif {0xa02, "W83627DHG", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -232,6 +239,7 @@ EOT}, {0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x48,0x00,0x00, EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xa23, "W83627UHG", {/* TODO: Not yet in sensors-detect */ {EOT}}}, @@ -250,6 +258,7 @@ */ {EOT}}}, {0x9773, "W83977TF", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -294,12 +303,14 @@ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, NANA,MISC,RSVD,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,RSVD,RSVD,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x9774, "W83977ATF", { {EOT}}},
/* ID only */ {0x52, "W83627HF/F/HG/G", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29, 0x2a,0x2b,0x2c,0x2e,0x2f,EOT}, @@ -342,6 +353,7 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x68, "W83697SF/UF/UG", { /* ID: 0x68 (for W83697SF/UF/UG) @@ -349,6 +361,7 @@ * 0x0X (for W83697SF) -- sic! * 0x1X (for W83697UF/UG) */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a, 0x2b,0x2c,EOT}, @@ -405,6 +418,7 @@ {0xf, "GPIO 8", {0x30,0x60,0x61,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0xff,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x88, "W83627EHF/EF/EHG/EG", { /* @@ -414,6 +428,7 @@ * (W83627EHF) has an ID of 0x8854 (verified on hardware). * So we now assume all 0x88?? IDs to mean W83627EHF/EF/EHG/EG. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -460,12 +475,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,0xf0,0xf1,EOT}, {0x00,0x00,0x00,0x00,0xc1,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}},
/* ID[3..0] */ {0xa, "W83877F", { {EOT}}}, {0xb, "W83877AF", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -475,6 +492,7 @@ 0x1f,0x0c,0x28,0xa3,RSVD,RSVD,0x00,0x00,0x00,0x00, 0x00,0x00,0x0e,0x00,MISC,MISC,MISC,MISC,MISC,MISC, MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xc, "W83877TF", { {EOT}}}, @@ -483,6 +501,7 @@ {EOT} };
+#ifndef LIBSUPERIODETECT static const struct superio_registers hwm_table[] = { {0x828, "W83627THF/THG", { {NOLDN, NULL, @@ -531,6 +550,7 @@ {EOT}}}, {EOT} }; +#endif /* ! LIBSUPERIODETECT */
static void enter_conf_mode_winbond_88(uint16_t port) { @@ -550,7 +570,10 @@
static void probe_idregs_winbond_helper(const char *init, uint16_t port) { - uint16_t id, hwmport; + uint16_t id; +#ifndef LIBSUPERIODETECT + uint16_t hwmport; +#endif /* LIBSUPERIODETECT */ uint8_t devid, rev, olddevid;
probing_for("Winbond", init, port); @@ -586,6 +609,7 @@ get_superio_name(reg_table, id), devid, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("Winbond", reg_table, port, id, LDN_SEL);
if (extra_dump) { @@ -607,6 +631,7 @@ dump_superio("Winbond-HWM", hwm_table, hwmport, id, WINBOND_HWM_SEL); } +#endif /* ! LIBSUPERIODETECT */ }
void probe_idregs_winbond(uint16_t port) @@ -631,5 +656,7 @@ void print_winbond_chips(void) { print_vendor_chips("Winbond", reg_table); +#ifndef LIBSUPERIODETECT print_vendor_chips("Winbond-HWM", hwm_table); +#endif /* ! LIBSUPERIODETECT */ } Index: superiotool_libsuperiodetect/ite.c =================================================================== --- superiotool_libsuperiodetect/ite.c (Revision 5651) +++ superiotool_libsuperiodetect/ite.c (Arbeitskopie) @@ -30,6 +30,7 @@ {0x8228, "IT8228E", { {EOT}}}, {0x8502, "IT8502E/TE/G", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -67,10 +68,12 @@ {0x17, "Power Channel 3", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x6a,0x00,0x6e,0x01,0x01,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8510, "IT8510E/TE/G", { {EOT}}}, {0x8511, "IT8511E/TE/G", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -101,8 +104,10 @@ {0x12, "Power Channel 2", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x68,0x00,0x6c,0x01,0x03,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8512, "IT8512E/F/G", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -133,10 +138,12 @@ {0x12, "Power Channel 2", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x68,0x00,0x6c,0x01,0x03,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8513, "IT8513E/F/G", { {EOT}}}, {0x8661, "IT8661F/IT8770F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x20,0x21,0x22, 0x23,0x24,EOT}, @@ -168,10 +175,12 @@ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8673, "IT8673F", { {EOT}}}, {0x8681, "IT8671F/IT8687R", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x20,0x21,0x22, 0x23,0x24,0x25,0x26,0x2e,0x2f,EOT}, @@ -211,8 +220,10 @@ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8701, "IT8703F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x26,0x29,0x2a,0x2b,EOT}, {0x87,0x00,0x00,0x80,0x00,0x00,0x7c,0xc0,EOT}}, @@ -253,10 +264,12 @@ {0xc, "GPIO set 5, 6 and 7", {0x30,0x60,0x61,0xf0,0xf3,0xf6,EOT}, {0x00,0x03,0x70,0x00,0xff,0xff,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8702, "IT8702F", { {EOT}}}, {0x8705, "IT8705F/AF / IT8700F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,EOT}, {0x87,0x05,0x00,0x00,NANA,EOT}}, @@ -303,11 +316,15 @@ {0x8, "MIDI port", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x00,0x0a,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8706, "IT8706R", { /* TODO: Not yet in sensors-detect */ +#ifndef LIBSUPERIODETECT /* This is a "Special General Purpose I/O chip". */ +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8708, "IT8708F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2e,0x2f,EOT}, @@ -361,12 +378,14 @@ {0xa, "MIDI port", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x00,0x0a,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8710, "IT8710F", { /* TODO: Not yet in sensors-detect */ {EOT}}}, {0x8711, "IT8711F", { /* 0x8711 is a guess, not found in datasheet. */ {EOT}}}, {0x8712, "IT8712F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x12,0x08,0x00,0x00,0x00,EOT}}, @@ -416,8 +435,10 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8716, "IT8716F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x16,0x01,0x00,0x00,0x00,EOT}}, @@ -466,8 +487,10 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8718, "IT8718F", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x18,0x01,0x00,0x00,0x00,EOT}}, @@ -514,6 +537,7 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8720, "IT8720F", { /* From sensors-detect */ {EOT}}}, @@ -521,6 +545,7 @@ {EOT}}}, {0x8726, "IT8726F", { /* Datasheet wrongly says that the ID is 0x8716. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x26,0x01,0x00,MISC,0x00,EOT}}, @@ -571,6 +596,7 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8761, "IT8761E", { {EOT}}}, @@ -579,6 +605,7 @@ {EOT} };
+#ifndef LIBSUPERIODETECT static const struct superio_registers ec_table[] = { {0x8716, "IT8716F", { {NOLDN, NULL, @@ -636,6 +663,7 @@ {EOT}}}, {EOT} }; +#endif /* ! LIBSUPERIODETECT */
/* Works for: IT8661F/IT8770F */ static const uint8_t initkey_it8661f[][4] = { @@ -712,7 +740,10 @@
static void probe_idregs_ite_helper(const char *init, uint16_t port) { - uint16_t id, chipver, ecport; + uint16_t id, chipver; +#ifndef LIBSUPERIODETECT + uint16_t ecport; +#endif /* ! LIBSUPERIODETECT */
probing_for("ITE", init, port);
@@ -730,6 +761,7 @@ get_superio_name(reg_table, id), id, chipver, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("ITE", reg_table, port, id, LDN_SEL);
if (extra_dump) { @@ -745,6 +777,7 @@ printf("Environment controller (0x%04x)\n", ecport); dump_superio("ITE-EC", ec_table, ecport, id, LDN_SEL); } +#endif /* ! LIBSUPERIODETECT */ }
void probe_idregs_ite(uint16_t port) @@ -783,5 +816,7 @@ void print_ite_chips(void) { print_vendor_chips("ITE", reg_table); +#ifndef LIBSUPERIODETECT print_vendor_chips("ITE-EC", ec_table); +#endif /* ! LIBSUPERIODETECT */ } Index: superiotool_libsuperiodetect/nsc.c =================================================================== --- superiotool_libsuperiodetect/nsc.c (Revision 5651) +++ superiotool_libsuperiodetect/nsc.c (Arbeitskopie) @@ -26,6 +26,7 @@
static const struct superio_registers reg_table[] = { {0xcf, "PC97307", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x27,EOT}, {0xcf,MISC,MISC,0x00,0x00,NANA,EOT}}, @@ -60,8 +61,10 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xd0, "PC87317", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,EOT}, {0xd0,MISC,MISC,0x00,0x00,0x00,EOT}}, @@ -96,8 +99,10 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xdf, "PC97317", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x27,EOT}, {0xdf,MISC,MISC,0x00,0x00,0x00,NANA,EOT}}, @@ -132,8 +137,10 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xe0, "PC87309", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x27,0x2e,EOT}, {0xe0,MISC,0x00,NANA,RSVD,EOT}}, @@ -162,8 +169,10 @@ 0xf0,EOT}, {0x01,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04, 0x40,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xe1, "PC87360", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,EOT}, @@ -206,8 +215,10 @@ {0xa, "Watchdog timer", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xe2, "PC87351", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x27,0x2e,EOT}, {0xe2,0x11,0xa1,0x00,MISC,NANA,RSVD,EOT}}, @@ -240,6 +251,7 @@ {0x8, "Fan speed control", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xe4, "PC87364", { {EOT}}}, @@ -248,6 +260,7 @@ {0xe8, "PC87363", { {EOT}}}, {0xe9, "PC87366", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x27,0x28,0x2a,0x2b, 0x2c,0x2d,0x2e,EOT}, @@ -304,10 +317,12 @@ {0xe, "Temperature sensor (TMS)", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}},
/* SID[7..0]: family, SRID[7..5]: ID, SRID[4..0]: rev. */ {0xea, "PC8739x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -344,12 +359,14 @@ 0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,EOT}, {0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xec, "PC87591x", { /* SRID[7..5]: 000=PC87591E, 001=PC87591S, 100=PC87591L */ {EOT}}}, {0xee, "PC8741x", { /* SRID[7..5] is marked as "not applicable for the PC8741x". */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -397,10 +414,12 @@ 0xf1,0xf2,0xf3,EOT}, {0x00,0x00,0x70,0x00,0x72,0x08,0x00,0x04,0x04,0x00, 0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xf0, "PC87372", { {EOT}}}, {0x0f1, "PC8374L", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26, 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -441,8 +460,10 @@ {0x8, "Health management", {0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x8f1, "WPCD376I", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26, 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -480,9 +501,11 @@ 0xf2,0xf3,0xf8,EOT}, {0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC, 0x00,MISC,0x01,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xf2, "PC87427", { /* SRID[7..5] is marked as "not applicable for the PC87427". */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x10,0x12,0x13,0x1d,0x20,0x21,0x22,0x23,0x24,0x25, 0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, @@ -542,6 +565,7 @@ 0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04, 0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0xf3, "PC87373", { {EOT}}}, @@ -592,8 +616,10 @@ get_superio_name(reg_table, magic), id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio(magic == 0x8f1 ? "Winbond" : "NSC", reg_table, port, magic, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */ }
void print_nsc_chips(void) Index: superiotool_libsuperiodetect/superiotool.c =================================================================== --- superiotool_libsuperiodetect/superiotool.c (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.c (Arbeitskopie) @@ -81,6 +81,7 @@ return "<unknown>"; }
+#ifndef LIBSUPERIODETECT static void dump_regs(const struct superio_registers reg_table[], int i, int j, uint16_t port, uint8_t ldn_sel) { @@ -170,6 +171,7 @@ printf("%02x ", INB(iobase + i)); printf("\n"); } +#endif /* ! LIBSUPERIODETECT */
void probing_for(const char *vendor, const char *info, uint16_t port) { @@ -189,9 +191,11 @@ for (i = 0; reg_table[i].superio_id != EOT; i++) { printf("%s %s", vendor, reg_table[i].name);
+#ifndef LIBSUPERIODETECT /* Unless the ldn is empty, assume this chip has a dump. */ if (reg_table[i].ldn[0].ldn != EOT) printf(" (dump available)"); +#endif /* ! LIBSUPERIODETECT */
printf("\n"); } Index: superiotool_libsuperiodetect/ali.c =================================================================== --- superiotool_libsuperiodetect/ali.c (Revision 5651) +++ superiotool_libsuperiodetect/ali.c (Arbeitskopie) @@ -28,6 +28,7 @@ static const struct superio_registers reg_table[] = { /* TODO: M5113 doesn't seem to have ID registers? */ {0x5315, "M1535/M1535D/M1535+/M1535D+", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x1f,0x20,0x21,0x22,0x23,0x2c,0x2d,0x2e,EOT}, {NANA,0x53,0x15,0x00,0x00,RSVD,RSVD,RSVD,EOT}}, @@ -52,6 +53,7 @@ {0xc, "Hotkey", {0x30,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,EOT}, {0x00,0x35,0x14,0x11,0x71,RSVD,0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x2351, "M512x", { {EOT}}}, @@ -95,7 +97,9 @@ get_superio_name(reg_table, id), id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("ALi", reg_table, port, id, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_ali(port); } Index: superiotool_libsuperiodetect/smsc.c =================================================================== --- superiotool_libsuperiodetect/smsc.c (Revision 5651) +++ superiotool_libsuperiodetect/smsc.c (Arbeitskopie) @@ -30,6 +30,7 @@ static const struct superio_registers reg_table[] = { /* The following Super I/Os use the 0x20/0x21 ID registers. */ {0x02, "FDC37C932", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x2d,0x2e, 0x2f,EOT}, @@ -68,11 +69,13 @@ {0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, 0x00,0x00,0x00,MISC,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x03, "FDC37C93xFR", { /* FIXME: There's another 0x03 but found on port 0x0d/0x0e! */ {EOT}}}, {0x0a, "FDC37N971", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -109,8 +112,10 @@ {0x9, "Mailbox", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x0b, "FDC37N972", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -147,8 +152,10 @@ {0x9, "Mailbox", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x0e, "LPC47N252", { /* From sensors-detect */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -188,12 +195,14 @@ {0xa, "LPC/8051 addressable GPIO (LGPIO)", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x14, "LPC47M172", { {EOT}}}, {0x30, "FDC37C93xAPM", { {EOT}}}, {0x40, "FDC37C67x", { /* E.g. FDC37C672. Chiprev: 0x01 */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c, 0x2d,0x2e,0x2f,EOT}, @@ -225,10 +234,12 @@ {0x00,NANA,NANA,NANA,NANA,0x06,0x03,NANA,NANA,NANA, 0x00,0x00,0x00,MISC,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD, EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x42, "FDC37B80x/FDC37M707", { {EOT}}}, {0x09, "FDC37N958FR", { /* Found in e.g. Dell Latitude CPi A366XT. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -270,10 +281,12 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x43, "FDC37B77x", { {EOT}}}, {0x44, "FDC37B78x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -315,12 +328,14 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x46, "FDC37M602", { /* Found in Biostar M6TLD. */ {EOT}}}, {0x47, "FDC37M60x", { /* TODO: Not yet in sensors-detect */ {EOT}}}, {0x4c, "FDC37B72x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -357,8 +372,10 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x4d, "FDC37M81x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c, 0x2d,0x2e,0x2f,EOT}, @@ -389,8 +406,10 @@ {0x00,NANA,NANA,NANA,NANA,0x02,0x01,NANA,NANA,NANA, NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,RSVD,RSVD, RSVD,RSVD,RSVD,RSVD,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x51, "LPC47B27x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -424,10 +443,12 @@ {0xb, "MIDI port (MPU-401)", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x52, "LPC47B37x", { {EOT}}}, {0x54, "LPC47U33x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -459,12 +480,14 @@ {0xb, "SMBus", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x56, "LPC47B34x", { {EOT}}}, {0x57, "LPC47S42x", { {EOT}}}, {0x59, "LPC47M10x/112/13x", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -498,12 +521,14 @@ {0xb, "MPU-401", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x5d, "LPC47B357", { /* From sensors-detect (no datasheet) */ {EOT}}}, {0x5f, "LPC47M14x", { {EOT}}}, {0x60, "LPC47M15x/192/997", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -535,6 +560,7 @@ {0xb, "MPU-401", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x62, "LPC47S45x", { {EOT}}}, @@ -550,6 +576,7 @@ {0x6f, "LPC47B397", { {EOT}}}, {0x74, "LPC47M182", { /* Only for LD_NUM = 0 */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27, 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -584,10 +611,12 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x76, "LPC47M584", { /* From sensors-detect (no datasheet) */ {EOT}}}, {0x77, "A8000", { /* ASUS A8000, a rebranded DME1737(?) */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -613,8 +642,10 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x78, "DME1737", { +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -640,6 +671,7 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x79, "SCH5504", { /* From sensors-detect (no datasheet) */ {EOT}}}, @@ -682,6 +714,7 @@ {EOT}}}, {0x28, "FDC37N769", { /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -693,12 +726,14 @@ NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD, 0x80,0x00,0x3c,RSVD,RSVD,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,RSVD,0x00,0x00,0x03,0x00,0x00,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x29, "FDC37N3869/FDC37N869", { /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ {EOT}}}, {0x5a, "LPC47N227", { /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -712,9 +747,11 @@ RSVD,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x5b, "SIO10N268", { /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */ +#ifndef LIBSUPERIODETECT {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -734,6 +771,7 @@ 0x00,0x00,0x00,0x00,NANA,NANA,NANA,NANA,NANA,0x50, NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x01, 0x00,0x01,0x00,0x8c,MISC,EOT}}, +#endif /* ! LIBSUPERIODETECT */ {EOT}}}, {0x65, "FDC37C665GT/IR", { /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */ @@ -765,7 +803,9 @@ uint8_t revreg) { uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */ const char *info = (idreg == 0x20) ? "(idregs=0x20/0x21) " : "(idregs=0x0d/0x0e) ";
@@ -788,6 +828,7 @@ id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id, LDN_SEL);
@@ -804,6 +845,7 @@ printf("No extra registers known for this chip.\n"); } } +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_smsc(port); } Index: superiotool_libsuperiodetect/superiotool.h =================================================================== --- superiotool_libsuperiodetect/superiotool.h (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.h (Arbeitskopie) @@ -98,12 +98,19 @@ struct superio_registers { int32_t superio_id; /* Signed, as we need EOT. */ const char *name; /* Super I/O name */ +#ifndef LIBSUPERIODETECT struct { int8_t ldn; const char *name; /* LDN name */ int16_t idx[IDXSIZE]; int16_t def[IDXSIZE]; } ldn[LDNSIZE]; +#else /* LIBSUPERIODETECT */ + /* Ugly hack to avoid messing with EOT markers. */ + struct { + int8_t dummy; + } dummy[1]; +#endif /* LIBSUPERIODETECT */ };
/* pci.c */ Index: superiotool_libsuperiodetect/Makefile =================================================================== --- superiotool_libsuperiodetect/Makefile (Revision 5651) +++ superiotool_libsuperiodetect/Makefile (Arbeitskopie) @@ -32,6 +32,10 @@ CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \ -Werror-implicit-function-declaration -ansi -pedantic $(SVNDEF)
+ifeq ($(CONFIG_LIB), yes) +CFLAGS += -D'LIBSUPERIODETECT=1' +endif + OBJS = superiotool.o ali.o fintek.o ite.o nsc.o smsc.o winbond.o
OS_ARCH = $(shell uname)
On 6/30/10 2:35 PM, Carl-Daniel Hailfinger wrote:
Using the superiotool code to detect SuperI/O chips can be really useful even for applications besides superiotool, e.g. flashrom. The biggest hurdle right now is the excessive size of the superiotool binary (>2.2 MB) which is still ~15 kB after lzma compression. That's simply unacceptable for a library.
Why? There is no size constraints on libraries in Unix like systems.
Assuming we're talking about a static library
From my system:
20M /usr/lib64/libbfd.a 20M /usr/lib64/libc.a 11M /usr/lib64/libcrypto.a 19M /usr/lib64/libdb-4.5.a 3.9M /usr/lib64/libfreetype.a 5.1M /usr/lib64/libgio-2.0.a 3.6M /usr/lib64/libglib-2.0.a 3.3M /usr/lib64/libgmp.a 2.8M /usr/lib64/libm.a 2.8M /usr/lib64/libncurses.a 3.2M /usr/lib64/libncursesw.a 4.9M /usr/lib64/libopcodes.a 4.2M /usr/lib64/libruby-static.a 3.0M /usr/lib64/libssl.a 6.9M /usr/lib64/libxml2.a
Also, keep in mind that the size of the library in the filesystem is not the size increase when linking it.
15kb lzma compressed is nothing.
This minimally invasive patch makes all dumping code optional and reduces binary size for the probe-only case (libsuperiodetect) a lot. Binary sizes: 2268258 (before) 31600 (after) 98.6% reduction LZMA compressed and stripped binary sizes: 14778 (before) 6709 (after) 54.6% reduction
Not worth the additional unreadability of the code in my opinion
To test compilation of superiotool with probe-only functionality, run make CONFIG_LIB=yes
This patch is the first step towards libsuperiodetect, and more will have to follow.
I think the idea for libsuperio is great.
I'll gladly ack this without the very intrusive "we save 6700 bytes" part of the patch.
IMHO the {EOT} markers should be killed in libsuperiodetect, at least for the LDNs. Such an operation would have increased the size of the patch and would have reduced readability as well. Due to that, I skipped it, but I plan to do that in a later operation.
What would you use instead? The array members all have different sizes as far as I can tell, so some kind of end marker will be needed.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
/* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */
@@ -765,7 +803,9 @@ uint8_t revreg) { uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */
Maybe this could be moved downwards to where it is used, to save an ifndef?
Index: superiotool_libsuperiodetect/superiotool.h
--- superiotool_libsuperiodetect/superiotool.h (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.h (Arbeitskopie) @@ -98,12 +98,19 @@ struct superio_registers { int32_t superio_id; /* Signed, as we need EOT. */ const char *name; /* Super I/O name */ +#ifndef LIBSUPERIODETECT struct { int8_t ldn; const char *name; /* LDN name */ int16_t idx[IDXSIZE]; int16_t def[IDXSIZE]; } ldn[LDNSIZE]; +#else /* LIBSUPERIODETECT */
- /* Ugly hack to avoid messing with EOT markers. */
- struct {
int8_t dummy;
- } dummy[1];
+#endif /* LIBSUPERIODETECT */ };
hm ... the comment is very terse.
On 30.06.2010 14:51, Stefan Reinauer wrote:
On 6/30/10 2:35 PM, Carl-Daniel Hailfinger wrote:
Using the superiotool code to detect SuperI/O chips can be really useful even for applications besides superiotool, e.g. flashrom. The biggest hurdle right now is the excessive size of the superiotool binary (>2.2 MB) which is still ~15 kB after lzma compression. That's simply unacceptable for a library.
Why? There is no size constraints on libraries in Unix like systems.
Yes, but if I proposed to increase the size of the flashrom binary by over 2 MBytes, various people would ask if I'm crazy.
Assuming we're talking about a static library
From my system:
20M /usr/lib64/libbfd.a 20M /usr/lib64/libc.a 11M /usr/lib64/libcrypto.a 19M /usr/lib64/libdb-4.5.a 3.9M /usr/lib64/libfreetype.a 5.1M /usr/lib64/libgio-2.0.a 3.6M /usr/lib64/libglib-2.0.a 3.3M /usr/lib64/libgmp.a 2.8M /usr/lib64/libm.a 2.8M /usr/lib64/libncurses.a 3.2M /usr/lib64/libncursesw.a 4.9M /usr/lib64/libopcodes.a 4.2M /usr/lib64/libruby-static.a 3.0M /usr/lib64/libssl.a 6.9M /usr/lib64/libxml2.a
Also, keep in mind that the size of the library in the filesystem is not the size increase when linking it.
However, if all objects in the library are used, the size increase of the binary is correlated closely to the linked static library size.
15kb lzma compressed is nothing.
8 kB more or less in a recovery payload of a coreboot image are not negligible IMHO.
In normal OS environments people don't use compressed binaries, and there a 2 MB size increase for flashrom (98% of it for dead code which can't be optimized away by the compiler/linker) is definitely something people will object to.
This minimally invasive patch makes all dumping code optional and reduces binary size for the probe-only case (libsuperiodetect) a lot. Binary sizes: 2268258 (before) 31600 (after) 98.6% reduction LZMA compressed and stripped binary sizes: 14778 (before) 6709 (after) 54.6% reduction
Not worth the additional unreadability of the code in my opinion
To test compilation of superiotool with probe-only functionality, run make CONFIG_LIB=yes
This patch is the first step towards libsuperiodetect, and more will have to follow.
I think the idea for libsuperio is great.
I'll gladly ack this without the very intrusive "we save 6700 bytes" part of the patch.
The patch is a pure size reduction. If I remove the size reduction part, the patch will be empty. I can reduce the number of #ifdefs, but that won't make the patch prettier. Will send the patch with less #ifdefs in a separate mail.
IMHO the {EOT} markers should be killed in libsuperiodetect, at least for the LDNs. Such an operation would have increased the size of the patch and would have reduced readability as well. Due to that, I skipped it, but I plan to do that in a later operation.
What would you use instead? The array members all have different sizes as far as I can tell, so some kind of end marker will be needed.
The libsuperiodetect case doesn't care about LDNs at all. Having exactly one LDN definition per Super I/O which is always EOT looks like dead code to me, especially if nothing is looking at the LDN.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
/* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */
@@ -765,7 +803,9 @@ uint8_t revreg) { uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */
Maybe this could be moved downwards to where it is used, to save an ifndef?
IIRC this would break on some compilers which don't allow variable declarations in the middle of some code.
Index: superiotool_libsuperiodetect/superiotool.h
--- superiotool_libsuperiodetect/superiotool.h (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.h (Arbeitskopie) @@ -98,12 +98,19 @@ struct superio_registers { int32_t superio_id; /* Signed, as we need EOT. */ const char *name; /* Super I/O name */ +#ifndef LIBSUPERIODETECT struct { int8_t ldn; const char *name; /* LDN name */ int16_t idx[IDXSIZE]; int16_t def[IDXSIZE]; } ldn[LDNSIZE]; +#else /* LIBSUPERIODETECT */
- /* Ugly hack to avoid messing with EOT markers. */
- struct {
int8_t dummy;
- } dummy[1];
+#endif /* LIBSUPERIODETECT */ };
hm ... the comment is very terse.
struct dummy is there to avoid putting all those LDN {EOT} markers inside #ifndef LIBSUPERIODETECT. It is a hack to allow compilation and make the patch less invasive than it would have been without struct dummy.
Regards, Carl-Daniel
On 6/30/10 4:16 PM, Carl-Daniel Hailfinger wrote:
15kb lzma compressed is nothing.
8 kB more or less in a recovery payload of a coreboot image are not negligible IMHO.
In normal OS environments people don't use compressed binaries, and there a 2 MB size increase for flashrom (98% of it for dead code which can't be optimized away by the compiler/linker) is definitely something people will object to.
Well...
- once we have a recovery payload (which will have to load a 1MB rom image from _somewhere_ as we speak of size) and - once we have people complaining
we should definitely think about such optimizations. My bet is by then anything below 8mbit flash parts has died out. :)
IMHO the {EOT} markers should be killed in libsuperiodetect, at least
for the LDNs. Such an operation would have increased the size of the patch and would have reduced readability as well. Due to that, I skipped it, but I plan to do that in a later operation.
What would you use instead? The array members all have different sizes as far as I can tell, so some kind of end marker will be needed.
The libsuperiodetect case doesn't care about LDNs at all. Having exactly one LDN definition per Super I/O which is always EOT looks like dead code to me, especially if nothing is looking at the LDN.
Maybe using the tables from superiotool is not the best way to solve the problem you are trying to solve at all?
What is that problem anyways? Since flashrom has mechanisms to figure out the board, and the super io is a hard component on the board, will you need anything more but the numeric ID of the chip?
uint8_t revreg)
{ uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */
@@ -765,7 +803,9 @@ Maybe this could be moved downwards to where it is used, to save an ifndef?
IIRC this would break on some compilers which don't allow variable declarations in the middle of some code.
Ok, which ones of them are supported for compiling flashrom?
The way superiotool defines functions also breaks K&R style.
Stefan
On 30.06.2010 16:36, Stefan Reinauer wrote:
On 6/30/10 4:16 PM, Carl-Daniel Hailfinger wrote:
15kb lzma compressed is nothing.
8 kB more or less in a recovery payload of a coreboot image are not negligible IMHO.
In normal OS environments people don't use compressed binaries, and there a 2 MB size increase for flashrom (98% of it for dead code which can't be optimized away by the compiler/linker) is definitely something people will object to.
Well...
- once we have a recovery payload (which will have to load a 1MB rom
image from _somewhere_ as we speak of size) and
If it is recovery over serial at 115200 bit/s (14 kByte/s), 2 MB more or less make a difference. However, if that recovery loader also has decompression support, that's different.
- once we have people complaining
we should definitely think about such optimizations. My bet is by then anything below 8mbit flash parts has died out. :)
I hope the same, but I'm not as optimistic as you are.
IMHO the {EOT} markers should be killed in libsuperiodetect, at least
for the LDNs. Such an operation would have increased the size of the patch and would have reduced readability as well. Due to that, I skipped it, but I plan to do that in a later operation.
What would you use instead? The array members all have different sizes as far as I can tell, so some kind of end marker will be needed.
The libsuperiodetect case doesn't care about LDNs at all. Having exactly one LDN definition per Super I/O which is always EOT looks like dead code to me, especially if nothing is looking at the LDN.
Maybe using the tables from superiotool is not the best way to solve the problem you are trying to solve at all?
What is that problem anyways? Since flashrom has mechanisms to figure out the board, and the super io is a hard component on the board, will you need anything more but the numeric ID of the chip?
Good point. Many mainboards use Super I/O chips to translate flash buses, usually LPC->SPI for newer boards and LPC->Parallel for older boards. A few months ago, we had to handle every single board with such a feature with a board enable, and the board enable table grew fast, even for boards which didn't need any GPIO twiddling for write enables. Since then, flashrom has evolved to autodetect ITE IT87* LPC->SPI translation, and this allowed us to support a few dozen boards out of the box without any board enables. flashrom has a few pending patches which add autodetection for ITE and Winbond LPC->Parallel translation, and those patches will allow us to kill a dozen board enables, and hundreds of boards will start working automatically.
For automatic Super I/O probing to work well, I'd like to reuse some proven code instead of rewriting the whole probing stuff from scratch. Two possible sources of code exist for this: - superiotool - Linux kernel Superiotool focuses on more recent (less than 12 years old) chips, whereas the Linux kernel focuses on chips from the 90s. Both codebases get some testing, and superiotool is regularly extended to support new chips.
So flashrom needs the probing, and it also needs a function in each chip definition which takes care of handling any translation functionality. With that in mind, I picked the #ifdef solution because it would have allowed me to simply run unifdef over the superiotool source code, then import the generated files into the flashrom source without manual editing.
OTOH, I could write a Coccinelle semantic patch which eliminates the need to touch any chip definitions in the superiotool source, and simply run the semantic patch locally before copying over the patched files.
Printing the name (instead of a cryptic ID) of the detected Super I/O chip is just for user friendliness.
{ uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */
@@ -765,7 +803,9 @@ Maybe this could be moved downwards to where it is used, to save an ifndef?
IIRC this would break on some compilers which don't allow variable declarations in the middle of some code.
Ok, which ones of them are supported for compiling flashrom?
Well, it breaks if we specify -std=c90 or -ansi to gcc, and superiotool has -ansi in the Makefile.
The way superiotool defines functions also breaks K&R style.
I won't comment on coding style in superiotool because I haven't touched it for quite some time, and coding style discussions usually lead to frustration.
I hope my mail helped to clarify the goals I want to achieve.
Regards, Carl-Daniel
Am Mittwoch, den 30.06.2010, 14:35 +0200 schrieb Carl-Daniel Hailfinger:
This patch is the first step towards libsuperiodetect, and more will have to follow.
I don't like the millions of ifdefs here. Would it be possible to approach it like the B() macro for the board URLs in flashrom instead?
Regards, Michael Karcher
On 30.06.2010 14:51, Michael Karcher wrote:
Am Mittwoch, den 30.06.2010, 14:35 +0200 schrieb Carl-Daniel Hailfinger:
This patch is the first step towards libsuperiodetect, and more will have to follow.
I don't like the millions of ifdefs here. Would it be possible to approach it like the B() macro for the board URLs in flashrom instead?
Sure. It doesn't look pretty, though. And it confuses vim syntax highlighting to no end. An alternative (which might look cleaner or not) would be to wrap the whole struct superio_registers in REGDEF() instead of wrapping only the LDN part.
Comments welcome.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: superiotool_libsuperiodetect/via.c =================================================================== --- superiotool_libsuperiodetect/via.c (Revision 5651) +++ superiotool_libsuperiodetect/via.c (Arbeitskopie) @@ -24,8 +24,9 @@ #define DEVICE_REV_VT82C686_REG 0xe1
static const struct superio_registers reg_table[] = { - {0x3c, "VT82C686A/VT82C686B", { - {EOT}}}, + {0x3c, "VT82C686A/VT82C686B", + LDNDEF({ + {EOT}})}, {EOT} };
Index: superiotool_libsuperiodetect/fintek.c =================================================================== --- superiotool_libsuperiodetect/fintek.c (Revision 5651) +++ superiotool_libsuperiodetect/fintek.c (Arbeitskopie) @@ -30,8 +30,9 @@ #define FINTEK_VENDOR_ID 0x3419
static const struct superio_registers reg_table[] = { - {0x0106, "F71862FG / F71863FG", { /* Same ID? Datasheet typo? */ + {0x0106, "F71862FG / F71863FG", /* Same ID? Datasheet typo? */ /* We assume reserved bits are read as 0. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a, 0x2b,0x2c,0x2d,EOT}, @@ -75,11 +76,13 @@ {0xa, "PME, ACPI", {0x30,0xf0,0xf1,0xf4,0xf5,0xf7,EOT}, {0x00,0x00,NANA,0x06,0x1c,0x01,EOT}}, - {EOT}}}, - {0x4103, "F71872F/FG / F71806F/FG", { /* Same ID? Datasheet typo? */ - {EOT}}}, - {0x4105, "F71882FG/F71883FG", { /* Same ID? Datasheet typo? */ + {EOT}})}, + {0x4103, "F71872F/FG / F71806F/FG", /* Same ID? Datasheet typo? */ + LDNDEF({ + {EOT}})}, + {0x4105, "F71882FG/F71883FG", /* Same ID? Datasheet typo? */ /* We assume reserved bits are read as 0. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a, 0x2b,0x2c,0x2d,EOT}, @@ -121,9 +124,10 @@ {0xa, "PME, ACPI", {0x30,0xf0,0xf1,0xf4,0xf5,EOT}, {0x00,0x00,0x01,0x06,0x1c,EOT}}, - {EOT}}}, - {0x0604, "F71805F/FG", { + {EOT}})}, + {0x0604, "F71805F/FG", /* We assume reserved bits are read as 0. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,EOT}, {0x04,0x06,0x19,0x34,0x00,0x00,0x3f,0x08,0x00,EOT}}, @@ -150,9 +154,10 @@ {0xa, "PME", {0x30,0xf0,0xf1,EOT}, {0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x0581, "F8000", { /* Fintek/ASUS F8000 */ - {EOT}}}, + {EOT}})}, + {0x0581, "F8000", /* Fintek/ASUS F8000 */ + LDNDEF({ + {EOT}})}, {EOT} };
@@ -181,7 +186,9 @@ get_superio_name(reg_table, did), vid, did, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("Fintek", reg_table, port, did, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_winbond_fintek_ite_8787(port); } Index: superiotool_libsuperiodetect/winbond.c =================================================================== --- superiotool_libsuperiodetect/winbond.c (Revision 5651) +++ superiotool_libsuperiodetect/winbond.c (Arbeitskopie) @@ -37,9 +37,11 @@ */ static const struct superio_registers reg_table[] = { /* ID and rev[3..0] */ - {0x527, "W83977CTF", { /* TODO: Not yet in sensors-detect */ - {EOT}}}, - {0x52f, "W83977EF/EG", { + {0x527, "W83977CTF", /* TODO: Not yet in sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x52f, "W83977EF/EG", + LDNDEF({ {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -78,10 +80,12 @@ 0xf0,0xf1,0xf3,0xf4,0xf6,0xf7,0xf9,0xfe,0xff,EOT}, {0x00,0x00,0x00,0x00,MISC,MISC,MISC,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,RSVD,RSVD,EOT}}, - {EOT}}}, - {0x595, "W83627SF", { /* TODO: Not yet in sensors-detect */ - {EOT}}}, - {0x601, "W83697HF/F/HG", { /* No G version? */ + {EOT}})}, + {0x595, "W83627SF", /* TODO: Not yet in sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x601, "W83697HF/F/HG", /* No G version? */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29, 0x2a,EOT}, @@ -126,12 +130,15 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x610, "W83L517D/D-F", { - {EOT}}}, - {0x708, "W83637HF/HG", { - {EOT}}}, - {0x828, "W83627THF/THG", { /* We assume rev is bits 3..0 of 0x21. */ + {EOT}})}, + {0x610, "W83L517D/D-F", + LDNDEF({ + {EOT}})}, + {0x708, "W83637HF/HG", + LDNDEF({ + {EOT}})}, + {0x828, "W83627THF/THG", /* We assume rev is bits 3..0 of 0x21. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -175,12 +182,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, + {EOT}})}, #if 0 - {0x85x, "W83687THF", { /* TODO: sensors-detect: 0x85 */ - {EOT}}}, + {0x85x, "W83687THF", /* TODO: sensors-detect: 0x85 */ + LDNDEF({ + {EOT}})}, #endif - {0xa02, "W83627DHG", { + {0xa02, "W83627DHG", + LDNDEF({ {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -232,24 +241,29 @@ EOT}, {0x00,0x48,0x48,0x48,0x48,0x00,0x00,0x48,0x00,0x00, EOT}}, - {EOT}}}, - {0xa23, "W83627UHG", {/* TODO: Not yet in sensors-detect */ - {EOT}}}, - {0xa51, "W83667HG", { + {EOT}})}, + {0xa23, "W83627UHG", /* TODO: Not yet in sensors-detect */ + LDNDEF({ + {EOT}})}, + {0xa51, "W83667HG", /* See also: http://lists.lm-sensors.org/pipermail/lm-sensors/2008-July/023683.html */ - {EOT}}}, + LDNDEF({ + {EOT}})},
/* ID and rev */ - {0x9771, "W83977F-A/G-A/AF-A/AG-A", { - {EOT}}}, - {0x9777, "W83977AF", { + {0x9771, "W83977F-A/G-A/AF-A/AG-A", + LDNDEF({ + {EOT}})}, + {0x9777, "W83977AF", /* * W83977AF as found on the Advantech PCM-5820. We weren't able * to find a datasheet (so far) which lists the 0x77 revision, * but the hardware is there in the wild, so detect it... */ - {EOT}}}, - {0x9773, "W83977TF", { + LDNDEF({ + {EOT}})}, + {0x9773, "W83977TF", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -294,12 +308,14 @@ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, NANA,MISC,RSVD,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,RSVD,RSVD,EOT}}, - {EOT}}}, - {0x9774, "W83977ATF", { - {EOT}}}, + {EOT}})}, + {0x9774, "W83977ATF", + LDNDEF({ + {EOT}})},
/* ID only */ - {0x52, "W83627HF/F/HG/G", { + {0x52, "W83627HF/F/HG/G", + LDNDEF({ {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29, 0x2a,0x2b,0x2c,0x2e,0x2f,EOT}, @@ -342,13 +358,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x68, "W83697SF/UF/UG", { + {EOT}})}, + {0x68, "W83697SF/UF/UG", /* ID: 0x68 (for W83697SF/UF/UG) * Rev: 0x1X (for W83697SF) * 0x0X (for W83697SF) -- sic! * 0x1X (for W83697UF/UG) */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x28,0x29,0x2a, 0x2b,0x2c,EOT}, @@ -405,8 +422,8 @@ {0xf, "GPIO 8", {0x30,0x60,0x61,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0xff,0x00,0x00,EOT}}, - {EOT}}}, - {0x88, "W83627EHF/EF/EHG/EG", { + {EOT}})}, + {0x88, "W83627EHF/EF/EHG/EG", /* * As per datasheet the ID should be 0x886? here. * Not mentioned in the datasheet, but sensors-detect says @@ -414,6 +431,7 @@ * (W83627EHF) has an ID of 0x8854 (verified on hardware). * So we now assume all 0x88?? IDs to mean W83627EHF/EF/EHG/EG. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -460,12 +478,14 @@ {0xb, "Hardware monitor", {0x30,0x60,0x61,0x70,0xf0,0xf1,EOT}, {0x00,0x00,0x00,0x00,0xc1,0x00,EOT}}, - {EOT}}}, + {EOT}})},
/* ID[3..0] */ - {0xa, "W83877F", { - {EOT}}}, - {0xb, "W83877AF", { + {0xa, "W83877F", + LDNDEF({ + {EOT}})}, + {0xb, "W83877AF", + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -475,14 +495,17 @@ 0x1f,0x0c,0x28,0xa3,RSVD,RSVD,0x00,0x00,0x00,0x00, 0x00,0x00,0x0e,0x00,MISC,MISC,MISC,MISC,MISC,MISC, MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,MISC,EOT}}, - {EOT}}}, - {0xc, "W83877TF", { - {EOT}}}, - {0xd, "W83877ATF/ATG", { - {EOT}}}, + {EOT}})}, + {0xc, "W83877TF", + LDNDEF({ + {EOT}})}, + {0xd, "W83877ATF/ATG", + LDNDEF({ + {EOT}})}, {EOT} };
+#ifndef LIBSUPERIODETECT static const struct superio_registers hwm_table[] = { {0x828, "W83627THF/THG", { {NOLDN, NULL, @@ -531,6 +554,7 @@ {EOT}}}, {EOT} }; +#endif /* ! LIBSUPERIODETECT */
static void enter_conf_mode_winbond_88(uint16_t port) { @@ -550,7 +574,10 @@
static void probe_idregs_winbond_helper(const char *init, uint16_t port) { - uint16_t id, hwmport; + uint16_t id; +#ifndef LIBSUPERIODETECT + uint16_t hwmport; +#endif /* LIBSUPERIODETECT */ uint8_t devid, rev, olddevid;
probing_for("Winbond", init, port); @@ -586,6 +613,7 @@ get_superio_name(reg_table, id), devid, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("Winbond", reg_table, port, id, LDN_SEL);
if (extra_dump) { @@ -607,6 +635,7 @@ dump_superio("Winbond-HWM", hwm_table, hwmport, id, WINBOND_HWM_SEL); } +#endif /* ! LIBSUPERIODETECT */ }
void probe_idregs_winbond(uint16_t port) @@ -631,5 +660,7 @@ void print_winbond_chips(void) { print_vendor_chips("Winbond", reg_table); +#ifndef LIBSUPERIODETECT print_vendor_chips("Winbond-HWM", hwm_table); +#endif /* ! LIBSUPERIODETECT */ } Index: superiotool_libsuperiodetect/ite.c =================================================================== --- superiotool_libsuperiodetect/ite.c (Revision 5651) +++ superiotool_libsuperiodetect/ite.c (Arbeitskopie) @@ -27,9 +27,11 @@ #define ISA_PNP_ADDR 0x279
static const struct superio_registers reg_table[] = { - {0x8228, "IT8228E", { - {EOT}}}, - {0x8502, "IT8502E/TE/G", { + {0x8228, "IT8228E", + LDNDEF({ + {EOT}})}, + {0x8502, "IT8502E/TE/G", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -67,10 +69,12 @@ {0x17, "Power Channel 3", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x6a,0x00,0x6e,0x01,0x01,EOT}}, - {EOT}}}, - {0x8510, "IT8510E/TE/G", { - {EOT}}}, - {0x8511, "IT8511E/TE/G", { + {EOT}})}, + {0x8510, "IT8510E/TE/G", + LDNDEF({ + {EOT}})}, + {0x8511, "IT8511E/TE/G", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -101,8 +105,9 @@ {0x12, "Power Channel 2", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x68,0x00,0x6c,0x01,0x03,EOT}}, - {EOT}}}, - {0x8512, "IT8512E/F/G", { + {EOT}})}, + {0x8512, "IT8512E/F/G", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2A,0x2B,0x2C,0x2D,0x2E,EOT}, @@ -133,10 +138,12 @@ {0x12, "Power Channel 2", {0x30,0x60,0x61,0x62,0x63,0x70,0x71,EOT}, {0x00,0x00,0x68,0x00,0x6c,0x01,0x03,EOT}}, - {EOT}}}, - {0x8513, "IT8513E/F/G", { - {EOT}}}, - {0x8661, "IT8661F/IT8770F", { + {EOT}})}, + {0x8513, "IT8513E/F/G", + LDNDEF({ + {EOT}})}, + {0x8661, "IT8661F/IT8770F", + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x20,0x21,0x22, 0x23,0x24,EOT}, @@ -168,10 +175,12 @@ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x8673, "IT8673F", { - {EOT}}}, - {0x8681, "IT8671F/IT8687R", { + {EOT}})}, + {0x8673, "IT8673F", + LDNDEF({ + {EOT}})}, + {0x8681, "IT8671F/IT8687R", + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x20,0x21,0x22, 0x23,0x24,0x25,0x26,0x2e,0x2f,EOT}, @@ -211,8 +220,9 @@ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x8701, "IT8703F", { + {EOT}})}, + {0x8701, "IT8703F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x23,0x24,0x26,0x29,0x2a,0x2b,EOT}, {0x87,0x00,0x00,0x80,0x00,0x00,0x7c,0xc0,EOT}}, @@ -253,10 +263,12 @@ {0xc, "GPIO set 5, 6 and 7", {0x30,0x60,0x61,0xf0,0xf3,0xf6,EOT}, {0x00,0x03,0x70,0x00,0xff,0xff,EOT}}, - {EOT}}}, - {0x8702, "IT8702F", { - {EOT}}}, - {0x8705, "IT8705F/AF / IT8700F", { + {EOT}})}, + {0x8702, "IT8702F", + LDNDEF({ + {EOT}})}, + {0x8705, "IT8705F/AF / IT8700F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,EOT}, {0x87,0x05,0x00,0x00,NANA,EOT}}, @@ -303,11 +315,13 @@ {0x8, "MIDI port", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x00,0x0a,0x00,EOT}}, - {EOT}}}, - {0x8706, "IT8706R", { /* TODO: Not yet in sensors-detect */ + {EOT}})}, + {0x8706, "IT8706R", /* TODO: Not yet in sensors-detect */ /* This is a "Special General Purpose I/O chip". */ - {EOT}}}, - {0x8708, "IT8708F", { + LDNDEF({ + {EOT}})}, + {0x8708, "IT8708F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2e,0x2f,EOT}, @@ -361,12 +375,15 @@ {0xa, "MIDI port", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x00,0x0a,0x00,EOT}}, - {EOT}}}, - {0x8710, "IT8710F", { /* TODO: Not yet in sensors-detect */ - {EOT}}}, - {0x8711, "IT8711F", { /* 0x8711 is a guess, not found in datasheet. */ - {EOT}}}, - {0x8712, "IT8712F", { + {EOT}})}, + {0x8710, "IT8710F", /* TODO: Not yet in sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x8711, "IT8711F", /* 0x8711 is a guess, not found in datasheet. */ + LDNDEF({ + {EOT}})}, + {0x8712, "IT8712F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x12,0x08,0x00,0x00,0x00,EOT}}, @@ -416,8 +433,9 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, - {EOT}}}, - {0x8716, "IT8716F", { + {EOT}})}, + {0x8716, "IT8716F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x16,0x01,0x00,0x00,0x00,EOT}}, @@ -466,8 +484,9 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, - {EOT}}}, - {0x8718, "IT8718F", { + {EOT}})}, + {0x8718, "IT8718F", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x18,0x01,0x00,0x00,0x00,EOT}}, @@ -514,13 +533,16 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, - {EOT}}}, - {0x8720, "IT8720F", { /* From sensors-detect */ - {EOT}}}, - {0x8722, "IT8722F", { - {EOT}}}, - {0x8726, "IT8726F", { + {EOT}})}, + {0x8720, "IT8720F", /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x8722, "IT8722F", + LDNDEF({ + {EOT}})}, + {0x8726, "IT8726F", /* Datasheet wrongly says that the ID is 0x8716. */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x2b,EOT}, {0x87,0x26,0x01,0x00,MISC,0x00,EOT}}, @@ -571,14 +593,17 @@ {0xa, "Consumer IR", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x03,0x10,0x0b,0x00,EOT}}, - {EOT}}}, - {0x8761, "IT8761E", { - {EOT}}}, - {0x8780, "IT8780F", { - {EOT}}}, + {EOT}})}, + {0x8761, "IT8761E", + LDNDEF({ + {EOT}})}, + {0x8780, "IT8780F", + LDNDEF({ + {EOT}})}, {EOT} };
+#ifndef LIBSUPERIODETECT static const struct superio_registers ec_table[] = { {0x8716, "IT8716F", { {NOLDN, NULL, @@ -636,6 +661,7 @@ {EOT}}}, {EOT} }; +#endif /* ! LIBSUPERIODETECT */
/* Works for: IT8661F/IT8770F */ static const uint8_t initkey_it8661f[][4] = { @@ -712,7 +738,10 @@
static void probe_idregs_ite_helper(const char *init, uint16_t port) { - uint16_t id, chipver, ecport; + uint16_t id, chipver; +#ifndef LIBSUPERIODETECT + uint16_t ecport; +#endif /* ! LIBSUPERIODETECT */
probing_for("ITE", init, port);
@@ -730,6 +759,7 @@ get_superio_name(reg_table, id), id, chipver, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("ITE", reg_table, port, id, LDN_SEL);
if (extra_dump) { @@ -745,6 +775,7 @@ printf("Environment controller (0x%04x)\n", ecport); dump_superio("ITE-EC", ec_table, ecport, id, LDN_SEL); } +#endif /* ! LIBSUPERIODETECT */ }
void probe_idregs_ite(uint16_t port) @@ -783,5 +814,7 @@ void print_ite_chips(void) { print_vendor_chips("ITE", reg_table); +#ifndef LIBSUPERIODETECT print_vendor_chips("ITE-EC", ec_table); +#endif /* ! LIBSUPERIODETECT */ } Index: superiotool_libsuperiodetect/nsc.c =================================================================== --- superiotool_libsuperiodetect/nsc.c (Revision 5651) +++ superiotool_libsuperiodetect/nsc.c (Arbeitskopie) @@ -25,7 +25,8 @@ #define CHIP_REV_REG 0x27 /* Super I/O revision ID (SRID) */
static const struct superio_registers reg_table[] = { - {0xcf, "PC97307", { + {0xcf, "PC97307", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x27,EOT}, {0xcf,MISC,MISC,0x00,0x00,NANA,EOT}}, @@ -60,8 +61,9 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, - {EOT}}}, - {0xd0, "PC87317", { + {EOT}})}, + {0xd0, "PC87317", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,EOT}, {0xd0,MISC,MISC,0x00,0x00,0x00,EOT}}, @@ -96,8 +98,9 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, - {EOT}}}, - {0xdf, "PC97317", { + {EOT}})}, + {0xdf, "PC97317", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x27,EOT}, {0xdf,MISC,MISC,0x00,0x00,0x00,NANA,EOT}}, @@ -132,8 +135,9 @@ {0x8, "Power management", {0x30,0x31,0x60,0x61,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x04,0x04,EOT}}, - {EOT}}}, - {0xe0, "PC87309", { + {EOT}})}, + {0xe0, "PC87309", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x27,0x2e,EOT}, {0xe0,MISC,0x00,NANA,RSVD,EOT}}, @@ -162,8 +166,9 @@ 0xf0,EOT}, {0x01,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04, 0x40,EOT}}, - {EOT}}}, - {0xe1, "PC87360", { + {EOT}})}, + {0xe1, "PC87360", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,EOT}, @@ -206,8 +211,9 @@ {0xa, "Watchdog timer", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}}, - {EOT}}}, - {0xe2, "PC87351", { + {EOT}})}, + {0xe2, "PC87351", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x27,0x2e,EOT}, {0xe2,0x11,0xa1,0x00,MISC,NANA,RSVD,EOT}}, @@ -240,14 +246,18 @@ {0x8, "Fan speed control", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,EOT}}, - {EOT}}}, - {0xe4, "PC87364", { - {EOT}}}, - {0xe5, "PC87365", { /* SRID[7..0] == chip revision */ - {EOT}}}, - {0xe8, "PC87363", { - {EOT}}}, - {0xe9, "PC87366", { + {EOT}})}, + {0xe4, "PC87364", + LDNDEF({ + {EOT}})}, + {0xe5, "PC87365", /* SRID[7..0] == chip revision */ + LDNDEF({ + {EOT}})}, + {0xe8, "PC87363", + LDNDEF({ + {EOT}})}, + {0xe9, "PC87366", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x27,0x28,0x2a,0x2b, 0x2c,0x2d,0x2e,EOT}, @@ -304,10 +314,11 @@ {0xe, "Temperature sensor (TMS)", {0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT}, {0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}}, - {EOT}}}, + {EOT}})},
/* SID[7..0]: family, SRID[7..5]: ID, SRID[4..0]: rev. */ - {0xea, "PC8739x", { + {0xea, "PC8739x", + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -344,12 +355,14 @@ 0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,EOT}, {0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0xec, "PC87591x", { + {EOT}})}, + {0xec, "PC87591x", /* SRID[7..5]: 000=PC87591E, 001=PC87591S, 100=PC87591L */ - {EOT}}}, - {0xee, "PC8741x", { + LDNDEF({ + {EOT}})}, + {0xee, "PC8741x", /* SRID[7..5] is marked as "not applicable for the PC8741x". */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -397,10 +410,12 @@ 0xf1,0xf2,0xf3,EOT}, {0x00,0x00,0x70,0x00,0x72,0x08,0x00,0x04,0x04,0x00, 0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0xf0, "PC87372", { - {EOT}}}, - {0x0f1, "PC8374L", { + {EOT}})}, + {0xf0, "PC87372", + LDNDEF({ + {EOT}})}, + {0x0f1, "PC8374L", + LDNDEF({ {NOLDN, NULL, {0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26, 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -441,8 +456,9 @@ {0x8, "Health management", {0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x05,EOT}}, - {EOT}}}, - {0x8f1, "WPCD376I", { + {EOT}})}, + {0x8f1, "WPCD376I", + LDNDEF({ {NOLDN, NULL, {0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26, 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -480,9 +496,10 @@ 0xf2,0xf3,0xf8,EOT}, {0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC, 0x00,MISC,0x01,EOT}}, - {EOT}}}, - {0xf2, "PC87427", { + {EOT}})}, + {0xf2, "PC87427", /* SRID[7..5] is marked as "not applicable for the PC87427". */ + LDNDEF({ {NOLDN, NULL, {0x10,0x12,0x13,0x1d,0x20,0x21,0x22,0x23,0x24,0x25, 0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, @@ -542,9 +559,10 @@ 0xf0,EOT}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04, 0x05,EOT}}, - {EOT}}}, - {0xf3, "PC87373", { - {EOT}}}, + {EOT}})}, + {0xf3, "PC87373", + LDNDEF({ + {EOT}})}, {EOT} };
@@ -592,8 +610,10 @@ get_superio_name(reg_table, magic), id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio(magic == 0x8f1 ? "Winbond" : "NSC", reg_table, port, magic, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */ }
void print_nsc_chips(void) Index: superiotool_libsuperiodetect/superiotool.c =================================================================== --- superiotool_libsuperiodetect/superiotool.c (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.c (Arbeitskopie) @@ -81,6 +81,7 @@ return "<unknown>"; }
+#ifndef LIBSUPERIODETECT static void dump_regs(const struct superio_registers reg_table[], int i, int j, uint16_t port, uint8_t ldn_sel) { @@ -170,6 +171,7 @@ printf("%02x ", INB(iobase + i)); printf("\n"); } +#endif /* ! LIBSUPERIODETECT */
void probing_for(const char *vendor, const char *info, uint16_t port) { @@ -189,9 +191,11 @@ for (i = 0; reg_table[i].superio_id != EOT; i++) { printf("%s %s", vendor, reg_table[i].name);
+#ifndef LIBSUPERIODETECT /* Unless the ldn is empty, assume this chip has a dump. */ if (reg_table[i].ldn[0].ldn != EOT) printf(" (dump available)"); +#endif /* ! LIBSUPERIODETECT */
printf("\n"); } Index: superiotool_libsuperiodetect/ali.c =================================================================== --- superiotool_libsuperiodetect/ali.c (Revision 5651) +++ superiotool_libsuperiodetect/ali.c (Arbeitskopie) @@ -27,7 +27,8 @@
static const struct superio_registers reg_table[] = { /* TODO: M5113 doesn't seem to have ID registers? */ - {0x5315, "M1535/M1535D/M1535+/M1535D+", { + {0x5315, "M1535/M1535D/M1535+/M1535D+", + LDNDEF({ {NOLDN, NULL, {0x1f,0x20,0x21,0x22,0x23,0x2c,0x2d,0x2e,EOT}, {NANA,0x53,0x15,0x00,0x00,RSVD,RSVD,RSVD,EOT}}, @@ -52,9 +53,10 @@ {0xc, "Hotkey", {0x30,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,EOT}, {0x00,0x35,0x14,0x11,0x71,RSVD,0x05,EOT}}, - {EOT}}}, - {0x2351, "M512x", { - {EOT}}}, + {EOT}})}, + {0x2351, "M512x", + LDNDEF({ + {EOT}})}, {EOT} };
@@ -95,7 +97,9 @@ get_superio_name(reg_table, id), id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio("ALi", reg_table, port, id, LDN_SEL); +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_ali(port); } Index: superiotool_libsuperiodetect/smsc.c =================================================================== --- superiotool_libsuperiodetect/smsc.c (Revision 5651) +++ superiotool_libsuperiodetect/smsc.c (Arbeitskopie) @@ -29,7 +29,8 @@
static const struct superio_registers reg_table[] = { /* The following Super I/Os use the 0x20/0x21 ID registers. */ - {0x02, "FDC37C932", { + {0x02, "FDC37C932", + LDNDEF({ {NOLDN, NULL, {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x2d,0x2e, 0x2f,EOT}, @@ -68,11 +69,13 @@ {0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, 0x00,0x00,0x00,MISC,EOT}}, - {EOT}}}, - {0x03, "FDC37C93xFR", { + {EOT}})}, + {0x03, "FDC37C93xFR", /* FIXME: There's another 0x03 but found on port 0x0d/0x0e! */ - {EOT}}}, - {0x0a, "FDC37N971", { + LDNDEF({ + {EOT}})}, + {0x0a, "FDC37N971", + LDNDEF({ {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -109,8 +112,9 @@ {0x9, "Mailbox", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x0b, "FDC37N972", { + {EOT}})}, + {0x0b, "FDC37N972", + LDNDEF({ {NOLDN, NULL, {0x02,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -147,8 +151,9 @@ {0x9, "Mailbox", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x0e, "LPC47N252", { /* From sensors-detect */ + {EOT}})}, + {0x0e, "LPC47N252", /* From sensors-detect */ + LDNDEF({ {NOLDN, NULL, {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28, 0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -188,12 +193,15 @@ {0xa, "LPC/8051 addressable GPIO (LGPIO)", {0x30,0x60,0x61,EOT}, {0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x14, "LPC47M172", { - {EOT}}}, - {0x30, "FDC37C93xAPM", { - {EOT}}}, - {0x40, "FDC37C67x", { /* E.g. FDC37C672. Chiprev: 0x01 */ + {EOT}})}, + {0x14, "LPC47M172", + LDNDEF({ + {EOT}})}, + {0x30, "FDC37C93xAPM", + LDNDEF({ + {EOT}})}, + {0x40, "FDC37C67x", /* E.g. FDC37C672. Chiprev: 0x01 */ + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c, 0x2d,0x2e,0x2f,EOT}, @@ -225,10 +233,12 @@ {0x00,NANA,NANA,NANA,NANA,0x06,0x03,NANA,NANA,NANA, 0x00,0x00,0x00,MISC,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD, EOT}}, - {EOT}}}, - {0x42, "FDC37B80x/FDC37M707", { - {EOT}}}, - {0x09, "FDC37N958FR", { /* Found in e.g. Dell Latitude CPi A366XT. */ + {EOT}})}, + {0x42, "FDC37B80x/FDC37M707", + LDNDEF({ + {EOT}})}, + {0x09, "FDC37N958FR", /* Found in e.g. Dell Latitude CPi A366XT. */ + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -270,10 +280,12 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, - {EOT}}}, - {0x43, "FDC37B77x", { - {EOT}}}, - {0x44, "FDC37B78x", { + {EOT}})}, + {0x43, "FDC37B77x", + LDNDEF({ + {EOT}})}, + {0x44, "FDC37B78x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -315,12 +327,15 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, - {EOT}}}, - {0x46, "FDC37M602", { /* Found in Biostar M6TLD. */ - {EOT}}}, - {0x47, "FDC37M60x", { /* TODO: Not yet in sensors-detect */ - {EOT}}}, - {0x4c, "FDC37B72x", { + {EOT}})}, + {0x46, "FDC37M602", /* Found in Biostar M6TLD. */ + LDNDEF({ + {EOT}})}, + {0x47, "FDC37M60x", /* TODO: Not yet in sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x4c, "FDC37B72x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -357,8 +372,9 @@ {0xa, "ACPI", {0x30,0x60,0x61,0x70,0xf0,EOT}, {0x00,0x00,0x00,NANA,NANA,EOT}}, - {EOT}}}, - {0x4d, "FDC37M81x", { + {EOT}})}, + {0x4d, "FDC37M81x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c, 0x2d,0x2e,0x2f,EOT}, @@ -389,8 +405,9 @@ {0x00,NANA,NANA,NANA,NANA,0x02,0x01,NANA,NANA,NANA, NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,RSVD,RSVD, RSVD,RSVD,RSVD,RSVD,EOT}}, - {EOT}}}, - {0x51, "LPC47B27x", { + {EOT}})}, + {0x51, "LPC47B27x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -424,10 +441,12 @@ {0xb, "MIDI port (MPU-401)", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, - {EOT}}}, - {0x52, "LPC47B37x", { - {EOT}}}, - {0x54, "LPC47U33x", { + {EOT}})}, + {0x52, "LPC47B37x", + LDNDEF({ + {EOT}})}, + {0x54, "LPC47U33x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,EOT}, @@ -459,12 +478,15 @@ {0xb, "SMBus", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x00,0x00,0x00,EOT}}, - {EOT}}}, - {0x56, "LPC47B34x", { - {EOT}}}, - {0x57, "LPC47S42x", { - {EOT}}}, - {0x59, "LPC47M10x/112/13x", { + {EOT}})}, + {0x56, "LPC47B34x", + LDNDEF({ + {EOT}})}, + {0x57, "LPC47S42x", + LDNDEF({ + {EOT}})}, + {0x59, "LPC47M10x/112/13x", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -498,12 +520,15 @@ {0xb, "MPU-401", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, - {EOT}}}, - {0x5d, "LPC47B357", { /* From sensors-detect (no datasheet) */ - {EOT}}}, - {0x5f, "LPC47M14x", { - {EOT}}}, - {0x60, "LPC47M15x/192/997", { + {EOT}})}, + {0x5d, "LPC47B357", /* From sensors-detect (no datasheet) */ + LDNDEF({ + {EOT}})}, + {0x5f, "LPC47M14x", + LDNDEF({ + {EOT}})}, + {0x60, "LPC47M15x/192/997", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -535,21 +560,27 @@ {0xb, "MPU-401", {0x30,0x60,0x61,0x70,EOT}, {0x00,0x03,0x30,0x05,EOT}}, - {EOT}}}, - {0x62, "LPC47S45x", { - {EOT}}}, - {0x67, "EMC2700LPC", { /* From sensors-detect */ - {EOT}}}, - {0x6b, "LPC47M292", { /* From sensors-detect */ - {EOT}}}, - {0x6e, "LPC47B387", { /* TODO: Not yet in sensors-detect */ + {EOT}})}, + {0x62, "LPC47S45x", + LDNDEF({ + {EOT}})}, + {0x67, "EMC2700LPC", /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x6b, "LPC47M292", /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x6e, "LPC47B387", /* TODO: Not yet in sensors-detect */ /* Found in the HP Compaq Business Desktop d530 Series */ /* http://article.gmane.org/gmane.linux.bios/27192 */ /* We cannot find a public datasheet for this Super I/O. */ - {EOT}}}, - {0x6f, "LPC47B397", { - {EOT}}}, - {0x74, "LPC47M182", { /* Only for LD_NUM = 0 */ + LDNDEF({ + {EOT}})}, + {0x6f, "LPC47B397", + LDNDEF({ + {EOT}})}, + {0x74, "LPC47M182", /* Only for LD_NUM = 0 */ + LDNDEF({ {NOLDN, NULL, {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27, 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -584,10 +615,12 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, - {EOT}}}, - {0x76, "LPC47M584", { /* From sensors-detect (no datasheet) */ - {EOT}}}, - {0x77, "A8000", { /* ASUS A8000, a rebranded DME1737(?) */ + {EOT}})}, + {0x76, "LPC47M584", /* From sensors-detect (no datasheet) */ + LDNDEF({ + {EOT}})}, + {0x77, "A8000", /* ASUS A8000, a rebranded DME1737(?) */ + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -613,8 +646,9 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, - {EOT}}}, - {0x78, "DME1737", { + {EOT}})}, + {0x78, "DME1737", + LDNDEF({ {NOLDN, NULL, {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a, 0x2b,0x2c,0x2d,0x2e,0x2f,EOT}, @@ -640,48 +674,64 @@ {0xa, "Runtime registers", {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT}, {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}}, - {EOT}}}, - {0x79, "SCH5504", { /* From sensors-detect (no datasheet) */ - {EOT}}}, - {0x7a, "LPC47N217", { /* Found in Toshiba Satellite A80-117. */ - {EOT}}}, - {0x7c, "SCH3112", { - {EOT}}}, - {0x7d, "SCH3114", { - {EOT}}}, - {0x7f, "SCH3116", { - {EOT}}}, - {0x81, "SCH5307", { - {EOT}}}, - {0x83, "SCH5514D", { /* From sensors-detect */ - {EOT}}}, - {0x85, "SCH5317", { /* From sensors-detect */ + {EOT}})}, + {0x79, "SCH5504", /* From sensors-detect (no datasheet) */ + LDNDEF({ + {EOT}})}, + {0x7a, "LPC47N217", /* Found in Toshiba Satellite A80-117. */ + LDNDEF({ + {EOT}})}, + {0x7c, "SCH3112", + LDNDEF({ + {EOT}})}, + {0x7d, "SCH3114", + LDNDEF({ + {EOT}})}, + {0x7f, "SCH3116", + LDNDEF({ + {EOT}})}, + {0x81, "SCH5307", + LDNDEF({ + {EOT}})}, + {0x83, "SCH5514D", /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x85, "SCH5317", /* From sensors-detect */ /* The SCH5317 can have either 0x85 or 0x8c as device ID. */ - {EOT}}}, - {0x86, "SCH5127", { /* From sensors-detect */ - {EOT}}}, - {0x89, "SCH5027", { /* From sensors-detect (no public datasheet) */ - {EOT}}}, - {0x8c, "SCH5317", { /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x86, "SCH5127", /* From sensors-detect */ + LDNDEF({ + {EOT}})}, + {0x89, "SCH5027", /* From sensors-detect (no public datasheet) */ + LDNDEF({ + {EOT}})}, + {0x8c, "SCH5317", /* From sensors-detect */ /* The SCH5317 can have either 0x85 or 0x8c as device ID. */ - {EOT}}}, - {0x90, "SCH4307", { /* From sensors-detect */ - {EOT}}}, + LDNDEF({ + {EOT}})}, + {0x90, "SCH4307", /* From sensors-detect */ + LDNDEF({ + {EOT}})},
/* The following Super I/Os use the 0x0d/0x0e ID registers. */ - {0x03, "FDC37C669", { + {0x03, "FDC37C669", /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ /* Chiprev: 0x02. */ /* FIXME: There's another 0x03 but found on port 0x20/0x21! */ - {EOT}}}, - {0x04, "FDC37C669FR", { /* TODO: Not yet in sensors-detect. */ + LDNDEF({ + {EOT}})}, + {0x04, "FDC37C669FR", /* TODO: Not yet in sensors-detect. */ /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ - {EOT}}}, - {0x13, "LPC47N237", { + LDNDEF({ + {EOT}})}, + {0x13, "LPC47N237", /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */ - {EOT}}}, - {0x28, "FDC37N769", { + LDNDEF({ + {EOT}})}, + {0x28, "FDC37N769", /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -693,12 +743,14 @@ NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD, 0x80,0x00,0x3c,RSVD,RSVD,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,RSVD,0x00,0x00,0x03,0x00,0x00,EOT}}, - {EOT}}}, - {0x29, "FDC37N3869/FDC37N869", { + {EOT}})}, + {0x29, "FDC37N3869/FDC37N869", /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */ - {EOT}}}, - {0x5a, "LPC47N227", { + LDNDEF({ + {EOT}})}, + {0x5a, "LPC47N227", /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */ + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -712,9 +764,10 @@ RSVD,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,EOT}}, - {EOT}}}, - {0x5b, "SIO10N268", { + {EOT}})}, + {0x5b, "SIO10N268", /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */ + LDNDEF({ {NOLDN, NULL, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, @@ -734,14 +787,16 @@ 0x00,0x00,0x00,0x00,NANA,NANA,NANA,NANA,NANA,0x50, NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x01, 0x00,0x01,0x00,0x8c,MISC,EOT}}, - {EOT}}}, - {0x65, "FDC37C665GT/IR", { + {EOT}})}, + {0x65, "FDC37C665GT/IR", /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */ /* Chiprev: 0x02 = FDC37C665GT, 0x82 = FDC37C665IR */ - {EOT}}}, - {0x66, "FDC37C666GT", { + LDNDEF({ + {EOT}})}, + {0x66, "FDC37C666GT", /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. Chiprev: 0x02. */ - {EOT}}}, + LDNDEF({ + {EOT}})}, {EOT} };
@@ -765,7 +820,9 @@ uint8_t revreg) { uint8_t id, rev; +#ifndef LIBSUPERIODETECT uint16_t runtime_base; +#endif /* ! LIBSUPERIODETECT */ const char *info = (idreg == 0x20) ? "(idregs=0x20/0x21) " : "(idregs=0x0d/0x0e) ";
@@ -788,6 +845,7 @@ id, rev, port); chip_found = 1;
+#ifndef LIBSUPERIODETECT dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id, LDN_SEL);
@@ -804,6 +862,7 @@ printf("No extra registers known for this chip.\n"); } } +#endif /* ! LIBSUPERIODETECT */
exit_conf_mode_smsc(port); } Index: superiotool_libsuperiodetect/superiotool.h =================================================================== --- superiotool_libsuperiodetect/superiotool.h (Revision 5651) +++ superiotool_libsuperiodetect/superiotool.h (Arbeitskopie) @@ -98,14 +98,22 @@ struct superio_registers { int32_t superio_id; /* Signed, as we need EOT. */ const char *name; /* Super I/O name */ +#ifndef LIBSUPERIODETECT struct { int8_t ldn; const char *name; /* LDN name */ int16_t idx[IDXSIZE]; int16_t def[IDXSIZE]; } ldn[LDNSIZE]; +#endif /* ! LIBSUPERIODETECT */ };
+#ifdef LIBSUPERIODETECT +#define LDNDEF(...) +#else /* ! LIBSUPERIODETECT */ +#define LDNDEF(...) __VA_ARGS__ +#endif + /* pci.c */ #ifdef PCI_SUPPORT extern struct pci_access *pacc; Index: superiotool_libsuperiodetect/Makefile =================================================================== --- superiotool_libsuperiodetect/Makefile (Revision 5651) +++ superiotool_libsuperiodetect/Makefile (Arbeitskopie) @@ -30,8 +30,12 @@ | sed -e "s/.*://" -e "s/([0-9]*).*/\1/")"'
CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \ - -Werror-implicit-function-declaration -ansi -pedantic $(SVNDEF) + -Werror-implicit-function-declaration -std=c99 -pedantic $(SVNDEF)
+ifeq ($(CONFIG_LIB), yes) +CFLAGS += -D'LIBSUPERIODETECT=1' +endif + OBJS = superiotool.o ali.o fintek.o ite.o nsc.o smsc.o winbond.o
OS_ARCH = $(shell uname) @@ -44,7 +48,7 @@
ifeq ($(CONFIG_PCI), yes) CFLAGS += -DPCI_SUPPORT -LIBS += -lpci +LIBS += -lpci -lz OBJS += pci.o via.o endif
Am Mittwoch, den 30.06.2010, 16:29 +0200 schrieb Carl-Daniel Hailfinger:
Comments welcome.
You want to use that for flashrom. Please be advised that superiotool not only contains IDs for Super I/O chips, but also for ECs with a Super I/O-like config space. There are systems with both a Winbond EC and a Winbond Super I/O, one on 0x2E, the other on 0x4E, so there might be more than one match. This is something flashrom is not prepared to handle. If it's just about Super I/O detection, we would need to throw out the non-Super-I/O-containing ECs from the list.
- {0x0581, "F8000", /* Fintek/ASUS F8000 */
LDNDEF({
{EOT}})},
It might be just me, But I don't like the extra line containing just "boilerplate" stuff. Are you geting serious line-length problems with putting LDNDEF also on the first line?
Regards, Michael Karcher