Chameleon

Chameleon Svn Source Tree

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

Source at commit 1146 created 12 years 11 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
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#include "bootargs.h"
34
35#if DEBUG
36#define DEBUG_DISK(x) printf x
37#else
38#define DEBUG_DISK(x)
39#endif
40
41typedef unsigned long entry_t;
42
43typedef struct {
44unsigned int sectors:8;
45unsigned int heads:8;
46unsigned int cylinders:16;
47} compact_diskinfo_t;
48
49struct driveParameters {
50int cylinders;
51int sectors;
52int heads;
53int totalDrives;
54};
55
56struct Tag {
57longtype;
58char *string;
59longoffset;
60struct Tag *tag;
61struct Tag *tagNext;
62};
63typedef struct Tag Tag, *TagPtr;
64
65typedef struct {
66charplist[4096];// buffer for plist
67TagPtrdictionary;// buffer for xml dictionary
68boolcanOverride;// flag to mark a dictionary can be overriden
69} config_file_t;
70
71typedef struct FinderInfo {
72unsigned char data[16];
73} FinderInfo;
74
75struct BootVolume;
76typedef struct BootVolume * BVRef;
77typedef struct BootVolume * CICell;
78
79typedef long (*FSInit)(CICell ih);
80typedef long (*FSLoadFile)(CICell ih, char * filePath);
81typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);
82typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);
83typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
84 char ** name, long * flags, long * time,
85 FinderInfo * finderInfo, long * infoValid);
86typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
87typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
88// Can be just pointed to free or a special free function
89typedef void (*BVFree)(CICell ih);
90
91struct iob {
92unsigned int i_flgs;/* see F_* below */
93unsigned int i_offset;/* seek byte offset in file */
94int i_filesize;/* size of file */
95char * i_buf;/* file load address */
96};
97
98#define BPS 512/* sector size of the device */
99#define F_READ 0x1/* file opened for reading */
100#define F_WRITE 0x2/* file opened for writing */
101#define F_ALLOC 0x4/* buffer allocated */
102#define F_FILE 0x8/* file instead of device */
103#define F_NBSF 0x10/* no bad sector forwarding */
104#define F_SSI 0x40/* set skip sector inhibit */
105#define F_MEM 0x80/* memory instead of file or device */
106
107struct dirstuff {
108char * dir_path;/* directory path */
109long long dir_index;/* directory entry index */
110BVRef dir_bvr;/* volume reference */
111};
112
113#define BVSTRLEN 32
114
115struct BootVolume {
116BVRef next; /* list linkage pointer */
117int biosdev; /* BIOS device number */
118int type; /* device type (floppy, hd, network) */
119unsigned int flags; /* attribute flags */
120BVGetDescription description; /* BVGetDescription function */
121int part_no; /* partition number (1 based) */
122unsigned int part_boff; /* partition block offset */
123unsigned int part_type; /* partition type */
124unsigned int fs_boff; /* 1st block # of next read */
125unsigned int fs_byteoff; /* Byte offset for read within block */
126FSLoadFile fs_loadfile; /* FSLoadFile function */
127FSReadFile fs_readfile; /* FSReadFile function */
128FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */
129FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */
130FSGetUUID fs_getuuid; /* FSGetUUID function */
131unsigned int bps; /* bytes per sector for this device */
132char name[BVSTRLEN]; /* (name of partition) */
133char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */
134BVFree bv_free; /* BVFree function */
135uint32_t modTime;
136char label[BVSTRLEN]; /* partition volume label */
137char altlabel[BVSTRLEN]; /* partition volume label */
138bool filtered; /* newFilteredBVChain() will set to TRUE */
139bool visible; /* will shown in the device list */
140};
141
142enum {
143kBVFlagPrimary= 0x01,
144kBVFlagNativeBoot= 0x02,
145kBVFlagForeignBoot= 0x04,
146kBVFlagBootable= 0x08,
147kBVFlagEFISystem= 0x10,
148kBVFlagBooter= 0x20,
149kBVFlagSystemVolume= 0x40
150};
151
152enum {
153kBIOSDevTypeFloppy= 0x00,
154kBIOSDevTypeHardDrive= 0x80,
155kBIOSDevTypeNetwork= 0xE0,
156kBIOSDevUnitMask= 0x0F,
157kBIOSDevTypeMask= 0xF0,
158kBIOSDevMask= 0xFF
159};
160
161enum {
162kPartitionTypeHFS= 0xAF,
163kPartitionTypeHPFS= 0x07,
164kPartitionTypeFAT16= 0x06,
165kPartitionTypeFAT32= 0x0c,
166kPartitionTypeEXT3= 0x83
167};
168
169//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
170#define BIOS_DEV_UNIT(bvr)((bvr)->biosdev - (bvr)->type)
171
172/*
173 * KernBootStruct device types.
174 */
175enum {
176DEV_SD = 0,
177DEV_HD = 1,
178DEV_FD = 2,
179DEV_EN = 3
180};
181
182/*
183 * min/max Macros.
184 * counting and rounding Macros.
185 *
186 * Azi: defined on <sys/param.h>,
187 *i386/include/IOKit/IOLib.h (min/max), and others...
188 *
189#ifndef MIN
190#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )
191#endif
192#ifndef MAX
193#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
194#endif
195
196#define round2(x, m)(((x) + (m / 2)) & ~(m - 1))
197#define roundup2(x, m)(((x) + m - 1) & ~(m - 1))*/
198
199enum {
200kNetworkDeviceType = kBIOSDevTypeNetwork,
201kBlockDeviceType = kBIOSDevTypeHardDrive
202}; //gBootFileType_t;
203
204enum {
205kCursorTypeHidden = 0x0100,
206kCursorTypeUnderline = 0x0607
207};
208
209#endif /* !__LIBSAIO_SAIO_TYPES_H */
210

Archive Download this file

Revision: 1146