Chameleon

Chameleon Svn Source Tree

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

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

Archive Download this file

Revision: 1302