Chameleon

Chameleon Svn Source Tree

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

Source at commit 1808 created 12 years 3 months ago.
By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?
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
66typedef struct {
67charplist[4096];// buffer for plist
68TagPtrdictionary;// buffer for xml dictionary
69boolcanOverride;// flag to mark a dictionary can be overriden
70} config_file_t;
71
72/*
73 * BIOS drive information.
74 */
75struct boot_drive_info {
76struct drive_params {
77unsigned short buf_size;
78unsigned short info_flags;
79unsigned long phys_cyls;
80unsigned long phys_heads;
81unsigned long phys_spt;
82unsigned long long phys_sectors;
83unsigned short phys_nbps;
84unsigned short dpte_offset;
85unsigned short dpte_segment;
86unsigned short key;
87unsigned char path_len;
88unsigned char reserved1;
89unsigned short reserved2;
90unsigned char bus_type[4];
91unsigned char interface_type[8];
92unsigned char interface_path[8];
93unsigned char dev_path[8];
94unsigned char reserved3;
95unsigned char checksum;
96} params;
97struct drive_dpte {
98unsigned short io_port_base;
99unsigned short control_port_base;
100unsigned char head_flags;
101unsigned char vendor_info;
102unsigned char irq : 4;
103unsigned char irq_unused : 4;
104unsigned char block_count;
105unsigned char dma_channel : 4;
106unsigned char dma_type : 4;
107unsigned char pio_type : 4;
108unsigned char pio_unused : 4;
109unsigned short option_flags;
110unsigned short reserved;
111unsigned char revision;
112unsigned char checksum;
113} dpte;
114} __attribute__((packed));
115typedef struct boot_drive_info boot_drive_info_t;
116
117struct driveInfo {
118boot_drive_info_t di;
119int uses_ebios;
120int no_emulation;
121int biosdev;
122int valid;
123};
124
125typedef struct FinderInfo {
126unsigned char data[16];
127} FinderInfo;
128
129struct BootVolume;
130typedef struct BootVolume * BVRef;
131typedef struct BootVolume * CICell;
132
133typedef long (*FSInit)(CICell ih);
134typedef long (*FSLoadFile)(CICell ih, char * filePath);
135typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);
136typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);
137typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
138 char ** name, long * flags, long * time,
139 FinderInfo * finderInfo, long * infoValid);
140typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
141typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
142// Can be just pointed to free or a special free function
143typedef void (*BVFree)(CICell ih);
144
145struct iob {
146unsigned int i_flgs;/* see F_* below */
147unsigned int i_offset;/* seek byte offset in file */
148int i_filesize;/* size of file */
149char * i_buf;/* file load address */
150};
151
152#define BPS 512/* sector size of the device */
153#define F_READ 0x1/* file opened for reading */
154#define F_WRITE 0x2/* file opened for writing */
155#define F_ALLOC 0x4/* buffer allocated */
156#define F_FILE 0x8/* file instead of device */
157#define F_NBSF 0x10/* no bad sector forwarding */
158#define F_SSI 0x40/* set skip sector inhibit */
159#define F_MEM 0x80/* memory instead of file or device */
160
161struct dirstuff {
162char * dir_path;/* directory path */
163long long dir_index;/* directory entry index */
164BVRef dir_bvr;/* volume reference */
165};
166
167#define BVSTRLEN 32
168
169struct BootVolume {
170BVRef next; /* list linkage pointer */
171int biosdev; /* BIOS device number */
172int type; /* device type (floppy, hd, network) */
173unsigned int flags; /* attribute flags */
174BVGetDescription description; /* BVGetDescription function */
175int part_no; /* partition number (1 based) */
176unsigned int part_boff; /* partition block offset */
177unsigned int part_type; /* partition type */
178unsigned int fs_boff; /* 1st block # of next read */
179unsigned int fs_byteoff; /* Byte offset for read within block */
180FSLoadFile fs_loadfile; /* FSLoadFile function */
181FSReadFile fs_readfile; /* FSReadFile function */
182FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */
183FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */
184FSGetUUID fs_getuuid; /* FSGetUUID function */
185unsigned int bps; /* bytes per sector for this device */
186char name[BVSTRLEN]; /* (name of partition) */
187char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */
188BVFree bv_free; /* BVFree function */
189uint32_t modTime;
190char label[BVSTRLEN]; /* partition volume label */
191char altlabel[BVSTRLEN]; /* partition volume label */
192bool filtered; /* newFilteredBVChain() will set to TRUE */
193bool visible; /* will shown in the device list */
194};
195
196enum {
197kBVFlagPrimary= 0x01,
198kBVFlagNativeBoot= 0x02,
199kBVFlagForeignBoot= 0x04,
200kBVFlagBootable= 0x08,
201kBVFlagEFISystem= 0x10,
202kBVFlagBooter= 0x20,
203kBVFlagSystemVolume= 0x40
204};
205
206enum {
207kBIOSDevTypeFloppy= 0x00,
208kBIOSDevTypeHardDrive= 0x80,
209kBIOSDevTypeNetwork= 0xE0,
210kBIOSDevUnitMask= 0x0F,
211kBIOSDevTypeMask= 0xF0,
212kBIOSDevMask= 0xFF
213};
214
215enum {
216kPartitionTypeHFS= 0xAF,
217kPartitionTypeHPFS= 0x07,
218kPartitionTypeFAT16= 0x06,
219kPartitionTypeFAT32= 0x0c,
220kPartitionTypeEXT3= 0x83
221};
222
223//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
224#define BIOS_DEV_UNIT(bvr)((bvr)->biosdev - (bvr)->type)
225
226/*
227 * KernBootStruct device types.
228 */
229enum {
230DEV_SD = 0,
231DEV_HD = 1,
232DEV_FD = 2,
233DEV_EN = 3
234};
235
236/*
237 * min/max Macros.
238 * counting and rounding Macros.
239 *
240 * Azi: defined on <sys/param.h>,
241 *i386/include/IOKit/IOLib.h (min/max), and others...
242 *
243#ifndef MIN
244#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )
245#endif
246#ifndef MAX
247#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
248#endif
249
250#define round2(x, m)(((x) + (m / 2)) & ~(m - 1))
251#define roundup2(x, m)(((x) + m - 1) & ~(m - 1))*/
252
253enum {
254kNetworkDeviceType = kBIOSDevTypeNetwork,
255kBlockDeviceType = kBIOSDevTypeHardDrive
256}; //gBootFileType_t;
257
258enum {
259kCursorTypeHidden = 0x0100,
260kCursorTypeUnderline = 0x0607
261};
262
263#endif /* !__LIBSAIO_SAIO_TYPES_H */
264

Archive Download this file

Revision: 1808