Chameleon

Chameleon Commit Details

Date:2011-12-13 23:27:33 (7 years 7 months ago)
Author:MacMan
Commit:1732
Parents: 1731
Message:Back ported r1671, 1674 and r1710. Added additional device ids to ati.c and nvidia.c. Added 2 more cards to nividia.c memory detection work around. Added a change to ati.c that should hopefully allow the ability to override kNull frame buffer definitions. Added CSTUsingSystemIO=Yes to BootHelp.txt.
Changes:
M/branches/Chimera/version
M/branches/Chimera/i386/libsaio/nvidia.c
M/branches/Chimera/i386/boot0/Makefile
M/branches/Chimera/i386/libsaio/ati.c
M/branches/Chimera/i386/libsaio/stringTable.c
M/branches/Chimera/CREDITS
M/branches/Chimera/doc/BootHelp.txt
M/branches/Chimera/i386/boot0/boot0md.s
M/branches/Chimera/i386/boot2/boot.c

File differences

branches/Chimera/version
1
1
1.6.0
1.7.0
branches/Chimera/i386/libsaio/nvidia.c
9999
100100
101101
102
103
104
105102
106103
107104
......
507504
508505
509506
507
510508
511509
512510
......
730728
731729
732730
731
732
733733
734734
735735
736736
737
737738
739
738740
739741
740742
......
743745
744746
745747
748
749
746750
747751
748752
749753
750754
751755
756
757
758
759
752760
761
753762
754763
755764
......
762771
763772
764773
774
765775
776
777
766778
767779
768780
......
801813
802814
803815
816
804817
818
805819
806820
821
807822
808823
809824
......
818833
819834
820835
836
821837
822838
839
823840
824
841
842
825843
826844
827845
......
12031221
12041222
12051223
1206
1224
12071225
12081226
1227
1228
12091229
12101230
1211
1231
12121232
12131233
12141234
static struct nv_chipsets_t NVKnownChipsets[] = {
{ 0x00000000, "Unknown" },
// temporary placement
{ 0x10DE0DF4, "GeForce GT 450M" }, //Azi + issue #99
{ 0x10DE1251, "GeForce GTX 560M" }, // Asus G74SX
//========================================
// 0040 - 004F
{ 0x10DE0040, "GeForce 6800 Ultra" },
{ 0x10DE06DD, "Quadro 4000" },
{ 0x10DE06DE, "Tesla M2050" },// TODO: sub-device id: 0x0846
{ 0x10DE06DE, "Tesla M2070" },// TODO: sub-device id: ?
{ 0x10DE06DF, "Tesla M2070-Q" },
// 0x10DE06DE also applies to misc S2050, X2070, M2050, M2070
// 06E0 - 06EF
{ 0x10DE06E0, "GeForce 9300 GE" },
{ 0x10DE0DC5, "GeForce GTS 450" },
{ 0x10DE0DC6, "GeForce GTS 450" },
{ 0x10DE0DCA, "GF10x" },
{ 0x10DE0DCD, "GeForce GT 555M" },
{ 0x10DE0DCE, "GeForce GT 555M" },
// 0DD0 - 0DDF
{ 0x10DE0DD1, "GeForce GTX 460M" },
{ 0x10DE0DD2, "GeForce GT 445M" },
{ 0x10DE0DD3, "GeForce GT 435M" },
{ 0x10DE0DD6, "GeForce GT 550M" },
{ 0x10DE0DD8, "Quadro 2000" },
{ 0x10DE0DDA, "Quadro 2000M" },
{ 0x10DE0DDE, "GF106-ES" },
{ 0x10DE0DDF, "GF106-INT" },
// 0DE0 - 0DEF
{ 0x10DE0DE2, "GeForce GT 420" },
{ 0x10DE0DE5, "GeForce GT 530" },
{ 0x10DE0DEB, "GeForce GT 555M" },
{ 0x10DE0DEC, "GeForce GT 525M" },
{ 0x10DE0DED, "GeForce GT 520M" },
{ 0x10DE0DEE, "GeForce GT 415M" },
// 0DF0 - 0DFF
{ 0x10DE0DF0, "GeForce GT 425M" },
{ 0x10DE0DF1, "GeForce GT 420M" },
{ 0x10DE0DF2, "GeForce GT 435M" },
{ 0x10DE0DF3, "GeForce GT 420M" },
{ 0x10DE0DF4, "GeForce GT 450M" },
{ 0x10DE0DF5, "GeForce GT 525M" },
{ 0x10DE0DF6, "GeForce GT 550M" },
{ 0x10DE0DF7, "GeForce GT 520M" },
{ 0x10DE0DF8, "Quadro 600" },
{ 0x10DE0DFA, "Quadro 1000M" },
{ 0x10DE0DFE, "GF108 ES" },
{ 0x10DE0DFF, "GF108 INT" },
// 0E00 - 0E0F
{ 0x10DE0E25, "D12U-50" },
// 0E30 - 0E3F
{ 0x10DE0E30, "GeForce GTX 470M" },
{ 0x10DE0E31, "GeForce GTX 485M" },
{ 0x10DE0E38, "GF104GL" },
{ 0x10DE0E3A, "Quadro 3000M" },
{ 0x10DE0E3B, "Quadro 4000M" },
{ 0x10DE0E3E, "GF104-ES" },
{ 0x10DE0E3F, "GF104-INT" },
// 0E40 - 0E4F
{ 0x10DE1040, "GeForce GT 520" },
// 1050 - 105F
{ 0x10DE1050, "GeForce GT 520M" },
{ 0x10DE1054, "GeForce GT 410M" },
{ 0x10DE1056, "Quadro NVS 4200M" },
{ 0x10DE1057, "Quadro NVS 4200M" },
// 1060 - 106F
// 1070 - 107F
{ 0x10DE107F, "NVIDIA GF119-ES" },
// 1080 - 108F
{ 0x10DE1080, "GeForce GTX 580" },
{ 0x10DE1081, "GeForce GTX 570" },
// 10B0 - 10BF
// 10C0 - 10CF
{ 0x10DE10C3, "GeForce 8400 GS" },
{ 0x10DE10C5, "GeForce 405" },
// 1200 -
{ 0x10DE1200, "GeForce GTX 560 Ti" },
{ 0x10DE1201, "GeForce GTX 560" },
{ 0x10DE1244, "GeForce GTX 550 Ti" },
{ 0x10DE1245, "GeForce GTS 450" },
{ 0x10DE1245, "GeForce GTS 450" },
{ 0x10DE1251, "GeForce GTX 560M" },
};
static uint16_t swap16(uint16_t x)
vram_size *= REG32(NVC0_MEM_CTRLR_COUNT);
}
// Workaround for GT 420/430 & 9600M GT
// Workaround for 9600M GT, GT 420/430/440 & GT 525M
switch (nvda_dev->device_id)
{
case 0x0649: vram_size = 512*1024*1024; break;// 9600M GT
case 0x0DE0: vram_size = 1024*1024*1024; break; // GT 440
case 0x0DE1: vram_size = 1024*1024*1024; break; // GT 430
case 0x0DE2: vram_size = 1024*1024*1024; break; // GT 420
case 0x0649: vram_size = 512*1024*1024; break;// 9600M GT
case 0x0DEC: vram_size = 1024*1024*1024; break; // GT 525M
default: break;
}
branches/Chimera/i386/libsaio/ati.c
220220
221221
222222
223
224
223225
224226
225227
......
359361
360362
361363
364
365
362366
363367
364368
365
366
367
368
369
369370
370371
371372
372373
373374
375
376
377
378
374379
375380
376381
......
469474
470475
471476
477
472478
473479
474480
......
477483
478484
479485
486
487
480488
481489
482490
......
485493
486494
487495
496
497
498
488499
489500
490501
......
492503
493504
494505
495
496
506
497507
498508
499509
510
511
500512
501513
502514
......
536548
537549
538550
551
552
553
554
555
556
539557
540558
541559
560
561
542562
543563
544564
......
555575
556576
557577
578
579
558580
581
582
583
584
559585
560586
561587
......
564590
565591
566592
593
594
567595
568596
597
569598
570599
571600
572601
573602
603
574604
575605
576606
......
583613
584614
585615
616
617
586618
587619
588620
......
607639
608640
609641
642
643
644
610645
611646
612647
......
679714
680715
681716
682
717
718
719
683720
684
721
722
685723
686724
687725
......
692730
693731
694732
695
733
696734
697735
698736
......
13191357
13201358
13211359
1322
1360
1361
13231362
13241363
13251364
{ 0x9440,0x24441682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x24451682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x114A174B, CHIP_FAMILY_RV770,"Sapphire Radeon HD4870 Vapor-X",kCardinal},
{ 0x9441,0x24401682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2",kMotmot},
{ 0x9442,0x080110B0, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x9540,0x30501787, CHIP_FAMILY_RV710,"ATI Radeon HD 4590",kNull},
{ 0x954F,0x16131462, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x29201682, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x29211682, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x30901682, CHIP_FAMILY_RV710,"XFX Radeon HD 4570",kNull},
{ 0x954F,0x30501787, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x31001787, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x3000174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x4450174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x4570174B, CHIP_FAMILY_RV710,"Sapphire Radeon HD 4570",kNull},
{ 0x954F,0xE990174B, CHIP_FAMILY_RV710,"Sapphire Radeon HD 4350",kNull},
{ 0x954F,0x20081787, CHIP_FAMILY_RV710,"ATI Radeon HD 4350",kNull},
{ 0x954F,0x30501787, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x31001787, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x301017AF, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x9552,0x04341028, CHIP_FAMILY_RV710,"ATI Mobility Radeon 4330",kShrike},
{ 0x6899,0x21E41458, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0xE140174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0xE174174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0x200A1787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0x22901787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x689C,0x039E1043, CHIP_FAMILY_HEMLOCK,"ASUS EAH5870 Series",kUakari},
{ 0x689C,0x30201682, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5970",kUakari},
{ 0x68A0,0x043A1028,CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5870",kNomascus},
{ 0x68A1,0x144D103C,CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5850",kNomascus},
{ 0x68A1,0x1522103C, CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5850",kHoolock},
{ 0x68B8,0x00CF106B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kHoolock},
{ 0x68B8,0x21D71458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x21F61458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x29901682, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x29911682, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0xE144174B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kHoolock},
{ 0x68B8,0xE147174B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x21D71458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x200A1787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x200B1787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x22881787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68BE,0x22881787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5750",kVervet},
{ 0x68BF,0x220E1458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 6750",kVervet},
{ 0x68C0,0x1594103C, CHIP_FAMILY_REDWOOD,"AMD Radeon HD 6570M",kNull},
{ 0x68E1,0x1426103C, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5430M",kEulemur},
{ 0x68F9,0x010E1002, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x03741043, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x23401462, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x5470174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
{ 0x68F9,0x5490174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5490",kNull},
{ 0x68F9,0x5530174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5530",kNull},
{ 0x68F9,0xE145174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0xE153174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x20091787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x22911787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x6718,0x67181002, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
{ 0x6718,0x31301682, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
{ 0x6719,0x0B001002, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kGibba},
{ 0x6719,0x20101787, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kGibba},
{ 0x6720,0x04BA1028, CHIP_FAMILY_BARTS,"AMD Radeon HD 6970M",kElodea},
{ 0x6738,0x00D01002,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x21FA1002,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x67381002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31031682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31041682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31071682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31081682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0xE178174B,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x174B174B,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kBulrushes},
{ 0x6738,0x20101787,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x23051787,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6739,0x67391002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0xAA881002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x21F81458, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6740,0x1657103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6770M",kNull},
{ 0x6740,0x165A103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6770M",kNull},
{ 0x6740,0x1D121043, CHIP_FAMILY_TURKS,"AMD Radeon HD 6730M",kNull},
{ 0x6741,0x050E1025, CHIP_FAMILY_TURKS,"AMD Radeon HD 6650M",kNull},
{ 0x6741,0x05131025, CHIP_FAMILY_TURKS,"AMD Radeon HD 6650M",kNull},
{ 0x6760,0x1CB21043, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6760,0x165A103C, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6760,0x167D103C, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6779,0x64501092,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6779,0xE164174B,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6899,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x689C,0x00000000, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5900 Series",kUakari},
{ 0x689E,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x68A0,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800M Series",kNomascus},
{ 0x68B8,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700 Series",kVervet},
{ 0x68B9,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5600 Series",kVervet},
{ 0x68B9,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5600 Series",kVervet},
{ 0x68BA,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 6770 Series",kVervet},
{ 0x68BE,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700 Series",kVervet},
{ 0x68D8,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5600 Series",kBaboon},
/* Northen Islands */
{ 0x6718,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970 Series",kNull},
{ 0x6719,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950 Series",kNull},
{ 0x6719,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950 Series",kGibba},
{ 0x6720,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6900M Series",kNull},
}
}
if (!card->info->device_id || !card->info->cfg_name)
//if (!card->info->device_id || !card->info->cfg_name)
if (!card->info->device_id)
{
verbose("Unsupported ATI card! Device ID: [%04x:%04x] Subsystem ID: [%08x] \n",
pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id);
branches/Chimera/i386/libsaio/stringTable.c
498498
499499
500500
501
501
502502
503503
504504
......
635635
636636
637637
638
639
640
641638
642639
643640
641
644642
643
644
645
646
645647
646648
647649
ret = getValueForConfigTableKey(config, key, val, size);
// Try to find alternate keys in bootInfo->overrideConfig
// Try to find alternate keys in bootInfo->chameleonConfig (if config can be overriden)
// and prefer its values with the exceptions for
// "Kernel"="mach_kernel" and "Kernel Flags"="".
sysConfigValid = true;
ret=0;
// enable canOverride flag
config->canOverride = true;
break;
}
}
if(ret == -1) ret = loadHelperConfig(config);
// Always enable canOverride flag (for SystemConfig)
config->canOverride = true;
return ret;
}
branches/Chimera/i386/boot0/boot0md.s
5454
5555
5656
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
5774
75
76
77
78
79
80
81
5882
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
59102
60103
61
104
105
106
62107
63108
64
109
110
65111
66
112
113
114
115
116
117
67118
68119
69120
......
116167
117168
118169
170
171
172
173
119174
120175
121176
......
175230
176231
177232
178
233
234
235
236
237
179238
180239
181240
182241
183242
184243
244
185245
186246
247
187248
188249
250
251
252
253
254
255
189256
190257
191258
......
229296
230297
231298
232
233
234
235
236
299
300
301
302
303
237304
238
305
239306
240
307
308
309
310
311
241312
242
243
244
245
246
247313
248314
249315
......
256322
257323
258324
259
325
260326
327
328
261329
262330
263331
......
265333
266334
267335
268
336
337
338
339
340
341
269342
270
343
271344
272
345
273346
274347
275
276
348
349
277350
278351
279
352
280353
281
354
282355
283356
357
358
284359
285360
286361
287362
288
363
289364
290365
291366
......
294369
295370
296371
297
372
298373
299374
300375
......
316391
317392
318393
319
320
321
322
323
324
325
326
327
394
328395
329396
330397
......
338405
339406
340407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
341422
342
343
423
424
425
426
427
344428
345
346
347
348
429
430
431
432
349433
350
351434
352
435
436
437
353438
354
355
356
439
440
441
357442
358
359
360443
361
362444
363445
364446
......
393475
394476
395477
396
478
479
397480
398
399481
400
401482
402483
403484
......
415496
416497
417498
499
500
418501
419
502
420503
421504
422505
......
447530
448531
449532
450
533
534
451535
452536
453537
......
457541
458542
459543
460
461544
462
463545
464546
465547
......
517599
518600
519601
602
603
520604
521605
522606
523
607
608
609
524610
525611
526612
527613
528614
529615
530
531616
532
533617
534618
535619
......
588672
589673
590674
591
592675
593676
594677
......
624707
625708
626709
627
628
629
630
631
632
633710
634711
635712
......
652729
653730
654731
655
656
657732
658733
659734
......
668743
669744
670745
671
746
747
748
672749
673750
674751
......
715792
716793
717794
795
718796
797
719798
720799
721800
......
732811
733812
734813
814
815
816
817
818
819
820
821
822
735823
736824
737825
......
770858
771859
772860
773
774
775
776
777
778
779
780
861
781862
863
864
865
866
782867
783868
784869
785
870
786871
787872
788
789873
790874
791875
876
792877
793878
794879
; - if not found, itarates over drives again and searches for active partition and
; loads from it
;
; dmazar: 19/7/2011
; Searching for bootable partition works in 3 passes now:
;
; - Pass1:
; - for the boot drive only:
; - searches MBR partition table for an active HSF+ bootable partition and boots it
; - if not found and disk is actually GPT, then searches for the first HFS+ bootable
; partition (or EFI with boot1f32) in the GPT array and boots it
; - if still not found, then continues with Pass2
;
; - Pass2:
; - iterates over all drives and for each drive:
; - searches MBR partition table for the first HSF+ bootable partition and boots it
; - if not found and disk is actually GPT, then searches for the first HFS+ bootable
; partition (or EFI with boot1f32) in the GPT array and boots it
; - if still not found, then continues with the next drive
; - if all drives are searched and nothing found, then continues with Pass3
; - Pass3:
; - iterates over all drives and for each drive:
; - searches MBR partition table for the first active bootable partition and boots it
; - if not found and disk is actually GPT, then searches for the first HFS+ bootable
; partition (or EFI with boot1f32) in the GPT and boots it
; - if still not found, then continues with the next drive
; - if all drives are searched and nothing found, finishes with "boot0: error"
;
; Bootable partition above means a partition with the boot sector signature (0xAA55)
; at the end of the partition boot sector.
; Booting partition means loading partition boot sector and passing control to partition
; boot loader (for example boot1h).
; Drives are searched in the order defined in the BIOS. Drive which is selected as the boot drive
; is searched first.
;
; If compiled with DEBUG=1 gives debug output:
; P - starting new pass
; D - starting disk scanning: MBR and then GPT
; p - checking MBR partition entry
; t - testing MBR partition
; l - MBR or GPT partition satisfies conditions - loading partition boot sector
; G - found GPT
; + - stage 1 booter loaded, press a key to continue
; E - error
;
;
; Set to 1 to enable obscure debug messages.
;
DEBUGEQU CONFIG_BOOT0_DEBUG
;DEBUGEQU CONFIG_BOOT0_DEBUG
DEBUGEQU 0
NOT_USEDEQU 0; exclude print_hex - no space for it
;
; Set to 1 to enable verbose mode
; Verbose - write boot0 messages
; No space for verbose and debug in the same time
;
VERBOSEEQU CONFIG_BOOT0_VERBOSE
;VERBOSEEQU CONFIG_BOOT0_VERBOSE
%if DEBUG
VERBOSEEQU 0
%else
VERBOSEEQU 1
%endif
;
; Various constants.
kDriveNumberEQU 0x80
%endif
kPass1EQU 3; Pass1
kPass2EQU 2; Pass2
kPass3EQU 1; Pass3
;
; Format of fdisk partition entry.
;
call print_char
%endmacro
%macro LogString 1
%macro DebugPauseMacro 0
call getc
%endmacro
%macro LogStringMacro 1
mov di, %1
call log_string
%endmacro
%if DEBUG
%define DebugChar(x) DebugCharMacro x
%define DebugPause DebugPauseMacro
%else
%define DebugChar(x)
%define DebugPause
%endif
%if VERBOSE
%define LogString(x) LogStringMacro x
%else
%define LogString(x)
%endif
;--------------------------------------------------------------------------
; Start of text segment.
;
start_reloc:
pushdx; save dl (boot drive) for second pass.
; will stay on stack if booter loaded in first pass.
; this should not be a problem
movbh, 1; BH = 1. two pass scanning (active or hfs partition).
; actuall use of it (scanning) is in find_boot
;
; BH is pass counter
; Pass1 BH=3, Pass2 BH=2, Pass3 BH=1
;
movbh, kPass1; BH = 3. Pass1
scan_drives:
pass_loop:
DebugChar('>')
DebugChar('P'); starting new pass
pushdx; save dl (boot drive) for next pass
.scan_drive:
%if DEBUG
mov al, dl
call print_hex
%endif
;
; Since this code may not always reside in the MBR, always start by
; loading the MBR to kMBRBuffer and LBA1 to kGPTBuffer.
mov bx, kMBRBuffer; MBR load address
call load
popbx; restore BH
jc .mbr_load_error; MBR load error - normally because we scanned all drives
jc .next_pass; MBR load error - normally because we scanned all drives
DebugChar('D'); starting disk scanning
;
; Look for the booter partition in the MBR partition table,
; which is at offset kMBRPartTable.
mov si, kMBRPartTable; pointer to partition table
call find_boot; will not return on success
; if returns - booter partition not found
; if returns - booter partition is not found
; skip scanning of all drives in Pass1
cmpbh, kPass1
je.next_pass
; try next drive
; if next drive does not exists - will break on above MBR load error
; if next drive does not exists - will break on the MBR load error above
incdl
jmpscan_drives
jmpshort .scan_drive
.mbr_load_error:
; all drives scanned - see if we need to run second pass
.next_pass:
; all drives scanned - move to next pass
popdx; restore orig boot drive
decbh; decrement scan pass counter
jzscan_drives; if zero - run seccond pass
jnzpass_loop; if not zero - exec next pass
; we ran two passes - nothing found - error
; we ran all passes - nothing found - error
error:
DebugChar('E')
DebugPause
LogString(boot_error_str)
hang:
hlt
jmp hang
jmp short hang
;--------------------------------------------------------------------------
; Arguments:
; DL = drive number (0x80 + unit number)
; SI = pointer to fdisk partition table.
; BH = pass counter (1=first pass, 0=second pass)
; BH = pass counter
;
; Clobber list:
; EAX, BX, EBP
.loop:
;
; First scan through the partition table looking for the active
; partition.
;
%if DEBUG
mov al, [si + part.type] ; print partition type
call print_hex
%endif
DebugChar('p'); checking partition entry
mov eax, [si + part.lba]; save starting LBA of current
mov [my_lba], eax; MBR partition entry for read_lba function
cmp BYTE [si + part.type], 0; unused partition?
mov bl, 1; Assume we can deal with GPT but try to scan
; later if not found any other bootable partitions.
;
; The following code between .testPass and .tryToBoot performs checking for 3 passes:
; Pass1 (BH=3) if (partition is HFS+ and active) then { DH=1; call loadBootSector}
; Pass2 (BH=2) if (partition is HFS+) then { DH=1; call loadBootSector}
; Pass3 (BH=1) if (partition is active) then { DH=0; call loadBootSector}
;
; BH is Pass counter
; DH is argument to loadBootSector
; = 0 - skip HFS+ partition signature check
; = 1 - check for HFS+ partition signature
;
; Code may be harder to read because I tried to optimized it for minimum size.
;
.testPass:
cmp bh, 1
jne .Pass2
DebugChar('t'); testing partition
xordh, dh ; DH=0 This will be used in Pass3 (partition is active, not HFS+).
cmp bh, kPass3; If this is Pass3 (BH=1)
je .checkActive; check for active flag only.
.Pass1:
cmp BYTE [si + part.type], kPartTypeHFS; In pass 1 we're going to find a HFS+ partition
; equipped with boot1h in its boot record
; regardless if it's active or not.
.checkHFS:
; We are in Pass1 (BH=3) or Pass2 (BH=2).
incdh ; DH=1
cmp BYTE [si + part.type], kPartTypeHFS; Check for a HFS+ partition.
jne .continue
movdh, 1 ; Argument for loadBootSector to check HFS+ partition signature.
jmp .tryToBoot
cmp bh, kPass2; It's HFS+. That's enough checking for Pass2,
je .tryToBoot; so try to boot (with DH=1)
; Pass1 needs active flag check also ...
.Pass2:
cmp BYTE [si + part.bootid], kPartActive; In pass 2 we are walking on the standard path
; by trying to hop on the active partition.
.checkActive:
; We are in Pass1 or Pass3
cmp BYTE [si + part.bootid], kPartActive; Check if partition is Active
jne .continue
xordh, dh ; Argument for loadBootSector to skip HFS+ partition
; signature check.
DebugChar('*')
;
; Found boot partition, read boot sector to memory.
;
initBootLoader:
DebugChar('J')
DebugChar('+')
DebugPause
%if VERBOSE
LogString(done_str)
%endif
jmp kBoot0LoadAddr
jne .exit; not found. Giving up.
cmp DWORD [di + 4], kGPTSignatureHigh ; looking for 'PART'
jne .exit; not found. Giving up indeed.
DebugChar('G'); found GPT
mov si, di
;
; Loading GUID Partition Table Array
;
call load; read GPT Array
pop si; SI = address of GPT Array
pop bx; BX = size of GUID Partition Array entry
jc error
;jc error
jc .exit; dmazar's change to continue disk scanning if encountering invalid LBA.
;
; Walk through GUID Partition Table Array
; otherwise skip to next partition.
;
%if VERBOSE
LogString(gpt_str)
%endif
.gpt_loop:
loadBootSector:
pusha
DebugChar('l'); loading partition boot sector
mov al, 3
mov bx, kBoot0LoadAddr
call load
jc error
;jc error
or dl, dl ; to set flag Z=0; dmazar's change to continue disk scanning if encountering invalid LBA.
jc .exit; dmazar's change to continue disk scanning if encountering invalid LBA.
ordh, dh
jz.checkBootSignature
.checkHFSSignature:
%if VERBOSE
;LogString(test_str); dmazar: removed to get space
%endif
;
; Looking for HFSPlus ('H+') or HFSPlus case-sensitive ('HX') signature.
pop cx
ret
;--------------------------------------------------------------------------
; read_lba - Read sectors from a partition using LBA addressing.
;
; It pushes 2 bytes with a smaller opcode than if WORD was used
push BYTE 16 ; offset 0-1, packet size
DebugChar('<')
%if DEBUG
mov eax, ecx
call print_hex
%endif
;
; INT13 Func 42 - Extended Read Sectors
;
jnc .exit
DebugChar('R') ; indicate INT13/F42 error
;
; Issue a disk reset on error.
; Should this be changed to Func 0xD to skip the diskette controller
popad
ret
%if VERBOSE
;--------------------------------------------------------------------------
; Write a string with 'boot0: ' prefix to the console.
;
.exit:
ret
%endif ;VERBOSE
%if DEBUG
;--------------------------------------------------------------------------
popa
ret
getc:
pusha
mov ah, 0
int 0x16
popa
ret
%endif ;DEBUG
%if NOT_USED
;--------------------------------------------------------------------------
; Write the 4-byte value to the console in hex.
call print_char
ret
getc:
pusha
mov ah, 0
int 0x16
popa
ret
%endif ;DEBUG
%endif ; NOT_USED
%if VERBOSE
;--------------------------------------------------------------------------
; NULL terminated strings.
;
log_title_strdb 10, 13, 'boot0: ', 0
log_title_strdb 10, 13, 'boot0:', 0
boot_error_str db 'error', 0
%if VERBOSE
gpt_strdb 'GPT', 0
;test_strdb 'test', 0
done_strdb 'done', 0
%endif
;--------------------------------------------------------------------------
branches/Chimera/i386/boot0/Makefile
1
1
22
33
44
......
1212
1313
1414
15
16
1517
16
17
18
1819
19
20
21
20
2221
2322
2423
25
26
24
25
26
SRCROOT = $(shell pwd)/../../
SRCROOT = $(abspath $(CURDIR)/../..)
OBJROOT = $(SRCROOT)/obj/i386/boot0
SYMROOT = $(SRCROOT)/sym/i386
DSTROOT = $(SRCROOT)/dst/i386
DIRS_NEEDED = $(SYMROOT)
OBJS = boot0 boot0hfs boot0md chain0
OBJS := $(addprefix $(SYMROOT)/, $(OBJS))
OBJECTS = boot0 boot0hfs boot0md chain0
OBJECTS := $(addprefix $(SYMROOT)/, $(OBJECTS))
all: $(DIRS_NEEDED) $(OBJS)
all: $(DIRS_NEEDED) $(OBJECTS)
$(OBJECTS): $(SRCROOT)/autoconf.inc
$(OBJS): $(SRCROOT)/autoconf.inc
@echo "\t[NASM] $(@F)"
@$(NASM) $(@F).s -o $@
#dependencies
clean-local:
@for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done
@rm -f $(OBJS)
branches/Chimera/i386/boot2/boot.c
159159
160160
161161
162
162
163163
164
164165
165166
166167
}
md0Ramdisk();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
verbose("Boot Args: %s\n", bootArgs->CommandLine);
// Cleanup the PXE base code.
branches/Chimera/CREDITS
33
44
55
6
6
77
88
99
10
10
1111
12
13
14
Developers:
----------
zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice, cosmo1t, cparm
zef, Turbo, dfe, netkas, mackerintel, mercurysquad, fassl, Kabyl, Crazor, Dense, Turbo, kaitek, iNDi, munky, JrCs, asereBLN, rekursor, mozodojo, meklort, AnV, valv, AzimutZ, Slice, cosmo1t, cparm
Thanks to:
---------
JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP
bumby, kalyway, Krazubu, XyZ, Galaxy, sckevyn, MasterChief, smith@@, blackosx, DHP, nawcom, scorpius, macman, dmazar
Package:
---------
kalyway, AzimutZ, blackosx, ErmaC, scrax
branches/Chimera/doc/BootHelp.txt
106106
107107
108108
109
110
109111
110112
111113
(C-States).
GeneratePStates=Yes Enable auto generation of processor power performance
states (P-States).
CSTUsingSystemIO=Yes New C-State _CST generation method using SystemIO
registers instead of FixedHW.
EnableC2State=Yes Enable specific Processor power state, C2.
EnableC3State=Yes Enable specific Processor power state, C3.

Archive Download the corresponding diff file

Revision: 1732