1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * ␊ |
5 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
6 | * Reserved. This file contains Original Code and/or Modifications of␊ |
7 | * Original Code as defined in and that are subject to the Apple Public␊ |
8 | * Source License Version 2.0 (the "License"). You may not use this file␊ |
9 | * except in compliance with the License. Please obtain a copy of the␊ |
10 | * License at http://www.apple.com/publicsource and read it before using␊ |
11 | * this file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
18 | * License for the specific language governing rights and limitations␊ |
19 | * under the License.␊ |
20 | * ␊ |
21 | */␊ |
22 | ␊ |
23 | #ifndef __LIBSAIO_SAIO_INTERNAL_H␊ |
24 | #define __LIBSAIO_SAIO_INTERNAL_H␊ |
25 | ␊ |
26 | #include "saio_types.h"␊ |
27 | ␊ |
28 | /* asm.s */␊ |
29 | extern void real_to_prot(void);␊ |
30 | extern void prot_to_real(void);␊ |
31 | extern void halt(void);␊ |
32 | extern void startprog(unsigned int address, void *arg);␊ |
33 | extern void loader(UInt32 code, UInt32 cmdptr);␊ |
34 | ␊ |
35 | /* bios.s */␊ |
36 | extern void bios(biosBuf_t *bb);␊ |
37 | ␊ |
38 | /* biosfn.c */␊ |
39 | #ifdef EISA_SUPPORT␊ |
40 | extern bool eisa_present(void);␊ |
41 | #endif␊ |
42 | extern int bgetc(void);␊ |
43 | extern int biosread(int dev, int cyl, int head, int sec, int num);␊ |
44 | extern int ebiosread(int dev, unsigned long long sec, int count);␊ |
45 | extern int ebioswrite(int dev, long sec, int count);␊ |
46 | extern int get_drive_info(int drive, struct driveInfo *dp);␊ |
47 | extern int ebiosEjectMedia(int biosdev);␊ |
48 | extern void␉ bios_putchar(int ch);␊ |
49 | extern void putca(int ch, int attr, int repeat);␊ |
50 | extern int readKeyboardStatus(void);␊ |
51 | extern int readKeyboardShiftFlags(void);␊ |
52 | extern unsigned int time18(void);␊ |
53 | extern void delay(int ms);␊ |
54 | extern unsigned int get_diskinfo(int dev);␊ |
55 | #if APM_SUPPORT␊ |
56 | extern int APMPresent(void);␊ |
57 | extern int APMConnect32(void);␊ |
58 | #endif␊ |
59 | extern int memsize(int i);␊ |
60 | extern void video_mode(int mode);␊ |
61 | extern void setCursorPosition(int x, int y, int page);␊ |
62 | extern void setCursorType(int type);␊ |
63 | extern void getCursorPositionAndType(int *x, int *y, int *type);␊ |
64 | extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);␊ |
65 | extern void clearScreenRows(int y1, int y2);␊ |
66 | extern void setActiveDisplayPage( int page );␊ |
67 | extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount,␊ |
68 | unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);␊ |
69 | extern unsigned long getExtendedMemorySize();␊ |
70 | extern unsigned long getConventionalMemorySize();␊ |
71 | extern void sleep(int n);␊ |
72 | ␊ |
73 | /* bootstruct.c */␊ |
74 | extern void initKernBootStruct(void);␊ |
75 | extern void reserveKernBootStruct(void);␊ |
76 | extern void copyKernBootStruct(void);␊ |
77 | extern void finalizeBootStruct(void);␊ |
78 | ␊ |
79 | /* cache.c */␊ |
80 | extern void CacheReset();␊ |
81 | extern void CacheInit(CICell ih, long blockSize);␊ |
82 | extern long CacheRead(CICell ih, char *buffer, long long offset,␊ |
83 | long length, long cache);␊ |
84 | ␊ |
85 | /* console.c */␊ |
86 | extern bool gVerboseMode;␊ |
87 | extern bool gErrors;␊ |
88 | extern void initBooterLog(void);␊ |
89 | extern void msglog(const char * format, ...);␊ |
90 | extern void setupBooterLog(void);␊ |
91 | extern int putchar(int ch);␊ |
92 | extern int getchar(void);␊ |
93 | extern int printf(const char *format, ...);␊ |
94 | extern int error(const char *format, ...);␊ |
95 | extern int verbose(const char *format, ...);␊ |
96 | extern void stop(const char *format, ...);␊ |
97 | //Azi: replace getc/getchar with ? console.c␊ |
98 | extern void pause();␊ |
99 | ␊ |
100 | /* disk.c */␊ |
101 | extern void rescanBIOSDevice(int biosdev);␊ |
102 | extern struct DiskBVMap* diskResetBootVolumes(int biosdev);␊ |
103 | extern void diskFreeMap(struct DiskBVMap *map);␊ |
104 | extern int testBiosread( int biosdev, unsigned long long secno );␊ |
105 | extern BVRef diskScanBootVolumes(int biosdev, int *count);␊ |
106 | extern void diskSeek(BVRef bvr, long long position);␊ |
107 | extern int diskRead(BVRef bvr, long addr, long length);␊ |
108 | extern int diskIsCDROM(BVRef bvr);␊ |
109 | extern int biosDevIsCDROM(int biosdev);␊ |
110 | extern BVRef getBVChainForBIOSDev(int biosdev);␊ |
111 | extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);␊ |
112 | extern int freeFilteredBVChain(const BVRef chain);␊ |
113 | extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
114 | extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);␊ |
115 | extern int readBootSector(int biosdev, unsigned int secno, void *buffer);␊ |
116 | extern void turnOffFloppy(void);␊ |
117 | extern int␉ testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );␊ |
118 | ␊ |
119 | /* hfs_compare.c */␊ |
120 | extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1, u_int16_t *uniStr2, u_int32_t len2, int byte_order);␊ |
121 | extern void utf_encodestr( const u_int16_t * ucsp, int ucslen, u_int8_t * utf8p, u_int32_t bufsize, int byte_order );␊ |
122 | extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp, u_int16_t *ucslen, u_int32_t bufsize, int byte_order );␊ |
123 | ␊ |
124 | /* load.c */␊ |
125 | extern bool gHaveKernelCache;␊ |
126 | extern long ThinFatFile(void **binary, unsigned long *length);␊ |
127 | extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
128 | ␊ |
129 | /* memory.c */␊ |
130 | long AllocateKernelMemory( long inSize );␊ |
131 | long AllocateMemoryRange(char * rangeName, long start, long length, long type);␊ |
132 | ␊ |
133 | /* misc.c */␊ |
134 | extern void enableA20(void);␊ |
135 | extern int checkForSupportedHardware();␊ |
136 | extern int␉ isLaptop();␊ |
137 | extern void getPlatformName(char *nameBuf);␊ |
138 | ␊ |
139 | /* nbp.c */␊ |
140 | extern UInt32 nbpUnloadBaseCode();␊ |
141 | extern BVRef nbpScanBootVolumes(int biosdev, int *count);␊ |
142 | ␊ |
143 | /* stringTable.c */␊ |
144 | extern char * newStringFromList(char **list, int *size);␊ |
145 | extern int stringLength(const char *table, int compress);␊ |
146 | extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);␊ |
147 | extern bool removeKeyFromTable(const char *key, char *table);␊ |
148 | extern char * newStringForStringTableKey(config_file_t *config, char *key);␊ |
149 | extern char * newStringForKey(char *key, config_file_t *configBuff);␊ |
150 | extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);␊ |
151 | extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);␊ |
152 | extern const char * getStringForKey(const char * key, config_file_t *config);␊ |
153 | extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);␊ |
154 | extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);␊ |
155 | extern bool getColorForKey(const char *key, unsigned int *val, config_file_t *configBuff);␊ |
156 | extern bool␉ getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size );␊ |
157 | extern int loadConfigFile(const char *configFile, config_file_t *configBuff);␊ |
158 | extern int loadSystemConfig(config_file_t *configBuff);␊ |
159 | extern int loadHelperConfig(config_file_t *configBuff);␊ |
160 | extern int loadChameleonConfig(config_file_t *configBuff);␊ |
161 | extern char * newString(const char *oldString);␊ |
162 | extern char * getNextArg(char ** ptr, char * val);␊ |
163 | extern int␉ ParseXMLFile( char * buffer, TagPtr * dict );␊ |
164 | ␊ |
165 | /* sys.c */␊ |
166 | extern BVRef getBootVolumeRef( const char * path, const char ** outPath );␊ |
167 | extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);␊ |
168 | extern long LoadFile(const char *fileSpec);␊ |
169 | extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);␊ |
170 | extern long LoadThinFatFile(const char *fileSpec, void **binary);␊ |
171 | extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name,␊ |
172 | long *flags, long *time);␊ |
173 | extern long GetFileInfo(const char *dirSpec, const char *name,␊ |
174 | long *flags, long *time);␊ |
175 | extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);␊ |
176 | extern long GetFSUUID(char *spec, char *uuidStr);␊ |
177 | extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);␊ |
178 | extern int openmem(char *buf, int len);␊ |
179 | extern int open(const char *str, int how);␊ |
180 | extern int open_bvdev(const char *bvd, const char *path, int flags);␊ |
181 | extern int close(int fdesc);␊ |
182 | extern int file_size(int fdesc);␊ |
183 | extern int read(int fdesc, char *buf, int count);␊ |
184 | extern int write(int fdesc, const char *buf, int count);␊ |
185 | extern int writebyte(int fdesc, char value);␊ |
186 | extern int writeint(int fdesc, int value);␊ |
187 | extern int b_lseek(int fdesc, int addr, int ptr);␊ |
188 | extern int tell(int fdesc);␊ |
189 | extern const char * systemConfigDir(void);␊ |
190 | extern struct dirstuff * opendir(const char *path);␊ |
191 | extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);␊ |
192 | extern int closedir(struct dirstuff *dirp);␊ |
193 | extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);␊ |
194 | extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,␊ |
195 | long * time, FinderInfo *finderInfo, long *infoValid);␊ |
196 | extern void flushdev(void);␊ |
197 | extern void scanBootVolumes(int biosdev, int *count);␊ |
198 | extern void scanDisks(int biosdev, int *count);␊ |
199 | extern BVRef selectBootVolume(BVRef chain);␊ |
200 | extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);␊ |
201 | extern void setRootVolume(BVRef volume);␊ |
202 | extern void setBootGlobals(BVRef chain);␊ |
203 | extern int getDeviceDescription(BVRef volume, char *str);␊ |
204 | ␊ |
205 | extern int gBIOSDev;␊ |
206 | extern int gBootFileType;␊ |
207 | extern BVRef gBootVolume;␊ |
208 | extern BVRef gBIOSBootVolume;␊ |
209 | ␊ |
210 | // Function pointer to be filled in if ramdisks are available␊ |
211 | extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);␊ |
212 | extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,␊ |
213 | unsigned int byteoff,␊ |
214 | unsigned int byteCount, void * buffer );␊ |
215 | ␊ |
216 | #endif /* !__LIBSAIO_SAIO_INTERNAL_H */␊ |
217 | |