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
This commit is contained in:
Uwe Hermann 2007-09-19 00:03:14 +00:00
parent d754d2c6c4
commit de24a0e585
7 changed files with 42 additions and 44 deletions

View File

@ -24,9 +24,9 @@ CC = gcc
INSTALL = /usr/bin/install INSTALL = /usr/bin/install
PREFIX = /usr/local PREFIX = /usr/local
# TODO: -ansi, -pedantic # TODO: -pedantic
CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \ 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 OBJS = superiotool.o fintek.o ite.o nsc.o smsc.o

View File

@ -20,7 +20,7 @@
#include "superiotool.h" #include "superiotool.h"
void dump_fintek(unsigned short port, unsigned int did) void dump_fintek(uint16_t port, uint16_t did)
{ {
switch (did) { switch (did) {
case 0x0604: case 0x0604:
@ -89,9 +89,9 @@ void dump_fintek(unsigned short port, unsigned int did)
regval(port, 0xf6), regval(port, 0xf7), regval(port, 0xf8)); 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) /* Enable configuration sequence (Fintek uses this for example)
* Older ITE chips have the same enable sequence. * Older ITE chips have the same enable sequence.

View File

@ -187,7 +187,7 @@ const static struct superio_registers reg_table[] = {
{EOT} {EOT}
}; };
void dump_ite(unsigned short port, unsigned short id) void dump_ite(uint16_t port, uint16_t id)
{ {
int i; 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) /* Enable configuration sequence (ITE uses this for newer IT87[012]x)
* IT871[01] uses 0x87, 0x87 -> fintek detection should handle it * IT871[01] uses 0x87, 0x87 -> fintek detection should handle it

View File

@ -25,7 +25,7 @@ static const char *familyid[] = {
[0xf1] = "PC8374 (Winbond/NatSemi)" [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", printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n",
regval(port, 0x21), regval(port, 0x22), regval(port, 0x23), regval(port, 0x21), regval(port, 0x22), regval(port, 0x23),
@ -56,9 +56,9 @@ void dump_ns8374(unsigned short port)
regval(port, 0xf0)); 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); outb(0x20, port);
if (inb(port) != 0x20) { if (inb(port) != 0x20) {

View File

@ -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. */ /* 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) { switch (id) {
case 0x28: 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; uint16_t id, rev;

View File

@ -22,23 +22,23 @@
#include "superiotool.h" #include "superiotool.h"
unsigned char regval(unsigned short port, unsigned char reg) uint8_t regval(uint16_t port, uint8_t reg)
{ {
outb(reg, port); outb(reg, port);
return inb(port + 1); 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(reg, port);
outb(val, port + 1); outb(val, port + 1);
} }
void dump_superio(const char *name, const struct superio_registers reg_table[], 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; int i, j, k;
signed short *idx; int *idx;
printf("%s ", name); 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) if (reg_table[i].superio_id == EOT)
break; break;
if ((unsigned short)reg_table[i].superio_id != id) if ((uint16_t)reg_table[i].superio_id != id)
continue; continue;
printf("%s\n", reg_table[i].name); printf("%s\n", reg_table[i].name);
for (j = 0;; j++) { for (j = 0; /* Nothing */; j++) {
if (reg_table[i].ldn[j].ldn == EOT) if (reg_table[i].ldn[j].ldn == EOT)
break; break;
if (reg_table[i].ldn[j].ldn != NOLDN) { 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); reg_table[i].ldn[j].ldn);
regwrite(port, 0x07, reg_table[i].ldn[j].ldn);
} }
idx = reg_table[i].ldn[j].idx; idx = reg_table[i].ldn[j].idx;
printf("idx "); printf("idx ");
for (k = 0;; k++) { for (k = 0; /* Nothing */; k++) {
if (idx[k] == EOT) if (idx[k] == EOT)
break; break;
printf("%02x ", idx[k]); printf("%02x ", idx[k]);
} }
printf("\nval "); printf("\nval ");
for (k = 0;; k++) { for (k = 0; /* Nothing */; k++) {
if (idx[k] == EOT) if (idx[k] == EOT)
break; break;
printf("%02x ", regval(port, idx[k])); printf("%02x ", regval(port, idx[k]));
@ -80,7 +79,7 @@ void dump_superio(const char *name, const struct superio_registers reg_table[],
printf("\ndef "); printf("\ndef ");
idx = reg_table[i].ldn[j].def; idx = reg_table[i].ldn[j].def;
for (k = 0;; k++) { for (k = 0; /* Nothing */; k++) {
if (idx[k] == EOT) if (idx[k] == EOT)
break; break;
else if (idx[k] == NANA) else if (idx[k] == NANA)

View File

@ -41,43 +41,42 @@
#define MAXNUMPORTS (2 + 1) /* Maximum number of Super I/O ports */ #define MAXNUMPORTS (2 + 1) /* Maximum number of Super I/O ports */
struct superio_registers { struct superio_registers {
/* Yes, superio_id should be unsigned, but EOT has to be negative. */ int32_t superio_id; /* Signed, as we need EOT. */
signed short superio_id;
const char name[MAXNAMELEN]; const char name[MAXNAMELEN];
struct { struct {
signed short ldn; int ldn;
signed short idx[IDXSIZE]; int idx[IDXSIZE];
signed short def[IDXSIZE]; int def[IDXSIZE];
} ldn[LDNSIZE]; } ldn[LDNSIZE];
}; };
/* superiotool.c */ /* superiotool.c */
unsigned char regval(unsigned short port, unsigned char reg); uint8_t regval(uint16_t port, uint8_t reg);
void regwrite(unsigned short port, unsigned char reg, unsigned char val); void regwrite(uint16_t port, uint8_t reg, uint8_t val);
void dump_superio(const char *name, const struct superio_registers reg_table[], void dump_superio(const char *name, const struct superio_registers reg_table[],
unsigned short port, unsigned short id); uint16_t port, uint16_t id);
void probe_superio(unsigned short port); void probe_superio(uint16_t port);
/* fintek.c */ /* fintek.c */
void dump_fintek(unsigned short port, unsigned int did); void dump_fintek(uint16_t port, uint16_t did);
void probe_idregs_fintek(unsigned short port); void probe_idregs_fintek(uint16_t port);
/* ite.c */ /* ite.c */
void dump_ite(unsigned short port, unsigned short id); void dump_ite(uint16_t port, uint16_t id);
void probe_idregs_ite(unsigned short port); void probe_idregs_ite(uint16_t port);
/* nsc.c */ /* nsc.c */
void dump_ns8374(unsigned short port); void dump_ns8374(uint16_t port);
void probe_idregs_simple(unsigned short port); void probe_idregs_simple(uint16_t port);
/* smsc.c */ /* smsc.c */
void dump_smsc(uint32_t port, uint32_t id); void dump_smsc(uint16_t port, uint16_t id);
void probe_idregs_smsc(unsigned short port); void probe_idregs_smsc(uint16_t port);
/** Table of which config ports to probe on each Super I/O. */ /** Table of which config ports to probe on each Super I/O. */
const static struct { const static struct {
void (*probe_idregs) (unsigned short port); void (*probe_idregs) (uint16_t port);
signed short ports[MAXNUMPORTS]; /* Signed, as we need EOT. */ int ports[MAXNUMPORTS]; /* Signed, as we need EOT. */
} superio_ports_table[] = { } superio_ports_table[] = {
{probe_idregs_simple, {0x2e, 0x4e, EOT}}, {probe_idregs_simple, {0x2e, 0x4e, EOT}},
{probe_idregs_fintek, {0x2e, 0x4e, EOT}}, {probe_idregs_fintek, {0x2e, 0x4e, EOT}},