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 arc4rand(void *ptr, u_int len, int reseed);␊ |
32 | extern uint32_t arc4random(void);␊ |
33 | ␊ |
34 | /* asm.s */␊ |
35 | extern void real_to_prot(void);␊ |
36 | extern void prot_to_real(void);␊ |
37 | extern void halt(void);␊ |
38 | extern void startprog(unsigned int address, void *arg);␊ |
39 | #ifdef NBP_SUPPORT␊ |
40 | extern void loader(UInt32 code, UInt32 cmdptr);␊ |
41 | #endif␊ |
42 | ␊ |
43 | /* bios.s */␊ |
44 | extern void bios(biosBuf_t *bb);␊ |
45 | ␊ |
46 | /* biosfn.c */␊ |
47 | #ifdef EISA_SUPPORT␊ |
48 | extern bool eisa_present(void);␊ |
49 | #endif␊ |
50 | extern int bgetc(void);␊ |
51 | extern int biosread(int dev, int cyl, int head, int sec, int num);␊ |
52 | extern int ebiosread(int dev, unsigned long long sec, int count);␊ |
53 | extern int ebioswrite(int dev, long sec, int count);␊ |
54 | extern int get_drive_info(int drive, struct driveInfo *dp);␊ |
55 | extern int ebiosEjectMedia(int biosdev);␊ |
56 | extern void putc(int ch);␊ |
57 | extern void putca(int ch, int attr, int repeat);␊ |
58 | extern int getc(void);␊ |
59 | extern void pause();␊ |
60 | extern int readKeyboardStatus(void);␊ |
61 | extern int readKeyboardShiftFlags(void);␊ |
62 | extern unsigned int time18(void);␊ |
63 | extern void delay(int ms);␊ |
64 | extern unsigned int get_diskinfo(int dev);␊ |
65 | #if APM_SUPPORT␊ |
66 | extern int APMPresent(void);␊ |
67 | extern int APMConnect32(void);␊ |
68 | #endif␊ |
69 | extern int memsize(int i);␊ |
70 | extern void video_mode(int mode);␊ |
71 | extern void setCursorPosition(int x, int y, int page);␊ |
72 | extern void setCursorType(int type);␊ |
73 | extern void getCursorPositionAndType(int *x, int *y, int *type);␊ |
74 | extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);␊ |
75 | extern void clearScreenRows(int y1, int y2);␊ |
76 | extern void setActiveDisplayPage( int page );␊ |
77 | extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount,␊ |
78 | unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);␊ |
79 | extern unsigned long getExtendedMemorySize();␊ |
80 | extern unsigned long getConventionalMemorySize();␊ |
81 | extern void sleep(int n);␊ |
82 | ␊ |
83 | /* bootstruct.c */␊ |
84 | extern void initKernBootStruct(void);␊ |
85 | extern void copyKernBootStruct(void);␊ |
86 | extern void finalizeBootStruct(void);␊ |
87 | extern void reserveKernLegacyBootStruct(void);␊ |
88 | extern void reserveKern107BootStruct(void);␊ |
89 | ␊ |
90 | /* cache.c */␊ |
91 | extern void CacheReset();␊ |
92 | extern void CacheInit(CICell ih, long blockSize);␊ |
93 | extern long CacheRead(CICell ih, char *buffer, long long offset,␊ |
94 | long length, long cache);␊ |
95 | ␊ |
96 | /* console.c */␊ |
97 | extern bool gVerboseMode;␊ |
98 | extern bool gErrors;␊ |
99 | extern void initBooterLog(void);␊ |
100 | extern void setupBooterLog(void);␊ |
101 | extern void putchar(int ch);␊ |
102 | extern int getchar(void);␊ |
103 | extern void msglog(const char * format, ...);␊ |
104 | extern int printf(const char *format, ...);␊ |
105 | extern int error(const char *format, ...);␊ |
106 | extern int verbose(const char *format, ...);␊ |
107 | extern void stop(const char *format, ...);␊ |
108 | extern char * newStringWithFormat(const char * fmt, ...);␊ |
109 | ␊ |
110 | /* disk.c */␊ |
111 | extern void rescanBIOSDevice(int biosdev);␊ |
112 | extern struct DiskBVMap* diskResetBootVolumes(int biosdev);␊ |
113 | extern void diskFreeMap(struct DiskBVMap *map);␊ |
114 | extern int testBiosread( int biosdev, unsigned long long secno );␊ |
115 | extern BVRef diskScanBootVolumes(int biosdev, int *count);␊ |
116 | extern void diskSeek(BVRef bvr, long long position);␊ |
117 | extern int diskRead(BVRef bvr, long addr, long length);␊ |
118 | extern int diskIsCDROM(BVRef bvr);␊ |
119 | extern int biosDevIsCDROM(int biosdev);␊ |
120 | extern BVRef getBVChainForBIOSDev(int biosdev);␊ |
121 | extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);␊ |
122 | extern int freeFilteredBVChain(const BVRef chain);␊ |
123 | extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
124 | extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
125 | extern int readBootSector(int biosdev, unsigned int secno, void *buffer);␊ |
126 | extern int␉ testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );␊ |
127 | ␊ |
128 | /* hfs_compare.c */␊ |
129 | extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,␊ |
130 | ␉␉␉␉␉␉␉␉ u_int16_t *uniStr2, u_int32_t len2, int byte_order);␊ |
131 | extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,␊ |
132 | ␉␉␉␉␉␉ u_int8_t * utf8p, u_int32_t bufsize, int byte_order );␊ |
133 | extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,␊ |
134 | ␉␉␉␉␉␉ u_int16_t *ucslen, u_int32_t bufsize, int byte_order );␊ |
135 | ␊ |
136 | /* load.c */␊ |
137 | extern bool gHaveKernelCache;␊ |
138 | extern long ThinFatFile(void **binary, unsigned long *length);␊ |
139 | extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
140 | ␊ |
141 | /* memory.c */␊ |
142 | long AllocateKernelMemory( long inSize );␊ |
143 | #if UNUSED␊ |
144 | long␊ |
145 | AllocateMemoryRange(char * rangeName, long start, long length, long type);␊ |
146 | #else␊ |
147 | long␊ |
148 | AllocateMemoryRange(char * rangeName, long start, long length);␊ |
149 | #endif␊ |
150 | /* misc.c */␊ |
151 | extern void enableA20(void);␊ |
152 | extern void turnOffFloppy(void);␊ |
153 | ␊ |
154 | extern void random_free (struct ran_obj* self);␊ |
155 | extern int random (struct ran_obj* self);␊ |
156 | extern struct ran_obj* random_init (int rmin, int rmax);␊ |
157 | extern void usefixedrandom (bool opt);␊ |
158 | ␊ |
159 | extern void getPlatformName(char *nameBuf);␊ |
160 | ␊ |
161 | #ifdef NBP_SUPPORT␊ |
162 | /* nbp.c */␊ |
163 | extern UInt32 nbpUnloadBaseCode();␊ |
164 | extern BVRef nbpScanBootVolumes(int biosdev, int *count);␊ |
165 | #endif␊ |
166 | ␊ |
167 | ␊ |
168 | ␊ |
169 | ␊ |
170 | /* stringTable.c */␊ |
171 | extern char * newStringFromList(char **list, int *size);␊ |
172 | extern int stringLength(const char *table, int compress);␊ |
173 | extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);␊ |
174 | extern bool removeKeyFromTable(const char *key, char *table);␊ |
175 | extern char * newStringForStringTableKey(config_file_t *config, char *key);␊ |
176 | extern char * newStringForKey(char *key, config_file_t *configBuff);␊ |
177 | extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);␊ |
178 | extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);␊ |
179 | extern const char * getStringForKey(const char * key, config_file_t *config);␊ |
180 | extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);␊ |
181 | extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);␊ |
182 | extern bool getColorForKey(const char *key, unsigned int *val, config_file_t *configBuff);␊ |
183 | extern bool␉ getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size );␊ |
184 | extern int loadConfigFile(const char *configFile, config_file_t *configBuff);␊ |
185 | extern int loadBooterConfig(config_file_t *configBuff);␊ |
186 | extern int loadSystemConfig(config_file_t *configBuff);␊ |
187 | #ifdef BOOT_HELPER_SUPPORT␊ |
188 | extern int loadHelperConfig(config_file_t *configBuff);␊ |
189 | #endif␊ |
190 | extern int loadOverrideConfig(config_file_t *configBuff);␊ |
191 | extern char * newString(const char *oldString);␊ |
192 | extern char * newEmptyStringWithLength(int len);␊ |
193 | extern char * newStringWithLength(const char * oldString, int len);␊ |
194 | ␊ |
195 | extern char * getNextArg(char ** ptr, char * val);␊ |
196 | extern int␉ ParseXMLFile( char * buffer, TagPtr * dict );␊ |
197 | ␊ |
198 | /* sys.c */␊ |
199 | extern BVRef getBootVolumeRef( const char * path, const char ** outPath );␊ |
200 | extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);␊ |
201 | extern long LoadFile(const char *fileSpec);␊ |
202 | extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);␊ |
203 | extern long LoadThinFatFile(const char *fileSpec, void **binary);␊ |
204 | extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name,␊ |
205 | long *flags, long *time);␊ |
206 | extern long GetFileInfo(const char *dirSpec, const char *name,␊ |
207 | long *flags, long *time);␊ |
208 | extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);␊ |
209 | extern long GetFSUUID(char *spec, char *uuidStr);␊ |
210 | extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);␊ |
211 | extern int openmem(char *buf, int len);␊ |
212 | #if UNUSED␊ |
213 | extern int open(const char *path, int flags);␊ |
214 | #else␊ |
215 | extern int open(const char *path);␊ |
216 | #endif␊ |
217 | #if UNUSED␊ |
218 | extern int open_bvdev(const char *bvd, const char *path, int flags);␊ |
219 | #else␊ |
220 | extern int open_bvdev(const char *bvd, const char *path);␊ |
221 | #endif␊ |
222 | extern int close(int fdesc);␊ |
223 | extern int file_size(int fdesc);␊ |
224 | extern int read(int fdesc, char *buf, int count);␊ |
225 | extern int write(int fdesc, const char *buf, int count);␊ |
226 | extern int writebyte(int fdesc, char value);␊ |
227 | extern int writeint(int fdesc, int value);␊ |
228 | extern int b_lseek(int fdesc, int addr, int ptr);␊ |
229 | extern int tell(int fdesc);␊ |
230 | extern const char * systemConfigDir(void);␊ |
231 | extern struct dirstuff * opendir(const char *path);␊ |
232 | extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);␊ |
233 | extern int closedir(struct dirstuff *dirp);␊ |
234 | extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);␊ |
235 | extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,␊ |
236 | long * time, FinderInfo *finderInfo, long *infoValid);␊ |
237 | extern void flushdev(void);␊ |
238 | extern void scanBootVolumes(int biosdev, int *count);␊ |
239 | #if UNUSED␊ |
240 | extern void scanDisks(int biosdev, int *count);␊ |
241 | #else␊ |
242 | extern void scanDisks(void);␊ |
243 | #endif␊ |
244 | extern BVRef selectBootVolume(BVRef chain);␊ |
245 | extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);␊ |
246 | extern void setRootVolume(BVRef volume);␊ |
247 | extern void setBootGlobals(BVRef chain);␊ |
248 | extern int getDeviceDescription(BVRef volume, char *str);␊ |
249 | ␊ |
250 | extern int gBIOSDev;␊ |
251 | extern int gBootFileType;␊ |
252 | extern BVRef gBootVolume;␊ |
253 | extern BVRef gBIOSBootVolume;␊ |
254 | ␊ |
255 | /* smp.c */␊ |
256 | extern void * getMPSTable();␊ |
257 | ␊ |
258 | ␊ |
259 | #endif /* !__LIBSAIO_SAIO_INTERNAL_H */␊ |
260 | |