~ubuntu-branches/ubuntu/edgy/hwinfo/edgy

« back to all changes in this revision

Viewing changes to src/int10/v86bios.h

  • Committer: Bazaar Package Importer
  • Author(s): James Vega
  • Date: 2006-09-28 20:56:06 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060928205606-bgxl69hts04xbx51
Tags: 13.4-1
* New upstream version.
* Switch from dbs to quilt
  - Revamp debian/rules
  - Add quilt and remove dbs from Build-Depends in debian/control
* Remove reference to hwscan(8) from manpage. (closes: #388245)
* Re-wrote manpage from scratch.  Drop docbook-to-man from Build-Depends.
* Remove NEWS.Debian since it is no longer applicable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 1999 Egbert Eich
 
3
 *
 
4
 * Permission to use, copy, modify, distribute, and sell this software and its
 
5
 * documentation for any purpose is hereby granted without fee, provided that
 
6
 * the above copyright notice appear in all copies and that both that
 
7
 * copyright notice and this permission notice appear in supporting
 
8
 * documentation, and that the name of the authors not be used in
 
9
 * advertising or publicity pertaining to distribution of the software without
 
10
 * specific, written prior permission.  The authors makes no representations
 
11
 * about the suitability of this software for any purpose.  It is provided
 
12
 * "as is" without express or implied warranty.
 
13
 *
 
14
 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
15
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
16
 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
17
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
18
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
19
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
20
 * PERFORMANCE OF THIS SOFTWARE.
 
21
 */
 
22
#ifndef V86_BIOS_H
 
23
#define V86_BIOS_H
 
24
 
 
25
#if defined (__i386__) || defined (__i486__) || defined (__i586__) || defined (__i686__) || defined (__k6__)
 
26
# ifndef __ia32__
 
27
#  define __ia32__
 
28
# endif
 
29
#endif
 
30
 
 
31
#include <stdio.h>
 
32
 
 
33
#define p_printf(f,a...) do {if (Config.PrintPort) lprintf(f,##a);} \
 
34
                         while(0)
 
35
#define i_printf(f,a...) do  {if (Config.PrintIrq) lprintf(f,##a);} \
 
36
                          while(0)
 
37
#define P_printf(f,a...) do {if (Config.PrintPci) lprintf(f,##a);} \
 
38
                          while(0)
 
39
 
 
40
typedef unsigned char CARD8;
 
41
typedef unsigned short CARD16;
 
42
typedef unsigned int CARD32;
 
43
#if defined (__alpha__) || defined (__ia64__)
 
44
typedef unsigned long memType;
 
45
#else
 
46
typedef unsigned int memType;
 
47
#endif
 
48
 
 
49
typedef int Bool;
 
50
 
 
51
#define FALSE 0
 
52
#define TRUE 1
 
53
 
 
54
struct config {
 
55
    Bool PrintPort;
 
56
    Bool IoStatistics;
 
57
    Bool PrintIrq;
 
58
    Bool PrintPci;
 
59
    Bool ShowAllDev;
 
60
    Bool PrintIp;
 
61
    Bool SaveBios;
 
62
    Bool Trace;
 
63
    Bool ConfigActiveOnly;
 
64
    Bool ConfigActiveDevice;
 
65
    Bool MapSysBios;
 
66
    Bool Resort;
 
67
    Bool FixRom;
 
68
    Bool NoConsole;         
 
69
    Bool BootOnly;
 
70
    int  Verbose;
 
71
};
 
72
 
 
73
struct pio {
 
74
        CARD8 (*inb)(CARD16);
 
75
        CARD16 (*inw)(CARD16);
 
76
        CARD32 (*inl)(CARD16);
 
77
        void (*outb)(CARD16,CARD8);
 
78
        void (*outw)(CARD16,CARD16);
 
79
        void (*outl)(CARD16,CARD32);
 
80
};
 
81
 
 
82
struct regs86 {
 
83
                long ebx;
 
84
                long ecx;
 
85
                long edx;
 
86
                long esi;
 
87
                long edi;
 
88
                long ebp;
 
89
                long eax;
 
90
                long eip;
 
91
                long esp;
 
92
                unsigned short cs;
 
93
                unsigned short ss;
 
94
                unsigned short es;
 
95
                unsigned short ds;
 
96
                unsigned short fs;
 
97
                unsigned short gs;
 
98
        long eflags;
 
99
};
 
100
 
 
101
typedef struct {
 
102
    CARD32 ax;
 
103
    CARD32 bx;
 
104
    CARD32 cx;
 
105
    CARD32 dx;
 
106
    CARD32 cs;
 
107
    CARD32 es;
 
108
    CARD32 ds;
 
109
    CARD32 si;
 
110
    CARD32 di;
 
111
} i86biosRegs, *i86biosRegsPtr;
 
112
 
 
113
typedef struct {
 
114
        int fd;
 
115
        int vt;
 
116
} console;
 
117
 
 
118
typedef struct {
 
119
    void* address;
 
120
    CARD8 orgval;
 
121
} haltpoints;
 
122
 
 
123
enum dev_type {  NONE, ISA, PCI };
 
124
struct device {
 
125
    Bool booted;
 
126
    enum dev_type type;
 
127
        union {
 
128
          int none;
 
129
          struct pci {
 
130
                int bus;
 
131
                int dev;
 
132
                int func;
 
133
          } pci;
 
134
        } loc;
 
135
};
 
136
 
 
137
extern struct device Device;
 
138
 
 
139
#ifdef __alpha__
 
140
unsigned long _bus_base(void);
 
141
extern void* vram_map;
 
142
extern int sparse_shift;
 
143
#endif
 
144
 
 
145
extern struct pio P;
 
146
extern struct config Config;
 
147
#define IOPERM_BITS 1024
 
148
extern int ioperm_list[IOPERM_BITS];
 
149
 
 
150
extern void setup_io(void);
 
151
extern void do_x86(unsigned long bios_start,i86biosRegsPtr regs, int cpuemu);
 
152
extern int run_bios_int(int num, struct regs86 *regs);
 
153
extern CARD32 getIntVect(int num);
 
154
CARD32 getIP(void);
 
155
 
 
156
extern void call_boot(struct device *dev);
 
157
extern void runINT(int num,i86biosRegsPtr Regs);
 
158
extern void add_hlt(unsigned long addr);
 
159
extern void del_hlt(int addr);
 
160
extern void list_hlt();
 
161
 
 
162
extern int port_rep_inb(CARD16 port, CARD8 *base, int d_f, CARD32 count);
 
163
extern int port_rep_inw(CARD16 port, CARD16 *base, int d_f, CARD32 count);
 
164
extern int port_rep_inl(CARD16 port, CARD32 *base, int d_f, CARD32 count);
 
165
extern int port_rep_outb(CARD16 port, CARD8 *base, int d_f, CARD32 count);
 
166
extern int port_rep_outw(CARD16 port, CARD16 *base, int d_f, CARD32 count);
 
167
extern int port_rep_outl(CARD16 port, CARD32 *base, int d_f, CARD32 count);
 
168
extern CARD8 p_inb(CARD16 port);
 
169
extern CARD16 p_inw(CARD16 port);
 
170
extern CARD32 p_inl(CARD16 port);
 
171
extern void p_outb(CARD16 port, CARD8 val);
 
172
extern void p_outw(CARD16 port, CARD16 val);
 
173
extern void p_outl(CARD16 port, CARD32 val);
 
174
#ifdef __alpha__
 
175
extern CARD8 a_inb(CARD16 port);
 
176
extern CARD16 a_inw(CARD16 port);
 
177
extern void a_outb(CARD16 port, CARD8 val);
 
178
extern void a_outw(CARD16 port, CARD16 val);
 
179
#endif
 
180
#ifdef __alpha__
 
181
CARD8 mem_rb(CARD32 addr);
 
182
CARD16 mem_rw(CARD32 addr);
 
183
CARD32 mem_rl(CARD32 addr);
 
184
void mem_wb(CARD32 addr, CARD8 val);
 
185
void mem_ww(CARD32 addr, CARD16 val);
 
186
void mem_wl(CARD32 addr, CARD32 val);
 
187
#endif
 
188
extern void io_statistics(void);
 
189
extern void clear_stat(void);
 
190
extern int int_handler(int num, struct regs86 *regs);
 
191
 
 
192
extern console open_console(void);
 
193
extern void close_console(console);
 
194
 
 
195
extern void dprint(unsigned long start, unsigned long size);
 
196
 
 
197
extern Bool logging;
 
198
extern Bool nostdout;
 
199
extern char* logfile;
 
200
extern void logon(void* ptr);
 
201
extern void logoff();
 
202
extern void lprintf(const char *f, ...);
 
203
 
 
204
#define MEM_FILE "/dev/mem"
 
205
#define DEFAULT_V_BIOS 0xc0000
 
206
#ifndef V_BIOS
 
207
#define V_BIOS DEFAULT_V_BIOS
 
208
#endif
 
209
 
 
210
#ifdef __alpha__
 
211
#define NEED_PCI_IO
 
212
#endif
 
213
 
 
214
#endif
 
215