Chameleon

Chameleon Svn Source Tree

Root/trunk/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 void pause();
53extern int readKeyboardStatus(void);
54extern int readKeyboardShiftFlags(void);
55extern unsigned int time18(void);
56extern void delay(int ms);
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, 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 getchar(void);
95extern void msglog(const char * format, ...);
96extern int printf(const char *format, ...);
97extern int error(const char *format, ...);
98extern int verbose(const char *format, ...);
99extern void stop(const char *format, ...);
100
101/* disk.c */
102extern void rescanBIOSDevice(int biosdev);
103extern struct DiskBVMap* diskResetBootVolumes(int biosdev);
104extern void diskFreeMap(struct DiskBVMap *map);
105extern int testBiosread( int biosdev, unsigned long long secno );
106extern BVRef diskScanBootVolumes(int biosdev, int *count);
107extern void diskSeek(BVRef bvr, long long position);
108extern int diskRead(BVRef bvr, long addr, long length);
109extern int diskIsCDROM(BVRef bvr);
110extern int biosDevIsCDROM(int biosdev);
111extern BVRef getBVChainForBIOSDev(int biosdev);
112extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
113extern int freeFilteredBVChain(const BVRef chain);
114extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
115extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
116extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
117extern void turnOffFloppy(void);
118extern int testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );
119
120/* hfs_compare.c */
121extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,
122 u_int16_t *uniStr2, u_int32_t len2, int byte_order);
123extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,
124 u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
125extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,
126 u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
127
128/* load.c */
129extern bool gHaveKernelCache;
130extern long ThinFatFile(void **binary, unsigned long *length);
131extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
132
133/* memory.c */
134long AllocateKernelMemory( long inSize );
135long AllocateMemoryRange(char * rangeName, long start, long length, long type);
136
137/* misc.c */
138extern void enableA20(void);
139extern int checkForSupportedHardware();
140extern int isLaptop();
141extern void getPlatformName(char *nameBuf);
142
143/* nbp.c */
144extern UInt32 nbpUnloadBaseCode();
145extern BVRef nbpScanBootVolumes(int biosdev, int *count);
146
147/* stringTable.c */
148extern char * newStringFromList(char **list, int *size);
149extern int stringLength(const char *table, int compress);
150extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);
151extern bool removeKeyFromTable(const char *key, char *table);
152extern char * newStringForStringTableKey(config_file_t *config, char *key);
153extern char * newStringForKey(char *key, config_file_t *configBuff);
154extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);
155extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);
156extern const char * getStringForKey(const char * key, config_file_t *config);
157extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);
158extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);
159extern bool getColorForKey(const char *key, unsigned int *val, config_file_t *configBuff);
160extern bool getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size );
161extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
162extern int loadSystemConfig(config_file_t *configBuff);
163extern int loadHelperConfig(config_file_t *configBuff);
164extern int loadOverrideConfig(config_file_t *configBuff);
165extern char * newString(const char *oldString);
166extern char * getNextArg(char ** ptr, char * val);
167extern int ParseXMLFile( char * buffer, TagPtr * dict );
168
169/* sys.c */
170extern BVRef getBootVolumeRef( const char * path, const char ** outPath );
171extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);
172extern long LoadFile(const char *fileSpec);
173extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);
174extern long LoadThinFatFile(const char *fileSpec, void **binary);
175extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name,
176 long *flags, long *time);
177extern long GetFileInfo(const char *dirSpec, const char *name,
178 long *flags, long *time);
179extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
180extern long GetFSUUID(char *spec, char *uuidStr);
181extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
182extern int openmem(char *buf, int len);
183extern int open(const char *str, int how);
184extern int open_bvdev(const char *bvd, const char *path, int flags);
185extern int close(int fdesc);
186extern int file_size(int fdesc);
187extern int read(int fdesc, char *buf, int count);
188extern int write(int fdesc, const char *buf, int count);
189extern int writebyte(int fdesc, char value);
190extern int writeint(int fdesc, int value);
191extern int b_lseek(int fdesc, int addr, int ptr);
192extern int tell(int fdesc);
193extern const char * systemConfigDir(void);
194extern struct dirstuff * opendir(const char *path);
195extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);
196extern int closedir(struct dirstuff *dirp);
197extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
198extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,
199 long * time, FinderInfo *finderInfo, long *infoValid);
200extern void flushdev(void);
201extern void scanBootVolumes(int biosdev, int *count);
202extern void scanDisks(int biosdev, int *count);
203extern BVRef selectBootVolume(BVRef chain);
204extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
205extern void setRootVolume(BVRef volume);
206extern void setBootGlobals(BVRef chain);
207extern int getDeviceDescription(BVRef volume, char *str);
208
209extern int gBIOSDev;
210extern int gBootFileType;
211extern BVRef gBootVolume;
212extern BVRef gBIOSBootVolume;
213
214// Function pointer to be filled in if ramdisks are available
215extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
216extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,
217 unsigned int byteoff,
218 unsigned int byteCount, void * buffer );
219
220#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
221

Archive Download this file

Revision: 925