summaryrefslogtreecommitdiffstats
path: root/board/MAI/bios_emulator/scitech/include/biosemu.h
blob: e38ff3157f09864d33fa5eaa9c3d9225e4800796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/****************************************************************************
*
*                        BIOS emulator and interface
*                      to Realmode X86 Emulator Library
*
*               Copyright (C) 1996-1999 SciTech Software, Inc.
*
*  ========================================================================
*
*  Permission to use, copy, modify, distribute, and sell this software and
*  its documentation for any purpose is hereby granted without fee,
*  provided that the above copyright notice appear in all copies and that
*  both that copyright notice and this permission notice appear in
*  supporting documentation, and that the name of the authors not be used
*  in advertising or publicity pertaining to distribution of the software
*  without specific, written prior permission.  The authors makes no
*  representations about the suitability of this software for any purpose.
*  It is provided "as is" without express or implied warranty.
*
*  THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
*  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
*  EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
*  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
*  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
*  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
*  PERFORMANCE OF THIS SOFTWARE.
*
*  ========================================================================
*
* Language:     ANSI C
* Environment:  Any
* Developer:    Kendall Bennett
*
* Description:  Header file for the real mode x86 BIOS emulator, which is
*               used to warmboot any number of VGA compatible PCI/AGP
*               controllers under any OS, on any processor family that
*               supports PCI. We also allow the user application to call
*               real mode BIOS functions and Int 10h functions (including
*               the VESA BIOS).
*
****************************************************************************/

#ifndef __BIOSEMU_H
#define __BIOSEMU_H

#include "x86emu.h"
#include "pmapi.h"
#include "pcilib.h"

/*---------------------- Macros and type definitions ----------------------*/

#pragma pack(1)

/****************************************************************************
REMARKS:
Data structure used to describe the details specific to a particular VGA
controller. This information is used to allow the VGA controller to be
swapped on the fly within the BIOS emulator.

HEADER:
biosemu.h

MEMBERS:
pciInfo         - PCI device information block for the controller
BIOSImage       - Pointer to a read/write copy of the BIOS image
BIOSImageLen    - Length of the BIOS image
LowMem          - Copy of key low memory areas
****************************************************************************/
typedef struct {
    PCIDeviceInfo   *pciInfo;
    void            *BIOSImage;
    ulong           BIOSImageLen;
    uchar           LowMem[1536];
    } BE_VGAInfo;

/****************************************************************************
REMARKS:
Data structure used to describe the details for the BIOS emulator system
environment as used by the X86 emulator library.

HEADER:
biosemu.h

MEMBERS:
vgaInfo         - VGA BIOS information structure
biosmem_base    - Base of the BIOS image
biosmem_limit   - Limit of the BIOS image
busmem_base     - Base of the VGA bus memory
****************************************************************************/
typedef struct {
    BE_VGAInfo      vgaInfo;
    ulong           biosmem_base;
    ulong           biosmem_limit;
    ulong           busmem_base;
    } BE_sysEnv;

/****************************************************************************
REMARKS:
Structure defining all the BIOS Emulator API functions as exported from
the Binary Portable DLL.
{secret}
****************************************************************************/
typedef struct {
    ulong   dwSize;
    ibool   (PMAPIP BE_init)(u32 debugFlags,int memSize,BE_VGAInfo *info);
    void    (PMAPIP BE_setVGA)(BE_VGAInfo *info);
    void    (PMAPIP BE_getVGA)(BE_VGAInfo *info);
    void *  (PMAPIP BE_mapRealPointer)(uint r_seg,uint r_off);
    void *  (PMAPIP BE_getVESABuf)(uint *len,uint *rseg,uint *roff);
    void    (PMAPIP BE_callRealMode)(uint seg,uint off,RMREGS *regs,RMSREGS *sregs);
    int     (PMAPIP BE_int86)(int intno,RMREGS *in,RMREGS *out);
    int     (PMAPIP BE_int86x)(int intno,RMREGS *in,RMREGS *out,RMSREGS *sregs);
    void *  reserved1;
    void    (PMAPIP BE_exit)(void);
    } BE_exports;

/****************************************************************************
REMARKS:
Function pointer type for the Binary Portable DLL initialisation entry point.
{secret}
****************************************************************************/
typedef BE_exports * (PMAPIP BE_initLibrary_t)(PM_imports *PMImp);

#pragma pack()

/*---------------------------- Global variables ---------------------------*/

#ifdef  __cplusplus
extern "C" {                        /* Use "C" linkage when in C++ mode */
#endif

/* {secret} Global BIOS emulator system environment */
extern BE_sysEnv _BE_env;

/*-------------------------- Function Prototypes --------------------------*/

/* BIOS emulator library entry points */

ibool   PMAPI BE_init(u32 debugFlags,int memSize,BE_VGAInfo *info);
void    PMAPI BE_setVGA(BE_VGAInfo *info);
void    PMAPI BE_getVGA(BE_VGAInfo *info);
void    PMAPI BE_setDebugFlags(u32 debugFlags);
void *  PMAPI BE_mapRealPointer(uint r_seg,uint r_off);
void *  PMAPI BE_getVESABuf(uint *len,uint *rseg,uint *roff);
void    PMAPI BE_callRealMode(uint seg,uint off,RMREGS *regs,RMSREGS *sregs);
int     PMAPI BE_int86(int intno,RMREGS *in,RMREGS *out);
int     PMAPI BE_int86x(int intno,RMREGS *in,RMREGS *out,RMSREGS *sregs);
void    PMAPI BE_exit(void);

#ifdef  __cplusplus
}                                   /* End of "C" linkage for C++       */
#endif

#endif /* __BIOSEMU_H */

OpenPOWER on IntegriCloud