Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/libsaio/saio_internal.h

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

Archive Download this file

Revision: 1079