Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/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 void real_to_prot(void);
32extern void prot_to_real(void);
33extern void halt(void);
34extern void startprog(unsigned int address, void *arg);
35extern void loader(UInt32 code, UInt32 cmdptr);
36
37/* bios.s */
38extern void bios(biosBuf_t *bb);
39
40/* biosfn.c */
41#ifdef EISA_SUPPORT
42extern bool eisa_present(void);
43#endif
44extern int bgetc(void);
45extern int biosread(int dev, int cyl, int head, int sec, int num);
46extern int ebiosread(int dev, unsigned long long sec, int count);
47extern int ebioswrite(int dev, long sec, int count);
48extern int get_drive_info(int drive, struct driveInfo *dp);
49extern int ebiosEjectMedia(int biosdev);
50extern void bios_putchar(int ch);
51extern void putca(int ch, int attr, int repeat);
52extern int readKeyboardStatus(void);
53extern int readKeyboardShiftFlags(void);
54extern unsigned int time18(void);
55extern void delay(int ms);
56extern unsigned int get_diskinfo(int dev);
57//Azi: reminder - apple partition map
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, long blockSize);
85extern long CacheRead(CICell ih, char *buffer, long long offset,
86 long length, long cache);
87
88/* console.c */
89extern bool gVerboseMode;
90extern bool gErrors;
91extern void initBooterLog(void);
92extern void setupBooterLog(void);
93extern int putchar(int ch);
94extern int getc(void); //Azi: getc stuff
95extern int getchar(void);
96extern void msglog(const char * format, ...);
97extern int printf(const char *format, ...);
98extern int error(const char *format, ...);
99extern int verbose(const char *format, ...);
100extern void stop(const char *format, ...);
101extern void pause();
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 loadOverrideConfig(config_file_t *configBuff);
167extern char * newString(const char *oldString);
168extern char * getNextArg(char ** ptr, char * val);
169extern int ParseXMLFile( char * buffer, TagPtr * dict );
170
171/* sys.c */
172extern BVRef getBootVolumeRef( const char * path, const char ** outPath );
173extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);
174extern long LoadFile(const char *fileSpec);
175extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);
176extern long LoadThinFatFile(const char *fileSpec, void **binary);
177extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name,
178 long *flags, long *time);
179extern long GetFileInfo(const char *dirSpec, const char *name,
180 long *flags, long *time);
181extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
182extern long GetFSUUID(char *spec, char *uuidStr);
183extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
184extern int openmem(char *buf, int len);
185extern int open(const char *str, int how);
186extern int open_bvdev(const char *bvd, const char *path, int flags);
187extern int close(int fdesc);
188extern int file_size(int fdesc);
189extern int read(int fdesc, char *buf, int count);
190extern int write(int fdesc, const char *buf, int count);
191extern int writebyte(int fdesc, char value);
192extern int writeint(int fdesc, int value);
193extern int b_lseek(int fdesc, int addr, int ptr);
194extern int tell(int fdesc);
195extern const char * systemConfigDir(void);
196extern struct dirstuff * opendir(const char *path);
197extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);
198extern int closedir(struct dirstuff *dirp);
199extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
200extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,
201 long * time, FinderInfo *finderInfo, long *infoValid);
202extern void flushdev(void);
203extern void scanBootVolumes(int biosdev, int *count);
204extern void scanDisks(int biosdev, int *count);
205extern BVRef selectBootVolume(BVRef chain);
206extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
207extern void setRootVolume(BVRef volume);
208extern void setBootGlobals(BVRef chain);
209extern int getDeviceDescription(BVRef volume, char *str);
210
211extern int gBIOSDev;
212extern int gBootFileType;
213extern BVRef gBootVolume;
214extern BVRef gBIOSBootVolume;
215
216// Function pointer to be filled in if ramdisks are available
217extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
218extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,
219 unsigned int byteoff,
220 unsigned int byteCount, void * buffer );
221
222#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
223

Archive Download this file

Revision: 1023