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