Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/i386/libsaio/saio_types.h

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;
102
103struct drive_dpte {
104unsigned short io_port_base;
105unsigned short control_port_base;
106unsigned char head_flags;
107unsigned char vendor_info;
108unsigned char irq : 4;
109unsigned char irq_unused : 4;
110unsigned char block_count;
111unsigned char dma_channel : 4;
112unsigned char dma_type : 4;
113unsigned char pio_type : 4;
114unsigned char pio_unused : 4;
115unsigned short option_flags;
116unsigned short reserved;
117unsigned char revision;
118unsigned char checksum;
119 } dpte;
120} __attribute__((packed));
121typedef struct boot_drive_info boot_drive_info_t;
122
123struct driveInfo {
124boot_drive_info_t di;
125
126int uses_ebios;
127int no_emulation;
128int biosdev;
129int valid;
130};
131
132typedef struct FinderInfo {
133unsigned char data[16];
134} FinderInfo;
135
136
137structBootVolume;
138typedef struct BootVolume * BVRef;
139typedef struct BootVolume * CICell;
140
141typedef long (*FSInit)(CICell ih);
142typedef long (*FSLoadFile)(CICell ih, char * filePath);
143typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);
144typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);
145typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
146 char ** name, long * flags, long * time,
147 FinderInfo * finderInfo, long * infoValid);
148typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
149typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
150// Can be just pointed to free or a special free function
151typedef void (*BVFree)(CICell ih);
152
153struct iob {
154char * i_buf; /* file load address */
155unsigned int i_flgs; /* see F_* below */
156unsigned int i_offset; /* seek byte offset in file */
157int i_filesize; /* size of file */
158};
159
160#define BPS 512/* sector size of the device */
161#define F_READ 0x1/* file opened for reading */
162#define F_WRITE 0x2/* file opened for writing */
163#define F_ALLOC 0x4/* buffer allocated */
164#define F_FILE 0x8/* file instead of device */
165#define F_NBSF 0x10/* no bad sector forwarding */
166#define F_SSI 0x40/* set skip sector inhibit */
167#define F_MEM 0x80/* memory instead of file or device */
168
169struct dirstuff {
170char * dir_path;/* directory path */
171long long dir_index;/* directory entry index */
172BVRef dir_bvr;/* volume reference */
173};
174
175#define BVSTRLEN 32
176
177struct BootVolume {
178BVRefnext;/* list linkage pointer */
179intbiosdev;/* BIOS device number */
180inttype;/* device type (floppy, hd, network) */
181unsigned intflags;/* attribute flags */
182BVGetDescriptiondescription;/* BVGetDescription function */
183intpart_no;/* partition number (1 based) */
184unsigned intpart_boff;/* partition block offset */
185unsigned intpart_type;/* partition type */
186unsigned intfs_boff;/* 1st block # of next read */
187unsigned intfs_byteoff;/* Byte offset for read within block */
188FSLoadFilefs_loadfile;/* FSLoadFile function */
189FSReadFilefs_readfile;/* FSReadFile function */
190FSGetDirEntryfs_getdirentry;/* FSGetDirEntry function */
191FSGetFileBlockfs_getfileblock;/* FSGetFileBlock function */
192FSGetUUIDfs_getuuid;/* FSGetUUID function */
193unsigned intbps;/* bytes per sector for this device */
194charname[BVSTRLEN];/* (name of partition) */
195chartype_name[BVSTRLEN];/* (type of partition, eg. Apple_HFS) */
196BVFreebv_free;/* BVFree function */
197uint32_tmodTime;
198charlabel[BVSTRLEN];/* partition volume label */
199charaltlabel[BVSTRLEN];/* partition volume label */
200boolfiltered;/* newFilteredBVChain() will set to TRUE */
201boolvisible;/* will shown in the device list */
202charOSVersion[8];
203boolOSisServer;/* 1 = OS X server , 0 = OS X client */
204boolOSisInstaller;/* 1 = OS X Install partition / recover partition , 0 = OS X Install */
205
206};
207
208enum {
209kBVFlagPrimary= 0x01,
210kBVFlagNativeBoot= 0x02,
211kBVFlagForeignBoot= 0x04,
212kBVFlagBootable= 0x08,
213kBVFlagEFISystem= 0x10,
214kBVFlagBooter= 0x20,
215kBVFlagSystemVolume= 0x40,
216kBVFlagInstallVolume= 0x80
217};
218
219enum {
220kBIOSDevTypeFloppy= 0x00,
221kBIOSDevTypeHardDrive= 0x80,
222kBIOSDevTypeNetwork= 0xE0,
223kBIOSDevUnitMask= 0x0F,
224kBIOSDevTypeMask= 0xF0,
225kBIOSDevMask= 0xFF
226};
227
228enum {
229//KPartitionTypeFAT12= 0x01, // FAT12
230kPartitionTypeHPFS= 0x07, // Mac OS X
231kPartitionTypeFAT16= 0x06, // FAT16
232kPartitionTypeFAT32= 0x0C, // FAT32
233kPartitionTypeEXT3= 0x83, // Linux
234kPartitionTypeOSXBoot= 0xAB, // Mac OS X Boot partition
235kPartitionTypeFreeBSD= 0xA5, // FreeBSD
236kPartitionTypeOpenBSD= 0xA6, // OpenBSD
237//kPartitionTypeNeXTSTEP= 0xA7 // NeXTSTEP
238//kPartitionTypeNetBSD= 0xA9 // NetBSD
239kPartitionTypeHFS= 0xAF, // Mac OS X
240//kPartitionTypeSolaris= 0xBE, // Solaris
241kPartitionTypeBEFS= 0xEB, // BeOS BFS
242//kPartitionTypeBeOS= 0xEB, // BeOS BFS
243//kPartitionTypeSkyOS= 0xEC, // SkyOS
244};
245
246//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
247#define BIOS_DEV_UNIT(bvr)((bvr)->biosdev - (bvr)->type)
248
249// KernBootStruct device types.
250
251enum {
252DEV_SD = 0,
253DEV_HD = 1,
254DEV_FD = 2,
255DEV_EN = 3
256};
257
258/*
259 * min/max Macros.
260 * counting and rounding Macros.
261 *
262 * Azi: defined on <sys/param.h>,
263 *i386/include/IOKit/IOLib.h (min/max), and others...
264 *
265#ifndef MIN
266#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )
267#endif
268#ifndef MAX
269#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
270#endif
271
272#define round2(x, m)(((x) + (m / 2)) & ~(m - 1))
273#define roundup2(x, m)(((x) + m - 1) & ~(m - 1))*/
274
275enum {
276kNetworkDeviceType = kBIOSDevTypeNetwork,
277kBlockDeviceType = kBIOSDevTypeHardDrive
278}; //gBootFileType_t;
279
280enum {
281kCursorTypeHidden = 0x0100,
282kCursorTypeUnderline = 0x0607
283};
284
285#endif /* !__LIBSAIO_SAIO_TYPES_H */
286

Archive Download this file

Revision: 2385