Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/arch/i386/libsaio/saio_types.h

Source at commit 1312 created 12 years 9 months ago.
By meklort, Update malloc_init in i386 boot file
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/* Useful types. */
25
26#ifndef __LIBSAIO_SAIO_TYPES_H
27#define __LIBSAIO_SAIO_TYPES_H
28
29#include <sys/reboot.h>
30#include <sys/types.h>
31#include <sys/param.h>
32#include "bios.h"
33
34#if DEBUG
35#define DEBUG_DISK(x) printf x
36#else
37#define DEBUG_DISK(x)
38#endif
39
40typedef unsigned long entry_t;
41
42typedef struct {
43unsigned int sectors:8;
44unsigned int heads:8;
45unsigned int cylinders:16;
46} compact_diskinfo_t;
47
48struct driveParameters {
49int cylinders;
50int sectors;
51int heads;
52int totalDrives;
53};
54
55struct Tag {
56longtype;
57char *string;
58longoffset;
59struct Tag *tag;
60struct Tag *tagNext;
61};
62typedef struct Tag Tag, *TagPtr;
63
64
65typedef struct FinderInfo {
66unsigned char data[16];
67} FinderInfo;
68
69struct BootVolume;
70typedef struct BootVolume * BVRef;
71typedef struct BootVolume * CICell;
72
73typedef long (*FSInit)(CICell ih);
74typedef long (*FSLoadFile)(CICell ih, char * filePath);
75typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);
76typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);
77typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
78 char ** name, long * flags, long * time,
79 FinderInfo * finderInfo, long * infoValid);
80typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
81typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
82// Can be just pointed to free or a special free function
83typedef void (*BVFree)(CICell ih);
84
85struct iob {
86unsigned int i_flgs;/* see F_* below */
87unsigned int i_offset;/* seek byte offset in file */
88int i_filesize;/* size of file */
89char * i_buf;/* file load address */
90};
91
92#define BPS 512/* sector size of the device */
93#define F_READ 0x1/* file opened for reading */
94#define F_WRITE 0x2/* file opened for writing */
95#define F_ALLOC 0x4/* buffer allocated */
96#define F_FILE 0x8/* file instead of device */
97#define F_NBSF 0x10/* no bad sector forwarding */
98#define F_SSI 0x40/* set skip sector inhibit */
99#define F_MEM 0x80/* memory instead of file or device */
100
101struct dirstuff {
102char * dir_path;/* directory path */
103long long dir_index;/* directory entry index */
104BVRef dir_bvr;/* volume reference */
105};
106
107#define BVSTRLEN 32
108
109enum {
110kBVFlagPrimary= 0x01,
111kBVFlagNativeBoot= 0x02,
112kBVFlagForeignBoot= 0x04,
113kBVFlagBootable= 0x08,
114kBVFlagEFISystem= 0x10,
115kBVFlagBooter= 0x20,
116kBVFlagSystemVolume= 0x40
117};
118
119enum {
120kBIOSDevTypeFloppy= 0x00,
121kBIOSDevTypeHardDrive= 0x80,
122kBIOSDevTypeNetwork= 0xE0,
123kBIOSDevUnitMask= 0x0F,
124kBIOSDevTypeMask= 0xF0,
125kBIOSDevMask= 0xFF
126};
127
128enum {
129kPartitionTypeHFS= 0xAF,
130kPartitionTypeHPFS= 0x07,
131kPartitionTypeFAT16= 0x06,
132kPartitionTypeFAT32= 0x0c,
133kPartitionTypeEXT3= 0x83
134};
135
136//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
137#define BIOS_DEV_UNIT(bvr)((bvr)->biosdev - (bvr)->type)
138
139/*
140 * KernBootStruct device types.
141 */
142enum {
143DEV_SD = 0,
144DEV_HD = 1,
145DEV_FD = 2,
146DEV_EN = 3
147};
148
149/*
150 * min/max Macros.
151 * counting and rounding Macros.
152 *
153 * Azi: defined on <sys/param.h>,
154 *i386/include/IOKit/IOLib.h (min/max), and others...
155 *
156#ifndef MIN
157#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )
158#endif
159#ifndef MAX
160#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
161#endif
162
163#define round2(x, m)(((x) + (m / 2)) & ~(m - 1))
164#define roundup2(x, m)(((x) + m - 1) & ~(m - 1))*/
165
166enum {
167kNetworkDeviceType = kBIOSDevTypeNetwork,
168kBlockDeviceType = kBIOSDevTypeHardDrive
169}; //gBootFileType_t;
170
171enum {
172kCursorTypeHidden = 0x0100,
173kCursorTypeUnderline = 0x0607
174};
175
176#endif /* !__LIBSAIO_SAIO_TYPES_H */
177

Archive Download this file

Revision: 1312