Chameleon

Chameleon Commit Details

Date:2012-06-04 22:43:09 (11 years 10 months ago)
Author:ErmaC
Commit:1987
Parents: 1986
Message:Code Cleaned up Add more nVidia SubIDs Merge code improvements from Slice Chameleon Branch. Package: - Update Czech.
Changes:
M/branches/ErmaC/Trunk/i386/libsaio/msdos.c
M/branches/ErmaC/Trunk/i386/boot2/gui.c
M/branches/ErmaC/Trunk/i386/libsaio/platform.h
M/branches/ErmaC/Trunk/i386/libsaio/disk.c
M/branches/ErmaC/Trunk/i386/libsaio/device_inject.c
M/branches/ErmaC/Trunk/i386/libsaio/smbios.c
M/branches/ErmaC/Trunk/i386/libsaio/xml.c
M/branches/ErmaC/Trunk/i386/libsaio/asm.s
M/branches/ErmaC/Trunk/i386/libsaio/xml.h
M/branches/ErmaC/Trunk/i386/boot2/graphics.h
M/branches/ErmaC/Trunk/i386/libsaio/ati.c
M/branches/ErmaC/Trunk/i386/libsaio/sys.c
M/branches/ErmaC/Trunk/i386/libsaio/befs.c
M/branches/ErmaC/Trunk/i386/libsaio/hfs.c
M/branches/ErmaC/Trunk/i386/libsa/memory.h
M/branches/ErmaC/Trunk/i386/libsaio/cpu.c
M/branches/ErmaC/Trunk/i386/libsaio/fake_efi.c
M/branches/ErmaC/Trunk/i386/libsaio/pci_setup.c
M/branches/ErmaC/Trunk/i386/libsaio/cpu.h
M/branches/ErmaC/Trunk/i386/libsa/strtol.c
M/branches/ErmaC/Trunk/i386/libsaio/gma.c
M/branches/ErmaC/Trunk/i386/Cconfig
M/branches/ErmaC/Trunk/i386/boot2/boot.c
M/branches/ErmaC/Trunk/i386/libsaio/dram_controllers.c
M/branches/ErmaC/Trunk/i386/libsaio/nvidia.c
M/branches/ErmaC/Trunk/i386/boot2/modules.c
M/branches/ErmaC/Trunk/i386/libsaio/pci.c
M/branches/ErmaC/Trunk/i386/boot2/boot.h
M/branches/ErmaC/Trunk/i386/libsaio/nvidia.h
M/branches/ErmaC/Trunk/i386/libsaio/pci.h
M/branches/ErmaC/Trunk/i386/libsaio/convert.c
M/branches/ErmaC/Trunk/i386/libsaio/platform.c

File differences

