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

Archive Download this file

Revision: 1815