Author: uwe Date: 2007-09-19 02:03:14 +0200 (Wed, 19 Sep 2007) New Revision: 2783
Modified: trunk/util/superiotool/Makefile trunk/util/superiotool/fintek.c trunk/util/superiotool/ite.c trunk/util/superiotool/nsc.c trunk/util/superiotool/smsc.c trunk/util/superiotool/superiotool.c trunk/util/superiotool/superiotool.h Log: Use uint16_t and friends where appropriate (trivial).
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/util/superiotool/Makefile =================================================================== --- trunk/util/superiotool/Makefile 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/Makefile 2007-09-19 00:03:14 UTC (rev 2783) @@ -24,9 +24,9 @@ INSTALL = /usr/bin/install PREFIX = /usr/local
-# TODO: -ansi, -pedantic +# TODO: -pedantic CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \ - -Werror-implicit-function-declaration + -Werror-implicit-function-declaration -ansi
OBJS = superiotool.o fintek.o ite.o nsc.o smsc.o
Modified: trunk/util/superiotool/fintek.c =================================================================== --- trunk/util/superiotool/fintek.c 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/fintek.c 2007-09-19 00:03:14 UTC (rev 2783) @@ -20,7 +20,7 @@
#include "superiotool.h"
-void dump_fintek(unsigned short port, unsigned int did) +void dump_fintek(uint16_t port, uint16_t did) { switch (did) { case 0x0604: @@ -89,9 +89,9 @@ regval(port, 0xf6), regval(port, 0xf7), regval(port, 0xf8)); }
-void probe_idregs_fintek(unsigned short port) +void probe_idregs_fintek(uint16_t port) { - unsigned int vid, did, success = 0; + uint16_t vid, did, success = 0;
/* Enable configuration sequence (Fintek uses this for example) * Older ITE chips have the same enable sequence.
Modified: trunk/util/superiotool/ite.c =================================================================== --- trunk/util/superiotool/ite.c 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/ite.c 2007-09-19 00:03:14 UTC (rev 2783) @@ -187,7 +187,7 @@ {EOT} };
-void dump_ite(unsigned short port, unsigned short id) +void dump_ite(uint16_t port, uint16_t id) { int i;
@@ -211,9 +211,9 @@ } }
-void probe_idregs_ite(unsigned short port) +void probe_idregs_ite(uint16_t port) { - unsigned int id, chipver; + uint16_t id, chipver;
/* Enable configuration sequence (ITE uses this for newer IT87[012]x) * IT871[01] uses 0x87, 0x87 -> fintek detection should handle it
Modified: trunk/util/superiotool/nsc.c =================================================================== --- trunk/util/superiotool/nsc.c 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/nsc.c 2007-09-19 00:03:14 UTC (rev 2783) @@ -25,7 +25,7 @@ [0xf1] = "PC8374 (Winbond/NatSemi)" };
-void dump_ns8374(unsigned short port) +void dump_ns8374(uint16_t port) { printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n", regval(port, 0x21), regval(port, 0x22), regval(port, 0x23), @@ -56,9 +56,9 @@ regval(port, 0xf0)); }
-void probe_idregs_simple(unsigned short port) +void probe_idregs_simple(uint16_t port) { - unsigned char id; + uint16_t id;
outb(0x20, port); if (inb(port) != 0x20) {
Modified: trunk/util/superiotool/smsc.c =================================================================== --- trunk/util/superiotool/smsc.c 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/smsc.c 2007-09-19 00:03:14 UTC (rev 2783) @@ -41,7 +41,7 @@ };
/* Note: The actual SMSC ID is 16 bits, but we must pass 32 bits here. */ -void dump_smsc(uint32_t port, uint32_t id) +void dump_smsc(uint16_t port, uint16_t id) { switch (id) { case 0x28: @@ -53,7 +53,7 @@ } }
-void probe_idregs_smsc(unsigned short port) +void probe_idregs_smsc(uint16_t port) { uint16_t id, rev;
Modified: trunk/util/superiotool/superiotool.c =================================================================== --- trunk/util/superiotool/superiotool.c 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/superiotool.c 2007-09-19 00:03:14 UTC (rev 2783) @@ -22,23 +22,23 @@
#include "superiotool.h"
-unsigned char regval(unsigned short port, unsigned char reg) +uint8_t regval(uint16_t port, uint8_t reg) { outb(reg, port); return inb(port + 1); }
-void regwrite(unsigned short port, unsigned char reg, unsigned char val) +void regwrite(uint16_t port, uint8_t reg, uint8_t val) { outb(reg, port); outb(val, port + 1); }
void dump_superio(const char *name, const struct superio_registers reg_table[], - unsigned short port, unsigned short id) + uint16_t port, uint16_t id) { int i, j, k; - signed short *idx; + int *idx;
printf("%s ", name);
@@ -46,33 +46,32 @@ if (reg_table[i].superio_id == EOT) break;
- if ((unsigned short)reg_table[i].superio_id != id) + if ((uint16_t)reg_table[i].superio_id != id) continue;
printf("%s\n", reg_table[i].name);
- for (j = 0;; j++) { + for (j = 0; /* Nothing */; j++) { if (reg_table[i].ldn[j].ldn == EOT) break;
if (reg_table[i].ldn[j].ldn != NOLDN) { - printf("Switching to LDN 0x%01x\n", + printf("Switching to LDN 0x%02x\n", reg_table[i].ldn[j].ldn); - regwrite(port, 0x07, - reg_table[i].ldn[j].ldn); + regwrite(port, 0x07, reg_table[i].ldn[j].ldn); }
idx = reg_table[i].ldn[j].idx;
printf("idx "); - for (k = 0;; k++) { + for (k = 0; /* Nothing */; k++) { if (idx[k] == EOT) break; printf("%02x ", idx[k]); }
printf("\nval "); - for (k = 0;; k++) { + for (k = 0; /* Nothing */; k++) { if (idx[k] == EOT) break; printf("%02x ", regval(port, idx[k])); @@ -80,7 +79,7 @@
printf("\ndef "); idx = reg_table[i].ldn[j].def; - for (k = 0;; k++) { + for (k = 0; /* Nothing */; k++) { if (idx[k] == EOT) break; else if (idx[k] == NANA)
Modified: trunk/util/superiotool/superiotool.h =================================================================== --- trunk/util/superiotool/superiotool.h 2007-09-18 23:30:24 UTC (rev 2782) +++ trunk/util/superiotool/superiotool.h 2007-09-19 00:03:14 UTC (rev 2783) @@ -41,43 +41,42 @@ #define MAXNUMPORTS (2 + 1) /* Maximum number of Super I/O ports */
struct superio_registers { - /* Yes, superio_id should be unsigned, but EOT has to be negative. */ - signed short superio_id; + int32_t superio_id; /* Signed, as we need EOT. */ const char name[MAXNAMELEN]; struct { - signed short ldn; - signed short idx[IDXSIZE]; - signed short def[IDXSIZE]; + int ldn; + int idx[IDXSIZE]; + int def[IDXSIZE]; } ldn[LDNSIZE]; };
/* superiotool.c */ -unsigned char regval(unsigned short port, unsigned char reg); -void regwrite(unsigned short port, unsigned char reg, unsigned char val); +uint8_t regval(uint16_t port, uint8_t reg); +void regwrite(uint16_t port, uint8_t reg, uint8_t val); void dump_superio(const char *name, const struct superio_registers reg_table[], - unsigned short port, unsigned short id); -void probe_superio(unsigned short port); + uint16_t port, uint16_t id); +void probe_superio(uint16_t port);
/* fintek.c */ -void dump_fintek(unsigned short port, unsigned int did); -void probe_idregs_fintek(unsigned short port); +void dump_fintek(uint16_t port, uint16_t did); +void probe_idregs_fintek(uint16_t port);
/* ite.c */ -void dump_ite(unsigned short port, unsigned short id); -void probe_idregs_ite(unsigned short port); +void dump_ite(uint16_t port, uint16_t id); +void probe_idregs_ite(uint16_t port);
/* nsc.c */ -void dump_ns8374(unsigned short port); -void probe_idregs_simple(unsigned short port); +void dump_ns8374(uint16_t port); +void probe_idregs_simple(uint16_t port);
/* smsc.c */ -void dump_smsc(uint32_t port, uint32_t id); -void probe_idregs_smsc(unsigned short port); +void dump_smsc(uint16_t port, uint16_t id); +void probe_idregs_smsc(uint16_t port);
/** Table of which config ports to probe on each Super I/O. */ const static struct { - void (*probe_idregs) (unsigned short port); - signed short ports[MAXNUMPORTS]; /* Signed, as we need EOT. */ + void (*probe_idregs) (uint16_t port); + int ports[MAXNUMPORTS]; /* Signed, as we need EOT. */ } superio_ports_table[] = { {probe_idregs_simple, {0x2e, 0x4e, EOT}}, {probe_idregs_fintek, {0x2e, 0x4e, EOT}},