Root/
Source at commit 1407 created 12 years 10 months ago. By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
17 | * License for the specific language governing rights and limitations␊ |
18 | * under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | /*␊ |
23 | * ci.h - Headers for the OF Client Interface Library␊ |
24 | *␊ |
25 | * Copyright (c) 1998-2002 Apple Computer, Inc.␊ |
26 | *␊ |
27 | * DRI: Josh de Cesare␊ |
28 | */␊ |
29 | ␊ |
30 | #ifndef _BOOTX_CI_H_␊ |
31 | #define _BOOTX_CI_H_␊ |
32 | ␊ |
33 | #define kCINoError (0)␊ |
34 | #define kCIError (-1)␊ |
35 | #define kCICatch (-2)␊ |
36 | ␊ |
37 | typedef long CICell;␊ |
38 | ␊ |
39 | struct CIArgs {␊ |
40 | char *service;␊ |
41 | CICell nArgs;␊ |
42 | CICell nReturns;␊ |
43 | ␊ |
44 | union {␊ |
45 | struct {␉␉␉// nArgs=1 + args, nReturns=1 + rets␊ |
46 | const char *forth;␊ |
47 | CICell cells[6 + 1 + 6];␊ |
48 | } interpret;␊ |
49 | ␊ |
50 | struct {␉␉␉// nArgs=2 + args, nReturns=1 + rets␊ |
51 | const char *method;␊ |
52 | CICell iHandle;␊ |
53 | CICell cells[6 + 1 + 6];␊ |
54 | } callMethod;␊ |
55 | ␊ |
56 | struct {␉␉␉// nArgs=1, nReturns=1␉( device-specifier -- ihandle )␊ |
57 | char *devSpec;␉ // IN parameter␊ |
58 | CICell ihandle;␉␉// RETURN value␊ |
59 | } open;␊ |
60 | ␊ |
61 | struct {␉␉␉// nArgs=1, nReturns=0␉( ihandle -- )␊ |
62 | CICell ihandle;␉␉// IN parameter␊ |
63 | } close;␊ |
64 | ␊ |
65 | struct { // nArgs=3, nReturns=1 ( ihandle addr length -- actual )␊ |
66 | CICell ihandle;␊ |
67 | CICell addr;␊ |
68 | CICell length;␊ |
69 | CICell actual;␊ |
70 | } read;␊ |
71 | ␊ |
72 | struct { // nArgs=3, nReturns=1 ( ihandle addr length -- actual )␊ |
73 | CICell ihandle;␊ |
74 | CICell addr;␊ |
75 | CICell length;␊ |
76 | CICell actual;␊ |
77 | } write;␊ |
78 | ␊ |
79 | struct { // nArgs=3, nReturns=1 ( ihandle pos.high pos.low -- result )␊ |
80 | CICell ihandle;␊ |
81 | CICell pos_high;␊ |
82 | CICell pos_low;␊ |
83 | CICell result;␊ |
84 | } seek;␊ |
85 | ␊ |
86 | struct {␉␉␉// nArgs=3, nReturns=1␊ |
87 | CICell virt;␊ |
88 | CICell size;␊ |
89 | CICell align;␊ |
90 | CICell baseaddr;␊ |
91 | } claim;␊ |
92 | ␊ |
93 | struct {␉␉␉// nArgs=2, nReturns=0␊ |
94 | CICell virt;␊ |
95 | CICell size;␊ |
96 | } release;␊ |
97 | ␊ |
98 | struct {␉␉␉// nArgs=1, nReturns=1␉( phandle -- peer-phandle )␊ |
99 | CICell phandle;␉ // IN parameter␊ |
100 | CICell peerPhandle;␉// RETURN value␊ |
101 | } peer;␊ |
102 | ␊ |
103 | struct {␉␉␉// nArgs=1, nReturns=1␉( phandle -- child-phandle )␊ |
104 | CICell phandle;␉␉// IN parameter␊ |
105 | CICell childPhandle;␉// RETURN value␊ |
106 | } child;␊ |
107 | ␊ |
108 | struct {␉␉␉// nArgs=1, nReturns=1␉( phandle -- parent-phandle )␊ |
109 | CICell childPhandle;␉// IN parameter␊ |
110 | CICell parentPhandle;␉// RETURN value␊ |
111 | } parent;␊ |
112 | ␊ |
113 | struct {␉␉␉// nArgs=1, nReturns=1␉( devSpec -- phandle )␊ |
114 | char *devSpec;␉ // IN parameter␊ |
115 | CICell phandle;␉ // RETURN value␊ |
116 | } finddevice;␊ |
117 | ␊ |
118 | struct { // nArgs=3, nReturns=1 ( ihandle buf buflen -- length )␊ |
119 | CICell ihandle; // IN ihandle␊ |
120 | char *buf; // IN buf␊ |
121 | CICell buflen; // IN buflen␊ |
122 | CICell length; // RETURN length␊ |
123 | } instanceToPath;␊ |
124 | ␊ |
125 | struct { // nArgs=1, nReturns=1 ( ihandle -- phandle )␊ |
126 | CICell ihandle; // IN ihandle␊ |
127 | CICell phandle; // RETURN phandle␊ |
128 | } instanceToPackage;␊ |
129 | ␊ |
130 | struct { // nArgs=3, nReturns=1 ( phandle buf buflen -- length )␊ |
131 | CICell phandle; // IN phandle␊ |
132 | char *buf; // IN buf␊ |
133 | CICell buflen; // IN buflen␊ |
134 | CICell length; // RETURN length␊ |
135 | } packageToPath;␊ |
136 | ␊ |
137 | struct {␉␉␉// nArgs=2, nReturns=1␉( phandle name -- size )␊ |
138 | CICell phandle;␉␉// IN parameter␊ |
139 | char *name;␉␉// IN parameter␊ |
140 | CICell size;␉␉// RETURN value␊ |
141 | } getproplen;␊ |
142 | ␊ |
143 | struct {␉␉␉// nArgs=4, nReturns=1␉( phandle name buf buflen -- size )␊ |
144 | CICell phandle;␉␉// IN parameter␊ |
145 | char *name;␉␉// IN parameter␊ |
146 | char *buf;␉␉// IN parameter␊ |
147 | CICell buflen;␉␉// IN parameter␊ |
148 | CICell size;␉␉// RETURN value␊ |
149 | } getprop;␊ |
150 | ␊ |
151 | struct {␉␉␉// nArgs=3, nReturns=1␉( phandle previous buf -- flag )␊ |
152 | CICell phandle;␉␉// IN parameter␊ |
153 | char *previous;␉␉// IN parameter␊ |
154 | char *buf;␉␉// IN parameter␊ |
155 | CICell flag;␉␉// RETURN value␊ |
156 | } nextprop;␊ |
157 | ␊ |
158 | struct {␉␉␉// nArgs=4, nReturns=1␉( phandle name buf buflen -- size )␊ |
159 | CICell phandle;␉␉// IN parameter␊ |
160 | char *name;␉␉// IN parameter␊ |
161 | char *buf;␉␉// IN parameter␊ |
162 | CICell buflen;␉␉// IN parameter␊ |
163 | CICell size;␉␉// RETURN value␊ |
164 | } setprop;␊ |
165 | ␊ |
166 | struct {␉␉␉// nArgs=1, nReturns=0␊ |
167 | char *bootspec;␊ |
168 | } boot;␊ |
169 | } args;␊ |
170 | };␊ |
171 | typedef struct CIArgs CIArgs;␊ |
172 | ␊ |
173 | typedef long (*ClientInterfacePtr)(CIArgs *args);␊ |
174 | ␊ |
175 | // ci.c␊ |
176 | long InitCI(ClientInterfacePtr ciPtr);␊ |
177 | long CallCI(CIArgs *ciArgsPtr);␊ |
178 | ␊ |
179 | // Device Tree␊ |
180 | CICell Peer(CICell phandle);␊ |
181 | CICell Child(CICell phandle);␊ |
182 | CICell Parent(CICell phandle);␊ |
183 | CICell FindDevice(char *devSpec);␊ |
184 | CICell InstanceToPath(CICell ihandle, char *buf, long buflen);␊ |
185 | CICell InstanceToPackage(CICell ihandle);␊ |
186 | CICell PackageToPath(CICell phandle, char *buf, long buflen);␊ |
187 | CICell GetPropLen(CICell phandle, char *name);␊ |
188 | CICell GetProp(CICell phandle, char *name, char *buf, long buflen);␊ |
189 | CICell NextProp(CICell phandle, char *previous, char *buf);␊ |
190 | CICell SetProp(CICell phandle, char *name, char *buf, long buflen);␊ |
191 | ␊ |
192 | // Device I/O␊ |
193 | CICell Open(char *devSpec);␊ |
194 | void Close(CICell ihandle);␊ |
195 | CICell Read(CICell ihandle, long addr, long length);␊ |
196 | CICell Write(CICell ihandle, long addr, long length);␊ |
197 | CICell Seek(CICell ihandle, long long position);␊ |
198 | ␊ |
199 | // Call Method␊ |
200 | long CallMethod(long args, long rets, CICell iHandle, const char *method, ...);␊ |
201 | ␊ |
202 | // Memory␊ |
203 | CICell Claim(CICell virt, CICell size, CICell align);␊ |
204 | void Release(CICell virt, CICell size);␊ |
205 | ␊ |
206 | // Control Transfer␊ |
207 | void Boot(char *bootspec);␊ |
208 | void Enter(void);␊ |
209 | void Exit(void);␊ |
210 | void Quiesce(void);␊ |
211 | ␊ |
212 | // Interpret␊ |
213 | long Interpret(long args, long rets, const char *forthString, ...);␊ |
214 | ␊ |
215 | #endif /* ! _BOOTX_CI_H_ */␊ |
216 |