1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the "License"). You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | ␊ |
25 | #ifndef __LIBSAIO_SAIO_INTERNAL_H␊ |
26 | #define __LIBSAIO_SAIO_INTERNAL_H␊ |
27 | ␊ |
28 | #include "saio_types.h"␊ |
29 | ␊ |
30 | /* arc4random.c */␊ |
31 | extern void arc4_init(void);␊ |
32 | extern void arc4rand(void *ptr, u_int len, int reseed);␊ |
33 | extern uint32_t arc4random(void);␊ |
34 | ␊ |
35 | /* asm.s */␊ |
36 | extern void real_to_prot(void);␊ |
37 | extern void prot_to_real(void);␊ |
38 | extern void halt(void);␊ |
39 | extern void startprog(unsigned int address, void *arg);␊ |
40 | #ifdef NBP_SUPPORT␊ |
41 | extern void loader(UInt32 code, UInt32 cmdptr);␊ |
42 | #endif␊ |
43 | ␊ |
44 | /* bios.s */␊ |
45 | extern void bios(biosBuf_t *bb);␊ |
46 | ␊ |
47 | /* biosfn.c */␊ |
48 | #ifdef EISA_SUPPORT␊ |
49 | extern bool eisa_present(void);␊ |
50 | #endif␊ |
51 | extern int bgetc(void);␊ |
52 | extern int biosread(int dev, int cyl, int head, int sec, int num);␊ |
53 | extern int ebiosread(int dev, unsigned long long sec, int count);␊ |
54 | extern int ebioswrite(int dev, long sec, int count);␊ |
55 | extern int get_drive_info(int drive, struct driveInfo *dp);␊ |
56 | extern int ebiosEjectMedia(int biosdev);␊ |
57 | extern void putc(int ch);␊ |
58 | extern void putca(int ch, int attr, int repeat);␊ |
59 | extern int getc(void);␊ |
60 | extern void pause();␊ |
61 | extern int readKeyboardStatus(void);␊ |
62 | extern int readKeyboardShiftFlags(void);␊ |
63 | extern unsigned int time18(void);␊ |
64 | extern void delay(int ms);␊ |
65 | extern unsigned int get_diskinfo(int dev);␊ |
66 | #if APM_SUPPORT␊ |
67 | extern int APMPresent(void);␊ |
68 | extern int APMConnect32(void);␊ |
69 | #endif␊ |
70 | extern int memsize(int i);␊ |
71 | extern void video_mode(int mode);␊ |
72 | extern void setCursorPosition(int x, int y, int page);␊ |
73 | extern void setCursorType(int type);␊ |
74 | extern void getCursorPositionAndType(int *x, int *y, int *type);␊ |
75 | extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);␊ |
76 | extern void clearScreenRows(int y1, int y2);␊ |
77 | extern void setActiveDisplayPage( int page );␊ |
78 | extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount,␊ |
79 | unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);␊ |
80 | extern unsigned long getExtendedMemorySize(void);␊ |
81 | extern unsigned long getConventionalMemorySize(void);␊ |
82 | extern void sleep(int n);␊ |
83 | extern time_t time(time_t *t);␊ |
84 | extern int is_no_emulation(int drive);␊ |
85 | ␊ |
86 | /* bootstruct.c */␊ |
87 | extern void initKernBootStruct(void);␊ |
88 | extern void copyKernBootStruct(void);␊ |
89 | extern void finalizeBootStruct(void);␊ |
90 | extern void reserveKernLegacyBootStruct(void);␊ |
91 | extern void reserveKern107BootStruct(void);␊ |
92 | extern void reserveKern108BootStruct(void);␊ |
93 | extern void setBootArgsVideoMode(int mode);␊ |
94 | extern void setBootArgsVideoStruct(Boot_Video␉*Video);␊ |
95 | extern uint32_t getVideoMode(void);␊ |
96 | extern boot_args_common * getBootArgs(void);␊ |
97 | ␊ |
98 | ␊ |
99 | /* cache.c */␊ |
100 | extern void CacheReset();␊ |
101 | extern void CacheInit(CICell ih, long blockSize);␊ |
102 | extern long CacheRead(CICell ih, char *buffer, long long offset,␊ |
103 | long length, long cache);␊ |
104 | ␊ |
105 | /* console.c */␊ |
106 | extern bool gVerboseMode;␊ |
107 | extern bool gErrors;␊ |
108 | extern void initBooterLog(void);␊ |
109 | extern void setupBooterLog(void);␊ |
110 | extern void putchar(int ch);␊ |
111 | extern int getchar(void);␊ |
112 | extern void msglog(const char * format, ...);␊ |
113 | extern int printf(const char *format, ...);␊ |
114 | extern int error(const char *format, ...);␊ |
115 | extern int verbose(const char *format, ...);␊ |
116 | extern void stop(const char *format, ...);␊ |
117 | extern char * newStringWithFormat(const char * fmt, ...);␊ |
118 | extern char *getConsoleMsg(void);␊ |
119 | extern char *getConsoleCursor(void);␊ |
120 | extern void setConsoleMsg(char *p);␊ |
121 | extern void setConsoleCursor(char *p);␊ |
122 | extern void pause(void); ␊ |
123 | ␊ |
124 | /* disk.c */␊ |
125 | extern void rescanBIOSDevice(int biosdev);␊ |
126 | extern struct DiskBVMap* diskResetBootVolumes(int biosdev);␊ |
127 | extern void diskFreeMap(struct DiskBVMap *map);␊ |
128 | extern int testBiosread( int biosdev, unsigned long long secno );␊ |
129 | extern BVRef diskScanBootVolumes(int biosdev, int *count);␊ |
130 | extern void diskSeek(BVRef bvr, long long position);␊ |
131 | extern int diskRead(BVRef bvr, long addr, long length);␊ |
132 | extern int diskIsCDROM(BVRef bvr);␊ |
133 | extern int biosDevIsCDROM(int biosdev);␊ |
134 | extern BVRef getBVChainForBIOSDev(int biosdev);␊ |
135 | extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);␊ |
136 | extern int freeFilteredBVChain(const BVRef chain);␊ |
137 | extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
138 | extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
139 | extern int readBootSector(int biosdev, unsigned int secno, void *buffer);␊ |
140 | extern int␉ testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );␊ |
141 | ␊ |
142 | /* hfs_compare.c */␊ |
143 | extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,␊ |
144 | ␉␉␉␉␉␉␉␉ u_int16_t *uniStr2, u_int32_t len2, int byte_order);␊ |
145 | extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,␊ |
146 | ␉␉␉␉␉␉ u_int8_t * utf8p, u_int32_t bufsize, int byte_order );␊ |
147 | extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,␊ |
148 | ␉␉␉␉␉␉ u_int16_t *ucslen, u_int32_t bufsize, int byte_order );␊ |
149 | ␊ |
150 | /* load.c */␊ |
151 | extern bool gHaveKernelCache;␊ |
152 | extern long ThinFatFile(void **binary, unsigned long *length);␊ |
153 | extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
154 | ␊ |
155 | /*␊ |
156 | * lzss.c␊ |
157 | */␊ |
158 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
159 | ␊ |
160 | /* memory.c */␊ |
161 | long AllocateKernelMemory( long inSize );␊ |
162 | ␊ |
163 | long␊ |
164 | AllocateMemoryRange(char * rangeName, long start, long length);␊ |
165 | ␊ |
166 | /* misc.c */␊ |
167 | extern void enableA20(void);␊ |
168 | extern void turnOffFloppy(void);␊ |
169 | ␊ |
170 | extern void random_free (struct ran_obj* self);␊ |
171 | extern int random (struct ran_obj* self);␊ |
172 | extern struct ran_obj* random_init (int rmin, int rmax);␊ |
173 | extern void usefixedrandom (bool opt);␊ |
174 | ␊ |
175 | extern void getPlatformName(char *nameBuf);␊ |
176 | ␊ |
177 | #ifdef NBP_SUPPORT␊ |
178 | /* nbp.c */␊ |
179 | extern UInt32 nbpUnloadBaseCode();␊ |
180 | extern BVRef nbpScanBootVolumes(int biosdev, int *count);␊ |
181 | #endif␊ |
182 | ␊ |
183 | /* platform.c */␊ |
184 | extern void scan_platform(void);␊ |
185 | extern void SetgRootDevice(const char * str);␊ |
186 | extern void Setgboardproduct(const char * str);␊ |
187 | extern void SetgPlatformName(const char * str);␊ |
188 | extern char * GetgPlatformName(void);␊ |
189 | extern char * Getgboardproduct(void);␊ |
190 | extern char * GetgRootDevice(void);␊ |
191 | ␊ |
192 | #ifdef rootpath␊ |
193 | extern void SetgRootPath(const char * str);␊ |
194 | extern char * GetgRootPath(void);␊ |
195 | #endif␊ |
196 | ␊ |
197 | extern void re_set_env_copy(const char *name , void* ptr,size_t size);␊ |
198 | extern void set_env(const char *name, unsigned long long value );␊ |
199 | extern void set_env_copy(const char *name, void * ptr, size_t size );␊ |
200 | extern unsigned long long get_env_var(const char *name);␊ |
201 | extern unsigned long long get_env(const char *name);␊ |
202 | extern void * get_env_ptr(const char *name);␊ |
203 | extern void safe_set_env_copy(const char *name , void * ptr, size_t size );␊ |
204 | extern void safe_set_env(const char *name , unsigned long long value);␊ |
205 | extern void re_set_env(const char *name , unsigned long long value) ;␊ |
206 | extern void unset_env(const char *name);␊ |
207 | extern void free_platform_env(void);␊ |
208 | ␊ |
209 | void debug_platform_env(void);␊ |
210 | ␊ |
211 | ␊ |
212 | /* stringTable.c */␊ |
213 | extern char * newStringFromList(char **list, int *size);␊ |
214 | extern int stringLength(const char *table, int compress);␊ |
215 | extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);␊ |
216 | extern bool removeKeyFromTable(const char *key, char *table);␊ |
217 | extern char * newStringForStringTableKey(config_file_t *config, char *key);␊ |
218 | extern char * newStringForKey(char *key, config_file_t *configBuff);␊ |
219 | extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);␊ |
220 | extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);␊ |
221 | extern const char * getStringForKey(const char * key, config_file_t *config);␊ |
222 | extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);␊ |
223 | extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);␊ |
224 | extern bool getColorForKey(const char *key, unsigned int *val, config_file_t *configBuff);␊ |
225 | extern bool␉ getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size );␊ |
226 | extern int loadConfigFile(const char *configFile, config_file_t *configBuff);␊ |
227 | extern int loadBooterConfig(void);␊ |
228 | extern int loadSystemConfig(void);␊ |
229 | #ifdef BOOT_HELPER_SUPPORT␊ |
230 | extern int loadHelperConfig(void);␊ |
231 | #endif␊ |
232 | extern int loadOverrideConfig(void);␊ |
233 | extern char * newString(const char *oldString);␊ |
234 | extern char * newEmptyStringWithLength(int len);␊ |
235 | extern char * newStringWithLength(const char * oldString, int len);␊ |
236 | ␊ |
237 | extern char * getNextArg(char ** ptr, char * val);␊ |
238 | extern int␉ ParseXMLFile( char * buffer, TagPtr * dict );␊ |
239 | ␊ |
240 | /* sys.c */␊ |
241 | extern BVRef getBootVolumeRef( const char * path, const char ** outPath );␊ |
242 | extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);␊ |
243 | extern long LoadFile(const char *fileSpec);␊ |
244 | extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);␊ |
245 | extern long LoadThinFatFile(const char *fileSpec, void **binary);␊ |
246 | extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name,␊ |
247 | long *flags, long *time);␊ |
248 | extern long GetFileInfo(const char *dirSpec, const char *name,␊ |
249 | long *flags, long *time);␊ |
250 | extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);␊ |
251 | extern long GetFSUUID(char *spec, char *uuidStr);␊ |
252 | extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);␊ |
253 | extern int openmem(char *buf, int len);␊ |
254 | ␊ |
255 | extern int open(const char *path);␊ |
256 | extern int open_bvdev(const char *bvd, const char *path);␊ |
257 | ␊ |
258 | extern int close(int fdesc);␊ |
259 | extern int file_size(int fdesc);␊ |
260 | extern int read(int fdesc, char *buf, int count);␊ |
261 | extern int write(int fdesc, const char *buf, int count);␊ |
262 | extern int writebyte(int fdesc, char value);␊ |
263 | extern int writeint(int fdesc, int value);␊ |
264 | extern int b_lseek(int fdesc, int addr, int ptr);␊ |
265 | extern int tell(int fdesc);␊ |
266 | extern const char * systemConfigDir(void);␊ |
267 | extern struct dirstuff * opendir(const char *path);␊ |
268 | extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);␊ |
269 | extern int closedir(struct dirstuff *dirp);␊ |
270 | extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);␊ |
271 | extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,␊ |
272 | long * time, FinderInfo *finderInfo, long *infoValid);␊ |
273 | extern void flushdev(void);␊ |
274 | extern void scanBootVolumes(int biosdev, int *count);␊ |
275 | ␊ |
276 | extern void scanDisks(void);␊ |
277 | ␊ |
278 | extern BVRef selectBootVolume(BVRef chain);␊ |
279 | extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);␊ |
280 | extern void setRootVolume(BVRef volume);␊ |
281 | extern void setBootGlobals(BVRef chain);␊ |
282 | extern int getDeviceDescription(BVRef volume, char *str);␊ |
283 | ␊ |
284 | extern int gBootFileType;␊ |
285 | extern BVRef gBootVolume;␊ |
286 | extern BVRef gBIOSBootVolume;␊ |
287 | ␊ |
288 | /* smp.c */␊ |
289 | extern void * getMPSTable();␊ |
290 | ␊ |
291 | /* uterror.c */␊ |
292 | extern jmp_buf h_buf_error;␊ |
293 | extern void init_ut_fnc(void);␊ |
294 | ␊ |
295 | #endif /* !__LIBSAIO_SAIO_INTERNAL_H */␊ |
296 | |