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) __attribute__((noreturn));
34extern voidstartprog(unsigned int address, void *arg) __attribute__((noreturn));
35extern voidloader(UInt32 code, UInt32 cmdptr);
36extern uint32_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);
75extern void enableA20(void);
76
77/* bootstruct.c */
78extern void initKernBootStruct(void);
79extern void reserveKernBootStruct(void);
80extern void copyKernBootStruct(void);
81extern void finalizeBootStruct(void);
82
83/* cache.c */
84extern void CacheReset();
85extern void CacheInit(CICell ih, u_int32_t blockSize);
86extern u_int32_t CacheRead(CICell ih, char *buffer, long long offset, u_int32_t length, long cache);
87
88/* console.c */
89extern bool gVerboseMode;
90extern bool gErrors;
91extern void initBooterLog(void);
92extern int msglog(const char * format, ...);
93extern void setupBooterLog(void);
94extern int putchar(int ch);
95extern int getchar(void);
96extern int printf(const char *format, ...);
97extern int error(const char *format, ...);
98extern int verbose(const char *format, ...) __attribute__((format(printf,1,2)));
99extern void stop(const char *format, ...) __attribute__ ((noreturn, format(printf,1,2)));
100//Azi: replace getc/getchar with ? console.c
101extern void pause();
102extern uint64_t getRTCdatetime();
103
104/* disk.c */
105extern void rescanBIOSDevice(int biosdev);
106extern struct DiskBVMap* diskResetBootVolumes(int biosdev);
107extern void diskFreeMap(struct DiskBVMap *map);
108extern int testBiosread( int biosdev, unsigned long long secno );
109extern BVRef diskScanBootVolumes(int biosdev, int *count);
110extern void diskSeek(BVRef bvr, long long position);
111extern int diskRead(BVRef bvr, long addr, long length);
112extern int diskIsCDROM(BVRef bvr);
113extern int biosDevIsCDROM(int biosdev);
114extern BVRef getBVChainForBIOSDev(int biosdev);
115extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
116extern int freeFilteredBVChain(const BVRef chain);
117extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
118extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
119extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
120extern void turnOffFloppy(void);
121extern int testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );
122
123/* hfs_compare.c */
124extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,
125 u_int16_t *uniStr2, u_int32_t len2, int byte_order);
126extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,
127 u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
128extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,
129 u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
130
131/* load.c */
132extern bool gHaveKernelCache;
133extern long ThinFatFile(void **binary, unsigned long *length);
134extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
135
136/* memory.c */
137long AllocateKernelMemory( long inSize );
138long AllocateMemoryRange(char *rangeName, long start, long length, long type);
139
140/* misc.c */
141extern int checkForSupportedHardware();
142extern int isLaptop();
143extern void getPlatformName(char *nameBuf, int size);
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 intParseXMLFile( 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);
205
206extern void scanDisks(int biosdev, int *count);
207extern BVRef selectBootVolume(BVRef chain);
208extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
209extern void setRootVolume(BVRef volume);
210extern void setBootGlobals(BVRef chain);
211extern int getDeviceDescription(BVRef volume, char *str);
212
213extern int gBIOSDev;
214extern int gBootPartition;
215extern int gBootFileType;
216extern BVRef gBootVolume;
217extern BVRef gBIOSBootVolume;
218
219// Function pointer to be filled in if ramdisks are available
220extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
221extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,
222 unsigned int byteoff,
223 unsigned int byteCount, void * buffer );
224
225// Base64-decode.c
226char *BASE64Decode(const char* src, int in_len, int* out_len);
227
228// options.c
229extern char gMacOSVersion[OSVERSTRLEN];
230extern uint32_t MacOSVerCurrent;
231extern uint32_t MacOSVer2Int(const char *osver);
232
233#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
234

Archive Download this file

Revision: 2758