Chameleon

Chameleon Svn Source Tree

Root/tags/2.1/i386/libsaio/saio_types.h

Source at commit 2381 created 10 years 21 days ago.
By ifabio, Apply patch: (Credits to Thomas Jansen aka tja) - Reading options from all devices during boot. The options for the boot menu are only read from the devices rd(0,0) or bt(0,0). Consequently, boot menu options (e.g. "Quiet Boot", "Timeout", etc.) in plists on other devices (like most users have) are ignored. This patch extends the list of paths to search for the options plist on all devices that can be found.
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 "nbp_cmd.h"
34#include "bootargs.h"
35
36#if DEBUG
37#define DEBUG_DISK(x) printf x
38#else
39#define DEBUG_DISK(x)
40#endif
41
42typedef unsigned long entry_t;
43
44typedef struct {
45unsigned int sectors:8;
46unsigned int heads:8;
47unsigned int cylinders:16;
48} compact_diskinfo_t;
49
50struct driveParameters {
51int cylinders;
52int sectors;
53int heads;
54int totalDrives;
55};
56
57struct Tag {
58longtype;
59char *string;
60longoffset;
61struct Tag *tag;
62struct Tag *tagNext;
63};
64typedef struct Tag Tag, *TagPtr;
65
66/*
67 * Max size fo config data array, in bytes.
68 */
69#define IO_CONFIG_DATA_SIZE40960 // was 4096 // was 163840
70
71typedef struct {
72charplist[IO_CONFIG_DATA_SIZE];// buffer for plist
73TagPtrdictionary;// buffer for xml dictionary
74boolcanOverride;// flag to mark a dictionary can be overriden
75} config_file_t;
76
77/*
78 * BIOS drive information.
79 */
80struct boot_drive_info {
81struct drive_params {
82unsigned short buf_size;
83unsigned short info_flags;
84unsigned long phys_cyls;
85unsigned long phys_heads;
86unsigned long phys_spt;
87unsigned long long phys_sectors;
88unsigned short phys_nbps;
89unsigned short dpte_offset;
90unsigned short dpte_segment;
91unsigned short key;
92unsigned char path_len;
93unsigned char reserved1;
94unsigned short reserved2;
95unsigned char bus_type[4];
96unsigned char interface_type[8];
97unsigned char interface_path[8];
98unsigned char dev_path[8];
99unsigned char reserved3;
100unsigned char checksum;
101} params;
102struct drive_dpte {
103unsigned short io_port_base;
104unsigned short control_port_base;
105unsigned char head_flags;
106unsigned char vendor_info;
107unsigned char irq : 4;
108unsigned char irq_unused : 4;
109unsigned char block_count;
110unsigned char dma_channel : 4;
111unsigned char dma_type : 4;
112unsigned char pio_type : 4;
113unsigned char pio_unused : 4;
114unsigned short option_flags;
115unsigned short reserved;
116unsigned char revision;
117unsigned char checksum;
118} dpte;
119} __attribute__((packed));
120typedef struct boot_drive_info boot_drive_info_t;
121
122struct driveInfo {
123boot_drive_info_t di;
124int uses_ebios;
125int no_emulation;
126int biosdev;
127int valid;
128};
129
130typedef struct FinderInfo {
131unsigned char data[16];
132} FinderInfo;
133
134struct BootVolume;
135typedef struct BootVolume * BVRef;
136typedef struct BootVolume * CICell;
137
138typedef long (*FSInit)(CICell ih);
139typedef long (*FSLoadFile)(CICell ih, char * filePath);
140typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);
141typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);
142typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
143 char ** name, long * flags, long * time,
144 FinderInfo * finderInfo, long * infoValid);
145typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
146typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
147// Can be just pointed to free or a special free function
148typedef void (*BVFree)(CICell ih);
149
150struct iob {
151unsigned int i_flgs;/* see F_* below */
152unsigned int i_offset;/* seek byte offset in file */
153int i_filesize;/* size of file */
154char * i_buf;/* file load address */
155};
156
157#define BPS 512/* sector size of the device */
158#define F_READ 0x1/* file opened for reading */
159#define F_WRITE 0x2/* file opened for writing */
160#define F_ALLOC 0x4/* buffer allocated */
161#define F_FILE 0x8/* file instead of device */
162#define F_NBSF 0x10/* no bad sector forwarding */
163#define F_SSI 0x40/* set skip sector inhibit */
164#define F_MEM 0x80/* memory instead of file or device */
165
166struct dirstuff {
167char * dir_path;/* directory path */
168long long dir_index;/* directory entry index */
169BVRef dir_bvr;/* volume reference */
170};
171
172#define BVSTRLEN 32
173
174struct BootVolume {
175BVRef next; /* list linkage pointer */
176int biosdev; /* BIOS device number */
177int type; /* device type (floppy, hd, network) */
178unsigned int flags; /* attribute flags */
179BVGetDescription description; /* BVGetDescription function */
180int part_no; /* partition number (1 based) */
181unsigned int part_boff; /* partition block offset */
182unsigned int part_type; /* partition type */
183unsigned int fs_boff; /* 1st block # of next read */
184unsigned int fs_byteoff; /* Byte offset for read within block */
185FSLoadFile fs_loadfile; /* FSLoadFile function */
186FSReadFile fs_readfile; /* FSReadFile function */
187FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */
188FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */
189FSGetUUID fs_getuuid; /* FSGetUUID function */
190unsigned int bps; /* bytes per sector for this device */
191char name[BVSTRLEN]; /* (name of partition) */
192char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */
193BVFree bv_free; /* BVFree function */
194uint32_t modTime;
195char label[BVSTRLEN]; /* partition volume label */
196char altlabel[BVSTRLEN]; /* partition volume label */
197bool filtered; /* newFilteredBVChain() will set to TRUE */
198bool visible; /* will shown in the device list */
199 char OSVersion[8];
200 bool OSisServer; /* 1 = OS X server , 0 = OS X client */
201bool OSisInstaller; /* 1 = OS X Install partition / recover partition , 0 = OS X Install */
202
203};
204
205enum {
206kBVFlagPrimary= 0x01,
207kBVFlagNativeBoot= 0x02,
208kBVFlagForeignBoot= 0x04,
209kBVFlagBootable= 0x08,
210kBVFlagEFISystem= 0x10,
211kBVFlagBooter= 0x20,
212kBVFlagSystemVolume= 0x40
213};
214
215enum {
216kBIOSDevTypeFloppy= 0x00,
217kBIOSDevTypeHardDrive= 0x80,
218kBIOSDevTypeNetwork= 0xE0,
219kBIOSDevUnitMask= 0x0F,
220kBIOSDevTypeMask= 0xF0,
221kBIOSDevMask= 0xFF
222};
223
224enum {
225kPartitionTypeHFS= 0xAF,
226kPartitionTypeHPFS= 0x07,
227kPartitionTypeFAT16= 0x06,
228kPartitionTypeFAT32= 0x0c,
229kPartitionTypeEXT3= 0x83,
230kPartitionTypeBEFS= 0xEB,
231kPartitionTypeFreeBSD= 0xa5,
232kPartitionTypeOpenBSD= 0xa6
233};
234
235//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
236#define BIOS_DEV_UNIT(bvr)((bvr)->biosdev - (bvr)->type)
237
238/*
239 * KernBootStruct device types.
240 */
241enum {
242DEV_SD = 0,
243DEV_HD = 1,
244DEV_FD = 2,
245DEV_EN = 3
246};
247
248/*
249 * min/max Macros.
250 * counting and rounding Macros.
251 *
252 * Azi: defined on <sys/param.h>,
253 *i386/include/IOKit/IOLib.h (min/max), and others...
254 *
255#ifndef MIN
256#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )
257#endif
258#ifndef MAX
259#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
260#endif
261
262#define round2(x, m)(((x) + (m / 2)) & ~(m - 1))
263#define roundup2(x, m)(((x) + m - 1) & ~(m - 1))*/
264
265enum {
266kNetworkDeviceType = kBIOSDevTypeNetwork,
267kBlockDeviceType = kBIOSDevTypeHardDrive
268}; //gBootFileType_t;
269
270enum {
271kCursorTypeHidden = 0x0100,
272kCursorTypeUnderline = 0x0607
273};
274
275#endif /* !__LIBSAIO_SAIO_TYPES_H */
276

Archive Download this file

Revision: 2381