Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/libsaio/saio_internal.h

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

Archive Download this file

Revision: 1840