branches/ErmaC/Trunk/i386/libsaio/xml.c
715715
716716
717717
718
719
720
721
722
723
724
718
719
725720
721
722
723
724
725
726726
727727
728728
......
12231223
12241224
12251225
1226
1226
return 0;
}
size = length = FixDataMatchingTag(buffer, kXMLTagInteger);
if (length == -1) return -1;
tmpTag = NewTag();
if (tmpTag == 0) return -1;
integer = 0;
size = length = FixDataMatchingTag(buffer, kXMLTagInteger);
if (length == -1) return -1;
tmpTag = NewTag();
if (tmpTag == 0) return -1;
integer = 0;
if(size > 1 && (val[1] == 'x' || val[1] == 'X'))// Hex value
{
val += 2;
return true;
}
return false;
}
}
branches/ErmaC/Trunk/i386/libsaio/asm.s
8282
8383
8484
85
85
8686
8787
8888
......
344344
345345
346346
347
348
347349
348350
349351
350
351
352352
353353
354354
* New boot0 (boot1 has been deprecated). Booter must now reside in its own partition, no disk label required.
*
* Revision 1.1.1.2 1999/08/04 21:16:57 wsanchez
* Impoort of boot-66
* Import of boot-66
*
* Revision 1.3 1999/08/04 21:12:12 wsanchez
* Update APSL
//
// Port of original patch by: CPARM (who basically did this in boot.c) Thanks!
//
//
LABEL(_disableIRQs)
// The ACPI specification dictates that the 8259 (PC-AT compatible) vectors
// must be disabled (that is, masked) when enabling the ACPI APIC operation
// but this isn't done (apparently) on all mobo's and thus we do that here.
//
LABEL(_disableIRQs)
push %eax // Saving register data
branches/ErmaC/Trunk/i386/libsaio/xml.h
4848
4949
5050
51
52
53
54
55
56
57
58
59
60
51
52
53
54
55
56
57
58
59
60
61
62
63
6164
62
63
64
6565
6666
6767
extern string_ref* ref_strings;
#define kXMLTagPList "plist "
#define kXMLTagDict "dict"
#define kXMLTagKey "key"
#define kXMLTagString "string"
#define kXMLTagInteger "integer"
#define kXMLTagData "data"
#define kXMLTagDate "date"
#define kXMLTagFalse "false/"
#define kXMLTagTrue "true/"
#define kXMLTagArray "array"
#define kXMLTagPList "plist "
#define kXMLTagDict "dict"
#define kXMLTagKey "key"
#define kXMLTagString "string"
#define kXMLTagInteger "integer"
#define kXMLTagData "data"
#define kXMLTagDate "date"
#define kXMLTagFalse "false/"
#define kXMLTagTrue "true/"
#define kXMLTagArray "array"
#define kXMLTagReference "reference"
#define kXMLStringID "ID="
#define kXMLStringIDRef "IDREF="
#define kXMLStringID"ID="
#define kXMLStringIDRef "IDREF="
#define kPropCFBundleIdentifier ("CFBundleIdentifier")
#define kPropCFBundleExecutable ("CFBundleExecutable")
#define kPropOSBundleRequired ("OSBundleRequired")
branches/ErmaC/Trunk/i386/libsaio/hfs.c
300300
301301
302302
303
303304
304305
305
306
306307
307308
308309
}
getDeviceDescription(ih, devStr);
/*
verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
(gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length);
*/
return length;
}
branches/ErmaC/Trunk/i386/libsaio/gma.c
1010
1111
1212
13
1314
1415
1516
1617
1718
1819
19
20
2021
2122
2223
......
188189
189190
190191
191
192
192193
193194
194195
195196
196197
197
198
198199
199200
200201
201202
202203
203
204
204205
206
205207
206208
207209
......
212214
213215
214216
215
217
216218
217219
218220
219221
220
222
221223
222224
223225
224226
225227
226228
229
227230
231
232
228233
229234
230235
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
249254
250255
251256
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
270275
271276
272277
273
274
275
276
277
278
278
279
280
281
282
283
279284
280285
281286
282
283
287
288
284289
285
286
287
288
290
291
292
293
289294
290295
291296
#include "platform.h"
#include "device_inject.h"
#include "gma.h"
#include "graphics.h"
#ifndef DEBUG_GMA
#define DEBUG_GMA 0
#endif
#if DEBUG_GMA
#define DBG(x...)printf(x)
#define DBG(x...)verbose(x)
#else
#define DBG(x...)
#endif
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
if ((strcmp("Mobile GMA950", model) == 0) || (strcmp("Mobile GMA3150",model) == 0))
if ((model == (char *)"Mobile GMA950") || (model == (char *)"Mobile GMA3150"))
{
devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4);
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
}
else if ((strcmp("Desktop GMA950", model) == 0) || (strcmp("Desktop GMA3150",model) == 0))
else if ((model == (char *)"Desktop GMA950") || (model == (char *)"Desktop GMA3150"))
{
BuiltIn = 0x01;
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
}
else if (strcmp("GMAX3100",model) == 0)
else if (model == (char *)"GMAX3100")
{
BuiltIn = gDualLink;
devprop_add_value(device, "AAPL,HasPanel",GMAX3100_vals[0], 4);
devprop_add_value(device, "AAPL,SelfRefreshSupported",GMAX3100_vals[1], 4);
devprop_add_value(device, "AAPL,aux-power-connected",GMAX3100_vals[2], 4);
devprop_add_value(device, "AAPL01,DataJustify",GMAX3100_vals[7], 4);
devprop_add_value(device, "AAPL01,Depth",GMAX3100_vals[8], 4);
devprop_add_value(device, "AAPL01,Dither",GMAX3100_vals[9], 4);
devprop_add_value(device, "AAPL01,DualLink",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,DualLink",&BuiltIn, 1);//GMAX3100_vals[10]
devprop_add_value(device, "AAPL01,Height",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,Interlace",GMAX3100_vals[11], 4);
devprop_add_value(device, "AAPL01,Inverter",GMAX3100_vals[12], 4);
devprop_add_value(device, "AAPL01,InverterCurrent",GMAX3100_vals[13], 4);
devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
//devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,LinkFormat",GMAX3100_vals[14], 4);
devprop_add_value(device, "AAPL01,LinkType",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,Pipe",GMAX3100_vals[16], 4);
devprop_add_value(device, "AAPL01,PixelFormat",GMAX3100_vals[17], 4);
devprop_add_value(device, "AAPL01,Refresh",GMAX3100_vals[18], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[19], 4);
devprop_add_value(device, "AAPL01,InverterFrequency",GMAX3100_vals[20], 4);
devprop_add_value(device, "class-code",ClassFix, 4);
devprop_add_value(device, "subsystem-vendor-id",GMAX3100_vals[21], 4);
devprop_add_value(device, "subsystem-id",GMAX3100_vals[22], 4);
}
else if (model == (char *)"Intel HD Graphics 2000 Mobile")
{
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL00,PixelFormat", HD2000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1", HD2000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2", HD2000_vals[2], 4);
devprop_add_value(device, "AAPL00,T3", HD2000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4", HD2000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5", HD2000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6", HD2000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType", HD2000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat", HD2000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink", HD2000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither", HD2000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4);
devprop_add_value(device, "graphic-options", HD2000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL00,PixelFormat",HD2000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1",HD2000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2",HD2000_vals[2], 4);
devprop_add_value(device, "AAPL00,T3",HD2000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4",HD2000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5",HD2000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6",HD2000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7",HD2000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType",HD2000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat",HD2000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink",HD2000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither",HD2000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify",HD3000_vals[12], 4);
devprop_add_value(device, "graphic-options",HD2000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
}
else if (model == (char *)"Intel HD Graphics 3000 Mobile")
{
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL00,PixelFormat", HD3000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1", HD3000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2", HD3000_vals[2], 4);
devprop_add_value(device, "AAPL00,T3", HD3000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4", HD3000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5", HD3000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6", HD3000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType", HD3000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat", HD3000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink", HD3000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither", HD3000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4);
devprop_add_value(device, "graphic-options", HD3000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20);
devprop_add_value(device, "class-code",ClassFix, 4);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL00,PixelFormat",HD3000_vals[0], 4);
devprop_add_value(device, "AAPL00,T1",HD3000_vals[1], 4);
devprop_add_value(device, "AAPL00,T2",HD3000_vals[2], 4);
devprop_add_value(device, "AAPL00,T3",HD3000_vals[3], 4);
devprop_add_value(device, "AAPL00,T4",HD3000_vals[4], 4);
devprop_add_value(device, "AAPL00,T5",HD3000_vals[5], 4);
devprop_add_value(device, "AAPL00,T6",HD3000_vals[6], 4);
devprop_add_value(device, "AAPL00,T7",HD3000_vals[7], 4);
devprop_add_value(device, "AAPL00,LinkType",HD3000_vals[8], 4);
devprop_add_value(device, "AAPL00,LinkFormat",HD3000_vals[9], 4);
devprop_add_value(device, "AAPL00,DualLink",HD3000_vals[10], 4);
devprop_add_value(device, "AAPL00,Dither",HD3000_vals[11], 4);
devprop_add_value(device, "AAPL00,DataJustify",HD3000_vals[12], 4);
devprop_add_value(device, "graphic-options",HD3000_vals[13], 4);
devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
}
else if (model == (char *)"Intel HD Graphics 2000")
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id));
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20);
devprop_add_value(device, "built-in",&BuiltIn, 1);
devprop_add_value(device, "class-code",ClassFix, 4);
devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info",HD2000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD2000_os_info, 20);
}
else if (model == (char *)"Intel HD Graphics 3000")
{
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
devprop_add_value(device, "built-in",&BuiltIn, 1);
devprop_add_value(device, "class-code",ClassFix, 4);
device_id = 0x00000126;// Inject a valid mobile GPU device id instead of patching kexts
devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id));
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20);
devprop_add_value(device, "device-id",(uint8_t*)&device_id, sizeof(device_id));
devprop_add_value(device, "hda-gfx",(uint8_t *)"onboard-1", 10);
devprop_add_value(device, "AAPL,tbl-info",HD3000_tbl_info, 18);
devprop_add_value(device, "AAPL,os-info",HD3000_os_info, 20);
}
stringdata = malloc(sizeof(uint8_t) * string->length);
branches/ErmaC/Trunk/i386/libsaio/befs.c
2929
3030
3131
32
3233
34
3335
3436
3537
char * buf=malloc (BeFSProbeSize);
str[0]=0;
if (!buf)
{
return;
}
Seek(ih, 0);
Read(ih, (long)buf, BeFSProbeSize);
if (!BeFSProbe (buf))
branches/ErmaC/Trunk/i386/libsaio/device_inject.c
158158
159159
160160
161
161
162162
163163
164164
......
193193
194194
195195
196
196
197197
198198
199199
......
257257
258258
259259
260
260
261261
262262
263263
......
364364
365365
366366
367
367
368368
369369
370
370
371371
372372
373373
374374
375375
376
376
377377
378378
379379
380380
381
381
382382
383383
384384
......
386386
387387
388388
389
389
390390
391391
392392
if(!numpaths)
{
free(device);
free(device);
return NULL;
}
{
if((string->entries = (struct DevPropDevice**)malloc(sizeof(device)))== NULL)
{
free(device);
free(device);
return NULL;
}
}
memcpy(newdata, device->data, offset);
}
}
memcpy(newdata + offset, data, length);
device->length += length;
int devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id)
{
uint8_t builtin = 0x0;
if(device)
{
if((vendor_id != 0x168c) && (builtin_set == 0))
{
builtin_set = 1;
builtin = 0x01;
}
if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1))
{
return 0;
}
devices_number++;
return 1;
}
{
return 0;
}
}
void set_eth_builtin(pci_dt_t *eth_dev)
branches/ErmaC/Trunk/i386/libsaio/dram_controllers.c
503503
504504
505505
506
506
507507
508
508
509509
510510
511511
512512
513
513
514514
515515
516516
......
522522
523523
524524
525
525526
526527
527528
{ 0x8086, 0x2A10, "GME965/GLE960",setup_p35, get_fsb_im965,get_timings_im965},
{ 0x8086, 0x2A40, "PM/GM45/47",setup_p35, get_fsb_im965,get_timings_im965},
{ 0x8086, 0x29B0, "Q35",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x29B0, "Q35",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x29C0, "P35/G33",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x29D0, "Q33",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x29D0, "Q33",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x29E0, "X38/X48",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x2E00, "Eaglelake",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x2E10, "Q45/Q43",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x2E20, "P45/G45",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x2E30, "G41",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0x2E30, "G41",setup_p35, get_fsb_i965,get_timings_p35},
{ 0x8086, 0xD131, "NHM IMC",setup_nhm, get_fsb_nhm,get_timings_nhm},
{ 0x8086, 0xD132, "NHM IMC",setup_nhm, get_fsb_nhm,get_timings_nhm},
{ 0x8086, 0x3405, "NHM IMC",setup_nhm, get_fsb_nhm,get_timings_nhm},
{ 0x8086, 0x3406, "NHM IMC",setup_nhm, get_fsb_nhm,get_timings_nhm},
{ 0x8086, 0x3407, "NHM IMC",setup_nhm, get_fsb_nhm,get_timings_nhm},
};
static const char *memory_channel_types[] =
branches/ErmaC/Trunk/i386/libsaio/nvidia.c
5959
6060
6161
62
62
6363
6464
6565
......
9999
100100
101101
102
103
104102
105103
106104
107105
108
109
110
111
106
107
108
109
112110
113111
114112
......
157155
158156
159157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
160198
161199
162200
......
337375
338376
339377
378
340379
341380
342381
......
9631002
9641003
9651004
966
1005
9671006
9681007
9691008
#endif
#if DEBUG_NVIDIA
#define DBG(x...)printf(x)
#define DBG(x...)verbose(x)
#else
#define DBG(x...)
#endif
static uint8_t default_dcfg_0[]={0x03, 0x01, 0x03, 0x00};
static uint8_t default_dcfg_1[]={0xff, 0xff, 0x00, 0x01};
// uint8_t connector_type_1[]={0x00, 0x08, 0x00, 0x00};
#define DCFG0_LEN ( sizeof(default_dcfg_0) / sizeof(uint8_t) )
#define DCFG1_LEN ( sizeof(default_dcfg_1) / sizeof(uint8_t) )
static uint8_t default_NVPM[]= {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
#define NVPM_LEN ( sizeof(default_NVPM) / sizeof(uint8_t) )
// 01B0 - 01BF
// 01C0 - 01CF
// 01D0 - 01DF
{ 0x10DE01D7,0x1025006C,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250090,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250096,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250100,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250107,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250110,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x10250112,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x102501C2,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x102501C8,"Acer GeForce Go 7300" },
{ 0x10DE01D7,0x102801C2,"Dell Quadro NVS 110M" },
{ 0x10DE01D7,0x102801C8,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x102801CC,"Dell Quadro NVS 110M" },
{ 0x10DE01D7,0x102801D7,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x102801E2,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x102801F9,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x102801FE,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x10282003,"Dell GeForce Go 7300" },
{ 0x10DE01D7,0x10338848,"NEC GeForce Go 7300" },
{ 0x10DE01D7,0x103C30B2,"HP GeForce Go 7300" },
{ 0x10DE01D7,0x103C30B7,"HP GeForce Go 7300" },
{ 0x10DE01D7,0x10431212,"Asus GeForce Go 7300" },
{ 0x10DE01D7,0x104313A2,"Asus GeForce Go 7300" },
{ 0x10DE01D7,0x10431441,"Asus GeForce Go 7300" },
{ 0x10DE01D7,0x10DE0000,"nVidia GeForce Go 7300" },
{ 0x10DE01D7,0x10DE014B,"nVidia Quadro NVS 110M" },
{ 0x10DE01D7,0x11790001,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x11790002,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x1179FF00,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x1179FF01,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x1179FF02,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x1179FF10,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x1179FF31,"Toshiba GeForce Go 7300" },
{ 0x10DE01D7,0x13DC1172,"Netbost GeForce Go 7300" },
{ 0x10DE01D7,0x144D8063,"Samsung GeForce Go 7300" },
{ 0x10DE01D7,0x144DC024,"Samsung GeForce Go 7300" },
{ 0x10DE01D7,0x144DC026,"Samsung GeForce Go 7300" },
{ 0x10DE01D7,0x144DC513,"Samsung GeForce Go 7300" },
{ 0x10DE01D7,0x14C00012,"Compal GeForce Go 7300" },
{ 0x10DE01D7,0xC0181631,"GeForce Go 7300" },
{ 0x10DE01D8,0x10250090,"Acer GeForce Go 7400" },
{ 0x10DE01D8,0x102801C8,"Dell GeForce Go 7400" },
{ 0x10DE01D8,0x102801CC,"Dell Quadro NVS 120M" },
{ 0x10DE05E2,0x104382C4,"Asus GTX 260" },
{ 0x10DE05E2,0x104382CF,"Asus GTX 260" },
{ 0x10DE05E2,0x104382E3,"Asus GTX 260" },
{ 0x10DE05E2,0x104382EB,"ASUS ENGTX260" },
{ 0x10DE05E2,0x10B00801,"Gainward GTX 260" },
{ 0x10DE05E2,0x10DE0585,"nVidia GTX 260" },
{ 0x10DE05E2,0x10DE0617,"nVidia GTX 260" },
{ 0x10DE01D2,NV_SUB_IDS,"GeForce 7550 LE" },
{ 0x10DE01D3,NV_SUB_IDS,"GeForce 7300 SE/7200 GS" },
{ 0x10DE01D6,NV_SUB_IDS,"GeForce Go 7200" },
{ 0x10DE01D7,NV_SUB_IDS,"Quadro NVS 110M / GeForce Go 7300" }, // 71 SubID
{ 0x10DE01D7,NV_SUB_IDS,"Quadro NVS 110M / GeForce Go 7300" },
{ 0x10DE01D8,NV_SUB_IDS,"GeForce Go 7400" },
{ 0x10DE01D9,NV_SUB_IDS,"GeForce Go 7450" },
{ 0x10DE01DA,NV_SUB_IDS,"Quadro NVS 110M" },
branches/ErmaC/Trunk/i386/libsaio/ati.c
804804
805805
806806
807
808
807809
810
811
808812
809813
810814
......
974978
975979
976980
977
978
979
980
981
982
981
982
983
984
985
986
983987
984988
985989
......
993997
994998
995999
996
1000
9971001
9981002
1003
9991004
10001005
10011006
10021007
1003
1004
1008
1009
10051010
10061011
10071012
......
11021107
11031108
11041109
1110
11051111
11061112
11071113
{ 0x6818,0x042F1043, CHIP_FAMILY_PITCAIRN,"Asus HD 7870", kNull},
{ 0x6818,0x04311043, CHIP_FAMILY_PITCAIRN,"Asus HD 7870", kNull},
{ 0x6818,0x0B041002, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6818,0x201C1787, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6818,0x23211787, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6818,0x25541458, CHIP_FAMILY_PITCAIRN,"Gigabyte HD 7870", kNull},
{ 0x6818,0x27401462, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6818,0x32501682, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6818,0xE217174B, CHIP_FAMILY_PITCAIRN,"ATI Radeon HD 7870", kNull},
{ 0x6819,0x04311043, CHIP_FAMILY_PITCAIRN,"Asus HD 7850", kNull},
/* IGP */
{ 0x791E,0x00000000, CHIP_FAMILY_RS690,"ATI Radeon IGP ", kNull },
{ 0x791F,0x00000000, CHIP_FAMILY_RS690,"ATI Radeon IGP ", kNull},
{ 0x796C,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull },
{ 0x796D,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull},
{ 0x796E,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull},
{ 0x796F,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon HD ", kNull },
{ 0x791E,0x00000000, CHIP_FAMILY_RS690,"ATI Radeon IGP ", kNull},
{ 0x791F,0x00000000, CHIP_FAMILY_RS690,"ATI Radeon IGP ", kNull},
{ 0x796C,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull},
{ 0x796D,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull},
{ 0x796E,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon IGP ", kNull},
{ 0x796F,0x00000000, CHIP_FAMILY_RS740,"ATI Radeon HD ", kNull},
/* standard/default models */
{ 0x940F,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 GT", kNull},
{ 0x9440,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9441,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2", kMotmot},
{ 0x9441,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2", kMotmot},
{ 0x9442,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9443,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4850 X2", kMotmot},
{ 0x9444,0x00000000, CHIP_FAMILY_RV770,"ATI FirePro V8750 (FireGL)", kMotmot},
{ 0x944A,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944C,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944E,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4700 Series",kMotmot},
{ 0x9450,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9270", kMotmot},
{ 0x9452,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9250", kMotmot},
{ 0x9450,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9270", kMotmot},
{ 0x9452,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9250", kMotmot},
{ 0x9460,0x00000000, CHIP_FAMILY_RV790,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9462,0x00000000, CHIP_FAMILY_RV790,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x6898,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x6899,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
//{ 0x689B,0x00000000, CHIP_FAMILY_???,"AMD Radeon HD 6800 Series",kNull},
{ 0x689C,0x00000000, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5900 Series",kUakari},
{ 0x689E,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
branches/ErmaC/Trunk/i386/libsaio/sys.c
798798
799799
800800
801
801
802802
803803
804
805
804
805
806806
807807
808808
......
10001000
10011001
10021002
1003
1003
10041004
10051005
10061006
hd++;
}
// Also scanning CD/DVD drive.
// Also scanning CD/DVD drive.
if (biosDevIsCDROM(gBIOSDev))
{
bvCount = 0;
scanBootVolumes(gBIOSDev, &bvCount);
bvCount = 0;
scanBootVolumes(gBIOSDev, &bvCount);
}
}
if (*cp == RP) cp++;
biosdev = dp->biosdev + unit;
bvr = newBootVolumeRef(biosdev, part);
bvr = newBootVolumeRef(biosdev, part);
if(bvr == NULL)
return NULL;
branches/ErmaC/Trunk/i386/libsaio/nvidia.h
7070
7171
7272
73
73
7474
75
75
7676
7777
7878
......
8181
8282
8383
84
85
86
87
84
85
86
87
8888
8989
9090
uint8_tsize;/* Size in multiples of 512 */
};
#define NV_SUB_IDS 0x00000000
#define NV_SUB_IDS0x00000000
#define NV_PMC_OFFSET0x000000
#define NV_PMC_SIZE 0x2ffff
#define NV_PMC_SIZE0x2ffff
#define NV_PDISPLAY_OFFSET0x610000
#define NV_PDISPLAY_SIZE0x10000
#define NV_PRAMIN_OFFSET0x00700000
#define NV_PRAMIN_SIZE0x00100000
#define NV04_PFB_FIFO_DATA0x0010020c
#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK0xfff00000
#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT20
#define NVC0_MEM_CTRLR_COUNT0x00121c74
#define NVC0_MEM_CTRLR_RAM_AMOUNT0x0010f20c
#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK0xfff00000
#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT20
#define NVC0_MEM_CTRLR_COUNT0x00121c74
#define NVC0_MEM_CTRLR_RAM_AMOUNT0x0010f20c
#define NV_PBUS_PCI_NV_200x00001850
#define NV_PBUS_PCI_NV_20_ROM_SHADOW_DISABLED(0 << 0)
branches/ErmaC/Trunk/i386/libsaio/platform.c
2929
3030
3131
32
32
33
3334
34
35
36
37
3538
3639
3740
/** Return if a CPU feature specified by feature is activated (true) or not (false) */
bool platformCPUFeature(uint32_t feature)
{
if (Platform.CPU.Features & feature) {
if (Platform.CPU.Features & feature)
{
return true;
} else {
}
else
{
return false;
}
}
branches/ErmaC/Trunk/i386/libsaio/cpu.c
140140
141141
142142
143
143
144144
145145
146146
......
227227
228228
229229
230
230
231231
232232
233
233
234234
235235
236
236
237237
238238
239239
......
248248
249249
250250
251
251
252252
253253
254254
......
260260
261261
262262
263
263
264264
265265
266266
......
268268
269269
270270
271
271
272272
273
273
274274
275275
276276
......
292292
293293
294294
295
295
296296
297297
298298
......
352352
353353
354354
355
355
356356
357357
358358
......
366366
367367
368368
369
369
370370
371371
372372
......
408408
409409
410410
411
411
412412
413413
414414
......
424424
425425
426426
427
427
428428
429
429
430430
431431
432432
......
440440
441441
442442
443
443
444444
445445
446446
......
452452
453453
454454
455
455
456456
457457
458458
......
463463
464464
465465
466
466
467467
468468
469469
......
493493
494494
495495
496
496
497497
498498
499499
......
509509
510510
511511
512
512
513513
514
514
515515
516516
517517
518518
519519
520
520
521521
522
522
523523
524524
525525
526526
527
527
528528
529529
530530
......
534534
535535
536536
537
537
538538
539539
540540
......
568568
569569
570570
571
571
572572
573573
574574
......
576576
577577
578578
579
579
580580
581581
582582
* Hz so we need to convert our milliseconds to seconds. Since we're
* dividing by the milliseconds, we simply multiply by 1000.
*/
/* Unlike linux, we're not limited to 32-bit, but we do need to take care
* that we're going to multiply by 1000 first so we do need at least some
* arithmetic headroom. For now, 32-bit should be enough.
uint64_tmsr, flex_ratio;
uint8_tmaxcoef, maxdiv, currcoef, bus_ratio_max, currdiv;
const char*newratio;
intlen, myfsb;
intlen, myfsb;
uint8_tbus_ratio_min;
uint32_tmax_ratio, min_ratio;
max_ratio = min_ratio = myfsb = bus_ratio_min = 0;
maxcoef = maxdiv = bus_ratio_max = currcoef = currdiv = 0;
/* get cpuid values */
do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]);
do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]);
else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) {
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
}
#if DEBUG_CPU
{
inti;
}
}
#endif
p->CPU.Vendor= p->CPU.CPUID[CPUID_0][1];
p->CPU.Signature= p->CPU.CPUID[CPUID_1][0];
p->CPU.Stepping= bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0);
p->CPU.Family= bitfield(p->CPU.CPUID[CPUID_1][0], 11, 8);
p->CPU.ExtModel= bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16);
p->CPU.ExtFamily= bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20);
p->CPU.Model += (p->CPU.ExtModel << 4);
if (p->CPU.Vendor == CPUID_VENDOR_INTEL &&
p->CPU.Family == 0x06 &&
p->CPU.Model >= CPUID_MODEL_NEHALEM &&
p->CPU.NoThreads= bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1;
}
/* get brand string (if supported) */
/* Copyright: from Apple's XNU cpuid.c */
if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) {
if (p->CPU.NoThreads > p->CPU.NoCores) {
p->CPU.Features |= CPU_FEATURE_HTT;
}
tscFrequency = measure_tsc_frequency();
DBG("cpu freq classic = 0x%016llx\n", tscFrequency);
/* if usual method failed */
}
fsbFrequency = 0;
cpuFrequency = 0;
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) {
int intelCPU = p->CPU.Model;
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) {
}
}
}
if (bus_ratio_max) {
fsbFrequency = (tscFrequency / bus_ratio_max);
}
max_ratio = atoi(newratio);
max_ratio = (max_ratio * 10);
if (len >= 3) max_ratio = (max_ratio + 5);
verbose("Bus-Ratio: min=%d, max=%s\n", bus_ratio_min, newratio);
// extreme overclockers may love 320 ;)
if ((max_ratio >= min_ratio) && (max_ratio <= 320)) {
cpuFrequency = (fsbFrequency * max_ratio) / 10;
/*if (bus_ratio_max > 0) bus_ratio = flex_ratio;*/
p->CPU.MaxRatio = max_ratio;
p->CPU.MinRatio = min_ratio;
myfsb = fsbFrequency / 1000000;
verbose("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", myfsb, max_ratio);
currcoef = bus_ratio_max;
maxdiv = bitfield(msr, 46, 46);
/* Non-integer bus ratio for the current-multi (undocumented)*/
currdiv = bitfield(msr, 14, 14);
// This will always be model >= 3
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f))
{
/* XXX */
maxcoef = currcoef;
}
if (maxcoef) {
if (maxdiv) {
fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1));
maxcoef = bitfield(msr, 21, 16) / 2 + 4;
currcoef = bitfield(msr, 5, 0) / 2 + 4;
break;
case 0x01: /* K10 */
msr = rdmsr64(K10_COFVID_STATUS);
do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]);
maxcoef = bitfield(msr, 54, 49) / 2 + 4;
currcoef = bitfield(msr, 5, 0) + 0x10;
currdiv = 2 << bitfield(msr, 8, 6);
break;
case 0x05: /* K14 */
msr = rdmsr64(K10_COFVID_STATUS);
currcoef = (bitfield(msr, 54, 49) + 0x10) << 2;
currdiv = (bitfield(msr, 8, 4) + 1) << 2;
currdiv += bitfield(msr, 3, 0);
break;
case 0x02: /* K11 */
// not implimented
break;
}
if (maxcoef)
{
if (currdiv)
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
else
fsbFrequency = ((cpuFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
if (!cpuFrequency)
DBG("cpu freq = 0x%016llxn", timeRDTSC() * 20);
#endif
p->CPU.MaxCoef = maxcoef;
p->CPU.MaxDiv = maxdiv;
p->CPU.CurrCoef = currcoef;
p->CPU.TSCFrequency = tscFrequency;
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
// keep formatted with spaces instead of tabs
DBG("CPU: Brand String: %s\n", p->CPU.BrandString);
DBG("CPU: Vendor/Family/ExtFamily: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Family, p->CPU.ExtFamily);
branches/ErmaC/Trunk/i386/libsaio/platform.h
8383
8484
8585
86
86
8787
8888
8989
......
138138
139139
140140
141
141
142142
143143
144144
......
151151
152152
153153
154
154
155155
156
157
158
159
156
157
158
159
160160
161
162
161
162
163163
164164
165165
#define SMB_MEM_TYPE_DDR18
#define SMB_MEM_TYPE_DDR219
#define SMB_MEM_TYPE_FBDIMM20
#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
/* Memory Configuration Types */
#define SMB_MEM_CHANNEL_UNKNOWN0
charBrandString[48];// 48 Byte Branding String
uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
} CPU;
struct RAM {
uint64_tFrequency;// Ram Frequency
uint32_tDivider;// Memory divider
uint8_tType;// Standard SMBIOS v2.5 Memory Type
RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
} RAM;
struct DMI {
intMaxMemorySlots;// number of memory slots populated by SMBIOS
intCntMemorySlots;// number of memory slots counted
intMemoryModules;// number of memory modules installed
intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
intMaxMemorySlots;// number of memory slots populated by SMBIOS
intCntMemorySlots;// number of memory slots counted
intMemoryModules;// number of memory modules installed
intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
} DMI;
uint8_tType; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
uint8_t*UUID;
} PlatformInfo_t;
branches/ErmaC/Trunk/i386/libsaio/disk.c
8080
8181
8282
83
8483
84
8585
8686
8787
88
89
8890
8991
9092
......
9294
9395
9496
95
96
97
98
99
100
97
98
99
101100
102
103
101
102
103
104104
105
106
107
108
109
110
111
112
105
113106
114107
115
116
117
118
119
120
121
122
108
109
110
111
112
113
114
123115
124116
125117
126118
127119
128
129
130
131
120
121
132122
133123
134124
......
137127
138128
139129
140
130
141131
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
132
133
162134
163
164
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
165161
166
167
168
169
162
163
164
165
166
167
168
170169
171
172170
173
171
174172
175
173
176174
177175
178176
179177
180178
181
182
183
179
180
181
182
184183
185184
186
187
185
188186
189
187
190188
191
192
193
194
195
189
190
191
192
193
194
195
196
196197
197198
198199
199200
200201
201
202
203
204
205
206
207
202
203
204
205
206
207
208
208209
209210
210211
211212
212
213
213
214
214215
215
216
216
217217
218
219
218
219
220
221
222
223
224
220225
221226
222227
223
224
225
228
229
226230
227
228
231
229232
230233
231234
232
235
233236
234
235
236
237
238
239
237240
238
239
240
241
241
242
243
244
242245
243
244
245
246
247
248
249
250
251
252
253
254
255
246
247
248
249
250
251
252
253
254
255
256
257
256258
257
259
260
261
262
263
264
258265
259
260
266
261267
262
263
264
265
266
267
268
269
270
271
272
268
269
273270
274
275
276
271
272
273
274
275
276
277
277278
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
279
280
281
297282
298
299
300
301
302
303
304
305
306
307
308
283
284
285
286
287
288
289
290
309291
310
311
292
293
294
295
296
312297
313
314
315
316
317
298
299
300
301
302
303
304
318305
319
320
321
322
323
324
325
326
327
328
329
330
331
332
306
307
308
309
310
311
312
333313
334
314
335315
336
337
338
339
340
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
341347
342
348
343349
344
350
345351
346352
347353
348354
349
355
350356
351357
352358
353359
354360
355361
356
357
358
362
359363
360
361
362
364
365
366
367
368
363369
364
365
366
370
371
372
367373
368
369
374
370375
371
372
373
374
375
376
377
378
376
377
378
379379
380
381
382
383
384
380
381
382
383
384
385385
386
386
387
388
389
390
387391
388
392
393
394
389395
390396
391397
392398
393399
394400
395
396
397
398
399
400
401
402
403
404
405
406
401407
402
408
403409
404
405
406
407
408
410
411
412
413
414
415
416
417
409418
410419
411420
......
413422
414423
415424
416
417
418
419
420
421
422
425
426
427
428
429
430
431
423432
424
425
426
427
433
434
435
436
428437
429
430
431
432
433
434
435
438
439
440
441
442
443
444
436445
437
438
439
446
447
448
440449
441
442
443
444
445
446
447
450
451
452
453
454
455
456
448457
449
458
450459
451
452
453
454
460
461
462
463
464
455465
456
466
457467
458
459
460
461
462
463
464
465
466
468
469
470
471
472
473
474
475
476
467477
468
478
469479
470
480
471481
472
482
473483
474
475
476
477
478
484
485
486
487
488
479489
480
490
481491
482
483
484
485
492
493
494
495
486496
487
488
497
498
489499
490
491
500
501
492502
493
494
503
504
495505
496
506
497507
498508
499509
......
509519
510520
511521
512
513
514
515
522
523
524
525
516526
517
518
519
520
521
522
523
524
525
526
527
528
527
528
529
530
531
532
533
534
535
536
537
538
529539
530
531
532
540
541
542
543
544
533545
534546
535547
......
540552
541553
542554
543
544
555
545556
546557
547558
......
561572
562573
563574
564
565
575
576
577
578
579
566580
567581
568582
......
612626
613627
614628
615
616
629
617630
618631
619632
......
638651
639652
640653
641
654
655
656
657
658
659
660
661
662
663
664
665
666
667
642668
643
644
669
670
671
645672
673
674
675
676
646677
647
648
649
650
651
652
653
654
655
656
657678
658679
659680
......
13481369
13491370
13501371
1372
1373
1374
1375
1376
13511377
13521378
13531379
......
15831609
15841610
15851611
1586
1612
15871613
15881614
15891615
......
18501876
18511877
18521878
1853
1879
18541880
18551881
18561882
1857
1883
18581884
1859
1885
18601886
18611887
18621888
......
18771903
18781904
18791905
1880
1906
18811907
18821908
18831909
18841910
18851911
1886
1912
18871913
18881914
18891915
18901916
18911917
1892
1918
18931919
18941920
18951921
18961922
18971923
1898
1924
18991925
19001926
19011927
......
19161942
19171943
19181944
1919
1945
19201946
19211947
19221948
19231949
19241950
1925
1951
19261952
1927
1928
1953
1954
19291955
1930
1931
1932
1933
1934
1935
1936
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
19371968
1938
1969
19391970
1940
1941
1942
1971
19431972
1944
1973
1974
1975
1976
1977
19451978
19461979
19471980
......
19852018
19862019
19872020
1988
2021
19892022
19902023
19912024
#include "disk.h"
// For EFI_GUID
#include "efi.h"
#include "efi_tables.h"
typedef struct gpt_hdr gpt_hdr;
typedef struct gpt_ent gpt_ent;
#include "efi_tables.h"
#define PROBEFS_SIZE BPS * 4 /* buffer size for filesystem probe */
#define CD_BPS 2048 /* CD-ROM block size */
#define N_CACHE_SECS (BIOS_LEN / BPS) /* Must be a multiple of 4 for CD-ROMs */
#define kAPMSector 2 /* Sector number of Apple partition map */
#define kAPMCDSector 8 /* Translated sector of Apple partition map on a CD */
/*
* IORound and IOTrunc convenience functions, in the spirit
* of vm's round_page() and trunc_page().
*/
#define IORound(value,multiple) \
((((value) + (multiple) - 1) / (multiple)) * (multiple))
// IORound and IOTrunc convenience functions, in the spirit of vm's round_page() and trunc_page().
#define IORound(value, multiple) ((((value) + (multiple) - 1) / (multiple)) * (multiple))
#define IOTrunc(value, multiple) (((value) / (multiple)) * (multiple));
#define IOTrunc(value,multiple) \
(((value) / (multiple)) * (multiple));
// trackbuf points to the start of the track cache. Biosread()
// will store the sectors read from disk to this memory area.
static char * const trackbuf = (char *) ptov(BIOS_ADDR);
/*
* trackbuf points to the start of the track cache. Biosread()
* will store the sectors read from disk to this memory area.
*
* biosbuf points to a sector within the track cache, and is
* updated by Biosread().
*/
static char * const trackbuf = (char *) ptov(BIOS_ADDR);
// biosbuf points to a sector within the track cache, and is updated by Biosread().
static char * biosbuf;
/*
* Map a disk drive to bootable volumes contained within.
*/
struct DiskBVMap {
int biosdev; // BIOS device number (unique)
BVRef bvr; // chain of boot volumes on the disk
int bvrcnt; // number of boot volumes
struct DiskBVMap * next; // linkage to next mapping
// Map a disk drive to bootable volumes contained within.
struct DiskBVMap
{
intbiosdev;// BIOS device number (unique).
BVRefbvr;// Chain of boot volumes on the disk.
intbvrcnt;// Number of boot volumes.
struct DiskBVMap *next;// Linkage to next mapping.
};
static struct DiskBVMap * gDiskBVMap = NULL;
static struct disk_blk0 * gBootSector = NULL;
// Function pointers to be filled in if ramdisks are available:
int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,
unsigned int byteoff,
unsigned int byteCount, void * buffer ) = NULL;
// Function pointers to be filled in when a ramdisk is available:
int (*p_ramdiskReadBytes)(int biosdev, unsigned int blkno, unsigned int byteoff, unsigned int byteCount, void * buffer) = NULL;
int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL;
static bool getOSVersion(BVRef bvr, char *str);
//==========================================================================
static int getDriveInfo( int biosdev, struct driveInfo *dip )
static int getDriveInfo(int biosdev, struct driveInfo *dip)
{
static struct driveInfo cached_di;
int cc;
// Real BIOS devices are 8-bit, so anything above that is for internal use.
// Don't cache ramdisk drive info since it doesn't require several BIOS
// calls and is thus not worth it.
if(biosdev >= 0x100)
{
if(p_get_ramdisk_info != NULL)
cc = (*p_get_ramdisk_info)(biosdev, dip);
else
cc = -1;
if(cc < 0)
{
dip->valid = 0;
return -1;
}
else
return 0;
}
static struct driveInfo cached_di;
int cc;
if ( !cached_di.valid || biosdev != cached_di.biosdev )
{
// Real BIOS devices are 8-bit, so anything above that is for internal use.
// Don't cache ramdisk drive info since it doesn't require several BIOS
// calls and is thus not worth it.
if (biosdev >= 0x100)
{
if (p_get_ramdisk_info != NULL)
{
cc = (*p_get_ramdisk_info)(biosdev, dip);
}
else
{
cc = -1;
}
if (cc < 0)
{
dip->valid = 0;
return -1;
}
else
{
return 0;
}
}
if (!cached_di.valid || biosdev != cached_di.biosdev)
{
cc = get_drive_info(biosdev, &cached_di);
if (cc < 0) {
cached_di.valid = 0;
DEBUG_DISK(("get_drive_info returned error\n"));
return (-1); // BIOS call error
if (cc < 0)
{
cached_di.valid = 0;
DEBUG_DISK(("get_drive_info returned error\n"));
return (-1); // BIOS call error
}
}
}
bcopy(&cached_di, dip, sizeof(cached_di));
bcopy(&cached_di, dip, sizeof(cached_di));
return 0;
return 0;
}
//==========================================================================
// Maps (E)BIOS return codes to message strings.
struct NamedValue {
unsigned char value;
const char * name;
struct NamedValue
{
unsigned char value;
const char * name;
};
static const char * getNameForValue( const struct NamedValue * nameTable,
unsigned char value )
static const char * getNameForValue(const struct NamedValue * nameTable, unsigned char value)
{
const struct NamedValue * np;
const struct NamedValue * np;
for ( np = nameTable; np->value; np++)
if (np->value == value)
return np->name;
return NULL;
for ( np = nameTable; np->value; np++)
{
if (np->value == value)
{
return np->name;
}
}
return NULL;
}
#define ECC_CORRECTED_ERR 0x11
static const struct NamedValue bios_errors[] = {
{ 0x10, "Media error" },
{ 0x11, "Corrected ECC error" },
{ 0x20, "Controller or device error" },
{ 0x40, "Seek failed" },
{ 0x80, "Device timeout" },
{ 0xAA, "Drive not ready" },
{ 0x00, 0 }
{ 0x10, "Media error" },
{ 0x11, "Corrected ECC error" },
{ 0x20, "Controller or device error" },
{ 0x40, "Seek failed" },
{ 0x80, "Device timeout" },
{ 0xAA, "Drive not ready" },
{ 0x00, 0 }
};
static const char * bios_error(int errnum)
{
static char errorstr[] = "Error 0x00";
const char * errname;
static char errorstr[] = "Error 0x00";
const char * errname;
errname = getNameForValue( bios_errors, errnum );
if ( errname ) return errname;
errname = getNameForValue(bios_errors, errnum);
sprintf(errorstr, "Error 0x%02x", errnum);
return errorstr; // No string, print error code only
if (errname)
{
return errname;
}
sprintf(errorstr, "Error 0x%02x", errnum);
return errorstr; // No string, print error code only
}
//==========================================================================
// Use BIOS INT13 calls to read the sector specified. This function will
// also perform read-ahead to cache a few subsequent sector to the sector
// cache.
// Use BIOS INT13 calls to read the sector specified. This function will also
// perform read-ahead to cache a few subsequent sector to the sector cache.
//
// Return:
// 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call.
// Returns 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call.
static bool cache_valid = false;
static int Biosread( int biosdev, unsigned long long secno )
static int Biosread(int biosdev, unsigned long long secno)
{
static int xbiosdev, xcyl, xhead;
static unsigned int xsec, xnsecs;
struct driveInfo di;
static int xbiosdev, xcyl, xhead;
static unsigned int xsec, xnsecs;
struct driveInfo di;
int rc = -1;
int cyl, head, sec;
int tries = 0;
int bps, divisor;
int rc = -1;
int cyl, head, sec;
int tries = 0;
int bps, divisor;
if (getDriveInfo(biosdev, &di) < 0) {
return -1;
}
if (di.no_emulation) {
/* Always assume 2k block size; BIOS may lie about geometry */
bps = 2048;
} else {
bps = di.di.params.phys_nbps;
if (bps == 0) {
return -1;
}
}
divisor = bps / BPS;
if (getDriveInfo(biosdev, &di) < 0)
{
return -1;
}
if (di.no_emulation)
{
/* Always assume 2k block size; BIOS may lie about geometry */
bps = 2048;
}
else
{
bps = di.di.params.phys_nbps;
DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps));
if (bps == 0)
{
return -1;
}
}
divisor = bps / BPS;
// To read the disk sectors, use EBIOS if we can. Otherwise,
// revert to the standard BIOS calls.
DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps));
if ((biosdev >= kBIOSDevTypeHardDrive) &&
(di.uses_ebios & EBIOS_FIXED_DISK_ACCESS))
{
if (cache_valid &&
(biosdev == xbiosdev) &&
(secno >= xsec) &&
((unsigned int)secno < (xsec + xnsecs)))
{
biosbuf = trackbuf + (BPS * (secno - xsec));
return 0;
}
// To read the disk sectors, use EBIOS if we can. Otherwise,
// revert to the standard BIOS calls.
xnsecs = N_CACHE_SECS;
xsec = (secno / divisor) * divisor;
cache_valid = false;
if ((biosdev >= kBIOSDevTypeHardDrive) && (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS))
{
if (cache_valid && (biosdev == xbiosdev) && (secno >= xsec) && ((unsigned int)secno < (xsec + xnsecs)))
{
biosbuf = trackbuf + (BPS * (secno - xsec));
return 0;
}
while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5))
{
if (rc == ECC_CORRECTED_ERR) {
/* Ignore corrected ECC errors */
rc = 0;
break;
}
error(" EBIOS read error: %s\n", bios_error(rc), rc);
error(" Block 0x%x Sectors %d\n", secno, xnsecs);
sleep(1);
}
}
else
{
/* spc = spt * heads */
int spc = (di.di.params.phys_spt * di.di.params.phys_heads);
cyl = secno / spc;
head = (secno % spc) / di.di.params.phys_spt;
sec = secno % di.di.params.phys_spt;
xnsecs = N_CACHE_SECS;
xsec = (secno / divisor) * divisor;
cache_valid = false;
if (cache_valid &&
(biosdev == xbiosdev) &&
(cyl == xcyl) &&
(head == xhead) &&
((unsigned int)sec >= xsec) &&
((unsigned int)sec < (xsec + xnsecs)))
{
// this sector is in trackbuf cache
biosbuf = trackbuf + (BPS * (sec - xsec));
return 0;
}
while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5))
{
if (rc == ECC_CORRECTED_ERR)
{
/* Ignore corrected ECC errors */
rc = 0;
break;
}
// Cache up to a track worth of sectors, but do not cross a
// track boundary.
error(" EBIOS read error: %s\n", bios_error(rc), rc);
error(" Block 0x%x Sectors %d\n", secno, xnsecs);
sleep(1);
}
}
xcyl = cyl;
xhead = head;
xsec = sec;
xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS;
cache_valid = false;
else
{
/* spc = spt * heads */
int spc = (di.di.params.phys_spt * di.di.params.phys_heads);
cyl = secno / spc;
head = (secno % spc) / di.di.params.phys_spt;
sec = secno % di.di.params.phys_spt;
while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) &&
(++tries < 5))
{
if (rc == ECC_CORRECTED_ERR) {
/* Ignore corrected ECC errors */
rc = 0;
break;
}
error(" BIOS read error: %s\n", bios_error(rc), rc);
error(" Block %d, Cyl %d Head %d Sector %d\n",
secno, cyl, head, sec);
sleep(1);
}
}
if (cache_valid && (biosdev == xbiosdev) && (cyl == xcyl) &&
(head == xhead) && ((unsigned int)sec < (xsec + xnsecs)))
{
// this sector is in trackbuf cache
biosbuf = trackbuf + (BPS * (sec - xsec));
return 0;
}
// If the BIOS reported success, mark the sector cache as valid.
// Cache up to a track worth of sectors, but do not cross a track boundary.
if (rc == 0) {
cache_valid = true;
}
biosbuf = trackbuf + (secno % divisor) * BPS;
xbiosdev = biosdev;
xcyl = cyl;
xhead = head;
xsec = sec;
xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS;
cache_valid = false;
while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) && (++tries < 5))
{
if (rc == ECC_CORRECTED_ERR)
{
/* Ignore corrected ECC errors */
rc = 0;
break;
}
error(" BIOS read error: %s\n", bios_error(rc), rc);
error(" Block %d, Cyl %d Head %d Sector %d\n",
secno, cyl, head, sec);
sleep(1);
}
}
// If the BIOS reported success, mark the sector cache as valid.
if (rc == 0)
{
cache_valid = true;
}
biosbuf = trackbuf + (secno % divisor) * BPS;
xbiosdev = biosdev;
spinActivityIndicator(xnsecs);
spinActivityIndicator(xnsecs);
return rc;
return rc;
}
//==========================================================================
int testBiosread( int biosdev, unsigned long long secno )
int testBiosread(int biosdev, unsigned long long secno)
{
return Biosread(biosdev, secno);
}
//==========================================================================
static int readBytes( int biosdev, unsigned long long blkno,
unsigned int byteoff,
unsigned int byteCount, void * buffer )
static int readBytes(int biosdev, unsigned long long blkno, unsigned int byteoff, unsigned int byteCount, void * buffer)
{
// ramdisks require completely different code for reading.
if(p_ramdiskReadBytes != NULL && biosdev >= 0x100)
return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer);
// ramdisks require completely different code for reading.
if(p_ramdiskReadBytes != NULL && biosdev >= 0x100)
{
return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer);
}
char * cbuf = (char *) buffer;
int error;
int copy_len;
char * cbuf = (char *) buffer;
int error;
int copy_len;
DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__,
biosdev, blkno, byteCount, (unsigned)cbuf));
DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf));
for ( ; byteCount; cbuf += copy_len, blkno++ )
{
error = Biosread( biosdev, blkno );
if ( error )
{
DEBUG_DISK(("error\n"));
return (-1);
}
for (; byteCount; cbuf += copy_len, blkno++)
{
error = Biosread(biosdev, blkno);
copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount;
bcopy( biosbuf + byteoff, cbuf, copy_len );
byteCount -= copy_len;
byteoff = 0;
}
if (error)
{
DEBUG_DISK(("error\n"));
return (-1);
}
DEBUG_DISK(("done\n"));
copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount;
bcopy( biosbuf + byteoff, cbuf, copy_len );
byteCount -= copy_len;
byteoff = 0;
}
return 0;
DEBUG_DISK(("done\n"));
return 0;
}
//==========================================================================
static int isExtendedFDiskPartition( const struct fdisk_part * part )
{
static unsigned char extParts[] =
{
0x05, /* Extended */
0x0f, /* Win95 extended */
0x85, /* Linux extended */
};
static unsigned char extParts[] =
{
0x05, /* Extended */
0x0f, /* Win95 extended */
0x85, /* Linux extended */
};
unsigned int i;
unsigned int i;
for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++)
{
if (extParts[i] == part->systid) return 1;
}
return 0;
for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++)
{
if (extParts[i] == part->systid)
{
return 1;
}
}
return 0;
}
//==========================================================================
static int getNextFDiskPartition( int biosdev, int * partno,
const struct fdisk_part ** outPart )
{
static int sBiosdev = -1;
static int sNextPartNo;
static unsigned int sFirstBase;
static unsigned int sExtBase;
static unsigned int sExtDepth;
static struct fdisk_part * sExtPart;
struct fdisk_part * part;
static int sBiosdev = -1;
static int sNextPartNo;
static unsigned int sFirstBase;
static unsigned int sExtBase;
static unsigned int sExtDepth;
static struct fdisk_part * sExtPart;
struct fdisk_part * part;
if ( sBiosdev != biosdev || *partno < 0 )
{
// Fetch MBR.
if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) return 0;
if ( sBiosdev != biosdev || *partno < 0 )
{
// Fetch MBR.
if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) return 0;
sBiosdev = biosdev;
sNextPartNo = 0;
sFirstBase = 0;
sExtBase = 0;
sExtDepth = 0;
sExtPart = NULL;
}
sBiosdev = biosdev;
sNextPartNo = 0;
sFirstBase = 0;
sExtBase = 0;
sExtDepth = 0;
sExtPart = NULL;
}
while (1)
{
part = NULL;
while (1)
{
part = NULL;
if ( sNextPartNo < FDISK_NPART )
{
part = (struct fdisk_part *) gBootSector->parts[sNextPartNo];
}
else if ( sExtPart )
{
unsigned int blkno = sExtPart->relsect + sFirstBase;
if ( sNextPartNo < FDISK_NPART )
{
part = (struct fdisk_part *) gBootSector->parts[sNextPartNo];
}
else if ( sExtPart )
{
unsigned int blkno = sExtPart->relsect + sFirstBase;
// Save the block offset of the first extended partition.
// Save the block offset of the first extended partition.
if (sExtDepth == 0) {
sFirstBase = blkno;
}
sExtBase = blkno;
if (sExtDepth == 0)
{
sFirstBase = blkno;
}
sExtBase = blkno;
// Load extended partition table.
// Load extended partition table.
if ( readBootSector( biosdev, blkno, 0 ) == 0 )
{
sNextPartNo = 0;
sExtDepth++;
sExtPart = NULL;
continue;
}
// Fall through to part == NULL
}
if ( readBootSector( biosdev, blkno, 0 ) == 0 )
{
sNextPartNo = 0;
sExtDepth++;
sExtPart = NULL;
continue;
}
// Fall through to part == NULL
}
if ( part == NULL ) break; // Reached end of partition chain.
if ( part == NULL ) break; // Reached end of partition chain.
// Advance to next partition number.
// Advance to next partition number.
sNextPartNo++;
sNextPartNo++;
if ( isExtendedFDiskPartition(part) )
{
sExtPart = part;
continue;
}
if ( isExtendedFDiskPartition(part) )
{
sExtPart = part;
continue;
}
// Skip empty slots.
// Skip empty slots.
if ( part->systid == 0x00 )
{
continue;
}
if ( part->systid == 0x00 )
{
continue;
}
// Change relative offset to an absolute offset.
part->relsect += sExtBase;
// Change relative offset to an absolute offset.
part->relsect += sExtBase;
*outPart = part;
*partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo;
*outPart = part;
*partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo;
break;
}
break;
}
return (part != NULL);
return (part != NULL);
}
//==========================================================================
BVFree bvFreeFunc,
int probe, int type, unsigned int bvrFlags )
{
BVRef bvr = (BVRef) malloc( sizeof(*bvr) );
if ( bvr )
{
bzero(bvr, sizeof(*bvr));
BVRef bvr = (BVRef) malloc( sizeof(*bvr) );
if ( bvr )
{
bzero(bvr, sizeof(*bvr));
bvr->biosdev = biosdev;
bvr->part_no = partno;
bvr->part_boff = blkoff;
bvr->part_type = part->systid;
bvr->fs_loadfile = loadFunc;
bvr->fs_readfile = readFunc;
bvr->fs_getdirentry = getdirFunc;
bvr->fs_getfileblock= getBlockFunc;
bvr->fs_getuuid = getUUIDFunc;
bvr->description = getDescriptionFunc;
bvr->type = type;
bvr->bv_free = bvFreeFunc;
bvr->biosdev = biosdev;
bvr->part_no = partno;
bvr->part_boff = blkoff;
bvr->part_type = part->systid;
bvr->fs_loadfile = loadFunc;
bvr->fs_readfile = readFunc;
bvr->fs_getdirentry = getdirFunc;
bvr->fs_getfileblock= getBlockFunc;
bvr->fs_getuuid = getUUIDFunc;
bvr->description = getDescriptionFunc;
bvr->type = type;
bvr->bv_free = bvFreeFunc;
if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS))
bvr->flags |= kBVFlagPrimary;
if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS))
{
bvr->flags |= kBVFlagPrimary;
}
// Probe the filesystem.
if ( initFunc )
{
// filesystem probe failed.
DEBUG_DISK(("%s: failed probe on dev %x part %d\n",
__FUNCTION__, biosdev, partno));
DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno));
(*bvr->bv_free)(bvr);
bvr = NULL;
bvr = NULL;
}
}
if (bvr) bvr->flags |= bvrFlags;
return bvr;
if (bvr) bvr->flags |= bvrFlags;
{
return bvr;
}
}
//==========================================================================
{
// filesystem probe failed.
DEBUG_DISK(("%s: failed probe on dev %x part %d\n",
__FUNCTION__, biosdev, partno));
DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno));
(*bvr->bv_free)(bvr);
bvr = NULL;
//==========================================================================
// GUID's in LE form:
// HFS+ partition - 48465300-0000-11AA-AA11-00306543ECAC
// http://en.wikipedia.org/wiki/GUID_Partition_Table
// 00000000-0000-0000-0000-000000000000 - Unused Entry partition
// 024DEE41-33E7-11D3-9D69-0008C781F39F - MBR partition scheme
// C12A7328-F81F-11D2-BA4B-00A0C93EC93B - turbo - or an EFI System Partition
EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } };
// 21686148-6449-6E6F-744E-656564454649 - BIOS Boot partition
// E3C9E316-0B5C-4DB8-817D-F92DF00215AE - Microsoft Reserved Partition
EFI_GUID const GPT_BASICDATA2_GUID = { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } };
// EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 - zef - Basic Data Partition - for foreign OS support
EFI_GUID const GPT_BASICDATA_GUID = { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } };
// 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3 - Logical Disk Manager metadata partition
// AF9B60A0-1431-4F62-BC68-3311714A69AD - Logical Disk Manager data partition
// DE94BBA4-06D1-4D40-A16A-BFD50179D6AC - Windows Recovery Environment
// 48465300-0000-11AA-AA11-00306543ECAC - Hierarchical File System Plus (HFS+) partition
EFI_GUID const GPT_HFS_GUID = { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
// turbo - Apple Boot Partition - 426F6F74-0000-11AA-AA11-00306543ECAC
// 55465300-0000-11AA-AA11-00306543ECAC - Apple UFS
// 52414944-0000-11AA-AA11-00306543ECAC - Apple RAID partition
// 426F6F74-0000-11AA-AA11-00306543ECAC - turbo - Apple Boot Partition
EFI_GUID const GPT_BOOT_GUID = { 0x426F6F74, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
// 4C616265-6C00-11AA-AA11-00306543ECAC - Apple Label
// 5265636F-7665-11AA-AA11-00306543ECAC - Apple TV Recovery partition
// 53746F72-6167-11AA-AA11-00306543ECAC - Apple Core Storage (i.e. Lion FileVault) partition (Apple_Boot Recovery HD)
// EFI_GUID const GPT_RECOVERY_GUID = { 0x53746F72, 0x6167, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
// turbo - or an EFI System Partition - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } };
// zef - Basic Data Partition - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 for foreign OS support
EFI_GUID const GPT_BASICDATA_GUID = { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } };
// Microsoft Reserved Partition - E3C9E316-0B5C-4DB8-817DF92DF00215AE
EFI_GUID const GPT_BASICDATA2_GUID = { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } };
BVRef newGPTBVRef( int biosdev, int partno, unsigned int blkoff,
const gpt_ent * part,
FSInit initFunc, FSLoadFile loadFunc,
0, 0, 0, 0, 0, 0, NTFSGetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_LINUX:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, 0, EX2GetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
default:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
BVRef diskScanBootVolumes( int biosdev, int * countPtr )
{
struct DiskBVMap * map;
struct DiskBVMap * map = NULL;
BVRef bvr;
int count = 0;
volStart = strbreak(entryStart, &volEnd, &volLen);
if(!volLen)
continue;
aliasStart = strbreak(volEnd, 0, &aliasLen);
if(!aliasLen)
continue;
if ( matchVolumeToString(bvr, volStart, volLen) )
{
{
strncat(str, aliasStart, MIN(strMaxLen, aliasLen));
free(aliasList);
return;
type = (unsigned char) bvr->part_type;
if (useDeviceDescription)
{
int len = getDeviceDescription(bvr, str);
if(len >= strMaxLen)
return;
strcpy(str + len, " ");
len++;
strMaxLen -= len;
p += len;
}
/* See if a partition rename is preferred */
if(getVolumeLabelAlias(bvr, p, strMaxLen)) {
strncpy(bvr->label, p, strMaxLen);
return; // we're done here no need to seek for real name
}
//
// Get the volume label using filesystem specific functions
// or use the alternate volume label if available.
strncpy(p, name, strMaxLen);
}
}
// Set the devices label
sprintf(bvr->label, p);
}
//==========================================================================
int readBootSector( int biosdev, unsigned int secno, void * buffer )
int readBootSector(int biosdev, unsigned int secno, void * buffer)
{
struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer;
int error;
int error;
struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer;
if ( bootSector == NULL )
{
if ( gBootSector == NULL )
{
gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector));
if ( gBootSector == NULL ) return -1;
}
if (bootSector == NULL)
{
if (gBootSector == NULL)
{
gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector));
if (gBootSector == NULL)
{
return -1;
}
}
bootSector = gBootSector;
}
}
error = readBytes( biosdev, secno, 0, BPS, bootSector );
if ( error || bootSector->signature != DISK_SIGNATURE )
return -1;
error = readBytes(biosdev, secno, 0, BPS, bootSector);
return 0;
if (error || bootSector->signature != DISK_SIGNATURE)
{
return -1;
}
return 0;
}
/*
//==========================================================================
// Handle seek request from filesystem modules.
void diskSeek( BVRef bvr, long long position )
void diskSeek(BVRef bvr, long long position)
{
bvr->fs_boff = position / BPS;
bvr->fs_byteoff = position % BPS;
branches/ErmaC/Trunk/i386/libsaio/pci_setup.c
66
77
88
9
910
11
12
13
14
15
16
1017
1118
1219
......
1421
1522
1623
24
25
1726
1827
1928
......
3342
3443
3544
45
3646
3747
3848
3949
4050
51
4152
4253
4354
4455
4556
57
4658
47
59
60
61
4862
4963
5064
......
5872
5973
6074
75
6176
6277
6378
79
6480
6581
6682
6783
84
6885
6986
7087
7188
7289
7390
74
91
7592
7693
7794
#include "nvidia.h"
#include "modules.h"
#define DEBUG_PCI 0
#if DEBUG_PCI
#define DBG(x...) msglog(x)
#else
#define DBG(x...)
#endif
extern bool setup_ati_devprop(pci_dt_t *ati_dev);
extern void set_eth_builtin(pci_dt_t *eth_dev);
extern void notify_usb_dev(pci_dt_t *pci_dev);
extern pci_dt_t *dram_controller_dev;
uint16_t vgaVendor;
void setup_pci_devs(pci_dt_t *pci_dt)
{
char *devicepath;
switch (current->class_id)
{
case PCI_CLASS_BRIDGE_HOST:
DBG("Setup BRIDGE_HOST \n");
if (current->dev.addr == PCIADDR(0, 0, 0))
dram_controller_dev = current;
break;
case PCI_CLASS_NETWORK_ETHERNET:
DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no");
if (do_eth_devprop)
set_eth_builtin(current);
break;
case PCI_CLASS_DISPLAY_VGA:
DBG("GraphicsEnabler %s enabled\n", do_gfx_devprop?"":"no");
if (do_gfx_devprop)
switch (current->vendor_id)
{
vgaVendor = current->vendor_id;
switch (vgaVendor)
{
case PCI_VENDOR_ID_ATI:
setup_ati_devprop(current);
setup_nvidia_devprop(current);
break;
}
}
break;
case PCI_CLASS_SERIAL_USB:
DBG("USB fix \n");
notify_usb_dev(current);
break;
case PCI_CLASS_BRIDGE_ISA:
DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no");
if (do_enable_hpet)
force_enable_hpet(current);
break;
}
execute_hook("PCIDevice", current, NULL, NULL, NULL);
DBG("setup_pci_devs current devID=%08x\n", current->device_id);
setup_pci_devs(current->children);
current = current->next;
}
branches/ErmaC/Trunk/i386/libsaio/cpu.h
1616
1717
1818
19
20
21
22
23
24
25
26
19
20
21
22
23
24
25
26
2727
28
29
28
29
3030
3131
3232
......
4141
4242
4343
44
4445
4546
47
48
4649
50
4751
4852
53
4954
5055
5156
......
5661
5762
5863
59
6064
6165
6266
#define CPU_STRING_UNKNOWN"Unknown CPU Type"
#defineMSR_IA32_PERF_STATUS0x00000198
#define MSR_IA32_PERF_CONTROL0x199
#define MSR_IA32_EXT_CONFIG0x00EE
#define MSR_FLEX_RATIO0x194
#define MSR_TURBO_RATIO_LIMIT0x1AD
#defineMSR_PLATFORM_INFO0xCE
#define MSR_CORE_THREAD_COUNT0x35// Undocumented
#define MSR_IA32_PLATFORM_ID0x17
#define MSR_IA32_PLATFORM_ID 0x17
#defineMSR_IA32_PERF_STATUS 0x198
#define MSR_IA32_PERF_CONTROL 0x199
#define MSR_IA32_EXT_CONFIG 0xEE
#define MSR_FLEX_RATIO 0x194
#define MSR_TURBO_RATIO_LIMIT 0x1AD
#defineMSR_PLATFORM_INFO 0xCE
#define MSR_CORE_THREAD_COUNT 0x35// Undocumented
#define K8_FIDVID_STATUS0xC0010042
#define K10_COFVID_STATUS0xC0010071
#define K8_FIDVID_STATUS 0xC0010042
#define K10_COFVID_STATUS 0xC0010071
#define MSR_AMD_MPERF 0x000000E7
#define MSR_AMD_APERF 0x000000E8
#define CALIBRATE_LATCH((CLKNUM * CALIBRATE_TIME_MSEC + 1000/2)/1000)
// CPUID Values
#define CPUID_MODEL_DOTHAN13// Dothan
#define CPUID_MODEL_YONAH14// Intel Mobile Core Solo, Duo
#define CPUID_MODEL_MEROM15// Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
#define CPUID_MODEL_CONROE15
#define CPUID_MODEL_CELERON22
#define CPUID_MODEL_PENRYN23// Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
#define CPUID_MODEL_WOLFDALE23
#define CPUID_MODEL_NEHALEM26// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
#define CPUID_MODEL_ATOM28// Intel Atom (45nm)
#define CPUID_MODEL_XEON_MP29
#define CPUID_MODEL_FIELDS30// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
#define CPUID_MODEL_DALES31// Havendale, Auburndale
#define CPUID_MODEL_DALES_32NM37// Intel Core i3, i5 LGA1156 (32nm)
#define CPUID_MODEL_WESTMERE_EX47// Intel Xeon E7
#define CPUID_MODEL_IVYBRIDGE58// Intel Core i5, i7 LGA1155 (22nm)
static inline uint64_t rdtsc64(void)
{
uint64_t ret;
branches/ErmaC/Trunk/i386/libsaio/smbios.c
8080
8181
8282
83
83
8484
8585
8686
......
200200
201201
202202
203
204
205
206
207
203208
204
205209
206210
207211
......
830834
831835
832836
833
// defaults for a MacBook
#define kDefaultMacBookFamily"MacBook"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0903051113"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0809221748"
// defaults for a MacBook Pro
#define kDefaultMacBookProFamily"MacBookPro"
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTagNumber),NULL,NULL,NULL},
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),NULL,NULL,NULL},
//-------------------------------------------------------------------------------------------------------------------------
// SystemEnclosure
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, manufacturer),
kSMBBaseBoardManufacturerKey,NULL,&defaultBaseBoard.manufacturer},
//-------------------------------------------------------------------------------------------------------------------------
// ProcessorInformation
//-------------------------------------------------------------------------------------------------------------------------
structHeader = (SMBStructHeader *)structPtr;
}
}
branches/ErmaC/Trunk/i386/libsaio/pci.c
66
77
88
9
910
1011
1112
......
1415
1516
1617
17
18
1819
1920
2021
......
9596
9697
9798
99
98100
99101
100102
......
144146
145147
146148
149
150
151
152
153
154
147155
148156
149157
......
193201
194202
195203
196
204
197205
198
206
199207
200208
201209
#include "libsaio.h"
#include "bootstruct.h"
#include "boot.h"
#include "pci.h"
#include "pci_root.h"
#endif
#if DEBUG_PCI
#define DBG(x...)printf(x)
#define DBG(x...)verbose(x)
#else
#define DBG(x...)
#endif
new->vendor_id= id & 0xffff;
new->device_id= (id >> 16) & 0xffff;
new->subsys_id.subsys_id= pci_config_read32(pci_addr, PCI_SUBSYSTEM_VENDOR_ID);
new->subclass= pci_config_read8(pci_addr, PCI_CLASS_PROG);
new->class_id= pci_config_read16(pci_addr, PCI_CLASS_DEVICE);
new->parent= start;
void build_pci_dt(void)
{
root_pci_dev = malloc(sizeof(pci_dt_t));
if (!root_pci_dev)
{
return;
}
gRootPCIDev = (void*)root_pci_dev;
bzero(root_pci_dev, sizeof(pci_dt_t));
enable_pci_devs();
scan_pci_bus(root_pci_dev, 0);
current = pci_dt;
while (current)
{
printf("%02x:%02x.%x [%04x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n",
printf("%02x:%02x.%x [%04x%02x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n",
current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func,
current->class_id, current->vendor_id, current->device_id,
current->class_id, current->subclass, current->vendor_id, current->device_id,
current->subsys_id.subsys.vendor_id, current->subsys_id.subsys.device_id,
get_pci_dev_path(current));
dump_pci_dt(current->children);
branches/ErmaC/Trunk/i386/libsaio/convert.c
9494
9595
9696
97
98
99
97
10098
10199
102100
hexNibble = hexStr[hexStrIdx];
// ignore all chars except valid hex numbers
if ( (hexNibble >= '0' && hexNibble <= '9') ||
(hexNibble >= 'A' && hexNibble <= 'F') ||
(hexNibble >= 'a' && hexNibble <= 'f') )
if ( (hexNibble >= '0' && hexNibble <= '9') || (hexNibble >= 'A' && hexNibble <= 'F') || (hexNibble >= 'a' && hexNibble <= 'f') )
{
hexByte[hexNibbleIdx++] = hexNibble;
branches/ErmaC/Trunk/i386/libsaio/pci.h
2323
2424
2525
26
26
2727
28
29
28
29
3030
3131
3232
......
3434
3535
3636
37
37
38
39
40
3841
39
40
4142
4243
4344
......
5758
5859
5960
61
6062
6163
6264
} pci_dev_t;
typedef struct pci_dt_t {
pci_dev_tdev;
pci_dev_tdev;
uint16_tvendor_id;
uint16_tdevice_id;
uint16_tvendor_id;
uint16_tdevice_id;
union {
struct {
uint16_tdevice_id;
} subsys;
uint32_tsubsys_id;
}subsys_id;
}subsys_id;
uint8_trevision;
uint8_tsubclass;
uint16_tclass_id;
uint16_tclass_id;
struct pci_dt_t*parent;
struct pci_dt_t*children;
struct pci_dt_t*next;
extern char*get_pci_dev_path(pci_dt_t *);
extern voidbuild_pci_dt(void);
extern voiddump_pci_dt(pci_dt_t *);
extern voidsetup_pci_devs(pci_dt_t *pci_dt);
/* Option ROM header */
typedef struct {
branches/ErmaC/Trunk/i386/libsaio/msdos.c
778778
779779
780780
781
781782
782783
784
783785
784786
785787
}
getDeviceDescription(ih, devStr);
/*
verbose("Read FAT%d file: [%s/%s] %d bytes.\n",
msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread);
*/
free (buf);
if (toread<0)
return wastoread;
branches/ErmaC/Trunk/i386/libsaio/fake_efi.c
450450
451451
452452
453
453
454454
455455
456456
......
622622
623623
624624
625
625626
626627
627628
dst = (EFI_CHAR16*) malloc( ((*len)+1) * 2 );
for (; i < (*len); i++) dst[i] = src[i];
dst[(*len)] = '\0';
*len = ((*len)+1)*2; // return the CHAR16 bufsize in cluding zero terminated CHAR16
*len = ((*len)+1)*2; // return the CHAR16 bufsize including zero terminated CHAR16
return dst;
}
/*
* Populate the chosen node
*/
void setupChosenNode()
{
Node *chosenNode;
branches/ErmaC/Trunk/i386/boot2/graphics.h
1818
1919
2020
21
2122
2223
2324
#define DEFAULT_SCREEN_WIDTH 1024
#define DEFAULT_SCREEN_HEIGHT 768
extern int gDualLink;
int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData);
unsigned long lookUpCLUTIndex( unsigned char index, unsigned char depth );
branches/ErmaC/Trunk/i386/boot2/boot.c
7575
7676
7777
78
78
79
80
81
7982
8083
8184
chargRootDevice[ROOT_DEVICE_SIZE];
chargMKextName[512];
chargMacOSVersion[8];
intbvCount = 0, gDeviceCount = 0;
void*gRootPCIDev;
intgDualLink;
intbvCount = 0, gDeviceCount = 0;
//intmenucount = 0;
longgBootMode; /* defaults to 0 == kBootModeNormal */
BVRefbvr, menuBVR, bvChain;
branches/ErmaC/Trunk/i386/boot2/boot.h
196196
197197
198198
199
200
201
202
199203
200204
201205
extern bool gScanSingleDrive;
extern bool useGUI;
extern void *gRootPCIDev;
extern uint16_t vgaVendor;;
/*
* Boot Modes
*/
branches/ErmaC/Trunk/i386/boot2/modules.c
367367
368368
369369
370
370
371371
372372
373373
}
else
{
verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//getchar();
return NULL;
}
branches/ErmaC/Trunk/i386/boot2/gui.c
845845
846846
847847
848
848849
849850
850851
// set our screen structure with the mode width & height
gui.screen.width = screen_params[0];
gui.screen.height = screen_params[1];
gDualLink =((screen_params[0] * screen_params[1]) > (1<<20))?1:0;
// load graphics otherwise fail and return
if (loadGraphics() == 0) {
branches/ErmaC/Trunk/i386/Cconfig
44
55
66
7
7
88
99
1010
config OPTIMIZATION_LEVEL
string "Optimization Level"
default "-Oz"
default "-Os"
---help---
Specify the level to compile chameleon with.
branches/ErmaC/Trunk/i386/libsa/strtol.c
148148
149149
150150
151
151
152152
153153
154154
......
220220
221221
222222
223
223
224224
225225
226226
......
291291
292292
293293
294
294
295295
296296
297297
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
branches/ErmaC/Trunk/i386/libsa/memory.h
5757
5858
5959
60
60
6161
6262
6363
#define BOOT2_SEG0x2000
#define BOOT2_OFS0x0200// 512 byte disk sector offset
#define BOOT2_MAX_LENGTH0x6FE00// Maximum size for boot2 is currentl 447kb
#define BOOT2_MAX_LENGTH0x6FE00// Maximum size for boot2 is currentl 447kb
#define BIOS_ADDR0x8000// BIOS disk I/O buffer
#define BIOS_LEN0x8000// 32K - divisible by 512 and 2048

Archive Download the corresponding diff file

Revision: 1987