]>
git.saurik.com Git - apple/boot.git/blob - i386/libsaio/saio_internal.h
2 * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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
22 * @APPLE_LICENSE_HEADER_END@
25 #ifndef __LIBSAIO_SAIO_INTERNAL_H
26 #define __LIBSAIO_SAIO_INTERNAL_H
28 #include "saio_types.h"
31 extern void real_to_prot(void);
32 extern void prot_to_real(void);
33 extern void halt(void);
34 extern void startprog(unsigned int address
, void *arg
);
35 extern void loader(UInt32 code
, UInt32 cmdptr
);
38 extern void bios(biosBuf_t
*bb
);
42 extern BOOL
eisa_present(void);
44 extern int bgetc(void);
45 extern int biosread(int dev
, int cyl
, int head
, int sec
, int num
);
46 extern int ebiosread(int dev
, long sec
, int count
);
47 extern int ebioswrite(int dev
, long sec
, int count
);
48 extern int get_drive_info(int drive
, struct driveInfo
*dp
);
49 extern void putc(int ch
);
50 extern void putca(int ch
, int attr
, int repeat
);
51 extern int getc(void);
52 extern int readKeyboardStatus(void);
53 extern int readKeyboardShiftFlags(void);
54 extern unsigned int time18(void);
55 extern void delay(int ms
);
56 extern unsigned int get_diskinfo(int dev
);
58 extern int APMPresent(void);
59 extern int APMConnect32(void);
61 extern int memsize(int i
);
62 extern void video_mode(int mode
);
63 extern void setCursorPosition(int x
, int y
, int page
);
64 extern void setCursorType(int type
);
65 extern void getCursorPositionAndType(int *x
, int *y
, int *type
);
66 extern void scollPage(int x1
, int y1
, int x2
, int y2
, int attr
, int rows
, int dir
);
67 extern void clearScreenRows(int y1
, int y2
);
68 extern void setActiveDisplayPage( int page
);
69 extern unsigned long getMemoryMap(struct MemoryRange
* rangeArray
, unsigned long maxRangeCount
,
70 unsigned long * conMemSizePtr
, unsigned long * extMemSizePtr
);
71 extern unsigned long getExtendedMemorySize();
72 extern unsigned long getConventionalMemorySize();
73 extern void sleep(int n
);
76 extern void initKernBootStruct(int biosdev
);
77 extern void reserveKernBootStruct(void);
78 extern void copyKernBootStruct(void);
79 extern void finalizeBootStruct(void);
82 extern void CacheInit(CICell ih
, long blockSize
);
83 extern long CacheRead(CICell ih
, char *buffer
, long long offset
,
84 long length
, long cache
);
87 extern BOOL gVerboseMode
;
89 extern void putchar(int ch
);
90 extern int getchar(void);
91 extern int printf(const char *format
, ...);
92 extern int error(const char *format
, ...);
93 extern int verbose(const char *format
, ...);
94 extern void stop(const char *format
, ...);
97 extern BVRef
diskScanBootVolumes(int biosdev
, int *count
);
98 extern void diskSeek(BVRef bvr
, long long position
);
99 extern int diskRead(BVRef bvr
, long addr
, long length
);
100 extern int diskIsCDROM(BVRef bvr
);
101 extern int rawDiskRead(BVRef bvr
, unsigned int secno
, void *buffer
, unsigned int len
);
102 extern int rawDiskWrite(BVRef bvr
, unsigned int secno
, void *buffer
, unsigned int len
);
103 extern int readBootSector(int biosdev
, unsigned int secno
, void *buffer
);
104 extern void turnOffFloppy(void);
107 extern void utf_encodestr( const u_int16_t
* ucsp
, int ucslen
,
108 u_int8_t
* utf8p
, u_int32_t bufsize
, int byte_order
);
109 extern void utf_decodestr(const u_int8_t
*utf8p
, u_int16_t
*ucsp
,
110 u_int16_t
*ucslen
, u_int32_t bufsize
, int byte_order
);
113 extern char gHaveKernelCache
;
114 extern long ThinFatFile(void **binary
, unsigned long *length
);
115 extern long DecodeMachO(void *binary
, entry_t
*rentry
, char **raddr
, int *rsize
);
118 long AllocateKernelMemory( long inSize
);
119 long AllocateMemoryRange(char * rangeName
, long start
, long length
, long type
);
122 extern void enableA20(void);
123 extern int checkForSupportedHardware();
124 extern void getPlatformName(char *nameBuf
);
127 extern UInt32
nbpUnloadBaseCode();
128 extern BVRef
nbpScanBootVolumes(int biosdev
, int *count
);
131 extern char * newStringFromList(char **list
, int *size
);
132 extern int stringLength(const char *table
, int compress
);
133 extern BOOL
getValueForConfigTableKey(const char *table
, const char *key
, const char **val
, int *size
);
134 extern BOOL
removeKeyFromTable(const char *key
, char *table
);
135 extern char * newStringForStringTableKey(char *table
, char *key
);
136 extern char * newStringForKey(char *key
);
137 extern BOOL
getValueForBootKey(const char *line
, const char *match
, const char **matchval
, int *len
);
138 extern BOOL
getValueForKey(const char *key
, const char **val
, int *size
);
139 extern BOOL
getBoolForKey(const char *key
, BOOL
*val
);
140 extern BOOL
getIntForKey(const char *key
, int *val
);
141 extern int loadConfigFile(const char *configFile
);
142 extern int loadSystemConfig(const char *which
, int size
);
143 extern char * newString(const char *oldString
);
146 extern BVRef
getBootVolumeRef( const char * path
, const char ** outPath
);
147 extern long LoadVolumeFile(BVRef bvr
, const char *fileSpec
);
148 extern long LoadFile(const char *fileSpec
);
149 extern long ReadFileAtOffset(const char * fileSpec
, void *buffer
, unsigned long offset
, unsigned long length
);
150 extern long LoadThinFatFile(const char *fileSpec
, void **binary
);
151 extern long GetDirEntry(const char *dirSpec
, long *dirIndex
, const char **name
,
152 long *flags
, long *time
);
153 extern long GetFileInfo(const char *dirSpec
, const char *name
,
154 long *flags
, long *time
);
155 extern long GetFileBlock(const char *fileSpec
, unsigned long long *firstBlock
);
156 extern long GetFSUUID(char *spec
, char *uuidStr
);
157 extern long CreateUUIDString(uint8_t uubytes
[], int nbytes
, char *uuidStr
);
158 extern int openmem(char *buf
, int len
);
159 extern int open(const char *str
, int how
);
160 extern int close(int fdesc
);
161 extern int file_size(int fdesc
);
162 extern int read(int fdesc
, char *buf
, int count
);
163 extern int b_lseek(int fdesc
, int addr
, int ptr
);
164 extern int tell(int fdesc
);
165 extern const char * usrDevices(void);
166 extern const char * systemConfigDir(void);
167 extern struct dirstuff
* opendir(const char *path
);
168 extern struct dirstuff
* vol_opendir(BVRef bvr
, const char *path
);
169 extern int closedir(struct dirstuff
*dirp
);
170 extern int readdir(struct dirstuff
*dirp
, const char **name
, long *flags
, long *time
);
171 extern int readdir_ext(struct dirstuff
* dirp
, const char ** name
, long * flags
,
172 long * time
, FinderInfo
*finderInfo
, long *infoValid
);
173 extern void flushdev(void);
174 extern int currentdev(void);
175 extern int switchdev(int dev
);
176 extern BVRef
scanBootVolumes(int biosdev
, int *count
);
177 extern BVRef
selectBootVolume(BVRef chain
);
178 extern void getBootVolumeDescription(BVRef bvr
, char *str
, long strMaxLen
, BOOL verbose
);
181 extern int gBootFileType
;
183 #endif /* !__LIBSAIO_SAIO_INTERNAL_H */