Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/libsaio/saio_internal.h

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

Archive Download this file

Revision: 2045