Import upstream u-boot 1.1.4
[u-boot.git] / board / MAI / bios_emulator / scitech / src / common / gartt.c
1 /****************************************************************************
2 *
3 *                   SciTech Nucleus Graphics Architecture
4 *
5 *               Copyright (C) 1991-1998 SciTech Software, Inc.
6 *                            All rights reserved.
7 *
8 *  ======================================================================
9 *  |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
10 *  |                                                                    |
11 *  |This copyrighted computer code contains proprietary technology      |
12 *  |owned by SciTech Software, Inc., located at 505 Wall Street,        |
13 *  |Chico, CA 95928 USA (http://www.scitechsoft.com).                   |
14 *  |                                                                    |
15 *  |The contents of this file are subject to the SciTech Nucleus        |
16 *  |License; you may *not* use this file or related software except in  |
17 *  |compliance with the License. You may obtain a copy of the License   |
18 *  |at http://www.scitechsoft.com/nucleus-license.txt                   |
19 *  |                                                                    |
20 *  |Software distributed under the License is distributed on an         |
21 *  |"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or      |
22 *  |implied. See the License for the specific language governing        |
23 *  |rights and limitations under the License.                           |
24 *  |                                                                    |
25 *  |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
26 *  ======================================================================
27 *
28 * Language:     ANSI C
29 * Environment:  RTTarget-32
30 *
31 * Description:  OS specific Nucleus Graphics Architecture services for
32 *               the RTTarget-32 operating system environments.
33 *
34 ****************************************************************************/
35
36 #include "nucleus/graphics.h"
37
38 /*------------------------- Global Variables ------------------------------*/
39
40 static ibool            haveRDTSC;
41
42 /*-------------------------- Implementation -------------------------------*/
43
44 /****************************************************************************
45 PARAMETERS:
46 path    - Local path to the Nucleus driver files.
47
48 REMARKS:
49 This function is used by the application program to override the location
50 of the Nucleus driver files that are loaded. Normally the loader code
51 will look in the system Nucleus directories first, then in the 'drivers'
52 directory relative to the current working directory, and finally relative
53 to the MGL_ROOT environment variable.
54 ****************************************************************************/
55 void NAPI GA_setLocalPath(
56     const char *path)
57 {
58     PM_setLocalBPDPath(path);
59 }
60
61 /****************************************************************************
62 RETURNS:
63 Pointer to the system wide PM library imports, or the internal version if none
64
65 REMARKS:
66 In order to support deploying new Nucleus drivers that may require updated
67 PM library functions, we check here to see if there is a system wide version
68 of the PM functions available. If so we return those functions for use with
69 the system wide Nucleus drivers, otherwise the compiled in version of the PM
70 library is used with the application local version of Nucleus.
71 ****************************************************************************/
72 PM_imports * NAPI GA_getSystemPMImports(void)
73 {
74     return &_PM_imports;
75 }
76
77 /****************************************************************************
78 REMARKS:
79 Nothing special for this OS.
80 ****************************************************************************/
81 ibool NAPI GA_getSharedExports(
82     GA_exports *gaExp,
83     ibool shared)
84 {
85     (void)gaExp;
86     (void)shared;
87     return false;
88 }
89
90 #ifndef TEST_HARNESS
91 /****************************************************************************
92 REMARKS:
93 Nothing special for this OS
94 ****************************************************************************/
95 ibool NAPI GA_queryFunctions(
96     GA_devCtx *dc,
97     N_uint32 id,
98     void _FAR_ *funcs)
99 {
100     return __GA_exports.GA_queryFunctions(dc,id,funcs);
101 }
102
103 /****************************************************************************
104 REMARKS:
105 Nothing special for this OS
106 ****************************************************************************/
107 ibool NAPI REF2D_queryFunctions(
108     REF2D_driver *ref2d,
109     N_uint32 id,
110     void _FAR_ *funcs)
111 {
112     return __GA_exports.REF2D_queryFunctions(ref2d,id,funcs);
113 }
114 #endif
115
116 /****************************************************************************
117 REMARKS:
118 This function initialises the high precision timing functions for the
119 Nucleus loader library.
120 ****************************************************************************/
121 ibool NAPI GA_TimerInit(void)
122 {
123     if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
124         haveRDTSC = true;
125         return true;
126         }
127     return false;
128 }
129
130 /****************************************************************************
131 REMARKS:
132 This function reads the high resolution timer.
133 ****************************************************************************/
134 void NAPI GA_TimerRead(
135     GA_largeInteger *value)
136 {
137     if (haveRDTSC)
138         _GA_readTimeStamp(value);
139 }