summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2007-09-19 00:03:14 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2007-09-19 00:03:14 +0000
commitde24a0e58557ac7913e2f8174710f50e4697b1bd (patch)
treed09db121810e5c61fd12650defb033b9c2c0bed7
parentd754d2c6c4970e686d004ea4d39c5e6599abf46f (diff)
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> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2783 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--util/superiotool/Makefile4
-rw-r--r--util/superiotool/fintek.c6
-rw-r--r--util/superiotool/ite.c6
-rw-r--r--util/superiotool/nsc.c6
-rw-r--r--util/superiotool/smsc.c4
-rw-r--r--util/superiotool/superiotool.c23
-rw-r--r--util/superiotool/superiotool.h37
7 files changed, 42 insertions, 44 deletions
diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile
index 6e86d01352..44d0316e5a 100644
--- a/util/superiotool/Makefile
+++ b/util/superiotool/Makefile
@@ -24,9 +24,9 @@ CC = gcc
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
diff --git a/util/superiotool/fintek.c b/util/superiotool/fintek.c
index f7baaf6989..c12954c7f9 100644
--- a/util/superiotool/fintek.c
+++ b/util/superiotool/fintek.c
@@ -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 @@ void dump_fintek(unsigned short port, unsigned int did)
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.
diff --git a/util/superiotool/ite.c b/util/superiotool/ite.c
index 41f2a9bb3d..938613efd4 100644
--- a/util/superiotool/ite.c
+++ b/util/superiotool/ite.c
@@ -187,7 +187,7 @@ const static struct superio_registers reg_table[] = {
{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 dump_ite(unsigned short port, unsigned short id)
}
}
-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
diff --git a/util/superiotool/nsc.c b/util/superiotool/nsc.c
index 0fb2b7463e..691ce13967 100644
--- a/util/superiotool/nsc.c
+++ b/util/superiotool/nsc.c
@@ -25,7 +25,7 @@ static const char *familyid[] = {
[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 @@ void dump_ns8374(unsigned short port)
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) {
diff --git a/util/superiotool/smsc.c b/util/superiotool/smsc.c
index f836b94a99..7636001bc1 100644
--- a/util/superiotool/smsc.c
+++ b/util/superiotool/smsc.c
@@ -41,7 +41,7 @@ const static struct superio_registers reg_table[] = {
};
/* 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 dump_smsc(uint32_t port, uint32_t id)
}
}
-void probe_idregs_smsc(unsigned short port)
+void probe_idregs_smsc(uint16_t port)
{
uint16_t id, rev;
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index 3514b24415..e95f1baac6 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -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 @@ void dump_superio(const char *name, const struct superio_registers reg_table[],
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 @@ void dump_superio(const char *name, const struct superio_registers reg_table[],
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)
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index 4986ff167c..f4b2a85935 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -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}},