summaryrefslogtreecommitdiff
path: root/util/superiotool
diff options
context:
space:
mode:
Diffstat (limited to 'util/superiotool')
-rw-r--r--util/superiotool/superiotool.c24
-rw-r--r--util/superiotool/superiotool.h9
2 files changed, 33 insertions, 0 deletions
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index aee5026189..a62f49a084 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -84,6 +84,28 @@ const char *get_superio_name(const struct superio_registers reg_table[],
return "<unknown>";
}
+static void set_extra_selector(uint16_t port, const struct extra_selector *esel)
+{
+ if (esel->idx == 0) /* entry without extra selector */
+ return;
+
+ uint8_t reg_val = regval(port, esel->idx);
+ reg_val &= ~esel->mask;
+ reg_val |= esel->val;
+ regwrite(port, esel->idx, reg_val);
+
+ reg_val = regval(port, esel->idx) & esel->mask;
+
+ printf(" -- ESEL[%02xh] 0x%02x", esel->idx, reg_val);
+ if (esel->name != NULL)
+ printf(" (%s)", esel->name);
+ printf(" --");
+
+ if (verbose)
+ printf(" config: idx=%02xh, mask=%02xh, val=%02xh --", esel->idx, esel->mask,
+ esel->val);
+}
+
static void dump_regs(const struct superio_registers reg_table[],
int i, int j, uint16_t port, uint8_t ldn_sel)
{
@@ -102,6 +124,8 @@ static void dump_regs(const struct superio_registers reg_table[],
printf("(%s)", reg_table[i].ldn[j].name);
}
+ set_extra_selector(port, &reg_table[i].ldn[j].esel);
+
idx = reg_table[i].ldn[j].idx;
def = reg_table[i].ldn[j].def;
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index 14090309ee..ef2bfd6685 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -136,6 +136,14 @@ extern int dump, verbose, extra_dump;
extern int chip_found;
+/* Extra selector structure (see fintek.c) */
+struct extra_selector {
+ const char *name;
+ uint8_t idx;
+ uint8_t mask;
+ uint8_t val;
+};
+
struct superio_registers {
int32_t superio_id; /* Signed, as we need EOT. */
const char *name; /* Super I/O name */
@@ -144,6 +152,7 @@ struct superio_registers {
const char *name; /* LDN name */
int16_t idx[IDXSIZE];
int16_t def[IDXSIZE];
+ struct extra_selector esel;
} ldn[LDNSIZE];
};