Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2577