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