Make 'struct superio_registers' globally available, pretty much
[coreboot.git] / util / superiotool / superiotool.h
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2007 Carl-Daniel Hailfinger
5  * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21
22 #ifndef SUPERIOTOOL_H
23 #define SUPERIOTOOL_H
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <sys/io.h>
28
29 #define EOT             -1              /* End Of Table */
30 #define NOLDN           -2              /* NO LDN needed */
31 #define NANA            -3              /* Not Available */
32 #define MAXNAMELEN      20              /* Maximum Name Length */
33 #define MAXLDN          0xa             /* Biggest LDN */
34 #define LDNSIZE         (MAXLDN + 3)    /* Biggest LDN + 0 + NOLDN + EOT */
35 #define MAXNUMIDX       70              /* Maximum number of indexes */
36 #define IDXSIZE         (MAXNUMIDX + 1)
37
38 struct superio_registers {
39         /* Yes, superio_id should be unsigned, but EOT has to be negative. */
40         signed short superio_id;
41         const char name[MAXNAMELEN];
42         struct ite_ldnidx {
43                 signed short ldn;
44                 signed short idx[IDXSIZE];
45                 signed short def[IDXSIZE];
46         } ldn[LDNSIZE];
47 };
48
49 /* superiotool.c */
50 unsigned char regval(unsigned short port, unsigned char reg);
51 void regwrite(unsigned short port, unsigned char reg, unsigned char val);
52 void probe_superio(unsigned short port);
53
54 /* fintek.c */
55 void dump_fintek(unsigned short port, unsigned int did);
56 void probe_idregs_fintek(unsigned short port);
57
58 /* ite.c */
59 void dump_ite(unsigned short port, unsigned short id);
60 void probe_idregs_ite(unsigned short port);
61
62 /* nsc.c */
63 void dump_ns8374(unsigned short port);
64 void probe_idregs_simple(unsigned short port);
65
66 #endif