Chameleon

Chameleon Commit Details

Date:2016-12-26 16:05:29 (7 years 3 months ago)
Author:Bungo
Commit:2839
Parents: 2838
Message:Some cleanup
Changes:
M/branches/Bungo/i386/libsaio/fdisk.h
M/branches/Bungo/i386/libsaio/exfat.c
M/branches/Bungo/Make.rules
M/branches/Bungo/i386/libsaio/vbe.c
M/branches/Bungo/CHANGES
M/branches/Bungo/i386/libsaio/ati.c
M/branches/Bungo/i386/libsaio/sys.c
M/branches/Bungo/i386/libsaio/pci_root.c
M/branches/Bungo/i386/libsaio/device_tree.c
M/branches/Bungo/i386/boot1/boot1h.s
M/branches/Bungo/i386/libsaio/hfs.c
M/branches/Bungo/i386/libsaio/biosfn.c
M/branches/Bungo/i386/libsaio/vbe.h
M/branches/Bungo/i386/boot2/drivers.c
M/branches/Bungo/i386/libsaio/saio_types.h
M/branches/Bungo/i386/boot0/boot0md.s
M/branches/Bungo/i386/libsaio/spd.c
M/branches/Bungo/i386/libsaio/cpu.c
M/branches/Bungo/i386/libsaio/md5c.c
M/branches/Bungo/i386/libsaio/fake_efi.c
M/branches/Bungo/i386/libsaio/smbios_getters.c
M/branches/Bungo/i386/libsa/zalloc.c
M/branches/Bungo/i386/boot2/lzvn.c
M/branches/Bungo/i386/libsaio/cpu.h
M/branches/Bungo/i386/libsa/prf.c
M/branches/Bungo/i386/boot2/Makefile
M/branches/Bungo/i386/libsaio/smbios_decode.c
M/branches/Bungo/i386/boot0/boot0.s
M/branches/Bungo/i386/libsaio/gma.c
M/branches/Bungo/i386/boot0/boot0hfs.s
M/branches/Bungo/i386/boot2/boot.c
M/branches/Bungo/i386/libsaio/bootstruct.c
M/branches/Bungo/i386/libsaio/ntfs_private.h
M/branches/Bungo/i386/libsaio/ntfs.c
M/branches/Bungo/i386/libsaio/nvidia.c
M/branches/Bungo/i386/boot2/modules.c
M/branches/Bungo/i386/boot2/boot.h
M/branches/Bungo/i386/libsaio/ext2fs.c
M/branches/Bungo/i386/libsaio/pci.c
M/branches/Bungo/i386/libsaio/bootstruct.h
M/branches/Bungo/i386/libsa/string.c
M/branches/Bungo/i386/libsaio/load.c
M/branches/Bungo/i386/libsaio/convert.c
M/branches/Bungo/i386/libsaio/acpi.h
M/branches/Bungo/i386/libsaio/acpi_patcher.c
M/branches/Bungo/Chameleon.xcodeproj/project.pbxproj
M/branches/Bungo/i386/libsaio/bootargs.h
M/branches/Bungo/i386/libsaio/msdos.c
M/branches/Bungo/i386/boot2/bmdecompress.c
M/branches/Bungo/i386/libsaio/state_generator.c
M/branches/Bungo/i386/boot2/gui.c
M/branches/Bungo/i386/libsaio/platform.h
M/branches/Bungo/i386/libsaio/disk.c
M/branches/Bungo/i386/libsaio/device_inject.c
M/branches/Bungo/i386/libsaio/state_generator.h
M/branches/Bungo/i386/libsaio/smbios.c
M/branches/Bungo/i386/boot2/options.c
M/branches/Bungo/CREDITS
M/branches/Bungo/i386/libsaio/console.c
M/branches/Bungo/i386/config/confdata.c
M/branches/Bungo/i386/boot2/graphics.c
M/branches/Bungo/doc/BootHelp.txt

File differences

branches/Bungo/Chameleon.xcodeproj/project.pbxproj
111111
112112
113113
114
115
114116
115117
116118
......
175177
176178
177179
180
181
182
183
184
185
186
187
188
178189
179190
180191
......
189200
190201
191202
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364203
365204
366205
......
1006845
1007846
1008847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
1009864
1010865
1011866
......
12461101
12471102
12481103
1104
1105
12491106
1107
1108
1109
1110
1111
1112
12501113
12511114
12521115
......
13341197
13351198
13361199
1200
1201
13371202
13381203
13391204
......
13921257
13931258
13941259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
13951327
13961328
13971329
......
14301362
14311363
14321364
1365
1366
1367
1368
14331369
14341370
14351371
......
14501386
14511387
14521388
1453
1389
14541390
14551391
14561392
......
14591395
14601396
14611397
1462
1398
14631399
14641400
1465
1466
1467
1401
14681402
1469
1403
14701404
14711405
1472
1406
14731407
14741408
1475
1476
1477
1478
1409
1410
1411
1412
1413
1414
14791415
1480
1416
14811417
14821418
1483
1419
14841420
14851421
1486
1422
14871423
1488
1424
1425
14891426
14901427
1491
1428
14921429
14931430
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1431
15091432
1510
1433
1434
15111435
15121436
1513
1437
15141438
15151439
1516
1517
1440
1441
15181442
1519
1443
1444
15201445
15211446
1522
1447
15231448
15241449
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1450
1451
1452
15381453
1539
1454
15401455
15411456
1542
1457
15431458
15441459
1545
1460
1461
1462
1463
15461464
1547
1465
15481466
15491467
1550
1468
15511469
15521470
1553
1471
15541472
1555
1473
15561474
15571475
1558
1476
15591477
15601478
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1479
1480
1481
1482
1483
1484
15861485
1587
1486
15881487
15891488
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
18001489
18011490
18021491
......
28962585
28972586
28982587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
28992618
29002619
29012620
......
32402959
32412960
32422961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
32433008
32443009
32453010
......
35533318
35543319
35553320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
35563341
35573342
35583343
......
37653550
37663551
37673552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
37683665
37693666
37703667
......
38093706
38103707
38113708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
38123736
38133737
38143738
......
38763800
38773801
38783802
3879
38803803
38813804
38823805
......
38873810
38883811
38893812
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
39633813
39643814
39653815
39663816
3967
3817
39683818
39693819
39703820
......
39793829
39803830
39813831
3982
3832
39833833
39843834
39853835
......
39913841
39923842
39933843
3994
3844
39953845
39963846
3997
3847
39983848
39993849
40003850
......
40033853
40043854
40053855
4006
3856
40073857
40083858
4009
3859
40103860
40113861
40123862
360A04CC1861F48F0091F464 /* vbe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = "<group>"; };
360A04CD1861F48F0091F464 /* xml.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = "<group>"; };
360A04CE1861F48F0091F464 /* xml.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = "<group>"; };
361BC70214BD977700236488 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = "<group>"; };
361BC70B14BD97C800236488 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pkg.zip; path = Icons/pkg.zip; sourceTree = "<group>"; };
369689D014BD0AF10013D77F /* BLOCKERS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BLOCKERS; sourceTree = "<group>"; };
369689D114BD0AF10013D77F /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
369689D214BD0B470013D77F /* version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = version; sourceTree = "<group>"; };
36AB75DB14BD0866005B8045 /* text_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text_scroll_prev.png; sourceTree = "<group>"; };
36AB75DC14BD0866005B8045 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = "<group>"; };
36AB75DD14BD0866005B8045 /* thumb.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = thumb.png; sourceTree = "<group>"; };
36AB75E114BD091C005B8045 /* InstallLog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = InstallLog.sh; sourceTree = "<group>"; };
36AB75E314BD0925005B8045 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
36AB75E414BD092D005B8045 /* preinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preinstall; sourceTree = "<group>"; };
36AB75E514BD095E005B8045 /* Control.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Control.txt; path = OptionalSettings/Control.txt; sourceTree = "<group>"; };
36AB75E614BD095E005B8045 /* General.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = General.txt; path = OptionalSettings/General.txt; sourceTree = "<group>"; };
36AB75E714BD095E005B8045 /* KernelFlags.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = KernelFlags.txt; path = OptionalSettings/KernelFlags.txt; sourceTree = "<group>"; };
36AB75E814BD095E005B8045 /* PowerManagement.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = PowerManagement.txt; path = OptionalSettings/PowerManagement.txt; sourceTree = "<group>"; };
36AB75E914BD095E005B8045 /* Resolution.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Resolution.txt; path = OptionalSettings/Resolution.txt; sourceTree = "<group>"; };
36AB75EA14BD095E005B8045 /* Video.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Video.txt; path = OptionalSettings/Video.txt; sourceTree = "<group>"; };
36AE6E5716D644BC00D083A6 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = KernelPatcher/Cconfig; sourceTree = "<group>"; };
36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = KernelPatcher.dylib; path = KernelPatcher/KernelPatcher.dylib; sourceTree = "<group>"; };
36AE6E5916D644BC00D083A6 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = KernelPatcher/Makefile; sourceTree = "<group>"; };
6648DC1B1A5AA2AE00A7BB54 /* device_hfsraid_yos_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_yos_o.png; sourceTree = "<group>"; };
6648DC1C1A5AA2AE00A7BB54 /* device_hfsraid_yos.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_yos.png; sourceTree = "<group>"; };
6648DC1D1A5AA2D600A7BB54 /* lzvn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzvn.c; sourceTree = "<group>"; };
667B35931A5EF2B400FD5ED9 /* clean_po_headers.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_po_headers.sh; sourceTree = "<group>"; };
667B35951A5EF2B400FD5ED9 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
667B35991A5EF2B400FD5ED9 /* BibTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BibTeX.pm; sourceTree = "<group>"; };
667B359A1A5EF2B400FD5ED9 /* Chooser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Chooser.pm; sourceTree = "<group>"; };
667B359B1A5EF2B400FD5ED9 /* Common.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Common.pm; sourceTree = "<group>"; };
667B359C1A5EF2B400FD5ED9 /* Debconf.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Debconf.pm; sourceTree = "<group>"; };
667B359D1A5EF2B400FD5ED9 /* Dia.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Dia.pm; sourceTree = "<group>"; };
667B359E1A5EF2B400FD5ED9 /* Docbook.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Docbook.pm; sourceTree = "<group>"; };
667B359F1A5EF2B400FD5ED9 /* Guide.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Guide.pm; sourceTree = "<group>"; };
667B35A01A5EF2B400FD5ED9 /* Halibut.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Halibut.pm; sourceTree = "<group>"; };
667B35A11A5EF2B400FD5ED9 /* Html.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Html.pm; sourceTree = "<group>"; };
667B35A21A5EF2B400FD5ED9 /* Ini.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Ini.pm; sourceTree = "<group>"; };
667B35A31A5EF2B400FD5ED9 /* KernelHelp.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = KernelHelp.pm; sourceTree = "<group>"; };
667B35A41A5EF2B400FD5ED9 /* LaTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = LaTeX.pm; sourceTree = "<group>"; };
667B35A51A5EF2B400FD5ED9 /* Man.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Man.pm; sourceTree = "<group>"; };
667B35A61A5EF2B400FD5ED9 /* NewsDebian.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = NewsDebian.pm; sourceTree = "<group>"; };
667B35A71A5EF2B400FD5ED9 /* Po.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Po.pm; sourceTree = "<group>"; };
667B35A81A5EF2B400FD5ED9 /* Pod.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Pod.pm; sourceTree = "<group>"; };
667B35A91A5EF2B400FD5ED9 /* Prop.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Prop.pm; sourceTree = "<group>"; };
667B35AA1A5EF2B400FD5ED9 /* Sgml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Sgml.pm; sourceTree = "<group>"; };
667B35AB1A5EF2B400FD5ED9 /* TeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TeX.pm; sourceTree = "<group>"; };
667B35AC1A5EF2B400FD5ED9 /* Texinfo.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Texinfo.pm; sourceTree = "<group>"; };
667B35AD1A5EF2B400FD5ED9 /* Text.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Text.pm; sourceTree = "<group>"; };
667B35AE1A5EF2B400FD5ED9 /* TransTractor.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TransTractor.pm; sourceTree = "<group>"; };
667B35AF1A5EF2B400FD5ED9 /* Wml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Wml.pm; sourceTree = "<group>"; };
667B35B01A5EF2B400FD5ED9 /* Xhtml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xhtml.pm; sourceTree = "<group>"; };
667B35B11A5EF2B400FD5ED9 /* Xml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xml.pm; sourceTree = "<group>"; };
667B35B21A5EF2B400FD5ED9 /* MANIFEST */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MANIFEST; sourceTree = "<group>"; };
667B35B31A5EF2B400FD5ED9 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = "<group>"; };
667B35B41A5EF2B400FD5ED9 /* po4a */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = po4a; sourceTree = "<group>"; };
667B35B51A5EF2B400FD5ED9 /* po4a-gettextize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-gettextize"; sourceTree = "<group>"; };
667B35B61A5EF2B400FD5ED9 /* po4a-normalize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-normalize"; sourceTree = "<group>"; };
667B35B71A5EF2B400FD5ED9 /* po4a-translate */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-translate"; sourceTree = "<group>"; };
667B35B81A5EF2B400FD5ED9 /* po4a-updatepo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-updatepo"; sourceTree = "<group>"; };
667B35B91A5EF2B400FD5ED9 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
667B35BA1A5EF2B400FD5ED9 /* README.maintainers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.maintainers; sourceTree = "<group>"; };
667B35BB1A5EF2B400FD5ED9 /* README.tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.tests; sourceTree = "<group>"; };
667B35BC1A5EF2B400FD5ED9 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = "<group>"; };
667B35BD1A5EF2B400FD5ED9 /* builddmg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = builddmg.sh; sourceTree = "<group>"; };
667B35BE1A5EF2B400FD5ED9 /* buildpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = buildpkg.sh; sourceTree = "<group>"; };
667B35BF1A5EF2B400FD5ED9 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = "<group>"; };
667B35C01A5EF2B400FD5ED9 /* Distribution */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Distribution; sourceTree = "<group>"; };
667B35C21A5EF2B400FD5ED9 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = pkg.zip; sourceTree = "<group>"; };
667B35C41A5EF2B400FD5ED9 /* Audio.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Audio.txt; sourceTree = "<group>"; };
667B35C51A5EF2B400FD5ED9 /* Control.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Control.txt; sourceTree = "<group>"; };
667B35C61A5EF2B400FD5ED9 /* General.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = General.txt; sourceTree = "<group>"; };
667B35C71A5EF2B400FD5ED9 /* HDAULayout.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HDAULayout.txt; sourceTree = "<group>"; };
667B35C81A5EF2B400FD5ED9 /* HDEFLayout.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HDEFLayout.txt; sourceTree = "<group>"; };
667B35C91A5EF2B400FD5ED9 /* IntelAzul.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IntelAzul.txt; sourceTree = "<group>"; };
667B35CA1A5EF2B400FD5ED9 /* IntelCapri.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IntelCapri.txt; sourceTree = "<group>"; };
667B35CB1A5EF2B400FD5ED9 /* KernelFlags.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KernelFlags.txt; sourceTree = "<group>"; };
667B35CC1A5EF2B400FD5ED9 /* PowerManagement.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PowerManagement.txt; sourceTree = "<group>"; };
667B35CD1A5EF2B400FD5ED9 /* Resolution.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Resolution.txt; sourceTree = "<group>"; };
667B35CE1A5EF2B400FD5ED9 /* Video.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Video.txt; sourceTree = "<group>"; };
667B35D01A5EF2B400FD5ED9 /* ar.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ar.po; sourceTree = "<group>"; };
667B35D11A5EF2B400FD5ED9 /* bg.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bg.po; sourceTree = "<group>"; };
667B35D21A5EF2B400FD5ED9 /* bs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bs.po; sourceTree = "<group>"; };
667B35D31A5EF2B400FD5ED9 /* ca.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.po; sourceTree = "<group>"; };
667B35D41A5EF2B400FD5ED9 /* chameleon.pot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = chameleon.pot; sourceTree = "<group>"; };
667B35D51A5EF2B400FD5ED9 /* cs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs.po; sourceTree = "<group>"; };
667B35D61A5EF2B400FD5ED9 /* de.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = de.po; sourceTree = "<group>"; };
667B35D71A5EF2B400FD5ED9 /* el.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = el.po; sourceTree = "<group>"; };
667B35D81A5EF2B400FD5ED9 /* en.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = en.po; sourceTree = "<group>"; };
667B35D91A5EF2B400FD5ED9 /* es.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = es.po; sourceTree = "<group>"; };
667B35DA1A5EF2B400FD5ED9 /* fa.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fa.po; sourceTree = "<group>"; };
667B35DB1A5EF2B400FD5ED9 /* fr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fr.po; sourceTree = "<group>"; };
667B35DC1A5EF2B400FD5ED9 /* he.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = he.po; sourceTree = "<group>"; };
667B35DD1A5EF2B400FD5ED9 /* hr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hr.po; sourceTree = "<group>"; };
667B35DE1A5EF2B400FD5ED9 /* hu.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hu.po; sourceTree = "<group>"; };
667B35DF1A5EF2B400FD5ED9 /* id.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = id.po; sourceTree = "<group>"; };
667B35E01A5EF2B400FD5ED9 /* it.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = it.po; sourceTree = "<group>"; };
667B35E11A5EF2B400FD5ED9 /* ja.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ja.po; sourceTree = "<group>"; };
667B35E21A5EF2B400FD5ED9 /* ko.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ko.po; sourceTree = "<group>"; };
667B35E31A5EF2B400FD5ED9 /* mk.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mk.po; sourceTree = "<group>"; };
667B35E41A5EF2B400FD5ED9 /* nl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl.po; sourceTree = "<group>"; };
667B35E51A5EF2B400FD5ED9 /* pl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pl.po; sourceTree = "<group>"; };
667B35E61A5EF2B400FD5ED9 /* pt-BR.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-BR.po"; sourceTree = "<group>"; };
667B35E71A5EF2B400FD5ED9 /* pt-PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-PT.po"; sourceTree = "<group>"; };
667B35E81A5EF2B400FD5ED9 /* pt.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pt.po; sourceTree = "<group>"; };
667B35E91A5EF2B400FD5ED9 /* ro.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ro.po; sourceTree = "<group>"; };
667B35EA1A5EF2B400FD5ED9 /* ru.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ru.po; sourceTree = "<group>"; };
667B35EB1A5EF2B400FD5ED9 /* sr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sr.po; sourceTree = "<group>"; };
667B35EC1A5EF2B400FD5ED9 /* zh_CN.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_CN.po; sourceTree = "<group>"; };
667B35ED1A5EF2B400FD5ED9 /* zh_TW.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_TW.po; sourceTree = "<group>"; };
667B35EE1A5EF2B400FD5ED9 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = "<group>"; };
667B35F11A5EF2B400FD5ED9 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35F31A5EF2B400FD5ED9 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B35F41A5EF2B400FD5ED9 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35F51A5EF2B400FD5ED9 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B35F61A5EF2B400FD5ED9 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35F71A5EF2B400FD5ED9 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B35F81A5EF2B400FD5ED9 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35F91A5EF2B400FD5ED9 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B35FB1A5EF2B400FD5ED9 /* License.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = "<group>"; };
667B35FC1A5EF2B400FD5ED9 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = cs.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35FD1A5EF2B400FD5ED9 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = cs.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B35FE1A5EF2B400FD5ED9 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B35FF1A5EF2B400FD5ED9 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36011A5EF2B400FD5ED9 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = "<group>"; };
667B36021A5EF2B400FD5ED9 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36031A5EF2B400FD5ED9 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36041A5EF2B400FD5ED9 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36051A5EF2B400FD5ED9 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36061A5EF2B400FD5ED9 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36071A5EF2B400FD5ED9 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36081A5EF2B400FD5ED9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = fa.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36091A5EF2B400FD5ED9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = fa.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B360A1A5EF2B400FD5ED9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B360B1A5EF2B400FD5ED9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B360C1A5EF2B400FD5ED9 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B360D1A5EF2B400FD5ED9 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B360E1A5EF2B400FD5ED9 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B360F1A5EF2B400FD5ED9 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36101A5EF2B400FD5ED9 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = hu.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36111A5EF2B400FD5ED9 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = hu.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36121A5EF2B400FD5ED9 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36131A5EF2B400FD5ED9 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36141A5EF2B400FD5ED9 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36151A5EF2B400FD5ED9 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36161A5EF2B400FD5ED9 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36171A5EF2B400FD5ED9 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36181A5EF2B400FD5ED9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36191A5EF2B400FD5ED9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B361A1A5EF2B400FD5ED9 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B361B1A5EF2B400FD5ED9 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B361C1A5EF2B400FD5ED9 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B361D1A5EF2B400FD5ED9 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B361E1A5EF2B400FD5ED9 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B361F1A5EF2B400FD5ED9 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36201A5EF2B400FD5ED9 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Conclusion.rtfd"; sourceTree = "<group>"; };
667B36211A5EF2B400FD5ED9 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Welcome.rtfd"; sourceTree = "<group>"; };
667B36221A5EF2B400FD5ED9 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Conclusion.rtfd"; sourceTree = "<group>"; };
667B36231A5EF2B400FD5ED9 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Welcome.rtfd"; sourceTree = "<group>"; };
667B36241A5EF2B400FD5ED9 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36251A5EF2B400FD5ED9 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36261A5EF2B400FD5ED9 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36271A5EF2B400FD5ED9 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36281A5EF2B400FD5ED9 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36291A5EF2B400FD5ED9 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B362B1A5EF2B400FD5ED9 /* Conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = "<group>"; };
667B362C1A5EF2B400FD5ED9 /* Description.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Description.html; sourceTree = "<group>"; };
667B362D1A5EF2B400FD5ED9 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
667B362E1A5EF2B400FD5ED9 /* Welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Welcome.html; sourceTree = "<group>"; };
667B362F1A5EF2B400FD5ED9 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36301A5EF2B400FD5ED9 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36311A5EF2B400FD5ED9 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Conclusion.rtfd; sourceTree = "<group>"; };
667B36321A5EF2B400FD5ED9 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Welcome.rtfd; sourceTree = "<group>"; };
667B36361A5EF2B500FD5ED9 /* ESPpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ESPpostinstall; sourceTree = "<group>"; };
667B36371A5EF2B500FD5ED9 /* Standardpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Standardpostinstall; sourceTree = "<group>"; };
667B36391A5EF2B500FD5ED9 /* CheckDiskMicrocode.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckDiskMicrocode.sh; sourceTree = "<group>"; };
667B363A1A5EF2B500FD5ED9 /* CheckFatType.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckFatType.sh; sourceTree = "<group>"; };
667B363B1A5EF2B500FD5ED9 /* CheckGRUBLinuxLoader.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckGRUBLinuxLoader.sh; sourceTree = "<group>"; };
667B363C1A5EF2B500FD5ED9 /* CheckPartitionScheme.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPartitionScheme.sh; sourceTree = "<group>"; };
667B363D1A5EF2B500FD5ED9 /* CheckPreviousChameleon.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPreviousChameleon.sh; sourceTree = "<group>"; };
667B363E1A5EF2B500FD5ED9 /* CheckProceed.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckProceed.sh; sourceTree = "<group>"; };
667B363F1A5EF2B500FD5ED9 /* CheckWindowsDiskSignature.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckWindowsDiskSignature.sh; sourceTree = "<group>"; };
667B36401A5EF2B500FD5ED9 /* MountESP.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = MountESP.sh; sourceTree = "<group>"; };
667B36411A5EF2B500FD5ED9 /* patch */ = {isa = PBXFileReference; lastKnownFileType = file; path = patch; sourceTree = "<group>"; };
667B36421A5EF2B500FD5ED9 /* SetActivePartition.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = SetActivePartition.sh; sourceTree = "<group>"; };
667B36431A5EF2B500FD5ED9 /* UnMountEFIvolumes.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = UnMountEFIvolumes.sh; sourceTree = "<group>"; };
667B36441A5EF2B500FD5ED9 /* WriteChameleonStage0.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage0.sh; sourceTree = "<group>"; };
667B36451A5EF2B500FD5ED9 /* WriteChameleonStage1.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage1.sh; sourceTree = "<group>"; };
667B36461A5EF2B500FD5ED9 /* WriteChameleonStage2.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage2.sh; sourceTree = "<group>"; };
667B36491A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
667B364B1A5EF2B500FD5ED9 /* InstallLog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = InstallLog.sh; sourceTree = "<group>"; };
667B364D1A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
667B364F1A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
667B36511A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
667B36531A5EF2B500FD5ED9 /* clean_bootplist.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = clean_bootplist.pl; sourceTree = "<group>"; };
667B36541A5EF2B500FD5ED9 /* preinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preinstall; sourceTree = "<group>"; };
667B36551A5EF2B500FD5ED9 /* slimpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = slimpkg.sh; sourceTree = "<group>"; };
667B36561A5EF2B500FD5ED9 /* smbios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = smbios.plist; sourceTree = "<group>"; };
668C4D6A1A19F9AF0098C523 /* device_hfsfusion_mav_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsfusion_mav_o.png; sourceTree = "<group>"; };
668C4D6B1A19F9AF0098C523 /* device_hfsfusion_mav.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsfusion_mav.png; sourceTree = "<group>"; };
668C4D6C1A19F9AF0098C523 /* device_hfsplus_mav_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_mav_o.png; sourceTree = "<group>"; };
6DBAFFC413B0D4590047ED33 /* unistd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = "<group>"; };
6DBAFFC513B0D4590047ED33 /* unwind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unwind.h; sourceTree = "<group>"; };
A31301A71503CB9900E8C718 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = "<group>"; };
A354B6271495124F00D81AA5 /* ESPpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ESPpostinstall; sourceTree = "<group>"; };
A354B62A1495124F00D81AA5 /* Standardpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Standardpostinstall; sourceTree = "<group>"; };
A354B62C149514DE00D81AA5 /* CheckDiskMicrocode.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckDiskMicrocode.sh; sourceTree = "<group>"; };
A354B62D149514DE00D81AA5 /* CheckFatType.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckFatType.sh; sourceTree = "<group>"; };
A354B62E149514DE00D81AA5 /* CheckGRUBLinuxLoader.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckGRUBLinuxLoader.sh; sourceTree = "<group>"; };
A354B62F149514DE00D81AA5 /* CheckPartitionScheme.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPartitionScheme.sh; sourceTree = "<group>"; };
A354B630149514DE00D81AA5 /* CheckPreviousChameleon.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPreviousChameleon.sh; sourceTree = "<group>"; };
A354B631149514DE00D81AA5 /* CheckProceed.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckProceed.sh; sourceTree = "<group>"; };
A354B632149514DE00D81AA5 /* CheckWindowsDiskSignature.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckWindowsDiskSignature.sh; sourceTree = "<group>"; };
A354B634149514DE00D81AA5 /* MountESP.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = MountESP.sh; sourceTree = "<group>"; };
A354B635149514DE00D81AA5 /* patch */ = {isa = PBXFileReference; lastKnownFileType = text; path = patch; sourceTree = "<group>"; };
A354B636149514DE00D81AA5 /* SetActivePartition.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = SetActivePartition.sh; sourceTree = "<group>"; };
A354B637149514DE00D81AA5 /* UnMountEFIvolumes.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = UnMountEFIvolumes.sh; sourceTree = "<group>"; };
A354B638149514DE00D81AA5 /* WriteChameleonStage0.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage0.sh; sourceTree = "<group>"; };
A354B639149514DE00D81AA5 /* WriteChameleonStage1.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage1.sh; sourceTree = "<group>"; };
A354B63A149514DE00D81AA5 /* WriteChameleonStage2.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage2.sh; sourceTree = "<group>"; };
A3561C731413FD7800E9B51E /* auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = auto.c; sourceTree = "<group>"; };
A3561C741413FD7800E9B51E /* auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = auto.h; sourceTree = "<group>"; };
A3561C751413FD7800E9B51E /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
A35D2176141A73B000969AC0 /* pc-fr.slt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pc-fr.slt"; sourceTree = "<group>"; };
A35D2177141A73B000969AC0 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
A35D2178141A753E00969AC0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
A35D2187141A75DC00969AC0 /* slimpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = slimpkg.sh; sourceTree = "<group>"; };
A35D2188141A75DC00969AC0 /* buildpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = buildpkg.sh; sourceTree = "<group>"; };
A360AA7D14136C1A00084D3F /* Make.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Make.rules; sourceTree = "<group>"; };
A396E2CC150247630025A245 /* License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = "<group>"; };
A396E2CE150247630025A245 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = "<group>"; };
A396E2D1150247630025A245 /* Description.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Description.html; sourceTree = "<group>"; };
A396E2D2150247630025A245 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
A396E35915028C9C0025A245 /* Welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Welcome.html; sourceTree = "<group>"; };
A396E5821502D3320025A245 /* Conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = "<group>"; };
A3F1F267141B9B3B00DDA709 /* Readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Readme.txt; sourceTree = "<group>"; };
AB1DE71815B6E2D00088E06B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
AB1DE71A15B6E2D00088E06B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D8011F3868000754B65 /* coding_standards.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = coding_standards.txt; sourceTree = "<group>"; };
B0056D8111F3868000754B65 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGES; sourceTree = "<group>"; };
B0056D8211F3868000754B65 /* APPLE_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = "<group>"; };
B0056D8511F3868000754B65 /* Distribution */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Distribution; sourceTree = "<group>"; };
B0056DB911F3868000754B65 /* smbios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = smbios.plist; sourceTree = "<group>"; };
B0056DBD11F3868000754B65 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = "<group>"; };
B0056DBE11F3868000754B65 /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = boot.png; sourceTree = "<group>"; };
B0056DBF11F3868000754B65 /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_cdrom.png; sourceTree = "<group>"; };
B0056E1A11F3868000754B65 /* Users_Guide0.5.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.5.pdf; sourceTree = "<group>"; };
B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = "<group>"; };
B4118C63153EFEC200C8D926 /* clean_po_headers.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_po_headers.sh; sourceTree = "<group>"; };
B4118C65153EFEC200C8D926 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
B4118C69153EFEC200C8D926 /* BibTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BibTeX.pm; sourceTree = "<group>"; };
B4118C6A153EFEC200C8D926 /* Chooser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Chooser.pm; sourceTree = "<group>"; };
B4118C6B153EFEC200C8D926 /* Common.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Common.pm; sourceTree = "<group>"; };
B4118C6C153EFEC200C8D926 /* Debconf.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Debconf.pm; sourceTree = "<group>"; };
B4118C6D153EFEC200C8D926 /* Dia.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Dia.pm; sourceTree = "<group>"; };
B4118C6E153EFEC200C8D926 /* Docbook.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Docbook.pm; sourceTree = "<group>"; };
B4118C6F153EFEC200C8D926 /* Guide.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Guide.pm; sourceTree = "<group>"; };
B4118C70153EFEC200C8D926 /* Halibut.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Halibut.pm; sourceTree = "<group>"; };
B4118C71153EFEC200C8D926 /* Html.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Html.pm; sourceTree = "<group>"; };
B4118C72153EFEC200C8D926 /* Ini.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Ini.pm; sourceTree = "<group>"; };
B4118C73153EFEC200C8D926 /* KernelHelp.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = KernelHelp.pm; sourceTree = "<group>"; };
B4118C74153EFEC200C8D926 /* LaTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = LaTeX.pm; sourceTree = "<group>"; };
B4118C75153EFEC200C8D926 /* Man.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Man.pm; sourceTree = "<group>"; };
B4118C76153EFEC200C8D926 /* NewsDebian.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = NewsDebian.pm; sourceTree = "<group>"; };
B4118C77153EFEC200C8D926 /* Po.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Po.pm; sourceTree = "<group>"; };
B4118C78153EFEC200C8D926 /* Pod.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Pod.pm; sourceTree = "<group>"; };
B4118C79153EFEC200C8D926 /* Prop.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Prop.pm; sourceTree = "<group>"; };
B4118C7A153EFEC200C8D926 /* Sgml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Sgml.pm; sourceTree = "<group>"; };
B4118C7B153EFEC200C8D926 /* TeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TeX.pm; sourceTree = "<group>"; };
B4118C7C153EFEC200C8D926 /* Texinfo.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Texinfo.pm; sourceTree = "<group>"; };
B4118C7D153EFEC200C8D926 /* Text.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Text.pm; sourceTree = "<group>"; };
B4118C7E153EFEC200C8D926 /* TransTractor.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TransTractor.pm; sourceTree = "<group>"; };
B4118C7F153EFEC200C8D926 /* Wml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Wml.pm; sourceTree = "<group>"; };
B4118C80153EFEC200C8D926 /* Xhtml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xhtml.pm; sourceTree = "<group>"; };
B4118C81153EFEC200C8D926 /* Xml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xml.pm; sourceTree = "<group>"; };
B4118C82153EFEC200C8D926 /* MANIFEST */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MANIFEST; sourceTree = "<group>"; };
B4118C83153EFEC200C8D926 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = "<group>"; };
B4118C84153EFEC200C8D926 /* po4a */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = po4a; sourceTree = "<group>"; };
B4118C85153EFEC200C8D926 /* po4a-gettextize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-gettextize"; sourceTree = "<group>"; };
B4118C86153EFEC200C8D926 /* po4a-normalize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-normalize"; sourceTree = "<group>"; };
B4118C87153EFEC200C8D926 /* po4a-translate */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-translate"; sourceTree = "<group>"; };
B4118C88153EFEC200C8D926 /* po4a-updatepo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-updatepo"; sourceTree = "<group>"; };
B4118C89153EFEC200C8D926 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
B4118C8A153EFEC200C8D926 /* README.maintainers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.maintainers; sourceTree = "<group>"; };
B4118C8B153EFEC200C8D926 /* README.tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.tests; sourceTree = "<group>"; };
B4118C8C153EFEC200C8D926 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = "<group>"; };
B4118C8F153EFF3300C8D926 /* ar.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ar.po; sourceTree = "<group>"; };
B4118C90153EFF3300C8D926 /* bg.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bg.po; sourceTree = "<group>"; };
B4118C91153EFF3300C8D926 /* bs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bs.po; sourceTree = "<group>"; };
B4118C92153EFF3300C8D926 /* ca.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.po; sourceTree = "<group>"; };
B4118C93153EFF3300C8D926 /* chameleon.pot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = chameleon.pot; sourceTree = "<group>"; };
B4118C94153EFF3300C8D926 /* cs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs.po; sourceTree = "<group>"; };
B4118C95153EFF3300C8D926 /* de.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = de.po; sourceTree = "<group>"; };
B4118C96153EFF3300C8D926 /* el.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = el.po; sourceTree = "<group>"; };
B4118C97153EFF3300C8D926 /* en.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = en.po; sourceTree = "<group>"; };
B4118C98153EFF3300C8D926 /* es.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = es.po; sourceTree = "<group>"; };
B4118C99153EFF3300C8D926 /* fa.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fa.po; sourceTree = "<group>"; };
B4118C9A153EFF3300C8D926 /* fr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fr.po; sourceTree = "<group>"; };
B4118C9B153EFF3300C8D926 /* he.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = he.po; sourceTree = "<group>"; };
B4118C9C153EFF3300C8D926 /* hr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hr.po; sourceTree = "<group>"; };
B4118C9D153EFF3300C8D926 /* hu.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hu.po; sourceTree = "<group>"; };
B4118C9E153EFF3300C8D926 /* id.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = id.po; sourceTree = "<group>"; };
B4118C9F153EFF3300C8D926 /* it.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = it.po; sourceTree = "<group>"; };
B4118CA0153EFF3300C8D926 /* ko.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ko.po; sourceTree = "<group>"; };
B4118CA1153EFF3300C8D926 /* mk.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mk.po; sourceTree = "<group>"; };
B4118CA2153EFF3300C8D926 /* nl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl.po; sourceTree = "<group>"; };
B4118CA3153EFF3300C8D926 /* pl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pl.po; sourceTree = "<group>"; };
B4118CA4153EFF3300C8D926 /* pt-BR.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-BR.po"; sourceTree = "<group>"; };
B4118CA5153EFF3300C8D926 /* pt-PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-PT.po"; sourceTree = "<group>"; };
B4118CA6153EFF3300C8D926 /* ro.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ro.po; sourceTree = "<group>"; };
B4118CA7153EFF3300C8D926 /* ru.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ru.po; sourceTree = "<group>"; };
B4118CA8153EFF3300C8D926 /* sr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sr.po; sourceTree = "<group>"; };
B4118CA9153EFF3300C8D926 /* zh_CN.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_CN.po; sourceTree = "<group>"; };
B4118CAA153EFF3300C8D926 /* zh_TW.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_TW.po; sourceTree = "<group>"; };
B4118CAB153EFF3D00C8D926 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = "<group>"; };
B41899FB14BFBE2400ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
B41899FD14BFBE4500ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
B41899FE14BFBE5200ED5B0B /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = "<group>"; };
B4189A2114BFBF1C00ED5B0B /* zconf.tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zconf.tab.c; path = config/zconf.tab.c; sourceTree = "<group>"; };
B4189A2214BFBF5600ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
B4189A2414BFBFD100ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = "<group>"; };
B4AABE5914C3B8B90055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
B4AABE5B14C3B8C70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
B4AABE5D14C3B8D70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = "<group>"; };
B4AABE5E14C3B8EF0055ECD1 /* clean_bootplist.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = clean_bootplist.pl; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
A360AA7D14136C1A00084D3F /* Make.rules */,
B0056D7D11F3868000754B65 /* Makefile */,
019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */,
667B35911A5EF2B400FD5ED9 /* package */,
B0056D8311F3868000754B65 /* package */,
B0146EFF11FDEF550010765C /* README */,
A31301A71503CB9900E8C718 /* README.translators */,
B0056D7C11F3868000754B65 /* TODO */,
name = Chameleon;
sourceTree = "<group>";
};
36AE6E5616D6449A00D083A6 /* KernelPatcher */ = {
361BC70414BD979700236488 /* Icons */ = {
isa = PBXGroup;
children = (
36AE6E5716D644BC00D083A6 /* Cconfig */,
36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */,
36AE6E5916D644BC00D083A6 /* Makefile */,
361BC70B14BD97C800236488 /* pkg.zip */,
);
name = KernelPatcher;
name = Icons;
sourceTree = "<group>";
};
36AE6E5A16D644CB00D083A6 /* FileNVRAM */ = {
364E0DDF14BCFB6600F55E58 /* Scripts.templates */ = {
isa = PBXGroup;
children = (
36AE6E5D16D644F300D083A6 /* Cconfig */,
36AE6E5E16D644F300D083A6 /* FileNVRAM.dylib */,
36AE6E5B16D644DB00D083A6 /* include */,
36AE6E5F16D644F300D083A6 /* Makefile */,
B4AABE5814C3B8B90055ECD1 /* AddOption */,
364E0DE114BCFB7A00F55E58 /* InstallerLog */,
B4AABE5A14C3B8C70055ECD1 /* InstallModule */,
B4AABE5C14C3B8D70055ECD1 /* InstallTheme */,
364E0DE314BCFB7A00F55E58 /* Post */,
364E0DE514BCFB7A00F55E58 /* Pre */,
);
name = FileNVRAM;
name = Scripts.templates;
sourceTree = "<group>";
};
36AE6E5B16D644DB00D083A6 /* include */ = {
364E0DE114BCFB7A00F55E58 /* InstallerLog */ = {
isa = PBXGroup;
children = (
36AE6E5C16D644E800D083A6 /* FileNVRAM.h */,
36AB75E114BD091C005B8045 /* InstallLog.sh */,
);
name = include;
name = InstallerLog;
path = Scripts.templates/InstallerLog;
sourceTree = "<group>";
};
667B35911A5EF2B400FD5ED9 /* package */ = {
364E0DE314BCFB7A00F55E58 /* Post */ = {
isa = PBXGroup;
children = (
667B35921A5EF2B400FD5ED9 /* bin */,
667B35BD1A5EF2B400FD5ED9 /* builddmg.sh */,
667B35BE1A5EF2B400FD5ED9 /* buildpkg.sh */,
667B35BF1A5EF2B400FD5ED9 /* Changes.txt */,
667B35C01A5EF2B400FD5ED9 /* Distribution */,
667B35C11A5EF2B400FD5ED9 /* Icons */,
667B35C31A5EF2B400FD5ED9 /* OptionalSettings */,
667B35CF1A5EF2B400FD5ED9 /* po */,
667B35EE1A5EF2B400FD5ED9 /* po4a-chameleon.cfg */,
667B35EF1A5EF2B400FD5ED9 /* Resources */,
667B36331A5EF2B400FD5ED9 /* Resources.old */,
667B36341A5EF2B400FD5ED9 /* Scripts */,
667B36471A5EF2B500FD5ED9 /* Scripts.templates */,
667B36551A5EF2B500FD5ED9 /* slimpkg.sh */,
667B36561A5EF2B500FD5ED9 /* smbios.plist */,
36AB75E314BD0925005B8045 /* postinstall */,
);
path = package;
name = Post;
path = Scripts.templates/Post;
sourceTree = "<group>";
};
667B35921A5EF2B400FD5ED9 /* bin */ = {
364E0DE514BCFB7A00F55E58 /* Pre */ = {
isa = PBXGroup;
children = (
667B35931A5EF2B400FD5ED9 /* clean_po_headers.sh */,
667B35941A5EF2B400FD5ED9 /* po4a */,
B4AABE5E14C3B8EF0055ECD1 /* clean_bootplist.pl */,
36AB75E414BD092D005B8045 /* preinstall */,
);
path = bin;
name = Pre;
path = Scripts.templates/Pre;
sourceTree = "<group>";
};
667B35941A5EF2B400FD5ED9 /* po4a */ = {
36AE6E5616D6449A00D083A6 /* KernelPatcher */ = {
isa = PBXGroup;
children = (
667B35951A5EF2B400FD5ED9 /* COPYING */,
667B35961A5EF2B400FD5ED9 /* lib */,
667B35B21A5EF2B400FD5ED9 /* MANIFEST */,
667B35B31A5EF2B400FD5ED9 /* NEWS */,
667B35B41A5EF2B400FD5ED9 /* po4a */,
667B35B51A5EF2B400FD5ED9 /* po4a-gettextize */,
667B35B61A5EF2B400FD5ED9 /* po4a-normalize */,
667B35B71A5EF2B400FD5ED9 /* po4a-translate */,
667B35B81A5EF2B400FD5ED9 /* po4a-updatepo */,
667B35B91A5EF2B400FD5ED9 /* README */,
667B35BA1A5EF2B400FD5ED9 /* README.maintainers */,
667B35BB1A5EF2B400FD5ED9 /* README.tests */,
667B35BC1A5EF2B400FD5ED9 /* README.translators */,
36AE6E5716D644BC00D083A6 /* Cconfig */,
36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */,
36AE6E5916D644BC00D083A6 /* Makefile */,
);
path = po4a;
name = KernelPatcher;
sourceTree = "<group>";
};
667B35961A5EF2B400FD5ED9 /* lib */ = {
36AE6E5A16D644CB00D083A6 /* FileNVRAM */ = {
isa = PBXGroup;
children = (
667B35971A5EF2B400FD5ED9 /* Locale */,
36AE6E5D16D644F300D083A6 /* Cconfig */,
36AE6E5E16D644F300D083A6 /* FileNVRAM.dylib */,
36AE6E5B16D644DB00D083A6 /* include */,
36AE6E5F16D644F300D083A6 /* Makefile */,
);
path = lib;
name = FileNVRAM;
sourceTree = "<group>";
};
667B35971A5EF2B400FD5ED9 /* Locale */ = {
36AE6E5B16D644DB00D083A6 /* include */ = {
isa = PBXGroup;
children = (
667B35981A5EF2B400FD5ED9 /* Po4a */,
36AE6E5C16D644E800D083A6 /* FileNVRAM.h */,
);
path = Locale;
name = include;
sourceTree = "<group>";
};
667B35981A5EF2B400FD5ED9 /* Po4a */ = {
36B43E8114BCE91300D29461 /* OptionalSettings */ = {
isa = PBXGroup;
children = (
667B35991A5EF2B400FD5ED9 /* BibTeX.pm */,
667B359A1A5EF2B400FD5ED9 /* Chooser.pm */,
667B359B1A5EF2B400FD5ED9 /* Common.pm */,
667B359C1A5EF2B400FD5ED9 /* Debconf.pm */,
667B359D1A5EF2B400FD5ED9 /* Dia.pm */,
667B359E1A5EF2B400FD5ED9 /* Docbook.pm */,
667B359F1A5EF2B400FD5ED9 /* Guide.pm */,
667B35A01A5EF2B400FD5ED9 /* Halibut.pm */,
667B35A11A5EF2B400FD5ED9 /* Html.pm */,
667B35A21A5EF2B400FD5ED9 /* Ini.pm */,
667B35A31A5EF2B400FD5ED9 /* KernelHelp.pm */,
667B35A41A5EF2B400FD5ED9 /* LaTeX.pm */,
667B35A51A5EF2B400FD5ED9 /* Man.pm */,
667B35A61A5EF2B400FD5ED9 /* NewsDebian.pm */,
667B35A71A5EF2B400FD5ED9 /* Po.pm */,
667B35A81A5EF2B400FD5ED9 /* Pod.pm */,
667B35A91A5EF2B400FD5ED9 /* Prop.pm */,
667B35AA1A5EF2B400FD5ED9 /* Sgml.pm */,
667B35AB1A5EF2B400FD5ED9 /* TeX.pm */,
667B35AC1A5EF2B400FD5ED9 /* Texinfo.pm */,
667B35AD1A5EF2B400FD5ED9 /* Text.pm */,
667B35AE1A5EF2B400FD5ED9 /* TransTractor.pm */,
667B35AF1A5EF2B400FD5ED9 /* Wml.pm */,
667B35B01A5EF2B400FD5ED9 /* Xhtml.pm */,
667B35B11A5EF2B400FD5ED9 /* Xml.pm */,
36AB75E514BD095E005B8045 /* Control.txt */,
36AB75E614BD095E005B8045 /* General.txt */,
36AB75E714BD095E005B8045 /* KernelFlags.txt */,
36AB75E814BD095E005B8045 /* PowerManagement.txt */,
36AB75E914BD095E005B8045 /* Resolution.txt */,
36AB75EA14BD095E005B8045 /* Video.txt */,
);
path = Po4a;
name = OptionalSettings;
sourceTree = "<group>";
};
667B35C11A5EF2B400FD5ED9 /* Icons */ = {
isa = PBXGroup;
children = (
667B35C21A5EF2B400FD5ED9 /* pkg.zip */,
);
path = Icons;
sourceTree = "<group>";
};
667B35C31A5EF2B400FD5ED9 /* OptionalSettings */ = {
isa = PBXGroup;
children = (
667B35C41A5EF2B400FD5ED9 /* Audio.txt */,
667B35C51A5EF2B400FD5ED9 /* Control.txt */,
667B35C61A5EF2B400FD5ED9 /* General.txt */,
667B35C71A5EF2B400FD5ED9 /* HDAULayout.txt */,
667B35C81A5EF2B400FD5ED9 /* HDEFLayout.txt */,
667B35C91A5EF2B400FD5ED9 /* IntelAzul.txt */,
667B35CA1A5EF2B400FD5ED9 /* IntelCapri.txt */,
667B35CB1A5EF2B400FD5ED9 /* KernelFlags.txt */,
667B35CC1A5EF2B400FD5ED9 /* PowerManagement.txt */,
667B35CD1A5EF2B400FD5ED9 /* Resolution.txt */,
667B35CE1A5EF2B400FD5ED9 /* Video.txt */,
);
path = OptionalSettings;
sourceTree = "<group>";
};
667B35CF1A5EF2B400FD5ED9 /* po */ = {
isa = PBXGroup;
children = (
667B35D01A5EF2B400FD5ED9 /* ar.po */,
667B35D11A5EF2B400FD5ED9 /* bg.po */,
667B35D21A5EF2B400FD5ED9 /* bs.po */,
667B35D31A5EF2B400FD5ED9 /* ca.po */,
667B35D41A5EF2B400FD5ED9 /* chameleon.pot */,
667B35D51A5EF2B400FD5ED9 /* cs.po */,
667B35D61A5EF2B400FD5ED9 /* de.po */,
667B35D71A5EF2B400FD5ED9 /* el.po */,
667B35D81A5EF2B400FD5ED9 /* en.po */,
667B35D91A5EF2B400FD5ED9 /* es.po */,
667B35DA1A5EF2B400FD5ED9 /* fa.po */,
667B35DB1A5EF2B400FD5ED9 /* fr.po */,
667B35DC1A5EF2B400FD5ED9 /* he.po */,
667B35DD1A5EF2B400FD5ED9 /* hr.po */,
667B35DE1A5EF2B400FD5ED9 /* hu.po */,
667B35DF1A5EF2B400FD5ED9 /* id.po */,
667B35E01A5EF2B400FD5ED9 /* it.po */,
667B35E11A5EF2B400FD5ED9 /* ja.po */,
667B35E21A5EF2B400FD5ED9 /* ko.po */,
667B35E31A5EF2B400FD5ED9 /* mk.po */,
667B35E41A5EF2B400FD5ED9 /* nl.po */,
667B35E51A5EF2B400FD5ED9 /* pl.po */,
667B35E61A5EF2B400FD5ED9 /* pt-BR.po */,
667B35E71A5EF2B400FD5ED9 /* pt-PT.po */,
667B35E81A5EF2B400FD5ED9 /* pt.po */,
667B35E91A5EF2B400FD5ED9 /* ro.po */,
667B35EA1A5EF2B400FD5ED9 /* ru.po */,
667B35EB1A5EF2B400FD5ED9 /* sr.po */,
667B35EC1A5EF2B400FD5ED9 /* zh_CN.po */,
667B35ED1A5EF2B400FD5ED9 /* zh_TW.po */,
);
path = po;
sourceTree = "<group>";
};
667B35EF1A5EF2B400FD5ED9 /* Resources */ = {
isa = PBXGroup;
children = (
667B35F01A5EF2B400FD5ED9 /* Conclusion.rtfd */,
667B35F21A5EF2B400FD5ED9 /* Welcome.rtfd */,
667B35FA1A5EF2B400FD5ED9 /* common */,
667B36001A5EF2B400FD5ED9 /* distribution */,
667B362A1A5EF2B400FD5ED9 /* templates */,
);
path = Resources;
sourceTree = "<group>";
};
667B35FA1A5EF2B400FD5ED9 /* common */ = {
isa = PBXGroup;
children = (
667B35FB1A5EF2B400FD5ED9 /* License.rtf */,
);
path = common;
sourceTree = "<group>";
};
667B36001A5EF2B400FD5ED9 /* distribution */ = {
isa = PBXGroup;
children = (
667B36011A5EF2B400FD5ED9 /* background.tiff */,
);
path = distribution;
sourceTree = "<group>";
};
667B362A1A5EF2B400FD5ED9 /* templates */ = {
isa = PBXGroup;
children = (
667B362B1A5EF2B400FD5ED9 /* Conclusion.html */,
667B362C1A5EF2B400FD5ED9 /* Description.html */,
667B362D1A5EF2B400FD5ED9 /* Localizable.strings */,
667B362E1A5EF2B400FD5ED9 /* Welcome.html */,
);
path = templates;
sourceTree = "<group>";
};
667B36331A5EF2B400FD5ED9 /* Resources.old */ = {
isa = PBXGroup;
children = (
);
path = Resources.old;
sourceTree = "<group>";
};
667B36341A5EF2B400FD5ED9 /* Scripts */ = {
isa = PBXGroup;
children = (
667B36351A5EF2B500FD5ED9 /* Main */,
667B36381A5EF2B500FD5ED9 /* Sub */,
);
path = Scripts;
sourceTree = "<group>";
};
667B36351A5EF2B500FD5ED9 /* Main */ = {
isa = PBXGroup;
children = (
667B36361A5EF2B500FD5ED9 /* ESPpostinstall */,
667B36371A5EF2B500FD5ED9 /* Standardpostinstall */,
);
path = Main;
sourceTree = "<group>";
};
667B36381A5EF2B500FD5ED9 /* Sub */ = {
isa = PBXGroup;
children = (
667B36391A5EF2B500FD5ED9 /* CheckDiskMicrocode.sh */,
667B363A1A5EF2B500FD5ED9 /* CheckFatType.sh */,
667B363B1A5EF2B500FD5ED9 /* CheckGRUBLinuxLoader.sh */,
667B363C1A5EF2B500FD5ED9 /* CheckPartitionScheme.sh */,
667B363D1A5EF2B500FD5ED9 /* CheckPreviousChameleon.sh */,
667B363E1A5EF2B500FD5ED9 /* CheckProceed.sh */,
667B363F1A5EF2B500FD5ED9 /* CheckWindowsDiskSignature.sh */,
667B36401A5EF2B500FD5ED9 /* MountESP.sh */,
667B36411A5EF2B500FD5ED9 /* patch */,
667B36421A5EF2B500FD5ED9 /* SetActivePartition.sh */,
667B36431A5EF2B500FD5ED9 /* UnMountEFIvolumes.sh */,
667B36441A5EF2B500FD5ED9 /* WriteChameleonStage0.sh */,
667B36451A5EF2B500FD5ED9 /* WriteChameleonStage1.sh */,
667B36461A5EF2B500FD5ED9 /* WriteChameleonStage2.sh */,
);
path = Sub;
sourceTree = "<group>";
};
667B36471A5EF2B500FD5ED9 /* Scripts.templates */ = {
isa = PBXGroup;
children = (
667B36481A5EF2B500FD5ED9 /* AddOption */,
667B364A1A5EF2B500FD5ED9 /* InstallerLog */,
667B364C1A5EF2B500FD5ED9 /* InstallModule */,
667B364E1A5EF2B500FD5ED9 /* InstallTheme */,
667B36501A5EF2B500FD5ED9 /* Post */,
667B36521A5EF2B500FD5ED9 /* Pre */,
);
path = Scripts.templates;
sourceTree = "<group>";
};
667B36481A5EF2B500FD5ED9 /* AddOption */ = {
isa = PBXGroup;
children = (
667B36491A5EF2B500FD5ED9 /* postinstall */,
);
path = AddOption;
sourceTree = "<group>";
};
667B364A1A5EF2B500FD5ED9 /* InstallerLog */ = {
isa = PBXGroup;
children = (
667B364B1A5EF2B500FD5ED9 /* InstallLog.sh */,
);
path = InstallerLog;
sourceTree = "<group>";
};
667B364C1A5EF2B500FD5ED9 /* InstallModule */ = {
isa = PBXGroup;
children = (
667B364D1A5EF2B500FD5ED9 /* postinstall */,
);
path = InstallModule;
sourceTree = "<group>";
};
667B364E1A5EF2B500FD5ED9 /* InstallTheme */ = {
isa = PBXGroup;
children = (
667B364F1A5EF2B500FD5ED9 /* postinstall */,
);
path = InstallTheme;
sourceTree = "<group>";
};
667B36501A5EF2B500FD5ED9 /* Post */ = {
isa = PBXGroup;
children = (
667B36511A5EF2B500FD5ED9 /* postinstall */,
);
path = Post;
sourceTree = "<group>";
};
667B36521A5EF2B500FD5ED9 /* Pre */ = {
isa = PBXGroup;
children = (
667B36531A5EF2B500FD5ED9 /* clean_bootplist.pl */,
667B36541A5EF2B500FD5ED9 /* preinstall */,
);
path = Pre;
sourceTree = "<group>";
};
6DBAFD1713B0D4590047ED33 /* include */ = {
isa = PBXGroup;
children = (
path = ufs;
sourceTree = "<group>";
};
A354B6261495124F00D81AA5 /* Main */ = {
isa = PBXGroup;
children = (
A354B6271495124F00D81AA5 /* ESPpostinstall */,
A354B62A1495124F00D81AA5 /* Standardpostinstall */,
);
path = Main;
sourceTree = "<group>";
};
A354B62B149514DE00D81AA5 /* Sub */ = {
isa = PBXGroup;
children = (
A354B62C149514DE00D81AA5 /* CheckDiskMicrocode.sh */,
A354B62D149514DE00D81AA5 /* CheckFatType.sh */,
A354B62E149514DE00D81AA5 /* CheckGRUBLinuxLoader.sh */,
A354B62F149514DE00D81AA5 /* CheckPartitionScheme.sh */,
A354B630149514DE00D81AA5 /* CheckPreviousChameleon.sh */,
A354B631149514DE00D81AA5 /* CheckProceed.sh */,
A354B632149514DE00D81AA5 /* CheckWindowsDiskSignature.sh */,
A354B634149514DE00D81AA5 /* MountESP.sh */,
A354B635149514DE00D81AA5 /* patch */,
A354B636149514DE00D81AA5 /* SetActivePartition.sh */,
A354B637149514DE00D81AA5 /* UnMountEFIvolumes.sh */,
A354B638149514DE00D81AA5 /* WriteChameleonStage0.sh */,
A354B639149514DE00D81AA5 /* WriteChameleonStage1.sh */,
A354B63A149514DE00D81AA5 /* WriteChameleonStage2.sh */,
);
path = Sub;
sourceTree = "<group>";
};
A3561C721413FD7800E9B51E /* fdisk */ = {
isa = PBXGroup;
children = (
path = "layouts-src";
sourceTree = "<group>";
};
A396E2CA150247630025A245 /* Resources */ = {
isa = PBXGroup;
children = (
A396E2CB150247630025A245 /* common */,
A396E2CD150247630025A245 /* distribution */,
A396E2CF150247630025A245 /* templates */,
);
path = Resources;
sourceTree = "<group>";
};
A396E2CB150247630025A245 /* common */ = {
isa = PBXGroup;
children = (
A396E2CC150247630025A245 /* License.rtf */,
);
path = common;
sourceTree = "<group>";
};
A396E2CD150247630025A245 /* distribution */ = {
isa = PBXGroup;
children = (
A396E2CE150247630025A245 /* background.tiff */,
);
path = distribution;
sourceTree = "<group>";
};
A396E2CF150247630025A245 /* templates */ = {
isa = PBXGroup;
children = (
A396E35915028C9C0025A245 /* Welcome.html */,
A396E2D1150247630025A245 /* Description.html */,
A396E5821502D3320025A245 /* Conclusion.html */,
A396E2D2150247630025A245 /* Localizable.strings */,
);
path = templates;
sourceTree = "<group>";
};
A3F1F20D141B9B0D00DDA709 /* Scripts */ = {
isa = PBXGroup;
children = (
A354B6261495124F00D81AA5 /* Main */,
A354B62B149514DE00D81AA5 /* Sub */,
);
path = Scripts;
sourceTree = "<group>";
};
AB1DE71715B6E2D00088E06B /* Sata */ = {
isa = PBXGroup;
children = (
path = util;
sourceTree = "<group>";
};
B0056D8311F3868000754B65 /* package */ = {
isa = PBXGroup;
children = (
B4118C62153EFEC200C8D926 /* bin */,
A35D2188141A75DC00969AC0 /* buildpkg.sh */,
361BC70214BD977700236488 /* Changes.txt */,
B0056D8511F3868000754B65 /* Distribution */,
361BC70414BD979700236488 /* Icons */,
36B43E8114BCE91300D29461 /* OptionalSettings */,
B4118C8E153EFF3300C8D926 /* po */,
B4118CAB153EFF3D00C8D926 /* po4a-chameleon.cfg */,
A396E2CA150247630025A245 /* Resources */,
A3F1F20D141B9B0D00DDA709 /* Scripts */,
364E0DDF14BCFB6600F55E58 /* Scripts.templates */,
A35D2187141A75DC00969AC0 /* slimpkg.sh */,
B0056DB911F3868000754B65 /* smbios.plist */,
);
path = package;
sourceTree = "<group>";
};
B0056DBA11F3868000754B65 /* artwork */ = {
isa = PBXGroup;
children = (
path = User_Guide_src;
sourceTree = "<group>";
};
B4118C62153EFEC200C8D926 /* bin */ = {
isa = PBXGroup;
children = (
B4118C63153EFEC200C8D926 /* clean_po_headers.sh */,
B4118C64153EFEC200C8D926 /* po4a */,
);
path = bin;
sourceTree = "<group>";
};
B4118C64153EFEC200C8D926 /* po4a */ = {
isa = PBXGroup;
children = (
B4118C65153EFEC200C8D926 /* COPYING */,
B4118C66153EFEC200C8D926 /* lib */,
B4118C82153EFEC200C8D926 /* MANIFEST */,
B4118C83153EFEC200C8D926 /* NEWS */,
B4118C84153EFEC200C8D926 /* po4a */,
B4118C85153EFEC200C8D926 /* po4a-gettextize */,
B4118C86153EFEC200C8D926 /* po4a-normalize */,
B4118C87153EFEC200C8D926 /* po4a-translate */,
B4118C88153EFEC200C8D926 /* po4a-updatepo */,
B4118C89153EFEC200C8D926 /* README */,
B4118C8A153EFEC200C8D926 /* README.maintainers */,
B4118C8B153EFEC200C8D926 /* README.tests */,
B4118C8C153EFEC200C8D926 /* README.translators */,
);
path = po4a;
sourceTree = "<group>";
};
B4118C66153EFEC200C8D926 /* lib */ = {
isa = PBXGroup;
children = (
B4118C67153EFEC200C8D926 /* Locale */,
);
path = lib;
sourceTree = "<group>";
};
B4118C67153EFEC200C8D926 /* Locale */ = {
isa = PBXGroup;
children = (
B4118C68153EFEC200C8D926 /* Po4a */,
);
path = Locale;
sourceTree = "<group>";
};
B4118C68153EFEC200C8D926 /* Po4a */ = {
isa = PBXGroup;
children = (
B4118C69153EFEC200C8D926 /* BibTeX.pm */,
B4118C6A153EFEC200C8D926 /* Chooser.pm */,
B4118C6B153EFEC200C8D926 /* Common.pm */,
B4118C6C153EFEC200C8D926 /* Debconf.pm */,
B4118C6D153EFEC200C8D926 /* Dia.pm */,
B4118C6E153EFEC200C8D926 /* Docbook.pm */,
B4118C6F153EFEC200C8D926 /* Guide.pm */,
B4118C70153EFEC200C8D926 /* Halibut.pm */,
B4118C71153EFEC200C8D926 /* Html.pm */,
B4118C72153EFEC200C8D926 /* Ini.pm */,
B4118C73153EFEC200C8D926 /* KernelHelp.pm */,
B4118C74153EFEC200C8D926 /* LaTeX.pm */,
B4118C75153EFEC200C8D926 /* Man.pm */,
B4118C76153EFEC200C8D926 /* NewsDebian.pm */,
B4118C77153EFEC200C8D926 /* Po.pm */,
B4118C78153EFEC200C8D926 /* Pod.pm */,
B4118C79153EFEC200C8D926 /* Prop.pm */,
B4118C7A153EFEC200C8D926 /* Sgml.pm */,
B4118C7B153EFEC200C8D926 /* TeX.pm */,
B4118C7C153EFEC200C8D926 /* Texinfo.pm */,
B4118C7D153EFEC200C8D926 /* Text.pm */,
B4118C7E153EFEC200C8D926 /* TransTractor.pm */,
B4118C7F153EFEC200C8D926 /* Wml.pm */,
B4118C80153EFEC200C8D926 /* Xhtml.pm */,
B4118C81153EFEC200C8D926 /* Xml.pm */,
);
path = Po4a;
sourceTree = "<group>";
};
B4118C8E153EFF3300C8D926 /* po */ = {
isa = PBXGroup;
children = (
B4118C8F153EFF3300C8D926 /* ar.po */,
B4118C90153EFF3300C8D926 /* bg.po */,
B4118C91153EFF3300C8D926 /* bs.po */,
B4118C92153EFF3300C8D926 /* ca.po */,
B4118C93153EFF3300C8D926 /* chameleon.pot */,
B4118C94153EFF3300C8D926 /* cs.po */,
B4118C95153EFF3300C8D926 /* de.po */,
B4118C96153EFF3300C8D926 /* el.po */,
B4118C97153EFF3300C8D926 /* en.po */,
B4118C98153EFF3300C8D926 /* es.po */,
B4118C99153EFF3300C8D926 /* fa.po */,
B4118C9A153EFF3300C8D926 /* fr.po */,
B4118C9B153EFF3300C8D926 /* he.po */,
B4118C9C153EFF3300C8D926 /* hr.po */,
B4118C9D153EFF3300C8D926 /* hu.po */,
B4118C9E153EFF3300C8D926 /* id.po */,
B4118C9F153EFF3300C8D926 /* it.po */,
B4118CA0153EFF3300C8D926 /* ko.po */,
B4118CA1153EFF3300C8D926 /* mk.po */,
B4118CA2153EFF3300C8D926 /* nl.po */,
B4118CA3153EFF3300C8D926 /* pl.po */,
B4118CA4153EFF3300C8D926 /* pt-BR.po */,
B4118CA5153EFF3300C8D926 /* pt-PT.po */,
B4118CA6153EFF3300C8D926 /* ro.po */,
B4118CA7153EFF3300C8D926 /* ru.po */,
B4118CA8153EFF3300C8D926 /* sr.po */,
B4118CA9153EFF3300C8D926 /* zh_CN.po */,
B4118CAA153EFF3300C8D926 /* zh_TW.po */,
);
path = po;
sourceTree = "<group>";
};
B4189A0314BFBED900ED5B0B /* config */ = {
isa = PBXGroup;
children = (
name = lxdialog;
sourceTree = "<group>";
};
B4AABE5814C3B8B90055ECD1 /* AddOption */ = {
isa = PBXGroup;
children = (
B4AABE5914C3B8B90055ECD1 /* postinstall */,
);
name = AddOption;
path = Scripts.templates/AddOption;
sourceTree = "<group>";
};
B4AABE5A14C3B8C70055ECD1 /* InstallModule */ = {
isa = PBXGroup;
children = (
B4AABE5B14C3B8C70055ECD1 /* postinstall */,
);
name = InstallModule;
path = Scripts.templates/InstallModule;
sourceTree = "<group>";
};
B4AABE5C14C3B8D70055ECD1 /* InstallTheme */ = {
isa = PBXGroup;
children = (
B4AABE5D14C3B8D70055ECD1 /* postinstall */,
);
name = InstallTheme;
path = Scripts.templates/InstallTheme;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
vi,
zh_CN,
zh_TW,
fa,
);
mainGroup = 08FB7794FE84155DC02AAC07 /* Chameleon */;
projectDirPath = "";
};
/* End PBXProject section */
/* Begin PBXVariantGroup section */
667B35F01A5EF2B400FD5ED9 /* Conclusion.rtfd */ = {
isa = PBXVariantGroup;
children = (
667B35F11A5EF2B400FD5ED9 /* ar */,
667B35F41A5EF2B400FD5ED9 /* bg */,
667B35F61A5EF2B400FD5ED9 /* bs */,
667B35F81A5EF2B400FD5ED9 /* ca */,
667B35FC1A5EF2B400FD5ED9 /* cs */,
667B35FE1A5EF2B400FD5ED9 /* de */,
667B36021A5EF2B400FD5ED9 /* el */,
667B36041A5EF2B400FD5ED9 /* en */,
667B36061A5EF2B400FD5ED9 /* es */,
667B36081A5EF2B400FD5ED9 /* fa */,
667B360A1A5EF2B400FD5ED9 /* fr */,
667B360C1A5EF2B400FD5ED9 /* he */,
667B360E1A5EF2B400FD5ED9 /* hr */,
667B36101A5EF2B400FD5ED9 /* hu */,
667B36121A5EF2B400FD5ED9 /* id */,
667B36141A5EF2B400FD5ED9 /* it */,
667B36161A5EF2B400FD5ED9 /* ja */,
667B36181A5EF2B400FD5ED9 /* ko */,
667B361A1A5EF2B400FD5ED9 /* mk */,
667B361C1A5EF2B400FD5ED9 /* nl */,
667B361E1A5EF2B400FD5ED9 /* pl */,
667B36201A5EF2B400FD5ED9 /* pt-BR */,
667B36221A5EF2B400FD5ED9 /* pt-PT */,
667B36241A5EF2B400FD5ED9 /* ro */,
667B36261A5EF2B400FD5ED9 /* ru */,
667B36281A5EF2B400FD5ED9 /* sr */,
667B362F1A5EF2B400FD5ED9 /* zh_CN */,
667B36311A5EF2B400FD5ED9 /* zh_TW */,
);
name = Conclusion.rtfd;
sourceTree = "<group>";
};
667B35F21A5EF2B400FD5ED9 /* Welcome.rtfd */ = {
isa = PBXVariantGroup;
children = (
667B35F31A5EF2B400FD5ED9 /* ar */,
667B35F51A5EF2B400FD5ED9 /* bg */,
667B35F71A5EF2B400FD5ED9 /* bs */,
667B35F91A5EF2B400FD5ED9 /* ca */,
667B35FD1A5EF2B400FD5ED9 /* cs */,
667B35FF1A5EF2B400FD5ED9 /* de */,
667B36031A5EF2B400FD5ED9 /* el */,
667B36051A5EF2B400FD5ED9 /* en */,
667B36071A5EF2B400FD5ED9 /* es */,
667B36091A5EF2B400FD5ED9 /* fa */,
667B360B1A5EF2B400FD5ED9 /* fr */,
667B360D1A5EF2B400FD5ED9 /* he */,
667B360F1A5EF2B400FD5ED9 /* hr */,
667B36111A5EF2B400FD5ED9 /* hu */,
667B36131A5EF2B400FD5ED9 /* id */,
667B36151A5EF2B400FD5ED9 /* it */,
667B36171A5EF2B400FD5ED9 /* ja */,
667B36191A5EF2B400FD5ED9 /* ko */,
667B361B1A5EF2B400FD5ED9 /* mk */,
667B361D1A5EF2B400FD5ED9 /* nl */,
667B361F1A5EF2B400FD5ED9 /* pl */,
667B36211A5EF2B400FD5ED9 /* pt-BR */,
667B36231A5EF2B400FD5ED9 /* pt-PT */,
667B36251A5EF2B400FD5ED9 /* ro */,
667B36271A5EF2B400FD5ED9 /* ru */,
667B36291A5EF2B400FD5ED9 /* sr */,
667B36301A5EF2B400FD5ED9 /* zh_CN */,
667B36321A5EF2B400FD5ED9 /* zh_TW */,
);
name = Welcome.rtfd;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1DEB919008733D9F0010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = NO;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
1DEB919108733D9F0010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = YES;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "";
1DEB919408733D9F0010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
1DEB919508733D9F0010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx;
};
branches/Bungo/i386/libsaio/console.c
6969
7070
7171
72
73
74
75
76
77
78
72
73
74
75
76
77
78
7979
8080
8181
......
100100
101101
102102
103
104
105
103
104
105
106106
107
108
109
110
111
112
113
114
107
108
109
110
111
112
113
114
115115
116
116
117117
118
119
120
121
122
123
118
119
120
121
122
123
124124
125125
126126
......
129129
130130
131131
132
133
132
133
134134
135135
136136
......
138138
139139
140140
141
141
142
142143
143144
144145
145
146
147
146148
147149
148150
......
152154
153155
154156
155
156
157
158
157159
158160
159161
160162
161
163
164
162165
163166
164167
......
215218
216219
217220
218
221
219222
220223
221224
......
299302
300303
301304
302
303
305
306
304307
305308
306309
307
308
310
311
309312
310313
311314
312
313
315
316
314317
315
316
317
318
318
319
320
321
319322
320323
321324
......
344347
345348
346349
347
348
350
351
349352
350
353
354
351355
352
356
357
358
353359
354360
355361
356362
357
363
358364
359
365
360366
// Bungo:
typedef struct {
uint16_t year;
uint8_t mon;
uint8_t day;
uint8_t hour;
uint8_t mins;
uint8_t secs;
uint8_t dlight;
uint16_t year;
uint8_t mon;
uint8_t day;
uint8_t hour;
uint8_t mins;
uint8_t secs;
uint8_t dlight;
} datetime_t;
static datetime_t datetime;
uint64_t getRTCdatetime() // 0xYYYYMMDDHHMMSS0L in decimal
{
biosBuf_t bb;
bb.intno = 0x1a;
biosBuf_t bb;
bb.intno = 0x1a;
bb.eax.r.h = 0x04; // get RTC date
//bb.flags.cf = 0;
bios(&bb);
if (bb.flags.cf) return 0;
datetime.year = (bb.ecx.r.h >> 4) * 1000 + (bb.ecx.r.h & 0x0F) * 100 + (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1;
datetime.mon = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1;
datetime.day = (bb.edx.r.l >> 4) * 10 + (bb.edx.r.l & 0x0F) * 1;
bb.intno = 0x1a;
//bb.flags.cf = 0;
bios(&bb);
if (bb.flags.cf) return 0;
datetime.year = (bb.ecx.r.h >> 4) * 1000 + (bb.ecx.r.h & 0x0F) * 100 + (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1;
datetime.mon = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1;
datetime.day = (bb.edx.r.l >> 4) * 10 + (bb.edx.r.l & 0x0F) * 1;
bb.intno = 0x1a;
bb.eax.r.h = 0x02; // get RTC time
//bb.flags.cf = 0;
//bb.flags.cf = 0;
bios(&bb);
if (bb.flags.cf) return 0;
datetime.dlight = bb.edx.r.l & 0x0F;
datetime.hour = (bb.ecx.r.h >> 4) * 10 + (bb.ecx.r.h & 0x0F) * 1;
datetime.mins = (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1;
datetime.secs = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1;
return *(uint64_t *)&datetime;
if (bb.flags.cf) return 0;
datetime.dlight = bb.edx.r.l & 0x0F;
datetime.hour = (bb.ecx.r.h >> 4) * 10 + (bb.ecx.r.h & 0x0F) * 1;
datetime.mins = (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1;
datetime.secs = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1;
return *(uint64_t *)&datetime;
}
void initBooterLog(void)
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
verbose("%s\n", "Chameleon v" I386BOOT_CHAMELEONVERSION " (Bungo branch) r" I386BOOT_CHAMELEONREVISION " [" I386BOOT_BUILDDATE "]");
getRTCdatetime();
verbose("Logging started: %04d/%02d/%02d, %02d:%02d:%02d (+/- offset)\n", datetime.year, datetime.mon, datetime.day, datetime.hour, datetime.mins, datetime.secs);
getRTCdatetime();
verbose("Logging started: %04d/%02d/%02d, %02d:%02d:%02d (+/- offset)\n", datetime.year, datetime.mon, datetime.day, datetime.hour, datetime.mins, datetime.secs);
}
int msglog(const char * fmt, ...)
va_list ap;
struct putc_info pi;
if (!msgbuf) {
if (!msgbuf)
{
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) {
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
{
return 0;
}
prf(fmt, ap, sputc, &pi);
va_end(ap);
cursor += strlen((char *)cursor);
return 0;
return 0;
}
void setupBooterLog(void)
{
if (!msgbuf) {
if (!msgbuf)
{
return;
}
int printf(const char * fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
vprf(fmt, ap);
}
// Kabyl: BooterLog
struct putc_info pi;
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf)
{
return 0;
}
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
{
return 0;
}
return 0;
}
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
va_end(ap);
return(0);
/** Print user message and a "Press a key to continue..." message and wait for a key press. */
void pause(const char * fmt, ...) // replace getchar() by pause() were useful.
{
va_list ap;
va_list ap;
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
prf(fmt, ap, putchar, 0);
} else {
}
else
{
vprf(fmt, ap);
}
va_end(ap);
printf("Press a key to continue...");
printf("Press a key to continue...");
getchar();
printf("\n");
printf("\n");
}
branches/Bungo/i386/libsaio/exfat.c
4848
4949
5050
51
5251
53
54
52
5553
5654
5755
......
240238
241239
242240
243
241
244242
245243
246244
......
870868
871869
872870
873
871
874872
875873
876874
......
888886
889887
890888
891
889
892890
893891
894892
......
927925
928926
929927
930
928
931929
932930
933931
......
957955
958956
959957
960
958
959
960
961961
962962
963963
......
967967
968968
969969
970
971
970
971
972
973
972974
973975
974976
......
979981
980982
981983
982
983
984
985
984
985
986
987
986988
987
988
989
990
991
992
993
994
989
990
991
992
993
994
995
996
995997
996
998
997999
998
999
1000
1001
1000
1001
1002
1003
10021004
1003
1005
10041006
10051007
1006
1008
10071009
10081010
10091011
1010
1012
10111013
10121014
1013
1015
10141016
10151017
10161018
10171019
1018
1019
1020
1021
10201022
10211023
10221024
10231025
1024
1026
10251027
1026
1028
10271029
1028
1029
1030
1031
10301032
1031
1032
1033
1034
10331035
1034
1036
10351037
1036
1038
10371039
1038
1040
10391041
#if DEBUG_EXFAT
#define DBG(x...)printf(x)
#define PAUSE()getchar()
#else
#define DBG(x...)
#define PAUSE()
#define DBG(x...)msglog(x)
#endif
#defineEXFAT_BBID&gExfatID[0]
}
if (invalidate)
{
gCachedFATBlockAddress = INVALID_FAT_ADDRESS;
gCachedFATBlockAddress = INVALID_FAT_ADDRESS;
}
return 0;
}
int loopControl = 0;
DBG("EXFAT: start %x:%x\n", ih->biosdev, ih->part_no);
buf = (char *)malloc(MAX_BLOCK_SIZE);
if (buf == 0)
{
// take our boot structure
boot = (struct exfatbootfile *) buf;
/*
* The first three bytes are an Intel x86 jump instruction. I assume it
* can be the same forms as DOS FAT:
DBG("EXFAT: invalid sectors per cluster shift (%d)\n", spcs);
goto error;
}
// calculate root dir cluster offset
rdirOffset = OSSwapLittleToHostInt32(boot->bf_cloff) + ((long long) (OSSwapLittleToHostInt32(boot->bf_rdircl) - 2) << spcs);
DBG("EXFAT: rdirOffset=%d\n", (int) rdirOffset);
DBG("EXFAT: label=%s\n", str);
free(buf);
PAUSE();
#if DEBUG_EXFAT
pause("\n[DEBUG_EXFAT] ");
#endif
return;
error:
}
DBG("EXFAT: error\n");
PAUSE();
return;
#if DEBUG_EXFAT
pause("\n[DEBUG_EXFAT] ");
#endif
return;
}
/**
long EXFATGetUUID(CICell ih, char *uuidStr)
{
uint32_t volsn;
struct exfatbootfile *boot;
void *buf = malloc(MAX_BLOCK_SIZE);
if ( !buf )
return -1;
struct exfatbootfile *boot;
void *buf = malloc(MAX_BLOCK_SIZE);
if ( !buf )
return -1;
/*
* Read the boot sector, check signatures, and do some minimal
* sanity checking. NOTE: the size of the read below is intended
* to be a multiple of all supported block sizes, so we don't
* have to determine or change the device's block size.
*/
Seek(ih, 0);
Read(ih, (long)buf, MAX_BLOCK_SIZE);
/*
* Read the boot sector, check signatures, and do some minimal
* sanity checking. NOTE: the size of the read below is intended
* to be a multiple of all supported block sizes, so we don't
* have to determine or change the device's block size.
*/
Seek(ih, 0);
Read(ih, (long)buf, MAX_BLOCK_SIZE);
boot = (struct exfatbootfile *) buf;
boot = (struct exfatbootfile *) buf;
/*
* Check the "EXFAT " signature.
*/
if (memcmp((const char *)boot->bf_sysid, EXFAT_BBID, EXFAT_BBIDLEN) != 0)
/*
* Check the "EXFAT " signature.
*/
if (memcmp((const char *)boot->bf_sysid, EXFAT_BBID, EXFAT_BBIDLEN) != 0)
{
return -1;
return -1;
}
// Check for non-null volume serial number
// Check for non-null volume serial number
volsn = OSSwapLittleToHostInt32(boot->bf_volsn);
if( !volsn )
{
return -1;
return -1;
}
// Use UUID like the one you get on Windows
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X", (unsigned short)(volsn >> 16) & 0xFFFF,
(unsigned short)volsn & 0xFFFF);
DBG("EXFATGetUUID: %x:%x = %s\n", ih->biosdev, ih->part_no, uuidStr);
return 0;
}
return 0;
}
/**
* Returns true if given buffer is the boot rec of the EXFAT volume.
*/
bool EXFATProbe(const void *buffer)
bool EXFATProbe(const void * buffer)
{
bool result = false;
bool result = false;
// boot sector structure
const struct exfatbootfile*boot = buffer;
// boot sector structure
const struct exfatbootfile* boot = buffer;
// Looking for EXFAT signature.
if (memcmp((const char *)boot->bf_sysid, EXFAT_BBID, EXFAT_BBIDLEN) == 0)
// Looking for EXFAT signature.
if (memcmp((const char *)boot->bf_sysid, EXFAT_BBID, EXFAT_BBIDLEN) == 0)
{
result = true;
result = true;
}
DBG("EXFATProbe: %d\n", result ? 1 : 0);
return result;
return result;
}
branches/Bungo/i386/libsaio/bootstruct.c
4545
4646
4747
48
48
4949
5050
51
51
5252
5353
5454
......
8383
8484
8585
86
87
88
86
87
88
8989
90
91
92
93
94
90
91
92
93
94
9595
9696
97
97
9898
9999
100100
101
101
102102
103103
104104
......
144144
145145
146146
147
147
148148
149149
150150
......
154154
155155
156156
157
158
159
160
161
157
158
159
160
161
162162
163163
164164
......
184184
185185
186186
187
188
189
190
187
188
189
190
191191
192192
193193
......
224224
225225
226226
227
227
228228
229229
230230
* the kernel by the booter.
*/
boot_args*bootArgs;
boot_args*bootArgs;
boot_args_pre_lion*bootArgsPreLion;
PrivateBootInfo_t*bootInfo;
Node*gMemoryMapNode;
Node*gMemoryMapNode;
static char platformName[64];
// BIOS did not provide a memory map, systems with
// discontiguous memory or unusual memory hole locations
// may have problems.
bootInfo->convmem = getConventionalMemorySize();
bootInfo->extmem = getExtendedMemorySize();
bootInfo->convmem= getConventionalMemorySize();
bootInfo->extmem= getExtendedMemorySize();
}
bootInfo->configEnd = bootInfo->config;
bootArgs->Video.v_display = VGA_TEXT_MODE;
// DeviceTree init
bootInfo->configEnd= bootInfo->config;
bootArgs->Video.v_display= VGA_TEXT_MODE;
// DeviceTree init
//DT__Initialize();
//node = DT__FindNode("/", true);
node = DT__Initialize();
node = DT__Initialize();
if (node == 0) {
stop("Couldn't create root node");
}
getPlatformName(platformName);
nameLen = strlen(platformName) + 1;
DT__AddProperty(node, "compatible", nameLen, platformName);
EfiMemoryRange *memoryMap;
MemoryRange *range;
int memoryMapCount = bootInfo->memoryMapCount;
if (memoryMapCount == 0)
{
// XXX could make a two-part map here
// convert memory map to boot_args memory map
memoryMap = (EfiMemoryRange *)AllocateKernelMemory(sizeof(EfiMemoryRange) * memoryMapCount);
bootArgs->MemoryMap = (uint32_t)memoryMap;
bootArgs->MemoryMapSize = sizeof(EfiMemoryRange) * memoryMapCount;
bootArgs->MemoryMapDescriptorSize = sizeof(EfiMemoryRange);
bootArgs->MemoryMapDescriptorVersion = 0;
bootArgs->MemoryMap= (uint32_t)memoryMap;
bootArgs->MemoryMapSize= sizeof(EfiMemoryRange) * memoryMapCount;
bootArgs->MemoryMapDescriptorSize= sizeof(EfiMemoryRange);
bootArgs->MemoryMapDescriptorVersion= 0;
for (i = 0; i < memoryMapCount; i++, memoryMap++)
{
range = &bootInfo->memoryMap[i];
break;
}
memoryMap->PhysicalStart = range->base;
memoryMap->VirtualStart = range->base;
memoryMap->NumberOfPages = range->length >> I386_PGSHIFT;
memoryMap->Attribute = 0;
memoryMap->PhysicalStart= range->base;
memoryMap->VirtualStart= range->base;
memoryMap->NumberOfPages= range->length >> I386_PGSHIFT;
memoryMap->Attribute= 0;
}
// copy bootFile into device tree
bootArgsPreLion->kaddr = bootArgs->kaddr;
bootArgsPreLion->ksize = bootArgs->ksize;
bootArgsPreLion->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart;
bootArgsPreLion->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount;
bootArgsPreLion->efiSystemTable = bootArgs->efiSystemTable;
branches/Bungo/i386/libsaio/ntfs_private.h
7474
7575
7676
77
78
79
80
81
77
78
79
80
8281
8382
8483
......
108107
109108
110109
111
112
113
110
111
112
114113
115
116
117
118
114
115
116
117
119118
120119
121120
......
140139
141140
142141
143
142
144143
145144
146145
......
150149
151150
152151
153
154
155
156
152
153
154
155
157156
158
157
159158
160159
161
160
162161
163162
164163
......
179178
180179
181180
182
181
183182
184183
185184
......
221220
222221
223222
224
223
225224
226225
227226
......
244243
245244
246245
247
248
246
247
249248
250249
251250
......
257256
258257
259258
260
259
261260
262261
263262
......
270269
271270
272271
273
272
274273
275274
276
277
275
276
278277
279278
280279
281280
282
283
281
282
284283
285
284
286285
287
286
288287
289288
290289
......
303302
304303
305304
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
321320
322321
323322
324323
325324
326
325
327326
328327
329
330
328
329
331330
332331
333332
334333
335334
336335
337
338
339
340
341
342
343
344
345
336
337
338
339
340
341
342
343
344
346345
347
346
348347
349
348
350349
351350
352351
typedef u_int16_t wchar;
#pragma pack(1)
#define BBSIZE 1024
#defineBBOFF ((off_t)(0))
#defineBBLOCK ((daddr_t)(0))
#defineNTFS_MFTINO 0
#define BBSIZE1024
#defineBBOFF((off_t)(0))
#defineBBLOCK((daddr_t)(0))
#defineNTFS_MFTINO0
#defineNTFS_VOLUMEINO3
#defineNTFS_ATTRDEFINO4
#defineNTFS_ROOTINO5
u_int16_t a_index;
};
#define NTFS_A_STD 0x10
#define NTFS_A_ATTRLIST 0x20
#define NTFS_A_NAME 0x30
#define NTFS_A_STD0x10
#define NTFS_A_ATTRLIST0x20
#define NTFS_A_NAME0x30
#define NTFS_A_VOLUMENAME0x60
#define NTFS_A_DATA 0x80
#defineNTFS_A_INDXROOT 0x90
#defineNTFS_A_INDX 0xA0
#define NTFS_A_INDXBITMAP 0xB0
#define NTFS_A_DATA0x80
#defineNTFS_A_INDXROOT0x90
#defineNTFS_A_INDX0xA0
#define NTFS_A_INDXBITMAP0xB0
#define NTFS_MAXATTRNAME255
} a_S_nr;
} a_S;
};
#define a_r a_S.a_S_r
#define a_ra_S.a_S_r
#define a_nra_S.a_S_nr
typedef struct {
u_int64_t t_access;
} ntfs_times_t;
#define NTFS_FFLAG_RDONLY 0x01LL
#define NTFS_FFLAG_HIDDEN 0x02LL
#define NTFS_FFLAG_SYSTEM 0x04LL
#define NTFS_FFLAG_ARCHIVE 0x20LL
#define NTFS_FFLAG_RDONLY0x01LL
#define NTFS_FFLAG_HIDDEN0x02LL
#define NTFS_FFLAG_SYSTEM0x04LL
#define NTFS_FFLAG_ARCHIVE0x20LL
#define NTFS_FFLAG_COMPRESSED0x0800LL
#define NTFS_FFLAG_DIR 0x10000000LL
#define NTFS_FFLAG_DIR0x10000000LL
struct attr_name {
u_int32_t n_pnumber;/* Parent ntnode */
u_int32_tn_pnumber;/* Parent ntnode */
u_int32_t reserved;
ntfs_times_t n_times;
u_int64_t n_size;
u_int32_t ir_datalen;/* (total size of index enties?) sizeof something */
u_int32_t ir_allocated;/* (allocated size of index entries?) */
u_int8_t ir_flag;/* 1=index allocation needed (large index) */
u_int8_t ir_pad1;/* padding */
u_int8_tir_pad1;/* padding */
u_int16_t ir_pad2;/* padding */
};
u_int64_t ie_fallocated;
u_int64_t ie_fsize;
u_int32_t ie_fflag;
u_int32_t unknown3;/* used by reparse points and external attributes? */
u_int32_tunknown3;/* used by reparse points and external attributes? */
u_int8_t ie_fnamelen;
u_int8_t ie_fnametype;
wchar ie_fname[NTFS_MAXFILENAME];
};
#defineNTFS_ATTRNAME_MAXLEN0x40
#defineNTFS_ADFLAG_NONRES 0x0080/* Attrib can be non resident */
#defineNTFS_ADFLAG_INDEX 0x0002/* Attrib can be indexed */
#defineNTFS_ADFLAG_NONRES0x0080/* Attrib can be non resident */
#defineNTFS_ADFLAG_INDEX0x0002/* Attrib can be indexed */
struct attrdef {
wcharad_name[NTFS_ATTRNAME_MAXLEN];
u_int32_tad_type;
struct ntvattrdef {
charad_name[0x40];
int ad_namelen;
intad_namelen;
u_int32_tad_type;
};
u_int8_t bf_spc;/* sectors per cluster */
u_int8_t reserved2[7];/* unused (zeroed) */
u_int8_t bf_media;/* media desc. (0xF8) */
u_int8_t reserved3[2]; /* always 0 */
u_int8_t reserved3[2];/* always 0 */
u_int16_t bf_spt;/* sectors per track */
u_int16_t bf_heads;/* number of heads */
u_int32_t bf_hidsecs; /* hidden sectors */
u_int8_t reserver4[8]; /* not used by NTFS (0x00000000) */
u_int32_t bf_hidsecs;/* hidden sectors */
u_int8_t reserver4[8];/* not used by NTFS (0x00000000) */
u_int64_t bf_spv;/* sectors per volume (total) */
cn_t bf_mftcn;/* $MFT cluster number */
cn_t bf_mftmirrcn;/* $MFTMirr cn */
u_int8_t bf_mftrecsz;/* MFT record size (clust) */
/* 0xF6 inducates 1/4 */
u_int8_t reserved5[3];
/* 0xF6 inducates 1/4 */
u_int8_t reserved5[3];
u_int8_t bf_ibsz;/* index buffer size */
u_int8_t reserved6[3]; /* not used by NTFS (0x000000) */
u_int8_t reserved6[3];/* not used by NTFS (0x000000) */
u_int64_t bf_volsn;/* volume ser. num. */
u_int32_t bf_crc32; /* checksum */
u_int32_t bf_crc32;/* checksum */
};
/*
#defineNTFS_SYSNODESNUM0x0B
struct ntfsmount {
struct mount *ntm_mountp;/* filesystem vfs structure */
struct bootfile ntm_bootfile;
dev_t ntm_dev;/* device mounted */
struct vnode *ntm_devvp;/* block device mounted vnode */
struct vnode *ntm_sysvn[NTFS_SYSNODESNUM];
u_int32_t ntm_bpmftrec;
uid_t ntm_uid;
gid_t ntm_gid;
mode_t ntm_mode;
u_long ntm_flag;
cn_t ntm_cfree;
struct ntvattrdef *ntm_ad;/* attribute names are stored in native byte order */
int ntm_adnum;
wchar * ntm_82u;/* 8bit to Unicode */
char ** ntm_u28;/* Unicode to 8 bit */
struct mount *ntm_mountp;/* filesystem vfs structure */
struct bootfile ntm_bootfile;
dev_t ntm_dev;/* device mounted */
struct vnode *ntm_devvp;/* block device mounted vnode */
struct vnode *ntm_sysvn[NTFS_SYSNODESNUM];
u_int32_t ntm_bpmftrec;
uid_t ntm_uid;
gid_t ntm_gid;
mode_t ntm_mode;
u_long ntm_flag;
cn_tntm_cfree;
struct ntvattrdef *ntm_ad;/* attribute names are stored in native byte order */
intntm_adnum;
wchar *ntm_82u;/* 8bit to Unicode */
char **ntm_u28;/* Unicode to 8 bit */
#ifdef APPLE
struct netexport ntm_export;/* NFS export information */
#endif
};
#define ntm_mftcn ntm_bootfile.bf_mftcn
#define ntm_mftcnntm_bootfile.bf_mftcn
#define ntm_mftmirrcnntm_bootfile.bf_mftmirrcn
#definentm_mftrecszntm_bootfile.bf_mftrecsz
#definentm_spc ntm_bootfile.bf_spc
#definentm_bps ntm_bootfile.bf_bps
#definentm_spcntm_bootfile.bf_spc
#definentm_bpsntm_bootfile.bf_bps
#pragma pack()
#defineNTFS_NEXTREC(s, type) ((type)(((caddr_t) s) + le16toh((s)->reclen)))
/* Convert mount ptr to ntfsmount ptr. */
#define VFSTONTFS(mp) ((struct ntfsmount *)((mp)->mnt_data))
#define VTONT(v) FTONT(VTOF(v))
#defineVTOF(v) ((struct fnode *)((v)->v_data))
#defineFTOV(f) ((f)->f_vp)
#defineFTONT(f) ((f)->f_ip)
#define ntfs_cntobn(cn) ((daddr_t)(cn) * (ntmp->ntm_spc))
#define ntfs_cntob(cn) ((off_t)(cn) * (ntmp)->ntm_spc * (ntmp)->ntm_bps)
#define ntfs_btocn(off) (cn_t)((off) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))
#define ntfs_btocl(off) (cn_t)((off + ntfs_cntob(1) - 1) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))
#define VFSTONTFS(mp)((struct ntfsmount *)((mp)->mnt_data))
#define VTONT(v)FTONT(VTOF(v))
#defineVTOF(v)((struct fnode *)((v)->v_data))
#defineFTOV(f)((f)->f_vp)
#defineFTONT(f)((f)->f_ip)
#define ntfs_cntobn(cn)((daddr_t)(cn) * (ntmp->ntm_spc))
#define ntfs_cntob(cn)((off_t)(cn) * (ntmp)->ntm_spc * (ntmp)->ntm_bps)
#define ntfs_btocn(off)(cn_t)((off) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))
#define ntfs_btocl(off)(cn_t)((off + ntfs_cntob(1) - 1) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))
#define ntfs_btocnoff(off)(off_t)((off) % ((ntmp)->ntm_spc * (ntmp)->ntm_bps))
#define ntfs_bntob(bn) (daddr_t)((bn) * (ntmp)->ntm_bps)
#define ntfs_bntob(bn)(daddr_t)((bn) * (ntmp)->ntm_bps)
#definentfs_bpbl (daddr_t)((ntmp)->ntm_bps)
#definentfs_bpbl(daddr_t)((ntmp)->ntm_bps)
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_NTFSMNT);
branches/Bungo/i386/libsaio/ext2fs.c
3737
3838
3939
40
40
4141
4242
4343
}
str[strMaxLen]=0;
strncpy (str, buf+0x478, MIN(strMaxLen, 16));
//verbose("EXT2: label=%s\n", str);
//verbose("EXT2: label=%s\n", str);
free (buf);
}
branches/Bungo/i386/libsaio/vbe.c
268268
269269
270270
271
272
273
271
272
273
274274
275275
276
277
278
279
280
276
277
278
279
280
281281
282282
283283
284284
285285
286286
287
288
289
290
291
292
293
294
295
287
288
289
290
291
292
293
294
295
296296
297297
298298
299299
300300
301301
302
303
304
305
306
307
308
309
310
302
303
304
305
306
307
308
309
310
311311
312312
313313
314314
315315
316316
317
318
319
320
321
317
318
319
320
321
322322
323323
324324
325325
326326
327327
328
329
330
331
332
333
334
335
328
329
330
331
332
333
334
335
336336
337337
338338
339339
340340
341341
342
343
344
342
343
344
345345
346
347
348
349
350
346
347
348
349
350
351351
uint8_t setVBEMode(unsigned short mode, const VBECRTCInfoBlock * timing)
{
bb.intno = 0x10;
bb.eax.rr = funcSetMode;
bb.ebx.rr = mode;
bb.intno = 0x10;
bb.eax.rr = funcSetMode;
bb.ebx.rr = mode;
if (timing)
{
bb.es = SEG(timing);
bb.edi.rr = OFF(timing);
}
bios(&bb);
return(bb.eax.r.h);
bb.es = SEG(timing);
bb.edi.rr = OFF(timing);
}
bios(&bb);
return(bb.eax.r.h);
}
//==============================================================================
uint8_t setVBEPalette(void *palette)
{
bb.intno = 0x10;
bb.eax.rr = funcGetSetPaletteData;
bb.ebx.r.l = subfuncSet;
bb.ecx.rr = 256;
bb.edx.rr = 0;
bb.es = SEG(palette);
bb.edi.rr = OFF(palette);
bios(&bb);
return(bb.eax.r.h);
bb.intno = 0x10;
bb.eax.rr = funcGetSetPaletteData;
bb.ebx.r.l = subfuncSet;
bb.ecx.rr = 256;
bb.edx.rr = 0;
bb.es = SEG(palette);
bb.edi.rr = OFF(palette);
bios(&bb);
return(bb.eax.r.h);
}
//==============================================================================
uint8_t getVBEPalette(void *palette)
{
bb.intno = 0x10;
bb.eax.rr = funcGetSetPaletteData;
bb.ebx.r.l = subfuncGet;
bb.ecx.rr = 256;
bb.edx.rr = 0;
bb.es = SEG(palette);
bb.edi.rr = OFF(palette);
bios(&bb);
return(bb.eax.r.h);
bb.intno = 0x10;
bb.eax.rr = funcGetSetPaletteData;
bb.ebx.r.l = subfuncGet;
bb.ecx.rr = 256;
bb.edx.rr = 0;
bb.es = SEG(palette);
bb.edi.rr = OFF(palette);
bios(&bb);
return(bb.eax.r.h);
}
//==============================================================================
uint8_t getVBECurrentMode(unsigned short *mode)
{
bb.intno = 0x10;
bb.eax.rr = funcGetCurrentMode;
bios(&bb);
*mode = bb.ebx.rr;
return(bb.eax.r.h);
bb.intno = 0x10;
bb.eax.rr = funcGetCurrentMode;
bios(&bb);
*mode = bb.ebx.rr;
return(bb.eax.r.h);
}
//==============================================================================
uint8_t getVBEPixelClock(unsigned short mode, unsigned long * pixelClock)
{
bb.intno = 0x10;
bb.eax.rr = funcGetSetPixelClock;
bb.ebx.r.l = 0;
bb.ecx.rx = *pixelClock;
bb.edx.rr = mode;
bios(&bb);
*pixelClock = bb.ecx.rx;
return(bb.eax.r.h);
bb.intno = 0x10;
bb.eax.rr = funcGetSetPixelClock;
bb.ebx.r.l = 0;
bb.ecx.rx = *pixelClock;
bb.edx.rr = mode;
bios(&bb);
*pixelClock = bb.ecx.rx;
return(bb.eax.r.h);
}
//==============================================================================
uint8_t getVBEEDID(void *edidBlock)
{
bzero(&bb, sizeof(bb));
bb.intno = 0x10;
bb.eax.rr = 0x4F15;
bzero(&bb, sizeof(bb));
bb.intno = 0x10;
bb.eax.rr = 0x4F15;
bb.ebx.r.l = 0x01;
//bb.edx.rr = 0x01;
bb.es = SEG(edidBlock);
bb.edi.rr = OFF(edidBlock);
bios(&bb);
return(bb.eax.r.h);
//bb.edx.rr = 0x01;
bb.es = SEG(edidBlock);
bb.edi.rr = OFF(edidBlock);
bios(&bb);
return(bb.eax.r.h);
}
branches/Bungo/i386/libsaio/bootstruct.h
4747
4848
4949
50
50
5151
5252
5353
......
7474
7575
7676
77
78
79
80
77
78
79
80
81
82
8183
8284
8385
......
9092
9193
9294
93
94
95
96
97
95
96
97
98
99
100
98101
99102
100103
/*
* Maximum number of boot drivers that can be loaded.
*/
#define NDRIVERS 500
#define NDRIVERS500
#define CONFIG_SIZE (40 * 4096)
unsigned char BIOSPresent;
} PCI_bus_info_t;
typedef struct {
unsigned long address; // address where driver was loaded
unsigned long size; // number of bytes
unsigned long type; // driver type
typedef struct
{
unsigned long address;// address where driver was loaded
unsigned long size;// number of bytes
unsigned long type;// driver type
} driver_config_t;
/*
/*
* ACPI defined memory range types.
*/
enum {
kMemoryRangeUsable = 1, // RAM usable by the OS.
kMemoryRangeReserved = 2, // Reserved. (Do not use)
kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed.
kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use)
enum
{
kMemoryRangeUsable= 1,// RAM usable by the OS.
kMemoryRangeReserved= 2,// Reserved. (Do not use)
kMemoryRangeACPI= 3,// ACPI tables. Can be reclaimed.
kMemoryRangeNVS= 4,// ACPI NVS memory. (Do not use)
/* Undefined types should be treated as kMemoryRangeReserved */
};
branches/Bungo/i386/libsaio/device_tree.c
8282
8383
8484
85
86
85
8786
8887
8988
......
143142
144143
145144
146
147
145
148146
149147
150148
......
206204
207205
208206
209
210
207
211208
212209
213210
......
215212
216213
217214
218
219
215
220216
221217
222218
......
224220
225221
226222
227
228
223
229224
230
231
232
233
234
235
236
237
238
239
240
241
242
243
225
226
227
228
229
230
231
232
233
234
235
236
237
238
244239
245240
246241
247242
248
249
243
250244
251
245
252246
253247
254248
255249
256250
257251
258
259
252
260253
261254
262255
......
265258
266259
267260
268
261
269262
270263
271264
......
289282
290283
291284
292
293
285
294286
295287
296288
297289
298290
299291
300
292
293
301294
302295
303296
......
334327
335328
336329
337
338
330
339331
340332
341333
......
343335
344336
345337
346
338
339
347340
348341
349342
......
387380
388381
389382
390
391
383
392384
393385
394386
......
409401
410402
411403
412
413
404
414405
415406
416407
......
427418
428419
429420
430
431
421
432422
433423
434424
......
456446
457447
458448
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
488478
489479
490480
......
495485
496486
497487
498
499
488
500489
501490
502491
......
533522
534523
535524
536
537
525
538526
539527
540528
......
548536
549537
550538
551
552
539
553540
554541
555542
......
557544
558545
559546
560
561
547
562548
563549
564550
......
589575
590576
591577
592
593
578
594579
595580
596581
......
611596
612597
613598
614
615
599
616600
617601
618602
619603
620604
621605
622
623
606
624607
625608
626609
//==============================================================================
Property *
DT__AddProperty(Node *node, const char *name, uint32_t length, void *value)
Property *DT__AddProperty(Node *node, const char *name, uint32_t length, void *value)
{
Property *prop;
//==============================================================================
Node *
DT__AddChild(Node *parent, const char *name)
Node *DT__AddChild(Node *parent, const char *name)
{
Node *node;
//==============================================================================
void
DT__FreeProperty(Property *prop)
void DT__FreeProperty(Property *prop)
{
prop->next = freeProperties;
freeProperties = prop;
//==============================================================================
void
DT__FreeNode(Node *node)
void DT__FreeNode(Node *node)
{
node->next = freeNodes;
freeNodes = node;
//==============================================================================
Node *
DT__Initialize(void)
Node *DT__Initialize(void)
{
//DPRINTF("DT__Initialize\n");
freeNodes = 0;
allocedNodes = 0;
freeProperties = 0;
allocedProperties = 0;
DTInfo.numNodes = 0;
DTInfo.numProperties = 0;
DTInfo.totalPropertySize = 0;
rootNode = DT__AddChild(NULL, "/");
DPRINTF("DT__Initialize: done\n");
return rootNode;
//DPRINTF("DT__Initialize\n");
freeNodes = 0;
allocedNodes = 0;
freeProperties = 0;
allocedProperties = 0;
DTInfo.numNodes = 0;
DTInfo.numProperties = 0;
DTInfo.totalPropertySize = 0;
rootNode = DT__AddChild(NULL, "/");
DPRINTF("DT__Initialize: done\n");
return rootNode;
}
//==============================================================================
Node *
DT__GetRootNode(void)
Node *DT__GetRootNode(void)
{
return rootNode;
return rootNode;
}
//==============================================================================
/*
* Free up memory used by in-memory representation of device tree.
*/
void
DT__Finalize(void)
void DT__Finalize(void)
{
Node *node;
Property *prop;
for (prop = allocedProperties; prop != NULL; prop = prop->next)
{
free((void *)(prop->name));
free((void *)(prop->name));
free(prop->value);
}
//==============================================================================
static void *
FlattenNodes(Node *node, void *buffer)
static void *FlattenNodes(Node *node, void *buffer)
{
Property *prop;
DeviceTreeNode *flatNode;
DeviceTreeNodeProperty *flatProp;
int count;
if (node == 0) {
if (node == 0)
{
return buffer;
}
* To use your own buffer, call with *result = &buffer.
*/
void
DT__FlattenDeviceTree(void **buffer_p, uint32_t *length)
void DT__FlattenDeviceTree(void **buffer_p, uint32_t *length)
{
uint32_t totalSize;
void * buf;
DPRINTF("DT__FlattenDeviceTree(0x%x, 0x%x)\n", buffer_p, length);
#if DEBUG
if (buffer_p) {
if (buffer_p)
{
DT__PrintTree(rootNode);
}
#endif
//==============================================================================
char *
DT__GetName(Node *node)
char *DT__GetName(Node *node)
{
Property *prop;
//==============================================================================
// Bungo
Property *
DT__GetProperty(Node *node, const char *name)
Property *DT__GetProperty(Node *node, const char *name)
{
Property *prop;
//==============================================================================
Node *
DT__FindNode(const char *path, bool createIfMissing)
Node *DT__FindNode(const char *path, bool createIfMissing)
{
Node *node, *child;
DTPropertyNameBuf nameBuf;
}
*bp = '\0';
if (nameBuf[0] == '\0')
{
// last path entry
break;
}
DPRINTF("DT__FindNode: Node '%s'\n", nameBuf);
for (child = node->children; child != 0; child = child->next)
{
DPRINTF("DT__FindNode: Child 0x%x\n", child);
if (strcmp(DT__GetName(child), nameBuf) == 0)
{
break;
}
}
if (child == 0 && createIfMissing)
{
char *str = malloc(strlen(nameBuf) + 1);
// XXX this will leak
strcpy(str, nameBuf);
child = DT__AddChild(node, str);
DPRINTF("DT__FindNode: Creating node: %s\n", str);
}
if (nameBuf[0] == '\0')
{
// last path entry
break;
}
DPRINTF("DT__FindNode: Node '%s'\n", nameBuf);
for (child = node->children; child != 0; child = child->next)
{
DPRINTF("DT__FindNode: Child 0x%x\n", child);
if (strcmp(DT__GetName(child), nameBuf) == 0)
{
break;
}
}
if (child == 0 && createIfMissing)
{
char *str = malloc(strlen(nameBuf) + 1);
// XXX this will leak
strcpy(str, nameBuf);
child = DT__AddChild(node, str);
DPRINTF("DT__FindNode: Creating node: %s\n", str);
}
node = child;
}
//==============================================================================
void
DT__PrintNode(Node *node, int level)
void DT__PrintNode(Node *node, int level)
{
char spaces[10], *cp = spaces;
Property *prop;
//==============================================================================
static void
_PrintTree(Node *node, int level)
static void _PrintTree(Node *node, int level)
{
DT__PrintNode(node, level);
//==============================================================================
void
DT__PrintTree(Node *node)
void DT__PrintTree(Node *node)
{
if (node == 0) node = rootNode;
_PrintTree(node, 0);
//==============================================================================
void
DT__PrintFlattenedNode(DTEntry entry, int level)
void DT__PrintFlattenedNode(DTEntry entry, int level)
{
char spaces[10], *cp = spaces;
DTPropertyIterator propIter;
//==============================================================================
static void
_PrintFlattenedTree(DTEntry entry, int level)
static void _PrintFlattenedTree(DTEntry entry, int level)
{
DTEntryIterator entryIter;
//==============================================================================
void
DT__PrintFlattenedTree(DTEntry entry)
void DT__PrintFlattenedTree(DTEntry entry)
{
_PrintFlattenedTree(entry, 0);
}
//==============================================================================
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
DTEntrydtEntry;
DTPropertyIteratorpropIter;
branches/Bungo/i386/libsaio/hfs.c
443443
444444
445445
446
446
447447
448448
449449
......
460460
461461
462462
463
463
464464
465465
466466
if (HFSInitPartition(ih) == -1)
{
verbose("HFSGetDescription: Init partition failed");
verbose("HFSGetDescription: Init partition failed");
return;
}
strncpy(str, name, strMaxLen);
str[strMaxLen] = '\0';
//verbose("HFS: label=%s\n", str);
//verbose("HFS: label=%s\n", str);
}
//==============================================================================
branches/Bungo/i386/libsaio/vbe.h
5858
5959
6060
61
62
63
61
62
63
6464
65
65
6666
6767
6868
*/
enum {
funcGetControllerInfo= 0x4F00,
funcGetModeInfo = 0x4F01,
funcSetMode = 0x4F02,
funcGetCurrentMode = 0x4F03,
funcGetModeInfo= 0x4F01,
funcSetMode= 0x4F02,
funcGetCurrentMode= 0x4F03,
funcSaveRestoreState= 0x4F04,
funcWindowControl = 0x4F05,
funcWindowControl= 0x4F05,
funcGetSetScanLineLength= 0x4F06,
funcGetSetDisplayStart= 0x4F07,
funcGetSetPaletteFormat= 0x4F08,
branches/Bungo/i386/libsaio/acpi_patcher.c
2828
2929
3030
31
32
31
32
3333
3434
3535
......
5454
5555
5656
57
58
59
57
58
59
6060
6161
6262
6363
64
64
6565
6666
67
67
6868
6969
70
71
72
70
71
72
7373
7474
7575
7676
77
78
79
77
78
79
8080
8181
8282
83
84
85
86
87
83
84
85
86
87
8888
8989
90
90
9191
9292
93
94
95
93
94
95
9696
9797
9898
......
102102
103103
104104
105
106
105
106
107107
108108
109109
110110
111
111
112112
113113
114
114
115115
116116
117
118
119
117
118
119
120120
121121
122122
123123
124
125
126
124
125
126
127127
128128
129129
130
131
132
133
134
135
136
137
138
139
140
141
130
131
132
133
134
135
136
137
138
139
140
141
142142
143143
144
145
146
144
145
146
147147
148148
149149
......
157157
158158
159159
160
161
160
161
162162
163163
164164
165165
166166
167167
168
169
168
169
170170
171171
172
173
172
173
174174
175175
176
177
176
177
178178
179179
180
181
182
183
180
181
182
183
184184
185185
186186
......
214214
215215
216216
217
218
217
218
219219
220220
221221
......
228228
229229
230230
231
231
232232
233233
234234
235235
236236
237
238
237
239238
240239
241240
......
267266
268267
269268
270
269
271270
272271
273272
......
278277
279278
280279
281
282
283
284
285
286
287
288
289
290
291
292
293
280
281
282
283
284
285
286
287
288
289
290
291
292
294293
295
294
296295
297
296
298297
299298
300299
301300
302
303
304
305
306
307
308
309
310
301
302
303
304
305
306
307
308
309
310
311
311312
312313
313314
314315
315
316
317
318
319
320
321
316
317
318
319
320
321
322
322323
323324
324325
325326
326327
327
328
329
330
331
328
329
330
331
332
332333
333334
334
335
335336
336337
337338
338
339
339
340
340341
341342
342
343
343344
344345
345
346
346347
347348
348
349
349
350
350351
351352
352353
353
354
355
354
355
356
356357
357358
358359
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
376381
377
382
383
378384
379385
380
386
387
381388
382
389
383390
384
391
385392
386
393
387394
388395
389396
390397
391
398
392399
393400
394401
......
419426
420427
421428
422
429
423430
424431
425432
426
427
428
429
430
431
432
433
434
435
436
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
437450
438
439
440
441
442
443
444
451
452
453
454
455
456
457
458
459
460
445461
446462
447
463
464
448465
449
466
467
468
450469
451470
452471
......
454473
455474
456475
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
473498
474499
475500
476501
477
502
503
478504
479
505
480506
481
482
483
484
485
486
487
507
508
509
510
511
512
513
514
515
516
488517
489518
490519
491520
492
521
493522
494523
495
496
497
498
524
525
526
527
499528
500529
501530
502531
503532
504533
505
534
506535
507536
508
509
510537
538
539
511540
512541
513542
514543
515544
516
517
518
519
545
546
547
548
520549
521550
522551
523
524
525
552
553
554
555
556
526557
527
558
559
560
528561
529562
530
531
563
564
532565
533566
534567
535
568
536569
537570
538571
......
546579
547580
548581
549
550
551
582
583
584
585
552586
553587
554588
......
558592
559593
560594
561
562
563
564
565
566
567
568
569
595
596
597
598
599
600
601
602
603
604
605
570606
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
596638
597639
598
599
600
601
640
641
642
643
644
645
602646
603647
604648
605649
606650
607
608
609
610
611
612
613
651
652
653
654
655
656
657
658
614659
615
616
617
618
619
660
661
662
663
664
665
620666
621667
622
623
668
669
670
671
624672
625673
626674
627
675
628676
629677
630678
631679
632680
633
681
682
634683
635684
636685
637686
638687
639688
640
689
690
641691
642692
643693
644694
645695
646696
647
648
649
697
698
699
650700
651
652
653
654
701
702
703
704
705
706
655707
656
657
708
709
710
711
712
658713
659
714
660715
661716
662717
......
664719
665720
666721
667
668
669
670
671
672
722
723
724
725
726
727
728
729
673730
674731
675732
......
679736
680737
681738
682
739
740
741
683742
684743
685744
686745
687
688
689746
690
747
748
749
750
751
752
691753
692754
693
755
694756
695
696
757
758
759
697760
698761
699762
700763
701764
702765
703
766
767
704768
705769
706
707
708
709
710
711
712
713
770
771
772
773
774
775
776
777
778
779
714780
715781
716
717
718
719
720
721782
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
783
784
785
786
787
747788
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
789
790
791
792
793
794
768795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
769821
770
771
772
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
773841
774
775
776
777
778
779
842
843
844
845
846
847
780848
781
782
783
784
785
786
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
787868
788869
789
790
791
870
871
872
792873
793
794
795
796
797
798
799
874
875
876
877
878
879
880
881
882
883
884
800885
801886
802887
803
888
804889
805890
806891
807892
808893
809
810
811
812
894
895
896
897
898
813899
814
900
901
815902
816903
817904
818
905
819906
820907
821
822
823
824
825
908
909
910
911
912
913
914
826915
827916
828917
829
918
830919
831920
832
833
921
922
923
924
834925
835926
836927
......
839930
840931
841932
842
933
934
843935
936
844937
845938
846939
847
848
849
940
941
942
943
944
850945
851
946
947
852948
853
854
949
950
855951
856
952
953
954
857955
858956
859957
860
861
958
959
862960
863
961
864962
865
866
867
963
868964
869
965
870966
871967
872968
873969
874970
875
876
971
972
877973
878
879
880
881
882
883
974
975
976
977
978
979
980
981
884982
885983
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
9101030
9111031
#endif
// Bungo:
void *new_dsdt = NULL,
*new_ecdt = NULL;
void *new_dsdt = NULL;
void *new_ecdt = NULL;
// Slice: New signature compare function
boolean_t tableSign(void *table, const char *sgn)
static struct acpi_2_rsdp *getAddressOfAcpiTable()
{
/* Before searching the BIOS space we are supposed to search the first 1K of the EBDA */
EBDA_RANGE_START = /* (uint32_t)swapUint16(*(uint16_t *)BDA_EBDA_START) << 4 */ EBDA_RANGE_MIN;
verbose("ACPIpatcher: scanning EBDA [%08X-%08X] for RSDP 1.0... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *acpi_addr = (void*)EBDA_RANGE_START;
EBDA_RANGE_START = /* (uint32_t)swapUint16(*(uint16_t *)BDA_EBDA_START) << 4 */ EBDA_RANGE_MIN;
verbose("ACPIpatcher: scanning EBDA [%08X-%08X] for RSDP 1.0... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *acpi_addr = (void*)EBDA_RANGE_START;
for (; acpi_addr < (void*)EBDA_RANGE_END; acpi_addr++)
{
if (*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)
{
break;
break;
}
}
if (acpi_addr >= (void*)EBDA_RANGE_END)
{
verbose("Nothing found.\n");
verbose("ACPIpatcher: scanning BIOS area [%08X-%08X] for RSDP 1.0...\n", ACPI_RANGE_START, ACPI_RANGE_END);
acpi_addr = (void*)ACPI_RANGE_START;
verbose("Nothing found.\n");
verbose("ACPIpatcher: scanning BIOS area [%08X-%08X] for RSDP 1.0...\n", ACPI_RANGE_START, ACPI_RANGE_END);
acpi_addr = (void*)ACPI_RANGE_START;
for (; acpi_addr < (void*)ACPI_RANGE_END; acpi_addr += 16)
{
if (*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)
{
break;
}
}
break;
}
}
}
else
{
verbose("\n");
}
uint8_t csum = checksum8(acpi_addr, 20);
verbose("\n");
}
uint8_t csum = checksum8(acpi_addr, 20);
if (csum == 0)
{
// Only return the table if it is a true version 1.0 table (Revision 0)
// Only return the table if it is a true version 1.0 table (Revision 0)
if(((struct acpi_2_rsdp*)acpi_addr)->Revision == 0)
{
return acpi_addr;
}
}
return acpi_addr;
}
}
return NULL;
}
{
/* Before searching the BIOS space we are supposed to search the first 1K of the EBDA */
EBDA_RANGE_START = /* (uint32_t)swapUint16(*(uint16_t *)BDA_EBDA_START) << 4 */ EBDA_RANGE_MIN;
verbose("ACPIpatcher: scanning EBDA [%08X-%08X] for RSDP 2.0 or newer... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *acpi_addr = (void *)EBDA_RANGE_START;
verbose("ACPIpatcher: scanning EBDA [%08X-%08X] for RSDP 2.0 or newer... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *acpi_addr = (void *)EBDA_RANGE_START;
for (; acpi_addr < (void *)EBDA_RANGE_END; acpi_addr++)
{
if (*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)
{
break;
break;
}
}
if (acpi_addr >= (void *)EBDA_RANGE_END)
{
verbose("Nothing found.\n");
verbose("ACPIpatcher: scanning BIOS area [%08X-%08X] for RSDP 2.0 or newer...\n", ACPI_RANGE_START, ACPI_RANGE_END);
acpi_addr = (void *)ACPI_RANGE_START;
verbose("Nothing found.\n");
verbose("ACPIpatcher: scanning BIOS area [%08X-%08X] for RSDP 2.0 or newer...\n", ACPI_RANGE_START, ACPI_RANGE_END);
acpi_addr = (void *)ACPI_RANGE_START;
for (; acpi_addr <= (void *)ACPI_RANGE_END; acpi_addr += 16)
{
if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)
{
break;
}
}
break;
}
}
}
else
{
verbose("\n");
}
uint8_t csum = checksum8(acpi_addr, 20);
/* Only assume this is a 2.0 or better table if the revision is greater than 0
* NOTE: ACPI 3.0 spec only seems to say that 1.0 tables have revision 1
* and that the current revision is 2.. I am going to assume that rev > 0 is 2.0.
*/
if(csum == 0 && (((struct acpi_2_rsdp*)acpi_addr)->Revision > 0)) {
uint8_t csum2 = checksum8(acpi_addr, sizeof(struct acpi_2_rsdp));
verbose("\n");
}
uint8_t csum = checksum8(acpi_addr, 20);
/* Only assume this is a 2.0 or better table if the revision is greater than 0
* NOTE: ACPI 3.0 spec only seems to say that 1.0 tables have revision 1
* and that the current revision is 2.. I am going to assume that rev > 0 is 2.0.
*/
if(csum == 0 && (((struct acpi_2_rsdp*)acpi_addr)->Revision > 0)) {
uint8_t csum2 = checksum8(acpi_addr, sizeof(struct acpi_2_rsdp));
if(csum2 == 0)
{
return acpi_addr;
}
}
return acpi_addr;
}
}
return NULL;
}
// Try finding 'filename' in the usual places
// Start searching any potential location for ACPI Table
snprintf(dirSpec, sizeof(dirSpec), "%s", filename);
fd = open(dirSpec, 0);
snprintf(dirSpec, sizeof(dirSpec), "%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "/Extra/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "/Extra/Acpi/%s", filename);
fd = open(dirSpec, 0);
snprintf(dirSpec, sizeof(dirSpec), "/Extra/Acpi/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/%s", filename);
fd = open(dirSpec, 0);
snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/Acpi/%s", filename);
fd = open(dirSpec, 0);
snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/Acpi/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
// NOT FOUND:
dirSpec[0] = 0;
}
}
// NOT FOUND:
dirSpec[0] = 0;
}
}
}
}
}
}
close(fd);
verbose("loadACPITable: Couldn't allocate memory for table: %s.\n", dirspec);
}
}
return NULL;
}
bool fix_restart = false;
bool fix_restart_ps2 = false;
int value = 1;
static bool ver_20 = false;
static bool ver_20 = false;
// Restart Fix
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel=0x756E6547
fix_restart = true;
fix_restart_ps2 = false;
if ( getBoolForKey(kPS2RestartFix, &fix_restart_ps2, &bootInfo->chameleonConfig) && fix_restart_ps2)
{
if ( getBoolForKey(kPS2RestartFix, &fix_restart_ps2, &bootInfo->chameleonConfig) && fix_restart_ps2) {
fix_restart = true;
}
else
fadt_mod = (struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length);
memcpy(fadt_mod, fadt, fadt->Length);
}
verbose("\tNew FACP loaded @%08X, length=%d\n", (uint32_t)fadt_mod, fadt_mod->Length);
verbose("\tNew FACP loaded @%08X, length=%d\n", (uint32_t)fadt_mod, fadt_mod->Length);
// Bungo: Determine PM Profile
verbose("\tPM Profile=0x%02X", fadt_mod->PM_Profile);
}
else
{
switch (fadt_mod->PM_Profile) { // check if PM Profile is correct (1..3)
case 1:
case 2:
case 3:
verbose(": using.\n");
break;
default:
// use SMBIOS chassisType to determine PM Profile (saved previously for us)
verbose(", expected value: 1, 2 or 3, setting to 0x%02X.\n", Platform.Type);
fadt_mod->PM_Profile = Platform.Type; // take care of modified FACP's PM Profile entry
break;
}
}
switch (fadt_mod->PM_Profile) { // check if PM Profile is correct (1..3)
case 1:
case 2:
case 3:
verbose(": using.\n");
break;
default:
// use SMBIOS chassisType to determine PM Profile (saved previously for us)
verbose(", expected value: 1, 2 or 3, setting to 0x%02X.\n", Platform.Type);
fadt_mod->PM_Profile = Platform.Type; // take care of modified FACP's PM Profile entry
break;
}
}
Platform.Type = fadt_mod->PM_Profile; // Save fixed PM Profile (system-type)
/* Bungo: Moved into fake_efi.c
// Setup system-type: We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()
// Setup system-type: We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()
// because we need to take care of FACP original content, if it is correct.
setupSystemType();
*/
// Patch FACP to fix restart
if (fix_restart) {
if (fix_restart_ps2) {
fadt_mod->Flags|= 0x400; // Reset register supported
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_BitWidth= 0x08; // 1 byte
fadt_mod->Reset_BitOffset= 0x00; // Offset 0
fadt_mod->Reset_AccessWidth= 0x01; // Byte access
fadt_mod->Reset_Address= 0x64; // Address of the register
fadt_mod->Reset_Value= 0xfe; // Value to write to reset the system
if (fix_restart)
{
if (fix_restart_ps2)
{
fadt_mod->Flags|= 0x400;// Reset register supported
fadt_mod->Reset_SpaceID= 0x01;// System I/O
fadt_mod->Reset_BitWidth= 0x08;// 1 byte
fadt_mod->Reset_BitOffset= 0x00;// Offset 0
fadt_mod->Reset_AccessWidth= 0x01;// Byte access
fadt_mod->Reset_Address= 0x64;// Address of the register
fadt_mod->Reset_Value= 0xfe;// Value to write to reset the system
verbose("\tFACP PS2 Restart Fix applied!\n");
}
else
{
fadt_mod->Flags|= 0x400; // Reset register supported
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_BitWidth= 0x08; // 1 byte
fadt_mod->Reset_BitOffset= 0x00; // Offset 0
fadt_mod->Reset_AccessWidth= 0x01; // Byte access
fadt_mod->Reset_Address= 0x0cf9; // Address of the register
fadt_mod->Reset_Value= 0x06; // Value to write to reset the system
fadt_mod->Flags|= 0x400;// Reset register supported
fadt_mod->Reset_SpaceID= 0x01;// System I/O
fadt_mod->Reset_BitWidth= 0x08;// 1 byte
fadt_mod->Reset_BitOffset= 0x00;// Offset 0
fadt_mod->Reset_AccessWidth= 0x01;// Byte access
fadt_mod->Reset_Address= 0x0cf9;// Address of the register
fadt_mod->Reset_Value= 0x06;// Value to write to reset the system
verbose("\tFACP Restart Fix applied!\n");
}
}
else
{
//verbose("\tRestart Fix: No.\n");
}
// Bungo: FACS table fix and load
verbose("\tOEM table FACS@%08X, length=%d: ", fadt_mod->FACS, ((struct acpi_2_facs *)fadt_mod->FACS)->Length);
//verbose("\tRestart Fix: No.\n");
}
// Bungo: FACS table fix and load
verbose("\tOEM table FACS@%08X, length=%d: ", fadt_mod->FACS, ((struct acpi_2_facs *)fadt_mod->FACS)->Length);
if ((fadt_mod->FACS > 0) && (fadt_mod->FACS < 0xFFFFFFFF) && (((struct acpi_2_facs *)fadt_mod->FACS)->Length >= 64))
{
verbose("using.\n");
verbose("using.\n");
}
else
{
verbose(" incorrect!\n");
}
verbose(" incorrect!\n");
}
if (ver_20 && (((uint32_t)(&(fadt_mod->X_FACS)) - (uint32_t)fadt_mod + 8) <= fadt_mod->Length))
{
verbose("\tOEM table X_FACS@%08X%08X, length=%d: ", (uint32_t)(fadt_mod->X_FACS >> 32), (uint32_t)(fadt_mod->X_FACS & 0xFFFFFFFF), ((struct acpi_2_facs *)fadt_mod->X_FACS)->Length);
verbose("\tOEM table X_FACS@%08X%08X, length=%d: ", (uint32_t)(fadt_mod->X_FACS >> 32), (uint32_t)(fadt_mod->X_FACS & 0xFFFFFFFF), ((struct acpi_2_facs *)fadt_mod->X_FACS)->Length);
if (fadt_mod->FACS != fadt_mod->X_FACS)
{
verbose("differes from FACS - fixing");
verbose("differes from FACS - fixing");
if ((fadt_mod->X_FACS > 0) && (fadt_mod->X_FACS < 0xFFFFFFFF) && (((struct acpi_2_facs *)(uint32_t)fadt_mod->X_FACS)->Length >= 64))
{
// Bungo: in my case only from X_FACS loading correct table (64 bytes) into IOReg
fadt_mod->FACS = (uint32_t)fadt_mod->X_FACS;
// Bungo: in my case only from X_FACS loading correct table (64 bytes) into IOReg
fadt_mod->FACS = (uint32_t)fadt_mod->X_FACS;
}
else
{
fadt_mod->X_FACS = (uint64_t)fadt_mod->FACS;
}
verbose(" \tUsing FACS@%08X = X_FACS@%08X\n", fadt_mod->FACS, (uint32_t)fadt_mod->X_FACS);
fadt_mod->X_FACS = (uint64_t)fadt_mod->FACS;
}
verbose(" \tUsing FACS@%08X = X_FACS@%08X\n", fadt_mod->FACS, (uint32_t)fadt_mod->X_FACS);
}
else
{
verbose("using.\n");
}
}
// Bungo: Save Hardware Signature (machine-signature)
if ((fadt_mod->FACS > 0) && (fadt_mod->FACS < 0xFFFFFFFF) && (((struct acpi_2_facs *)fadt_mod->FACS)->Length >= 64)) {
Platform.HWSignature = ((struct acpi_2_facs *)fadt_mod->FACS)->HWSignature;
verbose("\tHardware Signature=0x%08X: using.\n", Platform.HWSignature);
} else {
Platform.HWSignature = 0;
verbose("\tFixing Hardware Signature=0x%08X.\n", Platform.HWSignature);
}
verbose("\tOEM table DSDT@%08X, length=%d: %susing.\n", fadt_mod->DSDT, ((struct acpi_2_dsdt *)fadt_mod->DSDT)->Length, new_dsdt ? "not " : "");
if (ver_20 && (((uint32_t)(&(fadt_mod->X_DSDT)) - (uint32_t)fadt_mod + 8) <= fadt_mod->Length)) {
verbose("\tOEM table X_DSDT@%08X%08X, length=%d: %susing.\n", (uint32_t)(fadt_mod->X_DSDT >> 32), (uint32_t)(fadt_mod->X_DSDT & 0xFFFFFFFF), ((struct acpi_2_dsdt *)fadt_mod->X_DSDT)->Length, new_dsdt ? "not " : "");
}
verbose("using.\n");
}
}
// Bungo: Save Hardware Signature (machine-signature)
if ((fadt_mod->FACS > 0) && (fadt_mod->FACS < 0xFFFFFFFF) && (((struct acpi_2_facs *)fadt_mod->FACS)->Length >= 64))
{
Platform.HWSignature = ((struct acpi_2_facs *)fadt_mod->FACS)->HWSignature;
verbose("\tHardware Signature=0x%08X: using.\n", Platform.HWSignature);
}
else
{
Platform.HWSignature = 0;
verbose("\tFixing Hardware Signature=0x%08X.\n", Platform.HWSignature);
}
verbose("\tOEM table DSDT@%08X, length=%d: %susing.\n", fadt_mod->DSDT, ((struct acpi_2_dsdt *)fadt_mod->DSDT)->Length, new_dsdt ? "not " : "");
if (ver_20 && (((uint32_t)(&(fadt_mod->X_DSDT)) - (uint32_t)fadt_mod + 8) <= fadt_mod->Length))
{
verbose("\tOEM table X_DSDT@%08X%08X, length=%d: %susing.\n", (uint32_t)(fadt_mod->X_DSDT >> 32), (uint32_t)(fadt_mod->X_DSDT & 0xFFFFFFFF), ((struct acpi_2_dsdt *)fadt_mod->X_DSDT)->Length, new_dsdt ? "not " : "");
}
// Patch DSDT address if we have loaded DSDT.aml
if (new_dsdt) {
if (new_dsdt)
{
fadt_mod->DSDT = (uint32_t)new_dsdt;
verbose("\tFACP uses custom DSDT@%08X", fadt_mod->DSDT);
if (ver_20 && (((uint32_t)(&(fadt_mod->X_DSDT)) - (uint32_t)fadt_mod + 8) <= fadt_mod->Length)) {
if (ver_20 && (((uint32_t)(&(fadt_mod->X_DSDT)) - (uint32_t)fadt_mod + 8) <= fadt_mod->Length))
{
fadt_mod->X_DSDT = (uint64_t)new_dsdt;
verbose(" / X_DSDT@%08X%08X", (uint32_t)(fadt_mod->X_DSDT >> 32), (uint32_t)(fadt_mod->X_DSDT & 0xFFFFFFFF));
verbose(" / X_DSDT@%08X%08X", (uint32_t)(fadt_mod->X_DSDT >> 32), (uint32_t)(fadt_mod->X_DSDT & 0xFFFFFFFF));
}
verbose(", length=%d\n", ((struct acpi_2_dsdt *)fadt_mod->DSDT)->Length);
verbose(", length=%d\n", ((struct acpi_2_dsdt *)fadt_mod->DSDT)->Length);
}
// Correct the checksum
fadt_mod->Checksum=0;
fadt_mod->Checksum=256-checksum8(fadt_mod, fadt_mod->Length);
ver_20 = TRUE;
ver_20 = TRUE;
return fadt_mod;
}
// Bung: Unused
const char *filename;
char dirSpec[128];
int len = 0;
// always reset cpu count to 0 when injecting new acpi
acpi_cpu_count = 0;
verbose("\nACPIpatcher: Start patching...\n");
if (new_dsdt != NULL) {
verbose("ACPIpatcher: custom table DSDT already loaded @%08X, length=%d: using.\n", new_dsdt, ((struct acpi_2_header *)new_dsdt)->Length);
} else {
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig) && len) {
snprintf(dirSpec, sizeof(dirSpec), filename);
} else {
sprintf(dirSpec, "DSDT.aml");
}
verbose("\nACPIpatcher: Start patching...\n");
if (new_dsdt != NULL)
{
verbose("ACPIpatcher: custom table DSDT already loaded @%08X, length=%d: using.\n", new_dsdt, ((struct acpi_2_header *)new_dsdt)->Length);
}
else
{
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig) && len)
{
snprintf(dirSpec, sizeof(dirSpec), filename);
}
else
{
sprintf(dirSpec, "DSDT.aml");
}
verbose("ACPIpatcher: attempting to load custom table DSDT...\n", dirSpec);
if ((new_dsdt = loadACPITable(dirSpec))) {
verbose("ACPIpatcher: custom table DSDT loaded @%08X, length=%d.\n", new_dsdt, ((struct acpi_2_header *)new_dsdt)->Length);
} else {
//verbose("ACPIpatcher: custom DSDT not found!.\n");
}
}
verbose("ACPIpatcher: attempting to load custom table DSDT...\n", dirSpec);
if ((new_dsdt = loadACPITable(dirSpec)))
{
verbose("ACPIpatcher: custom table DSDT loaded @%08X, length=%d.\n", new_dsdt, ((struct acpi_2_header *)new_dsdt)->Length);
}
else
{
//verbose("ACPIpatcher: custom DSDT not found!.\n");
}
}
/* Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig)) {
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig))
{
snprintf(dirSpec, sizeof(dirSpec), filename);
} else {
}
else
{
sprintf(dirSpec, "DSDT.aml");
//DBG("dirSpec, DSDT.aml");
}
// Load replacement DSDT
new_dsdt = loadACPITable(dirSpec);
*/
// Load ECDT table
if (new_ecdt != NULL) {
verbose("ACPIpatcher: custom table ECDT already loaded @%08X, length=%d: using.\n", new_ecdt, ((struct acpi_2_header *)new_ecdt)->Length);
} else {
sprintf(dirSpec, "ECDT.aml");
filename = "ECDT.aml";
verbose("ACPIpatcher: attempting to load custom table ECDT...\n");
if ((new_ecdt = loadACPITable(filename))) {
verbose("ACPIpatcher: custom table ECDT loaded @%08X, length=%d.\n", new_ecdt, ((struct acpi_2_header *)new_ecdt)->Length);
} else {
//verbose("ACPIpatcher: custom ECDT not found!.\n");
}
}
// Mozodojo: Load additional SSDTs
// Load ECDT table
if (new_ecdt != NULL)
{
verbose("ACPIpatcher: custom table ECDT already loaded @%08X, length=%d: using.\n", new_ecdt, ((struct acpi_2_header *)new_ecdt)->Length);
}
else
{
sprintf(dirSpec, "ECDT.aml");
filename = "ECDT.aml";
verbose("ACPIpatcher: attempting to load custom table ECDT...\n");
if ((new_ecdt = loadACPITable(filename)))
{
verbose("ACPIpatcher: custom table ECDT loaded @%08X, length=%d.\n", new_ecdt, ((struct acpi_2_header *)new_ecdt)->Length);
}
else
{
//verbose("ACPIpatcher: custom ECDT not found!.\n");
}
}
// Mozodojo: Load additional SSDTs
struct acpi_2_ssdt *new_ssdt[32]; // 26 custom + 4 subssdt + 2 for pss & cst
int ssdtotal_number = 0;
{
int i;
for (i = 0; i < 26; i++) {
for (i = 0; i < 26; i++)
{
//char filename[512];
sprintf(dirSpec, (i > 0)? "SSDT-%d.aml":"SSDT.aml", i);
if ((new_ssdt[ssdtotal_number] = loadACPITable(dirSpec))) {
verbose("ACPIpatcher: custom table %s loaded @%08X, length=%d\n", dirSpec, new_ssdt[ssdtotal_number], new_ssdt[ssdtotal_number]->Length);
ssdtotal_number++;
} else {
//verbose("ACPIpatcher: custom table '%s' not found.\n", filename);
// Bungo: load up to 26 custom tables enabled now
if ((new_ssdt[ssdtotal_number] = loadACPITable(dirSpec)))
{
verbose("ACPIpatcher: custom table %s loaded @%08X, length=%d\n", dirSpec, new_ssdt[ssdtotal_number], new_ssdt[ssdtotal_number]->Length);
ssdtotal_number++;
}
else
{
//verbose("ACPIpatcher: custom table '%s' not found.\n", filename);
// Bungo: load up to 26 custom tables enabled now
//break;
}
}
}
// Mozodojo: going to patch FACP and load SSDTs even if DSDT.aml is not present
/*if (!new_dsdt)
{
return setupAcpiNoMod();
}*/
{
return setupAcpiNoMod();
}*/
// SSDT options
bool drop_ssdt = false, generate_pstates = false, generate_cstates = false;
getBoolForKey(kDropSSDT, &drop_ssdt, &bootInfo->chameleonConfig);
getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig);
getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig);
verbose("ACPIpatcher: drop SSDT tables: %s.\n", drop_ssdt ? "Yes" : "No");
verbose("ACPIpatcher: drop SSDT tables: %s.\n", drop_ssdt ? "Yes" : "No");
verbose("ACPIpatcher: generate P-States: %s.\n", generate_pstates ? "Yes" : "No");
verbose("ACPIpatcher: generate C-States: %s.\n", generate_cstates ? "Yes" : "No");
bool getSubSSDT = !generate_pstates && !generate_cstates;
bool getSubSSDT = !generate_pstates && !generate_cstates;
// Do the same procedure for both versions of ACPI
for (version = 0; version < 2; version++)
{
struct acpi_2_rsdp *rsdp, *rsdp_mod;
struct acpi_2_rsdt *rsdt, *rsdt_mod;
struct acpi_2_xsdt *xsdt, *xsdt_mod;
struct acpi_2_fadt *fadt_mod;
uint32_t *rsdt_entries;
uint64_t *xsdt_entries;
struct acpi_2_xsdt *xsdt, *xsdt_mod;
struct acpi_2_fadt *fadt_mod;
uint32_t *rsdt_entries;
uint64_t *xsdt_entries;
// Find original rsdp
rsdp = (struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable());
if (!rsdp) {
/*
if (version) {
if (!rsdp)
{
/*
if (version)
{
addConfigurationTable(&gEfiAcpi20TableGuid, NULL, "ACPI_20");
} else {
}
else
{
addConfigurationTable(&gEfiAcpiTableGuid, NULL, "ACPI");
}
*/
verbose("ACPIpatcher: ACPI version %d.0 not found. Not patching.\n", version + 1);
*/
verbose("ACPIpatcher: ACPI version %d.0 not found. Not patching.\n", version + 1);
continue;
}
int rsdplength = version ? rsdp->Length : 20;
int rsdplength = version ? rsdp->Length : 20;
int l = version ? 20 : 0;
verbose("ACPIpatcher: OEM table RSDP@%08X, length=%d. ACPI version %d.0: patching.\n", rsdp, rsdplength, version + 1);
rsdt = (struct acpi_2_rsdt *)rsdp->RsdtAddress;
verbose("ACPIpatcher: OEM table RSDT@%08X, length=%d: ", rsdp->RsdtAddress, rsdt->Length);
if ((rsdp->RsdtAddress > 0) && (rsdp->RsdtAddress < 0xFFFFFFFF) && (rsdt->Length < 0x10000)) {
verbose("using.\n");
if ((rsdp->RsdtAddress > 0) && (rsdp->RsdtAddress < 0xFFFFFFFF) && (rsdt->Length < 0x10000))
{
verbose("using.\n");
int rsdt_entries_num;
int dropoffset = 0, i, j;
rsdp_mod->RsdtAddress = (uint32_t)rsdt_mod;
rsdt_entries_num = (rsdt_mod->Length - sizeof(struct acpi_2_rsdt)) / 4;
rsdt_entries = (uint32_t *)(rsdt_mod + 1);
for (i = 0; i < rsdt_entries_num; i++) {
struct acpi_2_header *oemTable = (struct acpi_2_header *)rsdt_entries[i];
verbose("ACPIpatcher: OEM table %c%c%c%c@%08X, length=%d: ", oemTable->Signature[0], oemTable->Signature[1], oemTable->Signature[2], oemTable->Signature[3], oemTable, oemTable->Length);
if (!(rsdt_entries[i] > 0) || !(rsdt_entries[i] < 0xFFFFFFFF)) {
verbose("incorrect! Dropping.\n");
dropoffset++;
continue;
for (i = 0; i < rsdt_entries_num; i++)
{
struct acpi_2_header *oemTable = (struct acpi_2_header *)rsdt_entries[i];
verbose("ACPIpatcher: OEM table %c%c%c%c@%08X, length=%d: ", oemTable->Signature[0], oemTable->Signature[1], oemTable->Signature[2], oemTable->Signature[3], oemTable, oemTable->Length);
if (!(rsdt_entries[i] > 0) || !(rsdt_entries[i] < 0xFFFFFFFF))
{
verbose("incorrect! Dropping.\n");
dropoffset++;
continue;
}
if (tableSign(oemTable, "SSDT")) {
if (drop_ssdt) {
verbose("dropping.\n");
dropoffset++;
} else {
verbose("using.\n");
rsdt_entries[i-dropoffset] = rsdt_entries[i];
// get rest of ssdt tables from inside ssdt_pmref
if (getSubSSDT) { // prevent from extracting originals if user choosed generatind PSS and/or CSS tables
struct ssdt_pmref *subSSDT = (struct ssdt_pmref *)(rsdt_entries[i] + sizeof(struct acpi_2_header) + 15);
uint8_t tabNum = *((uint8_t *)subSSDT - 2) / 3; // e.g Name (SSDT, Package (0x0C) -> 0x0C / 3 = number of sub SSDTs
for (j = 0; (j < tabNum) && (ssdtotal_number < 30); j++) {
verbose("ACPIpatcher: OEM table SSDT_%s@%08X, length=%d: ", ((struct acpi_2_ssdt *)subSSDT[j].addr)->OEMTableId, subSSDT[j].addr, ((struct acpi_2_ssdt *)subSSDT[j].addr)->Length);
if (!(subSSDT[j].addr > 0) || !(subSSDT[j].addr < 0xFFFFFFFF)) {
verbose("incorrect! Dropping.\n");
continue;
}
verbose("using.\n");
new_ssdt[ssdtotal_number] = (struct acpi_2_ssdt *)subSSDT[j].addr;
ssdtotal_number++;
}
}
}
continue;
if (tableSign(oemTable, "SSDT"))
{
if (drop_ssdt)
{
verbose("dropping.\n");
dropoffset++;
}
else
{
verbose("using.\n");
rsdt_entries[i-dropoffset] = rsdt_entries[i];
// get rest of ssdt tables from inside ssdt_pmref
if (getSubSSDT) { // prevent from extracting originals if user choosed generatind PSS and/or CSS tables
struct ssdt_pmref *subSSDT = (struct ssdt_pmref *)(rsdt_entries[i] + sizeof(struct acpi_2_header) + 15);
uint8_t tabNum = *((uint8_t *)subSSDT - 2) / 3; // e.g Name (SSDT, Package (0x0C) -> 0x0C / 3 = number of sub SSDTs
for (j = 0; (j < tabNum) && (ssdtotal_number < 30); j++)
{
verbose("ACPIpatcher: OEM table SSDT_%s@%08X, length=%d: ", ((struct acpi_2_ssdt *)subSSDT[j].addr)->OEMTableId, subSSDT[j].addr, ((struct acpi_2_ssdt *)subSSDT[j].addr)->Length);
if (!(subSSDT[j].addr > 0) || !(subSSDT[j].addr < 0xFFFFFFFF))
{
verbose("incorrect! Dropping.\n");
continue;
}
verbose("using.\n");
new_ssdt[ssdtotal_number] = (struct acpi_2_ssdt *)subSSDT[j].addr;
ssdtotal_number++;
}
}
}
continue;
}
/* Bungo: According to ACPI Spec. no DSDT in RSDT, so what this for?
if (tableSign(oemTable, "DSDT")) {
if (new_dsdt) {
/* Bungo: According to ACPI Spec. no DSDT in RSDT, so what this for?
if (tableSign(oemTable, "DSDT"))
{
if (new_dsdt)
{
rsdt_entries[i-dropoffset] = (uint32_t)new_dsdt;
verbose("custom table added.\n");
}
continue;
}
So, suggest to drop, it should be in FACP */
if (tableSign(oemTable, "DSDT")) {
verbose("dropping.\n");
dropoffset++;
continue;
So, suggest to drop, it should be in FACP */
if (tableSign(oemTable, "DSDT"))
{
verbose("dropping.\n");
dropoffset++;
continue;
}
if (tableSign(oemTable, "ECDT") && new_ecdt) {
verbose("dropping.\n");
dropoffset++;
continue;
if (tableSign(oemTable, "ECDT") && new_ecdt)
{
verbose("dropping.\n");
dropoffset++;
continue;
}
if (tableSign(oemTable, "FACP")) {
if (oemTable->Length > 0x10000) {
if (tableSign(oemTable, "FACP"))
{
if (oemTable->Length > 0x10000)
{
verbose("incorrect. Not modifying.\n");
continue;
}
verbose("patching.\n");
fadt_mod = patch_fadt((struct acpi_2_fadt *)oemTable, new_dsdt);
rsdt_entries[i-dropoffset] = (uint32_t)fadt_mod;
// Generate _CST SSDT
if (generate_cstates && (new_ssdt[ssdtotal_number] = generate_cst_ssdt(fadt_mod))) {
if (generate_cstates && (new_ssdt[ssdtotal_number] = generate_cst_ssdt(fadt_mod)))
{
verbose("\tC-States generated.\n");
generate_cstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
// Generating _PSS SSDT
if (generate_pstates && (new_ssdt[ssdtotal_number] = generate_pss_ssdt((void*)fadt_mod->DSDT))) {
if (generate_pstates && (new_ssdt[ssdtotal_number] = generate_pss_ssdt((void*)fadt_mod->DSDT)))
{
verbose("\tP-States generated.\n");
generate_pstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
continue;
}
verbose("using.\n");
rsdt_entries[i-dropoffset] = rsdt_entries[i];
verbose("using.\n");
rsdt_entries[i-dropoffset] = rsdt_entries[i];
}
// For moded rsdt calculate new lenght
if (new_ecdt)
rsdt_mod->Length += 4*ssdtotal_number - 4*dropoffset + 4; // custom - dropped + ECDT
// For moded rsdt calculate new lenght
if (new_ecdt)
{
rsdt_mod->Length += 4*ssdtotal_number - 4*dropoffset + 4; // custom - dropped + ECDT
}
else
rsdt_mod->Length += 4*ssdtotal_number - 4*dropoffset;
// Allocate moded rsdt in Kernel memory area
{
rsdt_mod->Length += 4*ssdtotal_number - 4*dropoffset;
}
// Allocate moded rsdt in Kernel memory area
struct acpi_2_rsdt *rsdt_copy = (struct acpi_2_rsdt *)AllocateKernelMemory(rsdt_mod->Length);
memcpy(rsdt_copy, rsdt_mod, rsdt_mod->Length); // should be rsdt_mod->Length - 4*ssdtotal_number - 4 but don't care
memcpy(rsdt_copy, rsdt_mod, rsdt_mod->Length); // should be rsdt_mod->Length - 4*ssdtotal_number - 4 but don't care
free(rsdt_mod);
rsdt_mod = rsdt_copy;
rsdp_mod->RsdtAddress = (uint32_t)rsdt_mod;
rsdt_entries = (uint32_t *)(rsdt_mod + 1);
// Mozodojo: Insert additional SSDTs into RSDT
for (j = 0; j < ssdtotal_number; j++) {
rsdt_entries[i-dropoffset+j] = (uint32_t)new_ssdt[j];
}
verbose("ACPIpatcher: added %d custom SSDT table%s into RSDT.\n", ssdtotal_number, (ssdtotal_number != 1) ? "s" : "");
if (new_ecdt) {
for (j = 0; j < ssdtotal_number; j++)
{
rsdt_entries[i-dropoffset+j] = (uint32_t)new_ssdt[j];
}
verbose("ACPIpatcher: added %d custom SSDT table%s into RSDT.\n", ssdtotal_number, (ssdtotal_number != 1) ? "s" : "");
if (new_ecdt)
{
rsdt_entries[i - dropoffset + j] = (uint32_t)new_ecdt;
verbose("ACPIpatcher: added custom table %s @%08X into RSDT.\n", "ECDT", new_ecdt);
}
rsdt_mod->Checksum=0;
rsdt_mod->Checksum=256-checksum8(rsdt_mod,rsdt_mod->Length);
verbose("new=%d.\n", rsdt_mod->Checksum);
} else {
}
else
{
rsdp_mod->RsdtAddress = 0;
verbose("not found or incorrect!\n");
}
verbose("\n");
if (gVerboseMode) pause("");
if (version) {
#if DEBUG_ACPI
pause("\n[DEBUG_ACPI] ");
#endif
if (version)
{
// FIXME: handle 64-bit address correctly
xsdt = (struct acpi_2_xsdt *)(uint32_t)rsdp->XsdtAddress;
verbose("ACPIpatcher: OEM table XSDT@%08X%08X, length=%d: ", (uint32_t)(rsdp->XsdtAddress >> 32), (uint32_t)(rsdp->XsdtAddress & 0xFFFFFFFF), xsdt->Length);
verbose("ACPIpatcher: OEM table XSDT@%08X%08X, length=%d: ", (uint32_t)(rsdp->XsdtAddress >> 32), (uint32_t)(rsdp->XsdtAddress & 0xFFFFFFFF), xsdt->Length);
if ((rsdp->XsdtAddress > 0) && (rsdp->XsdtAddress < 0xFFFFFFFF) && (xsdt->Length < 0x10000)) {
verbose("using.\n");
if ((rsdp->XsdtAddress > 0) && (rsdp->XsdtAddress < 0xFFFFFFFF) && (xsdt->Length < 0x10000))
{
verbose("using.\n");
int xsdt_entries_num, i, j;
int dropoffset = 0;
// mozo: using malloc cos I didn't found how to free already allocated kernel memory
xsdt_mod = (struct acpi_2_xsdt *)malloc(xsdt->Length);
memcpy(xsdt_mod, xsdt, xsdt->Length);
rsdp_mod->XsdtAddress = (uint64_t)xsdt_mod;
rsdp_mod->XsdtAddress = (uint64_t)xsdt_mod;
xsdt_entries_num = (xsdt_mod->Length - sizeof(struct acpi_2_xsdt)) / 8;
xsdt_entries = (uint64_t *)(xsdt_mod + 1);
for (i = 0; i < xsdt_entries_num; i++) {
struct acpi_2_header *oemTable = (struct acpi_2_header *)(uint32_t)xsdt_entries[i];
verbose("ACPIpatcher: OEM table %c%c%c%c@%08X%08X, length=%d", oemTable->Signature[0], oemTable->Signature[1], oemTable->Signature[2], oemTable->Signature[3], (uint32_t)(xsdt_entries[i] >> 32), (uint32_t)(xsdt_entries[i] & 0xFFFFFFFF), oemTable->Length);
if (!(xsdt_entries[i] > 0) || !(xsdt_entries[i] < 0xFFFFFFFF)) {
verbose(": incorrect! Dropping.\n");
dropoffset++;
for (i = 0; i < xsdt_entries_num; i++)
{
struct acpi_2_header *oemTable = (struct acpi_2_header *)(uint32_t)xsdt_entries[i];
verbose("ACPIpatcher: OEM table %c%c%c%c@%08X%08X, length=%d", oemTable->Signature[0], oemTable->Signature[1], oemTable->Signature[2], oemTable->Signature[3], (uint32_t)(xsdt_entries[i] >> 32), (uint32_t)(xsdt_entries[i] & 0xFFFFFFFF), oemTable->Length);
if (!(xsdt_entries[i] > 0) || !(xsdt_entries[i] < 0xFFFFFFFF))
{
verbose(": incorrect! Dropping.\n");
dropoffset++;
continue;
}
bool inRSDT = (uint32_t)oemTable == ((uint32_t *)(rsdt + 1))[i]; // check if already in RSDT
if (inRSDT) {
verbose(" (already in RSDT)");
}
if (tableSign(oemTable, "SSDT") && !inRSDT) {
if (drop_ssdt) {
verbose(": dropping.\n");
dropoffset++;
} else {
verbose(": using.\n");
xsdt_entries[i - dropoffset] = xsdt_entries[i];
// Get rest of ssdts from ssdt_pmref
if (getSubSSDT) {
struct ssdt_pmref *subSSDT = (struct ssdt_pmref *)((uint32_t)xsdt_entries[i - dropoffset] + sizeof(struct acpi_2_header) + 15);
uint8_t tabNum = *((uint8_t *)subSSDT - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (j = 0; (j < tabNum) && (ssdtotal_number < 30); j++) {
verbose("ACPIpatcher: OEM table SSDT_%s@%08X, length=%d", ((struct acpi_2_ssdt *)subSSDT[j].addr)->OEMTableId, subSSDT[j].addr, ((struct acpi_2_ssdt *)subSSDT[j].addr)->Length);
if (!(subSSDT[j].addr > 0) || !(subSSDT[j].addr < 0xFFFFFFFF)) {
verbose(": incorrect! Dropping.\n");
continue;
}
new_ssdt[ssdtotal_number] = (struct acpi_2_ssdt *)subSSDT[j].addr;
ssdtotal_number++;
verbose(": using.\n");
}
}
}
continue;
}
bool inRSDT = (uint32_t)oemTable == ((uint32_t *)(rsdt + 1))[i]; // check if already in RSDT
if (inRSDT)
{
verbose(" (already in RSDT)");
}
// Bungo: According to ACPI Spec. no DSDT in RSDT, so what this for?
/*
if (tableSign(oemTable, "DSDT")) {
if (new_dsdt) {
xsdt_entries[i-dropoffset] = (uint64_t)new_dsdt;
verbose("custom table added.\n");
}
continue;
}
*/
// Suggest to drop, it should be in FACP
if (tableSign(oemTable, "DSDT") && !inRSDT) {
verbose(": dropping.\n");
dropoffset++;
continue;
}
if (tableSign(oemTable, "FACP") && !inRSDT) {
if (oemTable->Length > 0x10000) {
goto drop_xsdt;
if (tableSign(oemTable, "SSDT") && !inRSDT)
{
if (drop_ssdt)
{
verbose(": dropping.\n");
dropoffset++;
}
else
{
verbose(": using.\n");
xsdt_entries[i - dropoffset] = xsdt_entries[i];
// Get rest of ssdts from ssdt_pmref
if (getSubSSDT)
{
struct ssdt_pmref *subSSDT = (struct ssdt_pmref *)((uint32_t)xsdt_entries[i - dropoffset] + sizeof(struct acpi_2_header) + 15);
uint8_t tabNum = *((uint8_t *)subSSDT - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (j = 0; (j < tabNum) && (ssdtotal_number < 30); j++)
{
verbose("ACPIpatcher: OEM table SSDT_%s@%08X, length=%d", ((struct acpi_2_ssdt *)subSSDT[j].addr)->OEMTableId, subSSDT[j].addr, ((struct acpi_2_ssdt *)subSSDT[j].addr)->Length);
if (!(subSSDT[j].addr > 0) || !(subSSDT[j].addr < 0xFFFFFFFF))
{
verbose(": incorrect! Dropping.\n");
continue;
}
new_ssdt[ssdtotal_number] = (struct acpi_2_ssdt *)subSSDT[j].addr;
ssdtotal_number++;
verbose(": using.\n");
}
}
}
continue;
}
verbose(": patching.\n");
fadt_mod = patch_fadt((struct acpi_2_fadt *)oemTable, new_dsdt);
xsdt_entries[i - dropoffset] = (uint64_t)fadt_mod;
// Bungo: According to ACPI Spec. no DSDT in RSDT, so what this for?
/*
if (tableSign(oemTable, "DSDT"))
{
if (new_dsdt)
{
xsdt_entries[i-dropoffset] = (uint64_t)new_dsdt;
verbose("custom table added.\n");
}
continue;
}
*/
// Suggest to drop, it should be in FACP
if (tableSign(oemTable, "DSDT") && !inRSDT)
{
verbose(": dropping.\n");
dropoffset++;
continue;
}
// Generate _CST SSDT
if (generate_cstates && (new_ssdt[ssdtotal_number] = generate_cst_ssdt(fadt_mod))) {
verbose("\tC-States generated\n");
generate_cstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
if (tableSign(oemTable, "FACP") && !inRSDT)
{
if (oemTable->Length > 0x10000)
{
goto drop_xsdt;
}
// Generating _PSS SSDT
if (generate_pstates && (new_ssdt[ssdtotal_number] = generate_pss_ssdt((void *)fadt_mod->DSDT))) {
verbose("\tP-States generated\n");
generate_pstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
verbose(": patching.\n");
fadt_mod = patch_fadt((struct acpi_2_fadt *)oemTable, new_dsdt);
xsdt_entries[i - dropoffset] = (uint64_t)fadt_mod;
// Generate _CST SSDT
if (generate_cstates && (new_ssdt[ssdtotal_number] = generate_cst_ssdt(fadt_mod)))
{
verbose("\tC-States generated\n");
generate_cstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
// Generating _PSS SSDT
if (generate_pstates && (new_ssdt[ssdtotal_number] = generate_pss_ssdt((void *)fadt_mod->DSDT)))
{
verbose("\tP-States generated\n");
generate_pstates = false; // Generate SSDT only once!
ssdtotal_number++;
}
continue;
}
verbose(": using.\n");
xsdt_entries[i - dropoffset] = xsdt_entries[i];
verbose(": using.\n");
xsdt_entries[i - dropoffset] = xsdt_entries[i];
}
// For moded xsdt calculate new lenght
if (new_ecdt)
xsdt_mod->Length += 8*ssdtotal_number - 8*dropoffset + 8; // custom - dropped + ECDT
else
xsdt_mod->Length += 8*ssdtotal_number - 8*dropoffset;
// Allocate xsdt in Kernel memory area
// For moded xsdt calculate new lenght
if (new_ecdt)
{
xsdt_mod->Length += 8*ssdtotal_number - 8*dropoffset + 8; // custom - dropped + ECDT
}
else
{
xsdt_mod->Length += 8*ssdtotal_number - 8*dropoffset;
}
// Allocate xsdt in Kernel memory area
struct acpi_2_xsdt *xsdt_copy = (struct acpi_2_xsdt *)AllocateKernelMemory(xsdt_mod->Length);
memcpy(xsdt_copy, xsdt_mod, xsdt_mod->Length); // should be: rsdt_mod->Length - 8*ssdtotal_number - 8 but don't care
free(xsdt_mod);
xsdt_mod = xsdt_copy;
xsdt_mod = xsdt_copy;
rsdp_mod->XsdtAddress = (uint64_t)xsdt_mod;
xsdt_entries_num = (xsdt_mod->Length - sizeof(struct acpi_2_xsdt)) / 8;
xsdt_entries = (uint64_t *)(xsdt_mod + 1);
// Mozodojo: Insert additional SSDTs into XSDT
for (j = 0; j < ssdtotal_number; j++) {
xsdt_entries[i-dropoffset+j] = (uint64_t)new_ssdt[j];
}
verbose("ACPIpatcher: added %d custom SSDT table%s into XSDT.\n", ssdtotal_number, (ssdtotal_number != 1) ? "s" : "");
for (j = 0; j < ssdtotal_number; j++)
{
xsdt_entries[i-dropoffset+j] = (uint64_t)new_ssdt[j];
}
verbose("ACPIpatcher: added %d custom SSDT table%s into XSDT.\n", ssdtotal_number, (ssdtotal_number != 1) ? "s" : "");
if (new_ecdt) {
if (new_ecdt)
{
xsdt_entries[i - dropoffset + j] = (uint64_t)new_ecdt;
verbose("ACPIpatcher: added custom table %s@%016X into XSDT.\n", "ECDT", new_ecdt);
}
// Correct the checksum of XSDT
verbose("ACPIpatcher: modified XSDT@%016X, length=%d. Checksum: old=%d, ", xsdt_mod, xsdt_mod->Length, xsdt_mod->Checksum);
xsdt_mod->Checksum=0;
xsdt_mod->Checksum=256-checksum8(xsdt_mod, xsdt_mod->Length);
verbose("new=%d.\n", xsdt_mod->Checksum);
} else {
drop_xsdt:
xsdt_mod->Checksum=0;
xsdt_mod->Checksum=256-checksum8(xsdt_mod, xsdt_mod->Length);
verbose("new=%d.\n", xsdt_mod->Checksum);
}
else
{
drop_xsdt:
/*FIXME: Now we just hope that if MacOS doesn't find XSDT it reverts to RSDT.
* A Better strategy would be to generate
*/
verbose("not found or incorrect!\n");
verbose("not found or incorrect!\n");
rsdp_mod->XsdtAddress=0xffffffffffffffffLL;
}
if (gVerboseMode) pause("");
#if DEBUG_ACPI
pause("\n[DEBUG_ACPI] ");
#endif
}
// Correct the checksum of RSDP
rsdp_mod->Checksum=256-checksum8(rsdp_mod, 20);
verbose("new=%d", rsdp_mod->Checksum);
if (version) {
if (version)
{
verbose("; extended checksum: old=%d, ", rsdp_mod->ExtendedChecksum);
rsdp_mod->ExtendedChecksum=0;
rsdp_mod->ExtendedChecksum=256-checksum8(rsdp_mod,rsdp_mod->Length);
verbose("new=%d.\n", rsdp_mod->ExtendedChecksum);
} else {
verbose(".\n");
}
}
else
{
verbose(".\n");
}
if (version) {
if (version)
{
acpi20_p = (uint64_t)(uint32_t)rsdp_mod; // efi configuration table pointer to ACPI_20 RSDP
acpi10_p = acpi20_p - 20; // efi configuration table pointer to ACPI RSDP
memcpy((struct acpi_2_rsdp *)(uint32_t)acpi10_p, (struct acpi_2_rsdp *)(uint32_t)acpi20_p, 20);
acpi10_p = acpi20_p - 20; // efi configuration table pointer to ACPI RSDP
memcpy((struct acpi_2_rsdp *)(uint32_t)acpi10_p, (struct acpi_2_rsdp *)(uint32_t)acpi20_p, 20);
//addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");
} else {
}
else
{
acpi10_p = (uint64_t)(uint32_t)rsdp_mod; // efi configuration table pointer to ACPI RSDP
//addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");
}
verbose("ACPIpatcher: acpi version %d.0 patching finished.\n", version + 1);
verbose("ACPIpatcher: acpi version %d.0 patching finished.\n", version + 1);
}
#if DEBUG_ACPI
pause("[DEBUG ACPI] ");
#else
if (gVerboseMode) pause("");
pause("\n[DEBUG_ACPI] ");
#endif
return 1;
}
struct acpi_2_rsdp *getRSDPaddress()
{
bool found = false;
/* Before searching the BIOS space we are supposed to search the first 1K of the EBDA */
bool found = false;
/* Before searching the BIOS space we are supposed to search the first 1K of the EBDA */
EBDA_RANGE_START = (uint32_t)swapUint16(*(uint16_t *)BDA_EBDA_START) << 4;
verbose("getRSDPaddress: scanning EBDA [%08X:%08X] for RSDP... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *rsdp_addr = (void*)EBDA_RANGE_START;
for (; rsdp_addr <= (void*)EBDA_RANGE_END; rsdp_addr += 1) {
if (*(uint64_t *)rsdp_addr == ACPI_SIGNATURE_UINT64_LE) {
found = true;
break;
verbose("getRSDPaddress: scanning EBDA [%08X:%08X] for RSDP... ", EBDA_RANGE_START, EBDA_RANGE_END);
void *rsdp_addr = (void*)EBDA_RANGE_START;
for (; rsdp_addr <= (void*)EBDA_RANGE_END; rsdp_addr += 1)
{
if (*(uint64_t *)rsdp_addr == ACPI_SIGNATURE_UINT64_LE)
{
found = true;
break;
}
}
if (!found) {
verbose("Nothing found.\n");
verbose("getRSDPaddress: scanning BIOS area [%08X:%08X] for RSDP... ", ACPI_RANGE_START, ACPI_RANGE_END);
rsdp_addr = (void*)ACPI_RANGE_START;
for (; rsdp_addr <= (void*)ACPI_RANGE_END; rsdp_addr += 16) {
if (*(uint64_t *)rsdp_addr == ACPI_SIGNATURE_UINT64_LE) {
found = true;
break;
}
}
}
if (found) {
verbose("Found @0%08X, Rev.: %d.0).\n", rsdp_addr, ((struct acpi_2_rsdp *)rsdp_addr)->Revision + 1);
uint8_t csum = checksum8(rsdp_addr, 20);
if (csum == 0) {
if (((struct acpi_2_rsdp *)rsdp_addr)->Revision == 0) return rsdp_addr;
csum = checksum8(rsdp_addr, sizeof(struct acpi_2_rsdp));
if (csum == 0) return rsdp_addr;
else verbose("getRSDPaddress: RSDP extended checksum incorrect: %d.\n", csum);
} else verbose("getRSDPaddress: RSDP checksum incorrect: %d.\n", csum);
} else verbose("Nothing found.\n");
if (!found)
{
verbose("Nothing found.\n");
verbose("getRSDPaddress: scanning BIOS area [%08X:%08X] for RSDP... ", ACPI_RANGE_START, ACPI_RANGE_END);
rsdp_addr = (void*)ACPI_RANGE_START;
for (; rsdp_addr <= (void*)ACPI_RANGE_END; rsdp_addr += 16)
{
if (*(uint64_t *)rsdp_addr == ACPI_SIGNATURE_UINT64_LE)
{
found = true;
break;
}
}
}
if (found)
{
verbose("Found @0%08X, Rev.: %d.0).\n", rsdp_addr, ((struct acpi_2_rsdp *)rsdp_addr)->Revision + 1);
uint8_t csum = checksum8(rsdp_addr, 20);
if (csum == 0)
{
if (((struct acpi_2_rsdp *)rsdp_addr)->Revision == 0)
{
return rsdp_addr;
}
csum = checksum8(rsdp_addr, sizeof(struct acpi_2_rsdp));
if (csum == 0)
{
return rsdp_addr;
}
else
{
verbose("getRSDPaddress: RSDP extended checksum incorrect: %d.\n", csum);
}
}
else
{
verbose("getRSDPaddress: RSDP checksum incorrect: %d.\n", csum);
}
}
else
{
verbose("Nothing found.\n");
}
return NULL;
}
branches/Bungo/i386/libsaio/bootargs.h
4444
4545
4646
47
48
49
50
51
52
53
54
55
56
57
58
47
48
49
50
51
52
53
54
55
56
57
58
5959
60
61
60
61
6262
6363
6464
......
124124
125125
126126
127
128
127
128
129129
130130
131131
......
209209
210210
211211
212
212213
213214
214215
};
enum {
kEfiReservedMemoryType = 0,
kEfiLoaderCode = 1,
kEfiLoaderData = 2,
kEfiBootServicesCode = 3,
kEfiBootServicesData = 4,
kEfiRuntimeServicesCode = 5,
kEfiRuntimeServicesData = 6,
kEfiConventionalMemory = 7,
kEfiUnusableMemory = 8,
kEfiACPIReclaimMemory = 9,
kEfiACPIMemoryNVS = 10,
kEfiMemoryMappedIO = 11,
kEfiReservedMemoryType= 0,
kEfiLoaderCode= 1,
kEfiLoaderData= 2,
kEfiBootServicesCode= 3,
kEfiBootServicesData= 4,
kEfiRuntimeServicesCode= 5,
kEfiRuntimeServicesData= 6,
kEfiConventionalMemory= 7,
kEfiUnusableMemory= 8,
kEfiACPIReclaimMemory= 9,
kEfiACPIMemoryNVS= 10,
kEfiMemoryMappedIO= 11,
kEfiMemoryMappedIOPortSpace = 12,
kEfiPalCode = 13,
kEfiMaxMemoryType = 14
kEfiPalCode= 13,
kEfiMaxMemoryType= 14
};
/*
#define kBootArgsVersion22
#define kBootArgsRevision2_00
#define kBootArgsEfiMode3232
#define kBootArgsEfiMode6464
#define kBootArgsEfiMode32 32
#define kBootArgsEfiMode64 64
/* Bitfields for boot_args->flags */
#define kBootArgsFlagRebootOnPanic(1 << 0)
uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */
uint32_t efiRuntimeServicesPageCount;
uint32_t efiSystemTable; /* physical address of system table in runtime area */
uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */
branches/Bungo/i386/libsaio/spd.c
6969
7070
7171
72
73
74
75
76
77
78
79
80
81
82
83
84
7285
7386
7487
......
111124
112125
113126
114
115
116
117
118
119
120
121
122
123
124
125
126
127127
128128
129129
130130
131
131
132
132133
133134
134135
135136
136
137
137
138
138139
139140
140141
......
142143
143144
144145
145
146
146
147
147148
148149
149
150
150
151
152
153
151154
152155
153156
154
155
156
157
158
159
160
161
162
163
157164
158165
159166
160167
161168
162
163
169
170
171
172
164173
165174
166
167
175
176
177
178
168179
169180
170181
......
179190
180191
181192
182
183
184
185
186
187
188
189
190
191
192
193
194
195
193
194
195
196
197
196198
197199
198200
......
206208
207209
208210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
209226
210227
211228
......
215232
216233
217234
218
235
219236
220
237
221238
222
239
223240
224
241
225242
226
227
228
243
229244
245
246
247
248
230249
231250
232251
233252
234253
235
254
236255
256
257
237258
238
239259
240
260
261
241262
242
263
264
265
243266
244267
245268
246269
247270
248
249
250
271
272
273
251274
252
275
276
253277
254278
255
279
280
281
256282
257283
258284
......
262288
263289
264290
265
266291
267
268
269
270
271
272
292
293
294
295
296
297
298
299
273300
274
301
275302
276303
277304
......
288315
289316
290317
291
318
319
292320
293321
294322
295323
296
297
324
325
298326
299327
300328
......
305333
306334
307335
308
336
337
309338
310339
311340
312
313
314
341
342
343
315344
316345
317346
......
327356
328357
329358
359
360
361
362
363
330364
331365
332366
333367
334
368
369
335370
336371
337372
......
339374
340375
341376
342
343
377
378
379
344380
345381
346382
347383
348
384
385
349386
350387
351388
352
389
390
353391
354392
355393
......
359397
360398
361399
362
363
364
365
366
367
368
369
370
371
400
401
402
403
404
405
406
407
408
409
372410
373411
374412
375413
376
377
414
415
378416
379417
380418
......
420458
421459
422460
423
461
462
424463
425464
426465
427466
428467
429468
430
431
469
470
471
472
432473
433474
434475
#define SMBHSTDAT 5
#define SBMBLKDAT 7
int spd_indexes[] = {
SPD_MEMORY_TYPE,
SPD_DDR3_MEMORY_BANK,
SPD_DDR3_MEMORY_CODE,
SPD_NUM_ROWS,
SPD_NUM_COLUMNS,
SPD_NUM_DIMM_BANKS,
SPD_NUM_BANKS_PER_SDRAM,
4,7,8,9,12,64, /* TODO: give names to these values */
95,96,97,98, 122,123,124,125 /* UIS */
};
#define SPD_INDEXES_SIZE (sizeof(spd_indexes) / sizeof(int))
/** Read one byte from the intel i2c, used for reading SPD on intel chipsets only. */
unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd)
/* SPD i2c read optimization: prefetch only what we need, read non prefetcheable bytes on the fly */
#define READ_SPD(spd, base, slot, x) spd[x] = smb_read_byte_intel(base, 0x50 + slot, x)
int spd_indexes[] = {
SPD_MEMORY_TYPE,
SPD_DDR3_MEMORY_BANK,
SPD_DDR3_MEMORY_CODE,
SPD_NUM_ROWS,
SPD_NUM_COLUMNS,
SPD_NUM_DIMM_BANKS,
SPD_NUM_BANKS_PER_SDRAM,
4,7,8,9,12,64, /* TODO: give names to these values */
95,96,97,98, 122,123,124,125 /* UIS */
};
#define SPD_INDEXES_SIZE (sizeof(spd_indexes) / sizeof(int))
/** Read from spd *used* values only*/
static void init_spd(char * spd, uint32_t base, int slot)
{
int i;
for (i=0; i< SPD_INDEXES_SIZE; i++) {
for (i = 0; i < SPD_INDEXES_SIZE; i++)
{
READ_SPD(spd, base, slot, spd_indexes[i]);
}
}
/** Get Vendor Name from spd, 2 cases handled DDR3 and DDR2,
have different formats, always return a valid ptr.*/
// Get Vendor Name from spd, 2 cases handled DDR3 and DDR2,
// have different formats, always return a valid ptr.
const char * getVendorName(RamSlotInfo_t* slot, uint32_t base, int slot_num)
{
uint8_t bank = 0;
int i = 0;
uint8_t * spd = (uint8_t *) slot->spd;
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3)
{ // DDR3
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3
{
bank = (spd[SPD_DDR3_MEMORY_BANK] & 0x07f); // constructors like Patriot use b7=1
code = spd[SPD_DDR3_MEMORY_CODE];
for (i=0; i < VEN_MAP_SIZE; i++) {
if (bank==vendorMap[i].bank && code==vendorMap[i].code) {
for (i=0; i < VEN_MAP_SIZE; i++)
{
if (bank==vendorMap[i].bank && code==vendorMap[i].code)
{
return vendorMap[i].name;
}
}
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) {
if(spd[64]==0x7f) {
for (i=64; i<72 && spd[i]==0x7f;i++) {
}
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR)
{
if(spd[64]==0x7f)
{
for (i=64; i<72 && spd[i]==0x7f;i++)
{
bank++;
READ_SPD(spd, base, slot_num, (uint8_t)(i+1)); // prefetch next spd byte to read for next loop
}
READ_SPD(spd, base, slot_num,(uint8_t)i);
code = spd[i];
} else {
code = spd[64];
}
else
{
code = spd[64];
bank = 0;
}
for (i=0; i < VEN_MAP_SIZE; i++) {
if (bank==vendorMap[i].bank && code==vendorMap[i].code) {
for (i=0; i < VEN_MAP_SIZE; i++)
{
if (bank==vendorMap[i].bank && code==vendorMap[i].code)
{
return vendorMap[i].name;
}
}
/* Get Default Memory Module Speed (no overclocking handled) */
int getDDRspeedMhz(const char * spd)
{
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) {
switch(spd[12]) {
case 0x0f:
return 1066;
case 0x0c:
return 1333;
case 0x0a:
return 1600;
case 0x14:
default:
return 800;
}
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) {
switch(spd[9]) {
if ((spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2) || (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR))
{
switch(spd[9])
{
case 0x50:
return 400;
case 0x3d:
return 1066;
}
}
else if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3)
{
switch(spd[12])
{
case 0x0f:
return 1066;
case 0x0c:
return 1333;
case 0x0a:
return 1600;
case 0x14:
default:
return 800;
}
}
return 800; // default freq for unknown types
}
/* Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */
const char *getDDRSerial(const char* spd)
{
static char asciiSerial[16];
static char asciiSerial[17];
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3
if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3
{
snprintf(asciiSerial, sizeof(asciiSerial), "%X%X%X%X%X%X%X%X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
snprintf(asciiSerial, sizeof(asciiSerial), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
}
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) // DDR2 or DDR
else if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR) // DDR2 or DDR
{
snprintf(asciiSerial, sizeof(asciiSerial), "%X%X%X%X%X%X%X%X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
} else {
sprintf(asciiSerial, "000000000000000");
snprintf(asciiSerial, sizeof(asciiSerial), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
}
else
{
sprintf(asciiSerial, "0000000000000000");
}
return strdup(asciiSerial);
}
/* Get DDR3 or DDR2 Part Number, always return a valid ptr */
const char * getDDRPartNum(char* spd, uint32_t base, int slot)
const char *getDDRPartNum(char *spd, uint32_t base, int slot)
{
int i, start = 0, index = 0;
char c;
static char asciiPartNo[32];
int i, start=0, index = 0;
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) {
if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3)
{
start = 128;
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) {
}
else if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR)
{
start = 73;
}
// Check that the spd part name is zero terminated and that it is ascii:
bzero(asciiPartNo, sizeof(asciiPartNo));
char c;
for (i=start; i < start + sizeof(asciiPartNo); i++) {
READ_SPD(spd, base, slot, i); // only read once the corresponding model part (ddr3 or ddr2)
for (i = start; i < start + sizeof(asciiPartNo); i++)
{
READ_SPD(spd, base, slot, (uint8_t)i); // only read once the corresponding model part (ddr3 or ddr2)
c = spd[i];
if (isalpha(c) || isdigit(c) || ispunct(c)) {
if (isalpha(c) || isdigit(c) || ispunct(c))
{
// It seems that System Profiler likes only letters and digits...
asciiPartNo[index++] = c;
} else if (!isascii(c)) {
}
else if (!isascii(c))
{
break;
}
}
int mapping []= {0,2,1,3,4,6,5,7,8,10,9,11};
/* Read from smbus the SPD content and interpret it for detecting memory attributes */
static void read_smb_intel(pci_dt_t *smbus_dev) {
int i, speed;
uint8_t spd_size, spd_type;
uint32_t base, mmio, hostc;
//bool dump = false;
RamSlotInfo_t* slot;
static void read_smb_intel(pci_dt_t *smbus_dev)
{
inti, speed;
uint8_tspd_size, spd_type;
uint32_tbase, mmio, hostc;
uint16_tcmd;
//booldump = false;
RamSlotInfo_t*slot;
uint16_t cmd = pci_config_read16(smbus_dev->dev.addr, 0x04);
cmd = pci_config_read16(smbus_dev->dev.addr, 0x04);
verbose("SMBus CmdReg: 0x%x\n", cmd);
pci_config_write16(smbus_dev->dev.addr, 0x04, cmd | 1);
char spdbuf[MAX_SPD_SIZE];
// Search MAX_RAM_SLOTS slots
for (i = 0; i < MAX_RAM_SLOTS; i++) {
for (i = 0; i < MAX_RAM_SLOTS; i++)
{
slot = &Platform.RAM.DIMM[i];
spd_size = smb_read_byte_intel(base, 0x50 + i, 0);
verbose("SPD[0] (size): %d @0x%x\n", spd_size, 0x50 + i);
// Check spd is present
if (spd_size && (spd_size != 0xff)) {
if (spd_size && (spd_size != 0xff))
{
slot->spd = spdbuf;
slot->InUse = true;
//for (x = 0; x < spd_size; x++) slot->spd[x] = smb_read_byte_intel(base, 0x50 + i, x);
init_spd(slot->spd, base, i);
switch (slot->spd[SPD_MEMORY_TYPE]) {
switch (slot->spd[SPD_MEMORY_TYPE])
{
case SPD_MEMORY_TYPE_SDRAM_DDR:
slot->ModuleSize = (((1 << ((slot->spd[SPD_NUM_ROWS] & 0x0f)
+ (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17)) *
((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) *
slot->spd[SPD_NUM_BANKS_PER_SDRAM])/3)*2;
+ (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17)) *
((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) *
slot->spd[SPD_NUM_BANKS_PER_SDRAM])/3)*2;
break;
case SPD_MEMORY_TYPE_SDRAM_DDR2:
slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1));
break;
default:
slot->ModuleSize = 0;
break;
}
spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0);
slot->Type = spd_mem_to_smbios[spd_type];
if (slot->Type == UNKNOWN_MEM_TYPE) {
if (slot->Type == UNKNOWN_MEM_TYPE)
{
continue;
}
slot->PartNo = getDDRPartNum(slot->spd, base, i);
slot->SerialNo = getDDRSerial(slot->spd);
// determine spd speed
speed = getDDRspeedMhz(slot->spd);
if (slot->Frequency < speed) {
speed = (uint16_t)getDDRspeedMhz(slot->spd);
if (slot->Frequency < speed)
{
slot->Frequency = speed;
}
// pci memory controller if available, is more reliable
if (Platform.RAM.Frequency > 0) {
if (Platform.RAM.Frequency > 0)
{
uint32_t freq = (uint32_t)Platform.RAM.Frequency / 500000;
// now round off special cases
uint32_t fmod100 = freq %100;
switch(fmod100) {
switch(fmod100)
{
case 1:freq--;break;
case 32:freq++;break;
case 65:freq++; break;
slot->Frequency = freq;
}
verbose("Slot: %d Type %d %dMB (%s) %dMHz Vendor=%s\n PartNo=%s SerialNo=%s\n",
i,
(int)slot->Type,
slot->ModuleSize,
spd_memory_types[spd_type],
slot->Frequency,
slot->Vendor,
slot->PartNo,
slot->SerialNo);
slot->InUse = true;
verbose("Slot: %d Type %d %dMB (%s) %dMHz Vendor=%s\n PartNo=%s SerialNo=%s\n",
i,
(int)slot->Type,
slot->ModuleSize,
spd_memory_types[spd_type],
slot->Frequency,
slot->Vendor,
slot->PartNo,
slot->SerialNo);
slot->InUse = true;
}
// laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so:
Platform.DMI.DIMM[i]=
(uint32_t)((i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.CntMemorySlots == 2) ?
mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this
(uint32_t)((i > 0 && Platform.RAM.DIMM[1].InUse == false && fullBanks && Platform.DMI.CntMemorySlots == 2) ? mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this
slot->spd = NULL;
} // for
pci_dt_t*current = pci_dt;
int i;
while (current) {
while (current)
{
#if 0
printf("%02x:%02x.%x [%04x] [%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,
get_pci_dev_path(current));
#endif
for ( i = 0; i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ ) {
if (current->vendor_id == smbus_controllers[i].vendor && current->device_id == smbus_controllers[i].device) {
for ( i = 0; i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ )
{
if (current->vendor_id == smbus_controllers[i].vendor && current->device_id == smbus_controllers[i].device)
{
smbus_controllers[i].read_smb(current); // read smb
return true;
}
branches/Bungo/i386/libsaio/gma.c
5050
5151
5252
53
53
5454
5555
5656
......
397397
398398
399399
400
400
401
402
401403
402404
403405
......
527529
528530
529531
530
532
531533
532534
533535
......
540542
541543
542544
543
545
544546
545547
546548
......
604606
605607
606608
607
608
609
610
611
612
609613
610614
611615
......
717721
718722
719723
720
724
725
726
721727
722728
723729
724730
725
731
726732
727733
728734
#if DEBUG_GMA
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...) msglog(x)
#endif
static booldoit= false;
struct DevPropDevice *device = devprop_add_device(string, devicepath);
if (!device) {
error("[setup_gma_devprop] Failed initializing dev-prop string dev-entry!\n");
pause("");
#if DEBUG_GMA
pause("\n[DEBUG_GMA] ");
#endif
return false;
}
device_id = 0x00000102;// Inject a valid mobile GPU device id instead of patching kexts
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, "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);
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, "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);
default:
error("\nPlease specify 96, 64, or 32MB RAM for the HD4000 in the bios.\n"
"The selected %dMB RAM configuration is not supported for the HD4000.\n", ram);
pause("");
"The selected %dMB RAM configuration is not supported for the HD4000.\n", ram);
#if DEBUG_GMA
pause("\n[DEBUG_GMA] ");
#endif
return false;// Exit early before the AAPL,ig-platform-id property is set.
break;
}
if (!stringdata)
{
error("[setup_gma_devprop] No stringdata!\n");
pause("");
#if DEBUG_GMA
pause("\n[DEBUG_GMA] ");
#endif
return false;
}
verbose("---------------------------------------------\n");
memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
memcpy(stringdata, (uint8_t *)devprop_generate_string(string), string->length);
stringlength = string->length;
return true;
branches/Bungo/i386/libsaio/pci_root.c
5050
5151
5252
53
53
5454
5555
56
57
56
57
58
59
5860
5961
60
61
62
63
64
65
66
67
68
6269
6370
6471
65
66
72
73
74
75
76
77
78
6779
6880
6981
70
82
83
7184
7285
7386
74
87
88
7589
7690
7791
7892
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
98121
99122
100123
......
106129
107130
108131
109
132
110133
111134
112135
113136
114137
115138
116
117
118
139
140
141
119142
120
143
121144
122145
123
146
147
124148
125149
126150
127151
128
129
152
153
154
130155
131156
132157
133158
134159
135
160
136161
137162
138163
139
164
165
166
140167
141168
142169
143170
144171
145
172
173
174
146175
147176
148177
149178
150
179
151180
152
181
153182
154
183
155184
156185
int len = 0;
const char *dsdt_filename = NULL;
//extern int search_and_get_acpi_fd(const char *, const char **);
//extern void *loadACPITable (const char *filename);
//extern void *loadACPITable (const char *filename);
if (rootuid < 10)
return rootuid;
{
return rootuid;
}
rootuid = 0;/* default _UID = 0 */
if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->chameleonConfig) && len) {
if (isdigit(val[0])) rootuid = val[0] - '0';
if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->chameleonConfig) && len)
{
if (isdigit(val[0]))
{
rootuid = val[0] - '0';
}
goto out;
}
/* Chameleon compatibility */
else if (getValueForKey("PciRoot", &val, &len, &bootInfo->chameleonConfig) && len) {
if (isdigit(val[0])) rootuid = val[0] - '0';
else if (getValueForKey("PciRoot", &val, &len, &bootInfo->chameleonConfig) && len)
{
if (isdigit(val[0]))
{
rootuid = val[0] - '0';
}
goto out;
}
/* PCEFI compatibility */
else if (getValueForKey("-pci0", &val, &len, &bootInfo->chameleonConfig) && len) {
else if (getValueForKey("-pci0", &val, &len, &bootInfo->chameleonConfig) && len)
{
rootuid = 0;
goto out;
}
else if (getValueForKey("-pci1", &val, &len, &bootInfo->chameleonConfig) && len) {
else if (getValueForKey("-pci1", &val, &len, &bootInfo->chameleonConfig) && len)
{
rootuid = 1;
goto out;
}
if (new_dsdt != NULL) {
len = *(int *)(new_dsdt + 4);
verbose("PCIrootUID: custom DSDT already loaded @%08X, length=%d.\n", new_dsdt, len);
} else {
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig) && len) {
snprintf(dsdt_dirSpec, sizeof(dsdt_dirSpec), dsdt_filename);
} else {
sprintf(dsdt_dirSpec, "DSDT.aml");
}
verbose("PCIrootUID: attempting to load custom DSDT...\n");
if ((new_dsdt = loadACPITable(dsdt_dirSpec))) {
len = *(int *)(new_dsdt + 4);
verbose("PCIrootUID: custom DSDT loaded @%08X, length=%d\n", new_dsdt, len);
} else {
//verbose("PCIrootUID: custom DSDT not found!.\n");
}
}
if (new_dsdt != NULL)
{
len = *(int *)(new_dsdt + 4);
verbose("PCIrootUID: custom DSDT already loaded @%08X, length=%d.\n", new_dsdt, len);
}
else
{
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig) && len)
{
snprintf(dsdt_dirSpec, sizeof(dsdt_dirSpec), dsdt_filename);
}
else
{
sprintf(dsdt_dirSpec, "DSDT.aml");
}
verbose("PCIrootUID: attempting to load custom DSDT...\n");
if ((new_dsdt = loadACPITable(dsdt_dirSpec)))
{
len = *(int *)(new_dsdt + 4);
verbose("PCIrootUID: custom DSDT loaded @%08X, length=%d\n", new_dsdt, len);
}
else
{
//verbose("PCIrootUID: custom DSDT not found!.\n");
}
}
/*
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig) && len)
sprintf(dsdt_dirSpec, "DSDT.aml");
}
DBG("PCIrootUID: trying file DSDT.aml... ");
DBG("PCIrootUID: trying file DSDT.aml... ");
int fd = search_and_get_acpi_fd(dsdt_dirSpec, &dsdt_filename);
// Check booting partition
if (fd<0)
{
DBG("PCIrootUID: file '%s' not found, using default value.\n", dsdt_filename);
rootuid = 0;
goto out;
DBG("PCIrootUID: file '%s' not found, using default value.\n", dsdt_filename);
rootuid = 0;
goto out;
}
fsize = file_size(fd);
if (!(new_dsdt = malloc(fsize))) {
if (!(new_dsdt = malloc(fsize)))
{
DBG("PCIrootUID: ERROR: allocating DSDT memory failed.\n");
close (fd);
goto out;
}
if (read (fd, new_dsdt, fsize) != fsize) {
if (read (fd, new_dsdt, fsize) != fsize)
{
DBG("PCIrootUID: ERROR: failed reading DSDT from '%s'.\n", dsdt_filename);
free(new_dsdt);
close (fd);
goto out;
}
close (fd);
*/
if (len)
rootuid = findpciroot(new_dsdt, len);
{
rootuid = findpciroot(new_dsdt, len);
}
/*
free(new_dsdt);
*/
// make sure it really works:
if (rootuid == 11)
rootuid = 0; //usually when _UID isn't present, it means uid is zero
{
rootuid = 0; //usually when _UID isn't present, it means uid is zero
}
else if (rootuid < 0 || rootuid > 9)
{
verbose("PCIrootUID: proper value wasn't found. Using default value (0).\n");
rootuid = 0;
return rootuid;
return rootuid;
}
out:
verbose("PCIrootUID=0x%02X: using.\n", rootuid);
verbose("PCIrootUID=0x%02X: using.\n", rootuid);
return rootuid;
}
branches/Bungo/i386/libsaio/device_inject.c
2323
2424
2525
26
27
28
29
30
26
27
28
29
30
3131
3232
3333
......
5555
5656
5757
58
58
59
5960
6061
6162
6263
63
64
65
6466
65
67
68
6669
67
70
6871
6972
7073
......
7376
7477
7578
76
79
80
7781
7882
7983
......
8589
8690
8791
88
89
90
92
93
94
9195
92
96
97
9398
9499
95100
96101
97
102
103
98104
99105
100106
101
107
108
109
102110
103111
104112
......
110118
111119
112120
113
114
121
122
123
124
115125
116126
117127
118
128
129
119130
120
131
132
133
121134
122
135
136
137
123138
124139
125140
......
129144
130145
131146
132
147
148
133149
134
150
151
152
135153
136
154
155
156
137157
138158
139159
......
144164
145165
146166
147
167
168
148169
149170
150171
151172
152173
153174
154
155
156
157
175
176
177
178
158179
159180
160181
161182
162183
163184
164
185
186
165187
166188
167189
......
174196
175197
176198
177
178
199
200
201
202
179203
180204
181205
......
192216
193217
194218
195
219
220
196221
197222
198
199
223
224
200225
201
226
227
202228
203229
204230
205231
206
232
207233
208234
209235
210236
211237
212
238
239
213240
214241
215242
......
218245
219246
220247
221
248
249
222250
223251
224252
225253
226254
227255
228
256
257
229258
230259
231
232
260
261
262
263
264
233265
234266
235267
236268
237269
238
270
239271
240272
241273
242274
243
275
276
244277
245
278
279
280
246281
247282
248283
......
345380
346381
347382
348
349
350
383
384
385
386
387
388
351389
352390
353391
......
370408
371409
372410
373
411
374412
375413
376
414
415
377416
378417
379418
......
381420
382421
383422
384
385
423
424
425
426
386427
387428
388429
......
400441
401442
402443
444
403445
446
447
404448
405449
406450
407451
408452
409453
454
410455
456
411457
458
459
412460
413461
414462
......
420468
421469
422470
423
471
472
424473
425474
426475
427476
428
477
478
429479
430480
431481
432
482
483
433484
434485
435486
#define DBG(x...)msglog(x)
#endif
uint32_t devices_number= 1;
uint32_t builtin_set= 0;
DevPropString *string= 0;
uint8_t *stringdata = 0;
uint32_t stringlength= 0;
uint32_tdevices_number= 1;
uint32_tbuiltin_set= 0;
DevPropString*string= 0;
uint8_t*stringdata= 0;
uint32_tstringlength= 0;
char *efi_inject_get_devprop_string(uint32_t *len)
{
/* Use the static "device-properties" boot config key contents if available,
* otheriwse use the generated one.
*/
if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->chameleonConfig) && string) {
if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->chameleonConfig) && string)
{
val = (const char*)string;
cnt = strlength * 2;
}
if (cnt > 1) {
if (cnt > 1)
{
binStr = convertHexStr2Binary(val, &cnt2);
if (cnt2 > 0) {
if (cnt2 > 0)
{
DT__AddProperty(node, DEVICE_PROPERTIES_PROP, cnt2, binStr);
DBG("Adding device-properties string to DT");
DBG("Adding device-properties string to DT");
}
}
}
{
string = (struct DevPropString *)malloc(sizeof(struct DevPropString));
if(string == NULL) {
if(string == NULL)
{
return NULL;
}
DevPropDevice *devprop_add_device(DevPropString *string, char *path)
{
DevPropDevice*device = NULL;
const charpciroot_string[] = "PciRoot(0x";
const charpci_device_string[] = "Pci(0x";
DevPropDevice*device= NULL;
const charpciroot_string[]= "PciRoot(0x";
const charpci_device_string[]= "Pci(0x";
if (string == NULL || path == NULL) {
if (string == NULL || path == NULL)
{
printf("ERROR null device path\n");
return NULL;
}
if (strncmp(path, pciroot_string, strlen(pciroot_string))) {
if (strncmp(path, pciroot_string, strlen(pciroot_string)))
{
printf("ERROR parsing device path\n");
return NULL;
}
if (!(device = malloc(sizeof(DevPropDevice)))) {
if (!(device = malloc(sizeof(DevPropDevice))))
{
printf("ERROR malloc failed\n");
return NULL;
}
intx, curr = 0;
charbuff[] = "00";
for (x = 0; x < strlen(path); x++) {
if (!strncmp(&path[x], pci_device_string, strlen(pci_device_string))) {
for (x = 0; x < strlen(path); x++)
{
if (!strncmp(&path[x], pci_device_string, strlen(pci_device_string)))
{
x+=strlen(pci_device_string);
curr=x;
while(path[++x] != ',');
if(x-curr == 2) {
if(x-curr == 2)
{
sprintf(buff, "%c%c", path[curr], path[curr+1]);
} else if(x-curr == 1) {
}
else if(x-curr == 1)
{
sprintf(buff, "%c", path[curr]);
} else {
}
else
{
printf("ERROR parsing device path\n");
numpaths = 0;
break;
x += 3; // 0x
curr = x;
while(path[++x] != ')');
if(x-curr == 2) {
if(x-curr == 2)
{
sprintf(buff, "%c%c", path[curr], path[curr+1]);
} else if(x-curr == 1) {
}
else if(x-curr == 1)
{
sprintf(buff, "%c", path[curr]);
} else {
}
else
{
printf("ERROR parsing device path\n");
numpaths = 0;
break;
}
}
if(!numpaths) {
if(!numpaths)
{
free(device);
return NULL;
}
device->numentries = 0x00;
device->acpi_dev_path.length = 0x0c;
device->acpi_dev_path.type = 0x02;
device->acpi_dev_path.subtype = 0x01;
device->acpi_dev_path._HID = 0xd041030a;
device->acpi_dev_path.length= 0x0c;
device->acpi_dev_path.type= 0x02;
device->acpi_dev_path.subtype= 0x01;
device->acpi_dev_path._HID= 0xd041030a;
device->num_pci_devpaths = numpaths;
device->length = 24 + (6*numpaths);
inti;
for(i = 0; i < numpaths; i++) {
for(i = 0; i < numpaths; i++)
{
device->pci_dev_path[i].length = 0x06;
device->pci_dev_path[i].type = 0x01;
device->pci_dev_path[i].subtype = 0x01;
device->string = string;
device->data = NULL;
if(!string->entries) {
if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES))) {
if(!string->entries)
{
if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES)))
{
free(device);
return NULL;
}
int devprop_add_value(DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len)
{
if(!nm || !vl || !len) {
if(!nm || !vl || !len)
{
return 0;
}
uint32_t length = ((strlen(nm) * 2) + len + (2 * sizeof(uint32_t)) + 2);
uint8_t *data = (uint8_t*)malloc(length);
uint32_t length= ((strlen(nm) * 2) + len + (2 * sizeof(uint32_t)) + 2);
uint8_t *data= (uint8_t*)malloc(length);
if(!data) {
if(!data)
{
return 0;
}
memset(data, 0, length);
uint32_t off= 0;
uint32_t off = 0;
data[off+1] = ((strlen(nm) * 2) + 6) >> 8;
data[off] = ((strlen(nm) * 2) + 6) & 0x00FF;
off += 4;
uint32_t i=0, l = strlen(nm);
for(i = 0 ; i < l ; i++, off += 2) {
for(i = 0 ; i < l ; i++, off += 2)
{
data[off] = *nm++;
}
uint32_t *datalength = (uint32_t*)&data[off];
*datalength = (uint32_t)(l + 4);
off += 4;
for(i = 0 ; i < l ; i++, off++) {
for(i = 0 ; i < l ; i++, off++)
{
data[off] = *vl++;
}
uint32_t offset = device->length - (24 + (6 * device->num_pci_devpaths));
uint8_t *newdata = (uint8_t*)malloc((length + offset));
if(!newdata) {
if(!newdata)
{
return 0;
}
if(device->data) {
if(offset > 1) {
if(device->data)
{
if(offset > 1)
{
memcpy(newdata, device->data, offset);
}
}
memcpy(newdata + offset, data, length);
device->length += length;
device->string->length += length;
device->numentries++;
if(!device->data) {
if(!device->data)
{
device->data = (uint8_t*)malloc(sizeof(uint8_t));
} else {
}
else
{
free(device->data);
}
}
int i;
for(i = 0; i < string->numentries; i++) {
if(string->entries[i]) {
if(string->entries[i]->data) {
for(i = 0; i < string->numentries; i++)
{
if(string->entries[i])
{
if(string->entries[i]->data)
{
free(string->entries[i]->data);
string->entries[i]->data = NULL;
}
int hex2bin(const char *hex, uint8_t *bin, int len)
{
char*p;
int i;
inti;
charbuf[3];
if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) {
if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2)
{
printf("[ERROR] bin2hex input error\n");
return -1;
}
buf[2] = '\0';
p = (char *) hex;
for (i = 0; i < len; i++) {
if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1])) {
for (i = 0; i < len; i++)
{
if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1]))
{
printf("[ERROR] bin2hex '%s' syntax error\n", hex);
return -2;
}
int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id)
{
if(!device)
{
return 0;
}
uint8_t builtin = 0x0;
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;
}
verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath);
if(!string) {
if(!string)
{
string = devprop_create_string();
}
device = devprop_add_device(string, devicepath);
if(device) {
if(device)
{
verbose("Setting up lan keys\n");
devprop_add_network_template(device, eth_dev->vendor_id);
stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length);
if(stringdata) {
if(stringdata)
{
memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
stringlength = string->length;
}
branches/Bungo/i386/libsaio/fdisk.h
3535
3636
3737
38
39
40
38
39
40
4141
42
42
4343
4444
4545
46
46
4747
48
4849
49
50
51
52
53
54
55
56
50
51
52
53
54
55
56
57
5758
5859
5960
60
61
6162
6263
6364
64
65
66
65
66
67
6768
6869
6970
#ifndef __LIBSAIO_FDISK_H
#define __LIBSAIO_FDISK_H
#define DISK_BLK0 0 /* blkno of boot block */
#define DISK_BLK0SZ 512 /* size of boot block */
#define DISK_BOOTSZ 446 /* size of boot code in boot block */
#define DISK_BLK00 /* blkno of boot block */
#define DISK_BLK0SZ512 /* size of boot block */
#define DISK_BOOTSZ446 /* size of boot code in boot block */
#define DISK_SIGNATURE0xAA55/* signature of the boot record */
#define FDISK_NPART 4 /* number of entries in fdisk table */
#define FDISK_NPART4 /* number of entries in fdisk table */
#define FDISK_ACTIVE0x80/* indicator of active partition */
#define FDISK_DOS12 0x01/* 12-bit fat < 10MB dos partition */
#define FDISK_DOS120x01/* 12-bit fat < 10MB dos partition */
#define FDISK_DOS16S0x04/* 16-bit fat < 32MB dos partition */
#define FDISK_DOSEXT0x05/* extended DOS partition */
#define FDISK_DOS16B0x06/* 16-bit fat >= 32MB dos partition */
#define FDISK_NTFS 0x07/* NTFS partition */
#define FDISK_DOS32 0x0B/* DOS FAT32 partition */
#define FDISK_FAT32 0x0C/* Win FAT32 partition */
#define FDISK_FAT16 0x0E /* Win 16-bit FAT, LBA-mapped */
#define FDISK_WIN_LDM 0x42/* NTFS partition */
#define FDISK_LINUX_SWAP 0x82 /* Linux swap */
#define FDISK_LINUX 0x83 /* Linux native */
#define FDISK_LINUX_LVM 0x8E /* Linux LVM */
#define FDISK_NTFS0x07/* NTFS partition */
#define FDISK_DOS320x0B/* DOS FAT32 partition */
#define FDISK_FAT320x0C/* Win FAT32 partition */
#define FDISK_FAT160x0E /* Win 16-bit FAT, LBA-mapped */
#define FDISK_WIN_LDM0x42/* NTFS partition */
#define FDISK_LINUX_SWAP0x82 /* Linux swap */
#define FDISK_LINUX0x83 /* Linux native */
#define FDISK_LINUX_LVM0x8E /* Linux LVM */
#define FDISK_FREEBSD0xA5 /* FreeBSD UFS2 partition */
#define FDISK_OPENBSD0xA6 /* OpenBSD FFS partition */
#define FDISK_NEXTNAME0xA7/* Indicator of NeXT partition */
#define FDISK_UFS 0xA8/* Apple UFS partition */
#define FDISK_UFS0xA8/* Apple UFS partition */
#define FDISK_NETBSD0xA9 /* NetBSD disk label */
#define FDISK_BOOTER0xAB/* Apple booter partition */
#define FDISK_ENCRYPTED0xAE/* Apple encrypted */
#define FDISK_HFS 0xAF/* Apple HFS partition */
#define FDISK_BEFS 0xEB /* Haiku BeFS partition */
#define FDISK_LINUX_RAID 0xFD /* Linux RAID */
#define FDISK_HFS0xAF/* Apple HFS partition */
#define FDISK_BEFS0xEB /* Haiku BeFS partition */
#define FDISK_LINUX_RAID0xFD /* Linux RAID */
#define FDISK_PSEUDO_EXFAT0x107/* Shared with FDISK_NTFS */
/*
branches/Bungo/i386/libsaio/nvidia.c
7777
7878
7979
80
80
8181
8282
8383
#define WRITE_LE_SHORT(data) (((data) << 8 & 0xff00) | ((data) >> 8 & 0x00ff ))
#define WRITE_LE_INT(data) (WRITE_LE_SHORT(data) << 16 | WRITE_LE_SHORT(data >> 16))
static bool showGeneric = false;
static boolshowGeneric= false;
static booldoit= false;
char generic_name[128];
extern uint32_t devices_number;
branches/Bungo/i386/libsaio/ntfs.c
3131
3232
3333
34
34
3535
3636
3737
38
38
3939
4040
4141
4242
4343
44
45
44
45
4646
47
48
49
47
48
49
5050
51
51
5252
5353
5454
5555
5656
57
58
59
60
57
58
59
60
61
62
6163
6264
6365
......
104106
105107
106108
107
108
109
110
109
110
111
112
113
111114
112115
113116
......
160163
161164
162165
163
166
164167
165168
166169
......
184187
185188
186189
187
190
188191
189192
190193
......
290293
291294
292295
293
296
294297
295298
296299
......
313316
314317
315318
319
316320
317321
318322
......
329333
330334
331335
336
332337
333
338
334339
335340
336341
337342
338343
344
339345
340346
341347
342348
343349
344350
345
351
346352
347353
348354
349355
350356
351
357
358
352359
353360
354361
*/
//#include "exfat.h"
#define BYTE_ORDER_MARK 0xFEFF
#define BYTE_ORDER_MARK0xFEFF
#include "ntfs_private.h"
#define FS_TYPE "ntfs"
#define FS_TYPE"ntfs"
#define FS_NAME_FILE"NTFS"
#define MAX_BLOCK_SIZE2048
#define MAX_CLUSTER_SIZE32768
#define LABEL_LENGTH 1024
#define UNKNOWN_LABEL "Untitled NTFS"
#define LABEL_LENGTH1024
#define UNKNOWN_LABEL"Untitled NTFS"
#define FSUR_IO_FAIL -1
#define FSUR_UNRECOGNIZED -1
#define FSUR_RECOGNIZED 0
#define FSUR_IO_FAIL-1
#define FSUR_UNRECOGNIZED-1
#define FSUR_RECOGNIZED0
#define ERROR -1
#define ERROR-1
/*
* Process per-sector "fixups" that NTFS uses to detect corruption of
* multi-sector data structures, like MFT records.
*/
static int ntfs_fixup(char *buf,
size_t len,
u_int32_t magic,
u_int32_t bytesPerSector)
static int
ntfs_fixup(
char *buf,
size_t len,
u_int32_t magic,
u_int32_t bytesPerSector)
{
struct fixuphdr *fhp = (struct fixuphdr *) buf;
int i;
* Find a resident attribute of a given type. Returns a pointer to the
* attribute data, and its size in bytes.
*/
static int ntfs_find_attr(char *buf,
u_int32_t attrType,
void **attrData,
size_t *attrSize)
static int ntfs_find_attr(
char *buf,
u_int32_t attrType,
void **attrData,
size_t *attrSize)
{
struct filerec *filerec;
struct attr *attr;
buf = (char *)malloc(MAX_CLUSTER_SIZE);
if (buf == 0)
{
verbose("NTFS: can't allocate memory [%d] for buffer, exiting.\n", MAX_CLUSTER_SIZE);
verbose("NTFS: can't allocate memory [%d] for buffer, exiting.\n", MAX_CLUSTER_SIZE);
goto error;
}
*/
if (boot->reserved1[0] != 0xE9 && (boot->reserved1[0] != 0xEB || boot->reserved1[2] != 0x90))
{
verbose("NTFS: wrong jpm instruction [%02X %02X %02X], exiting.\n", boot->reserved1[0], boot->reserved1[1], boot->reserved1[2]);
verbose("NTFS: wrong jpm instruction [%02X %02X %02X], exiting.\n", boot->reserved1[0], boot->reserved1[1], boot->reserved1[2]);
goto error;
}
str[0] = '\0';
utf_encodestr( nameAttr, nameSize / 2, (u_int8_t *)str, strMaxLen, OSLittleEndian );
//verbose("NTFS: label=%s\n", str);
//verbose("NTFS: label=%s\n", str);
free(buf);
return;
{
return -1;
}
bzero(buf,MAX_BLOCK_SIZE);
/*
* Read the boot sector, check signatures, and do some minimal
if ( memcmp((void*)boot->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) != 0 )
{
// If not NTFS, maybe it is EXFAT
free(buf);
//return EXFATGetUUID(ih, uuidStr);
return -1;
return -1;
}
// Check for non-null volume serial number
if( !boot->bf_volsn )
{
free(buf);
return -1;
}
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X",(unsigned short)(boot->bf_volsn >> 16) & 0xFFFF, (unsigned short)boot->bf_volsn & 0xFFFF);
//verbose("NTFSGetUUID: %x:%x = %s\n", ih->biosdev, ih->part_no, uuidStr);
//verbose("NTFSGetUUID: %x:%x = %s\n", ih->biosdev, ih->part_no, uuidStr);
return 0;
}
bool NTFSProbe(const void *buffer)
{
bool result = false;
bool result = false;
const struct bootfile *part_bootfile = buffer;// NTFS boot sector structure
// Looking for NTFS signature.
branches/Bungo/i386/libsaio/ati.c
17061706
17071707
17081708
1709
1710
1709
1710
17111711
1712
1713
1714
1715
1716
1717
1718
1719
1712
1713
1714
1715
1716
1717
1718
1719
17201720
1721
1722
1723
1724
1725
1726
1727
1721
1722
1723
1724
1725
1726
1727
17281728
1729
1730
1731
1729
1730
1731
17321732
1733
1733
17341734
1735
1736
1737
1738
1739
1735
1736
1737
1738
1739
17401740
1741
1741
17421742
17431743
17441744
......
18671867
18681868
18691869
1870
1870
18711871
18721872
18731873
};
dev_prop_t ati_devprop_list[] = {
{FLAGTRUE,false,"@0,AAPL,boot-display",get_bootdisplay_val,NULVAL},
//{FLAGTRUE,false,"@0,ATY,EFIDisplay",NULL,STRVAL("TMDSA")},
{FLAGTRUE,false,"@0,AAPL,boot-display",get_bootdisplay_val,NULVAL},
//{FLAGTRUE,false,"@0,ATY,EFIDisplay",NULL,STRVAL("TMDSA")},
//{FLAGTRUE,true,"@0,AAPL,vram-memory",get_vrammemory_val,NULVAL},
//{FLAGTRUE,true,"@0,compatible",get_name_val,NULVAL},
//{FLAGTRUE,true,"@0,connector-type",get_conntype_val,NULVAL},
//{FLAGTRUE,true,"@0,device_type",NULL,STRVAL("display")},
//{FLAGTRUE,false,"@0,display-connect-flags", NULL,DWRVAL((uint32_t)0)},
//{FLAGTRUE,true,"@0,display-type",NULL,STRVAL("NONE")},
{FLAGTRUE,true,"@0,name",get_name_val,NULVAL},
//{FLAGTRUE,true,"@0,VRAM,memsize",get_vrammemsize_val,NULVAL},
//{FLAGTRUE,true,"@0,AAPL,vram-memory",get_vrammemory_val,NULVAL},
//{FLAGTRUE,true,"@0,compatible",get_name_val,NULVAL},
//{FLAGTRUE,true,"@0,connector-type",get_conntype_val,NULVAL},
//{FLAGTRUE,true,"@0,device_type",NULL,STRVAL("display")},
//{FLAGTRUE,false,"@0,display-connect-flags",NULL,DWRVAL((uint32_t)0)},
//{FLAGTRUE,true,"@0,display-type",NULL,STRVAL("NONE")},
{FLAGTRUE,true,"@0,name",get_name_val,NULVAL},
//{FLAGTRUE,true,"@0,VRAM,memsize",get_vrammemsize_val,NULVAL},
//{FLAGTRUE,false,"AAPL,aux-power-connected",NULL,DWRVAL((uint32_t)1)},
//{FLAGTRUE,false,"AAPL,backlight-control",NULL,DWRVAL((uint32_t)0)},
{FLAGTRUE,false,"ATY,bin_image",get_binimage_val,NULVAL},
{FLAGTRUE,false,"ATY,Copyright",NULL,STRVAL("Copyright AMD Inc. All Rights Reserved. 2005-2010") },
{FLAGTRUE,false,"ATY,Card#",get_romrevision_val,NULVAL},
{FLAGTRUE,false,"ATY,VendorID",NULL,WRDVAL((uint16_t)0x1002)},
{FLAGTRUE,false,"ATY,DeviceID",get_deviceid_val,NULVAL},
//{FLAGTRUE,false,"AAPL,aux-power-connected",NULL,DWRVAL((uint32_t)1)},
//{FLAGTRUE,false,"AAPL,backlight-control",NULL,DWRVAL((uint32_t)0)},
{FLAGTRUE,false,"ATY,bin_image",get_binimage_val,NULVAL},
{FLAGTRUE,false,"ATY,Copyright",NULL,STRVAL("Copyright AMD Inc. All Rights Reserved. 2005-2010") },
{FLAGTRUE,false,"ATY,Card#",get_romrevision_val,NULVAL},
{FLAGTRUE,false,"ATY,VendorID",NULL,WRDVAL((uint16_t)0x1002)},
{FLAGTRUE,false,"ATY,DeviceID",get_deviceid_val,NULVAL},
//{FLAGTRUE,false,"ATY,MCLK",get_mclk_val,NULVAL},
//{FLAGTRUE,false,"ATY,SCLK",get_sclk_val,NULVAL},
//{FLAGTRUE,false,"ATY,RefCLK",get_refclk_val,DWRVAL((uint32_t)0x0a8c)},
//{FLAGTRUE,false,"ATY,MCLK",get_mclk_val,NULVAL},
//{FLAGTRUE,false,"ATY,SCLK",get_sclk_val,NULVAL},
//{FLAGTRUE,false,"ATY,RefCLK",get_refclk_val,DWRVAL((uint32_t)0x0a8c)},
//{FLAGTRUE,false,"ATY,PlatformInfo",get_platforminfo_val,NULVAL},
//{FLAGTRUE,false,"ATY,PlatformInfo",get_platforminfo_val,NULVAL},
{FLAGTRUE,false,"name",get_nameparent_val,NULVAL},
{FLAGTRUE,false,"device_type",get_nameparent_val,NULVAL},
{FLAGTRUE,false,"model",get_model_val,STRVAL("ATI Radeon")},
//{FLAGTRUE,false,"VRAM,totalsize",get_vramtotalsize_val,NULVAL},
{FLAGTRUE,false,"hda-gfx",get_hdmiaudio,NULVAL},
{FLAGTRUE,false,"name",get_nameparent_val,NULVAL},
{FLAGTRUE,false,"device_type",get_nameparent_val,NULVAL},
{FLAGTRUE,false,"model",get_model_val,STRVAL("ATI Radeon")},
//{FLAGTRUE,false,"VRAM,totalsize",get_vramtotalsize_val,NULVAL},
{FLAGTRUE,false,"hda-gfx",get_hdmiaudio,NULVAL},
{FLAGTRUE,false,NULL,NULL,NULVAL}
{FLAGTRUE,false,NULL,NULL,NULVAL}
};
bool get_hdmiaudio(value_t * val)
val->type = kPtr;
val->size = strlen((char *)rev);
val->data = malloc(val->size);
if (!val->data)
{
return false;
branches/Bungo/i386/libsaio/sys.c
130130
131131
132132
133
134
135
133
134
135
136136
137137
138138
139
139
140140
141
142
141
142
143143
144
144
145145
146
146
147147
148
148
149149
150
150
151151
152152
153153
154154
155
156
155
156
157157
158158
159159
......
208208
209209
210210
211
211
212212
213213
214214
215215
216216
217217
218
218
219219
220220
221221
......
291291
292292
293293
294
295
296
297
298
294
295
296
297
298
299299
300
300
301301
302
303
304
305
306
302
303
304
305
306
307307
308
309
310
311
308
309
310
311
312312
313313
314
314
315315
316316
317317
......
359359
360360
361361
362
362
363363
364
364
365365
366
367
366
367
368368
369369
370370
......
375375
376376
377377
378
379
380
381
382
383
378
379
380
381
382
383
384384
385
385
386386
387387
388388
389389
390
390
391391
392392
393393
......
472472
473473
474474
475
475
476476
477477
478478
......
485485
486486
487487
488
488
489489
490
490
491491
492492
493493
......
504504
505505
506506
507
508
507
508
509509
510
511
512
510
511
512
513513
514
515
514
515
516516
517
518
519
517
518
519
520520
521
521
522522
523523
524524
......
581581
582582
583583
584
585
586
587
588
589
590
584
585
586
587
588
589
590
591591
592592
593593
......
639639
640640
641641
642
642
643643
644644
645645
......
662662
663663
664664
665
665
666666
667667
668668
......
695695
696696
697697
698
698
699699
700
700
701701
702702
703703
......
730730
731731
732732
733
733
734734
735735
736
736
737737
738738
739
739
740740
741741
742
742
743743
744
744
745745
746
746
747747
748748
749749
......
751751
752752
753753
754
755
756
754
755
756
757757
758
758
759759
760760
761
761
762762
763
763
764764
765765
766766
......
769769
770770
771771
772
772
773773
774774
775
775
776776
777777
778
778
779779
780
780
781781
782
782
783783
784784
785785
......
801801
802802
803803
804
804
805805
806
806
807807
808
808
809809
810810
811811
......
832832
833833
834834
835
836
835
836
837837
838
839
840
838
839
840
841841
842
843
844
842
843
844
845845
846
846
847847
848848
849849
850850
851
852
853
851
852
853
854854
855855
856856
857857
858
858
859859
860860
861861
......
867867
868868
869869
870
870
871871
872872
873873
......
894894
895895
896896
897
897
898898
899899
900900
......
907907
908908
909909
910
910
911911
912912
913913
......
954954
955955
956956
957
958
959
960
961
957
958
959
960
961
962
963
962964
963965
964966
965967
966968
967
969
968970
969971
970972
971973
972974
973975
974
975
976
977
976978
977979
978980
......
991993
992994
993995
994
995
996
997
996998
997999
9981000
9991001
10001002
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
10271032
10281033
10291034
......
10371042
10381043
10391044
1045
10401046
1041
1042
1047
10431048
10441049
10451050
......
10821087
10831088
10841089
1085
1090
10861091
10871092
1088
1093
10891094
10901095
10911096
......
11391144
11401145
11411146
1142
1143
1144
1147
1148
1149
11451150
1146
1151
11471152
11481153
11491154
......
11891194
11901195
11911196
1192
1197
11931198
11941199
11951200
......
12011206
12021207
12031208
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
12091214
12101215
12111216
......
12301235
12311236
12321237
1233
1238
12341239
12351240
12361241
......
12941299
12951300
12961301
1297
1302
12981303
12991304
13001305
......
13291334
13301335
13311336
1332
1337
13331338
13341339
13351340
......
13451350
13461351
13471352
1348
1353
13491354
13501355
13511356
//==========================================================================
// LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION.
// Load the specified file from the specified volume
// to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
// Load the specified file from the specified volume
// to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
long LoadVolumeFile(BVRef bvr, const char *filePath)
{
long fileSize;
long fileSize;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
gFSLoadAddress = (void *) LOAD_ADDR;
fileSize = bvr->fs_loadfile(bvr, (char *)filePath);
fileSize = bvr->fs_loadfile(bvr, (char *)filePath);
// Return the size of the file, or -1 if load failed.
// Return the size of the file, or -1 if load failed.
return fileSize;
return fileSize;
}
//==========================================================================
// LoadFile - LOW-LEVEL FILESYSTEM FUNCTION.
// Load the specified file to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
// Load the specified file to the load buffer at LOAD_ADDR.
// If the file is fat, load only the i386 portion.
long LoadFile(const char * fileSpec)
{
}
*binary = (void *)kLoadAddr;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
readFile = bvr->fs_readfile;
if (readFile != NULL)
{
// Read the first 4096 bytes (fat header)
long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr)
{
unsigned fmtbase, fmtidx, i;
uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 };
char *p = uuidStr;
MD5_CTX md5c;
uint8_t mdresult[16];
unsignedfmtbase, fmtidx, i;
uint8_tuuidfmt[] = { 4, 2, 2, 2, 6 };
char*p = uuidStr;
MD5_CTXmd5c;
uint8_tmdresult[16];
bzero(mdresult, sizeof(mdresult));
bzero(mdresult, sizeof(mdresult));
// just like AppleFileSystemDriver
MD5Init(&md5c);
MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1));
MD5Update(&md5c, uubytes, nbytes);
MD5Final(mdresult, &md5c);
// just like AppleFileSystemDriver
MD5Init(&md5c);
MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1));
MD5Update(&md5c, uubytes, nbytes);
MD5Final(mdresult, &md5c);
// this UUID has been made version 3 style (i.e. via namespace)
// see "-uuid-urn-" IETF draft (which otherwise copies byte for byte)
mdresult[6] = 0x30 | ( mdresult[6] & 0x0F );
mdresult[8] = 0x80 | ( mdresult[8] & 0x3F );
// this UUID has been made version 3 style (i.e. via namespace)
// see "-uuid-urn-" IETF draft (which otherwise copies byte for byte)
mdresult[6] = 0x30 | ( mdresult[6] & 0x0F );
mdresult[8] = 0x80 | ( mdresult[8] & 0x3F );
// generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292
// generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292
i = 0;
fmtbase = 0;
//==========================================================================
// GetDirEntry - LOW-LEVEL FILESYSTEM FUNCTION.
// Fetch the next directory entry for the given directory.
// Fetch the next directory entry for the given directory.
long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name, long *flags, u_int32_t *time)
long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, long * flags, u_int32_t * time)
{
const char *dirPath;
BVRef bvr;
const char*dirPath;
BVRefbvr;
// Resolve the boot volume from the dir spec.
if (bvr->fs_getdirentry)
{
// Returns 0 on success or -1 when there are no additional entries.
return bvr->fs_getdirentry( bvr,
/* dirPath */ (char *)dirPath,
/* dirIndex */ dirIndex,
/* dirEntry */ (char **)name, flags, time, 0, 0 );
}
// Returns 0 on success or -1 when there are no additional entries.
return bvr->fs_getdirentry( bvr,
/* dirPath */ (char *)dirPath,
/* dirIndex */ dirIndex,
/* dirEntry */ (char **)name, flags, time, 0, 0 );
}
return -1;
return -1;
}
//==========================================================================
// GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION.
// Get attributes for the specified file.
// Get attributes for the specified file.
static char *gMakeDirSpec;
if (iob[fd].i_flgs == 0)
{
return fd;
}
}
}
stop("Out of file descriptors");
// not reached
// Return a pointer to an allocated 'iob' based on the file descriptor
// provided. Returns NULL if the file descriptor given is invalid.
static struct iob *iob_from_fdesc(int fdesc)
static struct iob * iob_from_fdesc(int fdesc)
{
register struct iob *io;
register struct iob * io;
if (fdesc < 0 || fdesc >= NFILES || ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0)
{
int openmem(char *buf, int len)
{
int fdesc;
struct iob *io;
int fdesc;
struct iob *io;
fdesc = GetFreeFd();
io = &iob[fdesc];
bzero(io, sizeof(*io));
fdesc = GetFreeFd();
io = &iob[fdesc];
bzero(io, sizeof(*io));
// Mark the descriptor as taken. Set the F_MEM flag to indicate
// that the file buffer is provided by the caller.
// Mark the descriptor as taken. Set the F_MEM flag to indicate
// that the file buffer is provided by the caller.
io->i_flgs = F_ALLOC | F_MEM;
io->i_buf = buf;
io->i_filesize = len;
io->i_flgs = F_ALLOC | F_MEM;
io->i_buf = buf;
io->i_filesize = len;
return fdesc;
return fdesc;
}
//==========================================================================
//==========================================================================
int open_bvdev(const char *bvd, const char *path, int flags)
{
const struct devsw*dp;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
const struct devsw*dp;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
if ((i = open(path, flags)) >= 0)
{
return open_bvr(bvr, path, flags);
}
}
}
return -1;
}
//==========================================================================
// lseek() - Reposition the byte offset of the file descriptor from the
// beginning of the file. Returns the relocated offset.
// beginning of the file. Returns the relocated offset.
int b_lseek(int fdesc, int offset, int ptr)
{
//==========================================================================
// read() - Read up to 'count' bytes of data from the file descriptor
// into the buffer pointed to by buf.
// into the buffer pointed to by buf.
int read(int fdesc, char *buf, int count)
int read(int fdesc, char * buf, int count)
{
struct iob * io;
int write(int fdesc, const char * buf, int count)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + count) > (unsigned int)io->i_filesize)
count = io->i_filesize - io->i_offset;
if (count <= 0)
return 0; // end of file
bcopy(buf, io->i_buf + io->i_offset, count);
io->i_offset += count;
return count;
}
int writebyte(int fdesc, char value)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + 1) > (unsigned int)io->i_filesize)
return 0; // end of file
io->i_buf[io->i_offset++] = value;
return 1;
}
int writeint(int fdesc, int value)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + 4) > (unsigned int)io->i_filesize)
return 0; // end of file
bcopy(&value, io->i_buf + io->i_offset, 4);
io->i_offset += 4;
return 4;
}
//==========================================================================
struct dirstuff *vol_opendir(BVRef bvr, const char *path)
struct dirstuff * vol_opendir(BVRef bvr, const char * path)
{
struct dirstuff *dirp = 0;
struct dirstuff * dirp = 0;
dirp = (struct dirstuff *)malloc(sizeof(struct dirstuff));
dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
const char *dirPath;
BVRef bvr;
if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL)
goto error;
if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL)
goto error;
dirp = (struct dirstuff *)malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
dirp = (struct dirstuff *)malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
dirp->dir_path = newString(dirPath);
if (dirp->dir_path == NULL)
goto error;
dirp->dir_path = newString(dirPath);
if (dirp->dir_path == NULL)
goto error;
dirp->dir_bvr = bvr;
dirp->dir_bvr = bvr;
return dirp;
error:
closedir(dirp);
return NULL;
closedir(dirp);
return NULL;
}
//==========================================================================
int closedir(struct dirstuff *dirp)
int closedir(struct dirstuff * dirp)
{
if (dirp)
{
free(dirp);
}
return 0;
return 0;
}
//==========================================================================
//==========================================================================
const char *systemConfigDir()
const char * systemConfigDir()
{
if (gBootFileType == kNetworkDeviceType)
{
int gBootFileType;
void scanBootVolumes(int biosdev, int *count)
void scanBootVolumes(int biosdev, int * count)
{
BVRef bvr = 0;
BVRef selectBootVolume(BVRef chain)
{
bool filteredChain = false, foundPrimary = false;
BVRef bvr, bvr1 = NULL, bvr2 = NULL;
char dirSpec[] = "hd(%d,%d)/", fileSpec[] = "Volumes", *label;
u_int32_t time, lasttime = 0;
long flags;
bool filteredChain = false;
bool foundPrimary = false;
BVRef bvr, bvr1 = NULL;
BVRef bvr2 = NULL;
char dirSpec[] = "hd(%d,%d)/", fileSpec[] = "Volumes", *label;
u_int32_t time, lasttime = 0;
long flags;
if (chain->filtered)
{
filteredChain = true;
}
if (multiboot_partition_set)
{
for ( bvr = chain; bvr; bvr = bvr->next )
{
if ( (bvr->part_no == multiboot_partition) && (bvr->biosdev == gBIOSDev) )
{
label = bvr->label[0] ? bvr->label : (bvr->altlabel[0] ? bvr->altlabel : (bvr->name[0] ? bvr->name : "Untitled"));
verbose("Multiboot partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
label = bvr->label[0] ? bvr->label : (bvr->altlabel[0] ? bvr->altlabel : (bvr->name[0] ? bvr->name : "Untitled"));
verbose("Multiboot partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
return bvr;
}
}
if (matchVolumeToString(bvr, val, false))
{
free(val);
label = bvr->label[0] ? bvr->label : (bvr->altlabel[0] ? bvr->altlabel : (bvr->name[0] ? bvr->name : "Untitled"));
verbose("User default partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
label = bvr->label[0] ? bvr->label : (bvr->altlabel[0] ? bvr->altlabel : (bvr->name[0] ? bvr->name : "Untitled"));
verbose("User default partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
return bvr;
}
}
free(val);
}
// Bungo: select last booted partition as the boot volume
// TODO: support other OSes (foreign boot)
for (bvr = chain; bvr; bvr = bvr->next) {
if (bvr->flags & (kBVFlagSystemVolume | kBVFlagForeignBoot)) {
time = 0;
flags = 0;
sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no);
if ((GetFileInfo(dirSpec, fileSpec, &flags, &time) == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
if (time > lasttime) {
lasttime = time;
bvr1 = bvr;
label = bvr1->label[0] ? bvr1->label : (bvr1->altlabel[0] ? bvr1->altlabel : (bvr1->name[0] ? bvr1->name : "Untitled"));
}
}
}
}
if (bvr1) {
verbose("Last booted volume: hd(%d,%d) '%s' set as default partition\n\n", BIOS_DEV_UNIT(bvr1), bvr1->part_no, label);
return bvr1;
}
// Bungo: code below selects first partition in the chain (last partition on disk),
// in my case Recovery HD, as boot volume, so I would prefer last booted partition
// as default boot volume - see the code above
// Bungo: select last booted partition as the boot volume
// TODO: support other OSes (foreign boot)
for (bvr = chain; bvr; bvr = bvr->next) {
if (bvr->flags & (kBVFlagSystemVolume | kBVFlagForeignBoot))
{
time = 0;
flags = 0;
sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no);
if ((GetFileInfo(dirSpec, fileSpec, &flags, &time) == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory))
{
if (time > lasttime)
{
lasttime = time;
bvr1 = bvr;
label = bvr1->label[0] ? bvr1->label : (bvr1->altlabel[0] ? bvr1->altlabel : (bvr1->name[0] ? bvr1->name : "Untitled"));
}
}
}
}
if (bvr1)
{
verbose("Last booted volume: hd(%d,%d) '%s' set as default partition\n\n", BIOS_DEV_UNIT(bvr1), bvr1->part_no, label);
return bvr1;
}
// Bungo: code below selects first partition in the chain (last partition on disk),
// in my case Recovery HD, as boot volume, so I would prefer last booted partition
// as default boot volume - see the code above
/*
* Scannig the volume chain backwards and trying to find
* a HFS+ volume with valid boot record signature.
if (bvr->part_no == multiboot_skip_partition)
{
continue;
}
}
}
if ( (bvr->flags & kBVFlagPrimary) && (bvr->biosdev == gBIOSDev) )
{
foundPrimary = true;
}
}
}
bvr = bvr2 ? bvr2 : (bvr1 ? bvr1 : chain);
label = bvr->label[0] ? bvr->label : (bvr->altlabel[0] ? bvr->altlabel : (bvr->name[0] ? bvr->name : "Untitled"));
verbose("Default partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
verbose("Default partition set: hd(%d,%d) '%s'\n", BIOS_DEV_UNIT(bvr), bvr->part_no, label);
return bvr;
}
*/
BVRef getBootVolumeRef(const char *path, const char **outPath)
{
const char *cp;
BVRef bvr = gRootVolume;
int biosdev = gBIOSDev;
const char*cp;
BVRef bvr= gRootVolume;
int biosdev= gBIOSDev;
// Search for left parenthesis in the path specification.
// Search for left parenthesis in the path specification.
for (cp = path; *cp; cp++)
{
error("Unknown device '%c%c'\n", xp[0], xp[1]);
return NULL;
}
// Extract the optional unit number from the specification.
// hd(unit) or hd(unit, part).
unit = i;
}
// Unit is no longer optional and never really was.
// If the user failed to specify it then the unit number from the previous kernDev
// would have been used which makes little sense anyway.
// For example, if the user did fd()/foobar and the current root device was the
// second hard disk (i.e. unit 1) then fd() would select the second floppy drive!
// Unit is no longer optional and never really was.
// If the user failed to specify it then the unit number from the previous kernDev
// would have been used which makes little sense anyway.
// For example, if the user did fd()/foobar and the current root device was the
// second hard disk (i.e. unit 1) then fd() would select the second floppy drive!
if (unit == -1)
{
return NULL;
{
cp++;
}
biosdev = dp->biosdev + unit;
bvr = newBootVolumeRef(biosdev, part);
{
// Fetch the volume list from the device.
#if 0
scanBootVolumes(biosdev, NULL);
scanBootVolumes( biosdev, NULL );
#endif
bvrChain = getBVChainForBIOSDev(biosdev);
{
return 0;
}
*str = '\0';
if (bvr)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
}
return 0;
}
branches/Bungo/i386/libsaio/load.c
5858
5959
6060
61
61
6262
6363
6464
......
145145
146146
147147
148
148
149
149150
150151
151152
......
200201
201202
202203
203
204204
205
205206
206207
207
208
209
210
208
211209
212210
211
212
213
213214
214215
215216
......
287288
288289
289290
290
291
292
293
291
292
293
294
294295
295
296
297
296
297
298
298299
299300
300301
cpu_type_t fapcputype;
uint32_t fapoffset;
uint32_t fapsize;
if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */
{
nfat = fhp->nfat_arch;
case CPU_TYPE_X86_64:
/*
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) {
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC)
{
return -1;
}
*/
#endif
break;
}
if (ret != 0)
{
return -1;
}
cmdBase += cmdsize;
return -1;
}
cmdBase += cmdsize;
}
*rentry = (entry_t)( (unsigned long) entry & 0x3fffffff );
*rsize = vmend - vmaddr;
*raddr = (char *)vmaddr;
return 0;
}
if (! ((vmaddr >= KERNEL_ADDR && (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) ||
(vmaddr >= HIB_ADDR && (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) {
stop("Kernel overflows available space");
}
if (! ((vmaddr >= KERNEL_ADDR && (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) ||
(vmaddr >= HIB_ADDR && (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) {
stop("Kernel overflows available space");
}
if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) {
gHaveKernelCache = true;
}
if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) {
gHaveKernelCache = true;
}
// Copy from file load area.
if (vmsize>0 && filesize > 0) {
branches/Bungo/i386/libsaio/acpi.h
3333
3434
3535
36
36
3737
3838
3939
4040
4141
42
42
4343
4444
4545
......
101101
102102
103103
104
105
106
107
108
109
110
104
105
106
107
108
109
110
111
111112
112113
113114
......
176177
177178
178179
179
180
180181
181182
182183
......
191192
192193
193194
194
195
196
197
198
199
200
201
202
203
195
196
197
198
199
200
201
202
203
204
205
204206
205207
206208
// TODO Migrate
struct acpi_2_rsdp
{
// 1.0
// 1.0
charSignature[8];
uint8_tChecksum;
charOEMID[6];
uint8_tRevision;
uint32_tRsdtAddress;
// 2.0
// 2.0
uint32_tLength;
uint64_tXsdtAddress;
uint8_tExtendedChecksum;
uint32_tCreatorRevision;
} __attribute__((packed));
struct ssdt_pmref {
char oemTabID[9];
char byte1;
uint32_t addr;
char byte2;
uint32_t length;
char byte3;
struct ssdt_pmref
{
char oemTabID[9];
char byte1;
uint32_t addr;
char byte2;
uint32_t length;
char byte3;
} __attribute__((packed));
// TODO Migrate
/* Begin Asere */
//Reset Fix
uint32_t Flags;
// Reset Register
// Reset Register
uint8_t Reset_SpaceID;
uint8_t Reset_BitWidth;
uint8_t Reset_BitOffset;
uint8_t notimp2[96];
} __attribute__((packed));
struct acpi_2_facs {
charSignature[4];
uint32_tLength;
uint32_t HWSignature;
uint32_t FWWakingVector32;
uint32_t GlobalLock;
uint32_t Flags;
uint64_t FWWakingVector64;
uint8_t Version;
uint8_t Reserved[31];
struct acpi_2_facs
{
charSignature[4];
uint32_tLength;
uint32_t HWSignature;
uint32_t FWWakingVector32;
uint32_t GlobalLock;
uint32_t Flags;
uint64_t FWWakingVector64;
uint8_t Version;
uint8_t Reserved[31];
} __attribute__((packed));
#endif /* !__LIBSAIO_ACPI_H */
branches/Bungo/i386/libsaio/cpu.c
243243
244244
245245
246
246
247247
248248
249249
......
275275
276276
277277
278
279
280
278
279
280
281281
282282
283283
......
288288
289289
290290
291
291
292292
293
294
295
293
294
295
296296
297297
298298
299
300
299
300
301301
302
303
304
305
302
303
304
305
306
307
306308
307
309
308310
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
326336
327337
328
338
339
329340
330341
331
332
333
342
343
344
345
334346
335347
336
348
349
350
337351
338352
339353
......
365379
366380
367381
368
369
370
371
372
382
383
384
385
386
387
388
389
390
373391
374392
375393
......
392410
393411
394412
395
413
396414
397415
398416
......
404422
405423
406424
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
445467
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
466491
467492
468493
......
502527
503528
504529
505
506
530
531
532
507533
508
534
509535
510536
511537
512
538
513539
514540
515541
......
556582
557583
558584
559
585
586
560587
561
588
562589
563590
564591
......
566593
567594
568595
569
596
597
570598
571599
572600
573601
574
575
602
603
604
605
606
576607
577608
578609
579610
580611
581
582
612
613
583614
584615
585616
586617
587
588
618
619
589620
621
590622
591623
592
593
594
624
625
626
595627
596628
597
598
629
630
599631
600632
601
602
633
634
603635
604636
605637
606638
607639
608640
609
641
642
643
644
610645
611
612
613
614646
615
616
617
618
619647
620
621648
622649
650
651
652
653
654
623655
624656
625657
......
651683
652684
653685
654
655
686
687
656688
657689
658690
......
685717
686718
687719
688
720
689721
690722
691723
......
695727
696728
697729
698
730
699731
700732
701733
702734
703735
704
736
705737
706738
707739
......
719751
720752
721753
722
754
723755
724756
725757
......
727759
728760
729761
730
762
731763
732764
733765
......
750782
751783
752784
753
754
785
786
787
788
789
755790
756791
757792
......
767802
768803
769804
770
805
806
807
771808
772809
773810
......
779816
780817
781818
782
819
783820
784821
785822
......
799836
800837
801838
802
803
804
805
806
807
808
809
839
840
841
842
843
844
845
846
847
810848
811
812
849
850
813851
814
852
815853
816854
817855
......
819857
820858
821859
822
823
824
860
861
862
863
825864
826865
827
866
828867
829868
/* mperfDelta is now the least number of MPERF ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
*/
if (aperfDelta > (1ULL<<32))
{
retval = 0;
uint32_tmax_ratio = 0;
uint32_tmin_ratio = 0;
uint32_treg[4];
uint32_tcores_per_package = 0;
uint32_t logical_per_package = 1;
uint32_t threads_per_core = 1;;
uint32_tcores_per_package = 0;
uint32_tlogical_per_package = 1;
uint32_tthreads_per_core = 1;;
uint8_tbus_ratio_max = 0;
uint8_tbus_ratio_min = 0;
const char*newratio;
charstr[128];
char *s = 0;
char*s = 0;
int len = 0;
int myfsb = 0;
int i = 0;
intlen = 0;
intmyfsb = 0;
inti = 0;
/* get cpuid values */
do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]); // MaxFn, Vendor
p->CPU.Vendor = p->CPU.CPUID[CPUID_0][ebx];
p->CPU.Vendor = p->CPU.CPUID[CPUID_0][ebx];
do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]); // Signature, stepping, features
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((bit(28) & p->CPU.CPUID[CPUID_1][edx]) != 0)) { // Intel && HTT/Multicore
logical_per_package = bitfield(p->CPU.CPUID[CPUID_1][ebx], 23, 16);
}
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((bit(28) & p->CPU.CPUID[CPUID_1][edx]) != 0)) // Intel && HTT/Multicore
{
logical_per_package = bitfield(p->CPU.CPUID[CPUID_1][ebx], 23, 16);
}
do_cpuid(0x00000002, p->CPU.CPUID[CPUID_2]); // TLB/Cache/Prefetch
do_cpuid(0x00000003, p->CPU.CPUID[CPUID_3]); // S/N
/* Based on Apple's XNU cpuid.c - Deterministic cache parameters */
if ((p->CPU.CPUID[CPUID_0][eax] > 3) && (p->CPU.CPUID[CPUID_0][eax] < 0x80000000)) {
for (i = 0; i < 0xFF; i++) { // safe loop
do_cpuid2(0x00000004, i, reg); // AX=4: Fn, CX=i: cache index
if (bitfield(reg[eax], 4, 0) == 0) break;
//cores_per_package = bitfield(reg[eax], 31, 26) + 1;
}
}
do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]);
if (i > 0) {
cores_per_package = bitfield(p->CPU.CPUID[CPUID_4][eax], 31, 26) + 1; // i = cache index
threads_per_core = bitfield(p->CPU.CPUID[CPUID_4][eax], 25, 14) + 1;
}
if (cores_per_package == 0) cores_per_package = 1;
if (p->CPU.CPUID[CPUID_0][0] >= 0x5) { // Monitor/Mwait
/* Based on Apple's XNU cpuid.c - Deterministic cache parameters */
if ((p->CPU.CPUID[CPUID_0][eax] > 3) && (p->CPU.CPUID[CPUID_0][eax] < 0x80000000))
{
for (i = 0; i < 0xFF; i++) // safe loop
{
do_cpuid2(0x00000004, i, reg); // AX=4: Fn, CX=i: cache index
if (bitfield(reg[eax], 4, 0) == 0)
{
break;
}
//cores_per_package = bitfield(reg[eax], 31, 26) + 1;
}
}
do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]);
if (i > 0)
{
cores_per_package = bitfield(p->CPU.CPUID[CPUID_4][eax], 31, 26) + 1; // i = cache index
threads_per_core = bitfield(p->CPU.CPUID[CPUID_4][eax], 25, 14) + 1;
}
if (cores_per_package == 0) cores_per_package = 1;
if (p->CPU.CPUID[CPUID_0][0] >= 0x5) // Monitor/Mwait
{
do_cpuid(5, p->CPU.CPUID[CPUID_5]);
}
if (p->CPU.CPUID[CPUID_0][0] >= 6) { // Thermal/Power
if (p->CPU.CPUID[CPUID_0][0] >= 6) // Thermal/Power
{
do_cpuid(6, p->CPU.CPUID[CPUID_6]);
}
do_cpuid(0x80000000, p->CPU.CPUID[CPUID_80]);
if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8) {
do_cpuid(0x80000000, p->CPU.CPUID[CPUID_80]);
if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8)
{
do_cpuid(0x80000008, p->CPU.CPUID[CPUID_88]);
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
} else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) {
}
else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1)
{
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
}
p->CPU.ExtFamily= bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20);
/*
if (p->CPU.Family == 0x0f)
p->CPU.Family += p->CPU.ExtFamily;
if (p->CPU.Family == 0x0f || p->CPU.Family == 0x06) */
p->CPU.Model += (p->CPU.ExtModel << 4);
/* get BrandString (if supported) */
{
p->CPU.Family += p->CPU.ExtFamily;
}
if (p->CPU.Family == 0x0f || p->CPU.Family == 0x06)
*/
p->CPU.Model += (p->CPU.ExtModel << 4);
/* get BrandString (if supported) */
/* Copyright: from Apple's XNU cpuid.c */
if (p->CPU.CPUID[CPUID_80][0] > 0x80000004)
{
}
}
strlcpy(p->CPU.BrandString, s, 48);
if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, MIN(sizeof(p->CPU.BrandString), (unsigned)strlen(CPU_STRING_UNKNOWN) + 1)))
{
/*
p->CPU.BrandString[47] = '\0';
//verbose("Brandstring = %s\n", p->CPU.BrandString);
}
/*
* Find the number of enabled cores and threads
* (which determines whether SMT/Hyperthreading is active).
*/
switch (p->CPU.Vendor) {
case CPUID_VENDOR_INTEL:
switch (p->CPU.Model) {
case CPUID_MODEL_NEHALEM:
case CPUID_MODEL_FIELDS:
case CPUID_MODEL_DALES:
case CPUID_MODEL_NEHALEM_EX:
case CPUID_MODEL_JAKETOWN:
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_IVYBRIDGE:
case CPUID_MODEL_IVYBRIDGE_EP:
case CPUID_MODEL_HASWELL:
case CPUID_MODEL_HASWELL_SVR:
//case CPUID_MODEL_HASWELL_H:
case CPUID_MODEL_HASWELL_ULT:
case CPUID_MODEL_CRYSTALWELL:
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoCores= (uint32_t)bitfield((uint32_t)msr, 31, 16);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
break;
case CPUID_MODEL_DALES_32NM:
case CPUID_MODEL_WESTMERE:
case CPUID_MODEL_WESTMERE_EX:
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoCores= (uint32_t)bitfield((uint32_t)msr, 19, 16);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
break;
}
if (p->CPU.NoCores == 0) {
p->CPU.NoCores = cores_per_package;
p->CPU.NoThreads = logical_per_package;
}
/*
* Find the number of enabled cores and threads
* (which determines whether SMT/Hyperthreading is active).
*/
switch (p->CPU.Vendor)
{
case CPUID_VENDOR_INTEL:
switch (p->CPU.Model)
{
case CPUID_MODEL_NEHALEM:
case CPUID_MODEL_FIELDS:
case CPUID_MODEL_DALES:
case CPUID_MODEL_NEHALEM_EX:
case CPUID_MODEL_JAKETOWN:
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_IVYBRIDGE:
case CPUID_MODEL_IVYBRIDGE_EP:
case CPUID_MODEL_HASWELL:
case CPUID_MODEL_HASWELL_SVR:
//case CPUID_MODEL_HASWELL_H:
case CPUID_MODEL_HASWELL_ULT:
case CPUID_MODEL_CRYSTALWELL:
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoCores= (uint32_t)bitfield((uint32_t)msr, 31, 16);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
break;
case CPUID_MODEL_DALES_32NM:
case CPUID_MODEL_WESTMERE:
case CPUID_MODEL_WESTMERE_EX:
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoCores= (uint32_t)bitfield((uint32_t)msr, 19, 16);
p->CPU.NoThreads= (uint32_t)bitfield((uint32_t)msr, 15, 0);
break;
}
if (p->CPU.NoCores == 0)
{
p->CPU.NoCores = cores_per_package;
p->CPU.NoThreads = logical_per_package;
}
break;
case CPUID_VENDOR_AMD:
p->CPU.NoCores= (uint32_t)bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1;
p->CPU.NoThreads= (uint32_t)bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
if (p->CPU.NoCores == 0) p->CPU.NoCores = 1;
if (p->CPU.NoThreads < p->CPU.NoCores) p->CPU.NoThreads = p->CPU.NoCores;
break;
default:
stop("Unsupported CPU detected! System halted.");
}
//workaround for N270. I don't know why it detected wrong
// MSR is *NOT* available on the Intel Atom CPU
if ((p->CPU.Model == CPUID_MODEL_ATOM) && (strstr(p->CPU.BrandString, "270"))) {
p->CPU.NoCores= 1;
p->CPU.NoThreads= 2;
}
/* setup features */
case CPUID_VENDOR_AMD:
p->CPU.NoCores= (uint32_t)bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1;
p->CPU.NoThreads= (uint32_t)bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
if (p->CPU.NoCores == 0)
p->CPU.NoCores = 1;
if (p->CPU.NoThreads < p->CPU.NoCores)
p->CPU.NoThreads = p->CPU.NoCores;
break;
default:
stop("Unsupported CPU detected! System halted.");
}
//workaround for N270. I don't know why it detected wrong
// MSR is *NOT* available on the Intel Atom CPU
if ((p->CPU.Model == CPUID_MODEL_ATOM) && (strstr(p->CPU.BrandString, "270")))
{
p->CPU.NoCores= 1;
p->CPU.NoThreads= 2;
}
/* setup features */
if ((bit(23) & p->CPU.CPUID[CPUID_1][3]) != 0)
{
p->CPU.Features |= CPU_FEATURE_MMX;
{
p->CPU.Features |= CPU_FEATURE_MSR;
}
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && (p->CPU.NoThreads > p->CPU.NoCores)) {
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && (p->CPU.NoThreads > p->CPU.NoCores))
{
p->CPU.Features |= CPU_FEATURE_HTT;
}
}
tscFrequency = measure_tsc_frequency();
//verbose("cpu freq classic = 0x%016llx\n", tscFrequency);
/* if usual method failed */
if ( tscFrequency < 1000 )//TEST
{
bus_ratio_min = bitfield(msr, 47, 40); //valv: not sure about this one (Remarq.1)
msr = rdmsr64(MSR_FLEX_RATIO);
//verbose("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0));
if (bitfield(msr, 16, 16)) {
if (bitfield(msr, 16, 16))
{
flex_ratio = bitfield(msr, 15, 8);
// bcc9: at least on the gigabyte h67ma-ud2h,
// where the cpu multipler can't be changed to
// allow overclocking, the flex_ratio msr has unexpected (to OSX)
// fail to compute the bus ratio correctly, instead
// causing the system to crash since tscGranularity
// is inadvertently set to 0.
if (flex_ratio == 0) {
if (flex_ratio == 0)
{
// Clear bit 16 (evidently the presence bit)
wrmsr64(MSR_FLEX_RATIO, (msr & 0xFFFFFFFFFFFEFFFFULL));
msr = rdmsr64(MSR_FLEX_RATIO);
verbose("CPU: Unusable flex ratio detected. Patched MSR now %08x\n", bitfield(msr, 31, 0));
} else {
if (bus_ratio_max > flex_ratio) {
}
else
{
if (bus_ratio_max > flex_ratio)
{
bus_ratio_max = flex_ratio;
}
}
}
if (bus_ratio_max)
{
if (bus_ratio_max)
{
fsbFrequency = (tscFrequency / bus_ratio_max);
}
//valv: Turbo Ratio Limit
if ((intelCPU != 0x2e) && (intelCPU != 0x2f))
{
if ((intelCPU != 0x2e) && (intelCPU != 0x2f))
{
msr = rdmsr64(MSR_TURBO_RATIO_LIMIT);
cpuFrequency = bus_ratio_max * fsbFrequency;
max_ratio = bus_ratio_max * 10;
}
else
{
}
else
{
cpuFrequency = tscFrequency;
}
if ((getValueForKey(kbusratio, &newratio, &len, &bootInfo->chameleonConfig)) && (len <= 4))
{
if ((getValueForKey(kbusratio, &newratio, &len, &bootInfo->chameleonConfig)) && (len <= 4))
{
max_ratio = atoi(newratio);
max_ratio = (max_ratio * 10);
if (len >= 3)
{
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))
if ((max_ratio >= min_ratio) && (max_ratio <= 320))
{
cpuFrequency = (fsbFrequency * max_ratio) / 10;
if (len >= 3)
{
cpuFrequency = (fsbFrequency * max_ratio) / 10;
if (len >= 3)
{
maxdiv = 1;
}
else
{
maxdiv = 0;
}
}
else
{
maxdiv = 0;
}
}
else
{
max_ratio = (bus_ratio_max * 10);
}
}
}
else
{
/* On lower models, currcoef defines TSC freq */
/* XXX */
// On lower models, currcoef defines TSC freq
// XXX
maxcoef = currcoef;
}
break;
}
}
/* Mobile CPU */
// Mobile CPU
if (rdmsr64(MSR_IA32_PLATFORM_ID) & (1<<28))
{
p->CPU.Features |= CPU_FEATURE_MOBILE;
{
switch(p->CPU.ExtFamily)
{
case 0x00: /* K8 */
case 0x00: //* K8 *//
msr = rdmsr64(K8_FIDVID_STATUS);
maxcoef = bitfield(msr, 21, 16) / 2 + 4;
currcoef = bitfield(msr, 5, 0) / 2 + 4;
break;
case 0x01: /* K10 */
case 0x01: //* K10 *//
msr = rdmsr64(K10_COFVID_STATUS);
do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]);
// EffFreq: effective frequency interface
break;
case 0x05: /* K14 */
case 0x05: //* K14 *//
msr = rdmsr64(K10_COFVID_STATUS);
currcoef = (bitfield(msr, 54, 49) + 0x10) << 2;
currdiv = (bitfield(msr, 8, 4) + 1) << 2;
break;
case 0x02: /* K11 */
case 0x02: //* K11 *//
// not implimented
break;
}
fsbFrequency = ((cpuFrequency * currdiv) / currcoef);
}
//verbose("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
if (!cpuFrequency) {
}
else
{
if (!cpuFrequency)
{
fsbFrequency = (tscFrequency / maxcoef);
}
else
{
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
//verbose("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
}
else
{
fsbFrequency = (tscFrequency / currcoef);
//verbose("%d\n", currcoef);
}
if (!fsbFrequency)
{
fsbFrequency = (DEFAULT_FSB * 1000);
verbose("CPU: fsbFrequency=0! using the default value for FSB!\n");
verbose("CPU: fsbFrequency=0! using the default value for FSB!\n");
cpuFrequency = tscFrequency;
}
//verbose("\n---------------------------------------------\n");
verbose("\n------------------ CPU INFO -----------------\n");
//verbose("---------------------------------------------\n");
verbose("\nCPUID Raw Values:\n");
for (i = 0; i < CPUID_MAX; i++) {
verbose("%02d: %08X-%08X-%08X-%08X\n", i, p->CPU.CPUID[i][eax], p->CPU.CPUID[i][ebx], p->CPU.CPUID[i][ecx], p->CPU.CPUID[i][edx]);
}
verbose("\n");
verbose("Brand String: %s\n",p->CPU.BrandString); // Processor name (BIOS)
verbose("Vendor: 0x%X\n",p->CPU.Vendor); // Vendor ex: GenuineIntel
verbose("Family: 0x%X\n",p->CPU.Family); // Family ex: 6 (06h)
verbose("\nCPUID Raw Values:\n");
for (i = 0; i < CPUID_MAX; i++)
{
verbose("%02d: %08X-%08X-%08X-%08X\n", i, p->CPU.CPUID[i][eax], p->CPU.CPUID[i][ebx], p->CPU.CPUID[i][ecx], p->CPU.CPUID[i][edx]);
}
verbose("\n");
verbose("Brand String: %s\n",p->CPU.BrandString);// Processor name (BIOS)
verbose("Vendor: 0x%X\n",p->CPU.Vendor);// Vendor ex: GenuineIntel
verbose("Family: 0x%X\n",p->CPU.Family);// Family ex: 6 (06h)
verbose("ExtFamily: 0x%X\n",p->CPU.ExtFamily);
verbose("Signature: 0x%08X\n",p->CPU.Signature); // CPUID signature
verbose("Model: 0x%X\n",p->CPU.Model); // Model ex: 37 (025h)
verbose("Signature: 0x%08X\n",p->CPU.Signature);// CPUID signature
verbose("Model: 0x%X\n",p->CPU.Model);// Model ex: 37 (025h)
verbose("ExtModel: 0x%X\n",p->CPU.ExtModel);
verbose("Stepping: 0x%X\n",p->CPU.Stepping); // Stepping ex: 5 (05h)
verbose("Stepping: 0x%X\n",p->CPU.Stepping);// Stepping ex: 5 (05h)
verbose("MaxCoef: %d\n",p->CPU.MaxCoef);
verbose("CurrCoef: %d\n",p->CPU.CurrCoef);
verbose("MaxDiv: %d\n",p->CPU.MaxDiv);
verbose("TSCFreq: %dMHz\n",p->CPU.TSCFrequency / 1000000);
verbose("FSBFreq: %dMHz\n",p->CPU.FSBFrequency / 1000000);
verbose("CPUFreq: %dMHz\n",p->CPU.CPUFrequency / 1000000);
verbose("Cores: %d\n",p->CPU.NoCores); // Cores
verbose("Logical procesors: %d\n",p->CPU.NoThreads); // Threads
verbose("Features: 0x%08x\n",p->CPU.Features);
verbose("Cores: %d\n",p->CPU.NoCores);// Cores
verbose("Logical procesors: %d\n",p->CPU.NoThreads);// Threads
verbose("Features: 0x%08x\n",p->CPU.Features);
verbose("---------------------------------------------\n\n");
#if DEBUG_CPU
pause("\n[DEBUG CPU] ");
pause("\n[DEBUG CPU] ");
#endif
}
branches/Bungo/i386/libsaio/platform.h
3030
3131
3232
33
34
35
36
33
34
35
36
3737
38
39
38
39
4040
41
42
43
41
42
43
4444
45
46
45
46
4747
48
49
50
51
52
48
49
50
51
52
5353
5454
5555
......
6262
6363
6464
65
65
6666
6767
6868
......
167167
168168
169169
170
171
172
170
171
172
173173
174174
175
176
175
176
177
177178
178179
179180
......
190191
191192
192193
193
194
195
196
194
195
196
197
197198
198199
199200
200201
201
202
202203
203204
204205
#define CPUID_889
#define CPUID_MAX10
#define CPUID_MODEL_ANY 0xFF
#define CPUID_MODEL_UNKNOWN 0x00
//#define CPUID_MODEL_PRESCOTT 0x03// Celeron D, Pentium 4 (90nm)
#define CPUID_MODEL_NOCONA 0x03// Celeron D, Pentium 4, Xeon (90nm)
#define CPUID_MODEL_ANY0xFF
#define CPUID_MODEL_UNKNOWN0x00
//#define CPUID_MODEL_PRESCOTT0x03// Celeron D, Pentium 4 (90nm)
#define CPUID_MODEL_NOCONA0x03// Celeron D, Pentium 4, Xeon (90nm)
//#define CPUID_MODEL_NOCONA 0x04// Xeon Nocona/Paxville, Irwindale (90nm)
#define CPUID_MODEL_IRWINDALE 0x04// Xeon Paxville, Irwindale (90nm)
#define CPUID_MODEL_PRESLER 0x06// Pentium 4, Pentium D (65nm)
#define CPUID_MODEL_IRWINDALE0x04// Xeon Paxville, Irwindale (90nm)
#define CPUID_MODEL_PRESLER0x06// Pentium 4, Pentium D (65nm)
#define CPUID_MODEL_PENTIUM_M0x09// Banias Pentium M (130nm)
#define CPUID_MODEL_DOTHAN 0x0D// Dothan Pentium M, Celeron M (90nm)
#define CPUID_MODEL_YONAH 0x0E// Sossaman, Yonah
#define CPUID_MODEL_MEROM 0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
#define CPUID_MODEL_DOTHAN0x0D// Dothan Pentium M, Celeron M (90nm)
#define CPUID_MODEL_YONAH0x0E// Sossaman, Yonah
#define CPUID_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
//#define CPUID_MODEL_CONROE0x0F//
#define CPUID_MODEL_CELERON 0x16// Merom, Conroe (65nm), Celeron (45nm)
#define CPUID_MODEL_PENRYN 0x17// Wolfdale, Yorkfield, Harpertown, Penryn
#define CPUID_MODEL_CELERON0x16// Merom, Conroe (65nm), Celeron (45nm)
#define CPUID_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
//#define CPUID_MODEL_WOLFDALE0x17// Xeon 31xx, 33xx, 52xx, 54xx, Core 2 Quad 8xxx and 9xxx
#define CPUID_MODEL_NEHALEM 0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
#define CPUID_MODEL_ATOM 0x1C// Pineview, Bonnell
#define CPUID_MODEL_XEON_MP 0x1D// MP 7400
#define CPUID_MODEL_FIELDS 0x1E// Lynnfield, Clarksfield, Jasper Forest
#define CPUID_MODEL_DALES 0x1F// Havendale, Auburndale
#define CPUID_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
#define CPUID_MODEL_ATOM0x1C// Pineview, Bonnell
#define CPUID_MODEL_XEON_MP0x1D// MP 7400
#define CPUID_MODEL_FIELDS0x1E// Lynnfield, Clarksfield, Jasper Forest
#define CPUID_MODEL_DALES0x1F// Havendale, Auburndale
#define CPUID_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
#define CPUID_MODEL_ATOM_SAN0x26// Lincroft
#define CPUID_MODEL_LINCROFT0x27// Bonnell
#define CPUID_MODEL_ATOM_20000x36// Cedarview / Saltwell
#define CPUID_MODEL_SILVERMONT0x37// Atom E3000, Z3000 Atom Silvermont
#define CPUID_MODEL_IVYBRIDGE0x3A// Ivy Bridge
#define CPUID_MODEL_HASWELL 0x3C// Haswell DT
#define CPUID_MODEL_HASWELL0x3C// Haswell DT
#define CPUID_MODEL_BROADWELL0x3D// Core M, Broadwell / Core-AVX2
//#define CPUID_MODEL_IVYBRIDGE_XEON0x3E// Ivy Bridge Xeon
#define CPUID_MODEL_IVYBRIDGE_EP0x3E// Ivy Bridge Xeon
uint8_tMaxDiv;// Min Multiplier
uint8_tCurrCoef;// Current Multiplier
uint8_tCurrDiv;
uint64_tTSCFrequency;// TSC Frequency Hz
uint64_tFSBFrequency;// FSB Frequency Hz
uint64_tCPUFrequency;// CPU Frequency Hz
uint64_tTSCFrequency;// TSC Frequency Hz
uint64_tFSBFrequency;// FSB Frequency Hz
uint64_tCPUFrequency;// CPU Frequency Hz
uint32_tMaxRatio;// Max Bus Ratio
uint32_tMinRatio;// Min Bus Ratio
charBrandString[48];// 48 Byte Branding String
uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
charBrandString[48];// 48 Byte Branding String
uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
} CPU;
struct RAM {
} 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, 3=Workstation... according ACPI2.0 (FACP: PM_Profile)
uint8_t*UUID; // system-id (SMBIOS Table 1: system uuid)
uint32_t HWSignature; // machine-signature (FACS: Hardware Signature)
uint32_tHWSignature; // machine-signature (FACS: Hardware Signature)
} PlatformInfo_t;
extern PlatformInfo_t Platform;
branches/Bungo/i386/libsaio/disk.c
120120
121121
122122
123
124
125
126
123
124
125
126
127127
128128
129129
......
163163
164164
165165
166
167
168
169
170
171
172
173
174
166
167
168
169
170
171
172
173
174
175175
176176
177
177
178178
179
180
181
179
180
181
182182
183
184
185
186
183
184
185
186
187187
188188
189189
190
191
190192
191193
192194
......
570572
571573
572574
573
575
574576
575577
576578
577579
578
580
579581
580582
581
583
582584
583585
584
586
585587
586588
587
589
588590
589591
590
592
591593
592594
593595
......
612614
613615
614616
615
617
616618
617619
618620
......
620622
621623
622624
623
625
624626
625627
626
628
627629
628630
629631
630
631
632
633
632634
633635
634636
......
639641
640642
641643
642
644
643645
644646
645647
646648
647649
648
650
651
649652
650653
651654
......
669672
670673
671674
672
673
674
675
676
677
678
679
680
681
682
683
684
675
676
677
678
679
680
681
682
683
684
685
686
687
685688
686689
687690
......
726729
727730
728731
729
730
732
733
731734
732735
733736
......
740743
741744
742745
743
744
746
747
745748
746749
747750
......
811814
812815
813816
814
817
815818
816819
817820
818821
819
822
820823
821824
822825
......
883886
884887
885888
886
887
888
889
890
889
890
891
892
893
894
895
891896
892
897
898
893899
894
900
901
902
895903
896904
897
898
905
906
899907
900908
901909
......
933941
934942
935943
936
944
937945
938946
939947
940948
941
949
942950
943951
944952
......
953961
954962
955963
956
957
958
959
964
965
966
967
960968
961
969
962970
963
964
965
971
972
973
966974
967
968
975
976
969977
970978
971979
......
982990
983991
984992
985
986
993
994
995
987996
988
989
997
998
990999
991
992
993
994
995
1000
1001
1002
1003
1004
9961005
997
1006
9981007
999
1000
1001
1002
1008
1009
1010
1011
10031012
1004
1005
1013
1014
10061015
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
10201033
10211034
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
10351052
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
10501073
10511074
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
10631090
1064
1091
10651092
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
10841115
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
11061150
1107
1108
1109
1110
1111
1112
1113
1114
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
11151164
1116
1117
1118
1119
1120
1121
1122
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
11231177
1124
1125
1126
1127
1128
1129
1130
1131
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
11321190
1133
1134
1135
1136
1137
1138
1139
1140
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
11411203
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
11571216
1217
1218
1219
1220
1221
1222
1223
1224
11581225
1159
1160
1226
1227
11611228
11621229
11631230
......
11741241
11751242
11761243
1244
11771245
11781246
11791247
......
12171285
12181286
12191287
1220
1288
1289
1290
1291
12211292
1222
1293
12231294
12241295
12251296
12261297
12271298
12281299
1229
1230
1231
1232
1233
1234
1235
1236
1300
1301
1302
1303
12371304
1305
1306
1307
1308
12381309
12391310
12401311
12411312
1242
1313
12431314
12441315
12451316
......
12471318
12481319
12491320
1250
1321
12511322
12521323
12531324
......
13111382
13121383
13131384
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
13261400
13271401
13281402
......
13301404
13311405
13321406
1333
1334
1335
1336
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
13371417
13381418
13391419
......
13491429
13501430
13511431
1352
1432
13531433
1354
1355
1356
1357
1434
1435
1436
1437
13581438
1359
1360
1361
1362
1439
1440
1441
1442
13631443
1364
1365
1444
1445
13661446
13671447
13681448
13691449
13701450
1371
1451
13721452
13731453
13741454
......
13881468
13891469
13901470
1391
1471
13921472
13931473
13941474
......
13991479
14001480
14011481
1402
1482
14031483
14041484
14051485
......
14071487
14081488
14091489
1410
1490
14111491
14121492
14131493
14141494
1415
1416
1417
1418
14191495
1496
1497
1498
1499
14201500
14211501
14221502
14231503
1424
1504
14251505
14261506
14271507
......
14321512
14331513
14341514
1435
1515
14361516
14371517
14381518
14391519
14401520
1441
1521
14421522
14431523
14441524
14451525
14461526
14471527
1448
1528
14491529
14501530
14511531
1452
1532
14531533
14541534
14551535
14561536
14571537
1458
1459
1460
1461
1462
1463
1538
1539
1540
1541
1542
1543
14641544
14651545
14661546
......
14691549
14701550
14711551
1472
1552
14731553
14741554
14751555
......
15081588
15091589
15101590
1511
1512
1513
15141591
1592
1593
1594
15151595
1516
1517
1596
1597
1598
1599
15181600
15191601
15201602
......
15231605
15241606
15251607
1526
1608
15271609
15281610
1529
1530
1611
1612
15311613
15321614
1533
1615
15341616
1535
1617
15361618
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
15521639
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
15681657
1569
1570
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
15711669
1572
1573
15741670
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1671
16031672
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
16391673
1640
1641
1642
1643
1644
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
16451687
1646
1647
1648
1649
1650
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
16511782
1652
1653
1654
1655
16561783
16571784
1658
1785
1786
16591787
1660
1661
1662
1663
1664
1665
1666
1667
1788
1789
16681790
1669
1670
1671
1791
1792
1793
16721794
1673
1674
16751795
1676
1677
1678
1679
1680
16811796
16821797
16831798
......
17001815
17011816
17021817
1703
1818
1819
17041820
17051821
1706
1822
1823
1824
17071825
17081826
17091827
1710
1711
1712
1828
1829
1830
1831
17131832
17141833
17151834
......
17201839
17211840
17221841
1723
1842
17241843
17251844
17261845
17271846
17281847
17291848
1730
1731
1732
1849
1850
1851
1852
17331853
17341854
17351855
17361856
17371857
17381858
1739
1740
1741
1742
1743
1859
1860
1861
1862
1863
1864
17441865
17451866
1746
1747
1867
1868
1869
1870
17481871
17491872
17501873
17511874
1752
1875
1876
17531877
17541878
17551879
......
17581882
17591883
17601884
1761
1762
1885
1886
17631887
17641888
17651889
......
17721896
17731897
17741898
1775
1776
1777
1778
1779
1899
17801900
17811901
1902
1903
1904
1905
1906
1907
17821908
17831909
1784
1910
17851911
17861912
17871913
......
17891915
17901916
17911917
1792
1793
1794
1795
1796
1918
1919
1920
1921
1922
1923
1924
17971925
17981926
17991927
18001928
18011929
18021930
1803
1931
1932
18041933
18051934
18061935
......
18371966
18381967
18391968
1840
1969
18411970
18421971
1972
18431973
18441974
18451975
......
18481978
18491979
18501980
1981
1982
1983
1984
1985
18511986
18521987
18531988
......
18802015
18812016
18822017
1883
2018
2019
18842020
18852021
18862022
......
19312067
19322068
19332069
1934
2070
19352071
19362072
19372073
19382074
1939
2075
19402076
19412077
19422078
......
19462082
19472083
19482084
1949
2085
19502086
19512087
19522088
19532089
1954
2090
19552091
19562092
19572093
......
20202156
20212157
20222158
2159
2160
20232161
20242162
20252163
......
20822220
20832221
20842222
2223
2224
2225
2226
20852227
20862228
2087
2229
20882230
20892231
20902232
......
21032245
21042246
21052247
2248
2249
2250
2251
2252
21062253
21072254
21082255
* 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
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
};
/*
{
{ FDISK_DOS12, "DOS_FAT_12" }, // 0x01
{ FDISK_DOS16S, "DOS_FAT_16_S" }, // 0x04
{ FDISK_DOS16B, "DOS_FAT_16" }, // 0x06
{ FDISK_NTFS, "Windows_NTFS" }, // 0x07
{ FDISK_DOS32, "DOS_FAT_32" }, // 0x0B
{ FDISK_FAT32, "Windows_FAT_32" }, // 0x0C
{ FDISK_FAT16, "Windows_FAT_16" }, // 0x0E
{ FDISK_WIN_LDM, "Windows_LDM" }, // 0x42
{ FDISK_LINUX_SWAP, "Linux_Swap" }, // 0x82
{ FDISK_LINUX, "Linux" }, // 0x83
{ FDISK_LINUX_LVM, "Linux_LVM" }, // 0x8E
{ FDISK_DOS16B, "DOS_FAT_16" }, // 0x06
{ FDISK_NTFS, "Windows_NTFS" }, // 0x07
{ FDISK_DOS32, "DOS_FAT_32" }, // 0x0B
{ FDISK_FAT32, "Windows_FAT_32" }, // 0x0C
{ FDISK_FAT16, "Windows_FAT_16" }, // 0x0E
{ FDISK_WIN_LDM, "Windows_LDM" }, // 0x42
{ FDISK_LINUX_SWAP, "Linux_Swap" }, // 0x82
{ FDISK_LINUX, "Linux" }, // 0x83
{ FDISK_LINUX_LVM, "Linux_LVM" }, // 0x8E
{ FDISK_FREEBSD, "FreeBSD" }, // 0xA5
{ FDISK_OPENBSD, "OpenBSD" }, // 0xA6
{ FDISK_NEXTNAME, "Apple_Rhapsody_UFS" }, // 0xA7
{ FDISK_NEXTNAME, "Apple_Rhapsody_UFS" }, // 0xA7
{ FDISK_UFS, "Apple_UFS" }, // 0xA8
{ FDISK_NETBSD, "NetBSD" }, // 0xA9
{ FDISK_BOOTER, "Apple_Boot" }, // 0xAB
{ FDISK_ENCRYPTED, "Apple_Encrypted" }, // 0xAE
{ FDISK_NETBSD, "NetBSD" }, // 0xA9
{ FDISK_BOOTER, "Apple_Boot" }, // 0xAB
{ FDISK_ENCRYPTED, "Apple_Encrypted" }, // 0xAE
{ FDISK_HFS, "Apple_HFS" }, // 0xAF
{ 0xCD, "CD-ROM" },
{ 0xE7, "Windows_exFAT" },
{ FDISK_BEFS, "Haiku" }, // 0xEB
{ FDISK_LINUX_RAID, "Linux_RAID" }, // 0xFD
{ 0xCD, "CD-ROM" }, // 0xCD
{ 0xE7, "Windows_exFAT" }, // 0xE7
{ FDISK_BEFS, "Haiku" }, // 0xEB
{ FDISK_LINUX_RAID, "Linux_RAID" }, // 0xFD
{ 0x00, NULL } /* must be last */
};
//==============================================================================
extern void spinActivityIndicator(int sectors);
//==========================================================================
// detected filesystem type;
int result = -1;
int fatbits = 0;
// Allocating buffer for 4 sectors.
const void *probeBuffer = malloc(PROBEFS_SIZE);
if (probeBuffer == NULL)
{
verbose("[probeFileSystem] Error: can't alloc memory for probe buffer.\n");
verbose("[probeFileSystem] Error: can't alloc memory for probe buffer.\n");
goto exit;
}
// Reading first 4 sectors of current partition
int error = readBytes(biosdev, blkoff, 0, PROBEFS_SIZE, (void *)probeBuffer);
if (error)
{
verbose("[probeFileSystem] Error: can't read from device=%02Xh.\n", biosdev);
verbose("[probeFileSystem] Error: can't read from device=%02Xh.\n", biosdev);
goto exit;
}
if (HFSProbe(probeBuffer))
{
result = FDISK_HFS;
{
result = FDISK_NTFS;
}
else if (EXFATProbe(probeBuffer))
else if (EXFATProbe(probeBuffer))
{
result = 0xE7;
}
{
switch (fatbits)
{
case 12:
case 12:
result = FDISK_DOS12;
break;
case 16:
result = FDISK_DOS16B;
break;
case 32:
case 32:
default:
result = FDISK_FAT32;
break;
// Couldn't detect filesystem type
result = 0;
}
exit:
if (probeBuffer != NULL)
{
free((void *)probeBuffer);
}
return result;
return result;
}
//==============================================================================
{
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;
}
else
{*/
bvr->flags |= kBVFlagForeignBoot;
// }
bvr->flags |= kBVFlagForeignBoot;
//}
}
else
{
{
bvr->flags |= bvrFlags;
}
return bvr;
return bvr;
}
//==============================================================================
bvr = NULL;
}
}
if ( bvr )
{
bvr->flags |= bvrFlags;
}
return bvr;
}
// FIXME: UCS-2 -> UTF-8 the name
// Bungo:
//strlcpy(bvr->name, "----", DPISTRLEN);
uint8_t i;
for (i = 0; i < BVSTRLEN; i++ )
bvr->name[i] = (char)part->ent_name[i];
/*
uint8_t i;
for (i = 0; i < BVSTRLEN; i++ )
{
bvr->name[i] = (char)part->ent_name[i];
}
/*
if ( (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)part->ent_type) == 0) ||
(efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const*)part->ent_type) == 0) ) {
(efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const*)part->ent_type) == 0) )
{
strlcpy(bvr->type_name, "GPT HFS+", DPISTRLEN);
} else {
}
else
{
strlcpy(bvr->type_name, "GPT Unknown", DPISTRLEN);
}
*/
*/
/*
if ( part->bootid & FDISK_ACTIVE )
{
bvr = NULL;
}
}
if ( bvr )
{
bvr->flags |= bvrFlags;
}
return bvr;
}
static BVRef diskScanFDiskBootVolumes( int biosdev, int *countPtr )
{
const struct fdisk_part *part;
struct DiskBVMap *map;
int partno = -1;
BVRef bvr;
const struct fdisk_part*part;
struct DiskBVMap*map;
intpartno = -1;
BVRefbvr;
#if UFS_SUPPORT
BVRef booterUFS = NULL;
BVRefbooterUFS = NULL;
#endif
int spc;
struct driveInfo di;
boot_drive_info_t *dp;
intspc;
struct driveInfodi;
boot_drive_info_t*dp;
verbose("Attempting to scan FDISK boot volumes [biosdev=%02Xh]:\n", biosdev);
verbose("Attempting to scan FDISK boot volumes [biosdev=%02Xh]:\n", biosdev);
/* Initialize disk info */
if (getDriveInfo(biosdev, &di) != 0)
spc = 1;
}
do {
// Create a new mapping.
do
{
// Create a new mapping.
map = (struct DiskBVMap *)malloc(sizeof(*map));
if ( map )
map = (struct DiskBVMap *)malloc(sizeof(*map));
if ( map )
{
map->biosdev = biosdev;
map->bvr = NULL;
map->bvrcnt = 0;
map->next = gDiskBVMap;
gDiskBVMap = map;
map->biosdev = biosdev;
map->bvr = NULL;
map->bvrcnt = 0;
map->next = gDiskBVMap;
gDiskBVMap = map;
// Create a record for each partition found on the disk.
// Create a record for each partition found on the disk.
while ( getNextFDiskPartition( biosdev, &partno, &part ) )
{
DEBUG_DISK(("%s: part %d [%X]\n", __FUNCTION__, partno, part->systid));
bvr = 0;
while ( getNextFDiskPartition( biosdev, &partno, &part ) )
{
DEBUG_DISK(("%s: part %d [%X]\n", __FUNCTION__, partno, part->systid));
bvr = 0;
switch ( part->systid )
{
switch ( part->systid )
{
#if UFS_SUPPORT
case FDISK_UFS:
bvr = newFDiskBVRef(biosdev, partno, part->relsect + UFS_FRONT_PORCH/BPS, part,
UFSInitPartition,
UFSLoadFile,
UFSReadFile,
UFSGetDirEntry,
UFSGetFileBlock,
UFSGetUUID,
UFSGetDescription,
UFSFree,
0,
kBIOSDevTypeHardDrive, 0);
break;
case FDISK_UFS:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect + UFS_FRONT_PORCH/BPS,
part,
UFSInitPartition,
UFSLoadFile,
UFSReadFile,
UFSGetDirEntry,
UFSGetFileBlock,
UFSGetUUID,
UFSGetDescription,
UFSFree,
0,
kBIOSDevTypeHardDrive,
0);
break;
#endif
case FDISK_HFS:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, 0);
break;
case FDISK_HFS:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive,
0);
break;
// turbo - we want the booter type scanned also
case FDISK_BOOTER:
if (part->bootid & FDISK_ACTIVE)
gBIOSBootVolume = newFDiskBVRef(biosdev, partno, part->relsect, part,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, 0);
// turbo - we want the booter type scanned also
case FDISK_BOOTER:
if (part->bootid & FDISK_ACTIVE)
{
gBIOSBootVolume = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive,
0);
}
#if UFS_SUPPORT
booterUFS = newFDiskBVRef(biosdev, partno, ((part->relsect + spc - 1) / spc) * spc, part,
UFSInitPartition,
UFSLoadFile,
UFSReadFile,
UFSGetDirEntry,
UFSGetFileBlock,
UFSGetUUID,
UFSGetDescription,
UFSFree,
0,
kBIOSDevTypeHardDrive, 0);
booterUFS = newFDiskBVRef(
biosdev, partno,
((part->relsect + spc - 1) / spc) * spc,
part,
UFSInitPartition,
UFSLoadFile,
UFSReadFile,
UFSGetDirEntry,
UFSGetFileBlock,
UFSGetUUID,
UFSGetDescription,
UFSFree,
0,
kBIOSDevTypeHardDrive,
0);
#endif
break;
break;
case FDISK_FAT32:
case FDISK_DOS12:
case FDISK_DOS16S:
case FDISK_DOS16B:
case FDISK_DOS32:
case FDISK_FAT16:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0,
kBIOSDevTypeHardDrive, 0);
break;
case FDISK_FAT32:
case FDISK_DOS12:
case FDISK_DOS16S:
case FDISK_DOS16B:
case FDISK_DOS32:
case FDISK_FAT16:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0,
kBIOSDevTypeHardDrive,
0);
break;
case FDISK_NTFS:
if (probeFileSystem(biosdev, part->relsect) == 0xE7) // 0xE7 means 'FDISK_EXFAT'
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
EXFATInitPartition,
EXFATLoadFile,
EXFATReadFile,
EXFATGetDirEntry,
EXFATGetFileBlock,
EXFATGetUUID,
EXFATGetDescription,
EXFATFree,
0,
kBIOSDevTypeHardDrive, 0);
else
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0,
NTFSGetUUID,
NTFSGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_NTFS:
if (probeFileSystem(biosdev, part->relsect) == 0xE7) // 0xE7 means 'FDISK_EXFAT'
{bvr = newFDiskBVRef(
biosdev,
partno,
part->relsect,
part,
EXFATInitPartition,
EXFATLoadFile,
EXFATReadFile,
EXFATGetDirEntry,
EXFATGetFileBlock,
EXFATGetUUID,
EXFATGetDescription,
EXFATFree,
0,
kBIOSDevTypeHardDrive,
0);
}
else
{
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0,
NTFSGetUUID,
NTFSGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
}
break;
case FDISK_LINUX:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0,
EX2GetUUID,
EX2GetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_LINUX:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0,
EX2GetUUID,
EX2GetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
break;
case FDISK_BEFS:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0, 0,
BeFSGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_BEFS:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
BeFSGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
break;
case FDISK_FREEBSD:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0, 0,
FreeBSDGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive, 0);
break;
case FDISK_FREEBSD:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
FreeBSDGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
break;
case FDISK_OPENBSD:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0, 0,
OpenBSDGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive, 0);
break;
case FDISK_OPENBSD:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
OpenBSDGetDescription,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
break;
default:
bvr = newFDiskBVRef(biosdev, partno, part->relsect, part,
0, 0, 0, 0, 0, 0, 0,
(BVFree)free,
0,
kBIOSDevTypeHardDrive, 0);
break;
}
if ( bvr )
{
bvr->next = map->bvr;
map->bvr = bvr;
map->bvrcnt++;
}
}
default:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0, 0,
(BVFree)free,
0,
kBIOSDevTypeHardDrive,
0);
break;
}
if ( bvr )
{
bvr->next = map->bvr;
map->bvr = bvr;
map->bvrcnt++;
}
}
#if UFS_SUPPORT
// Booting from a CD with an UFS filesystem embedded
// in a booter partition.
// Booting from a CD with an UFS filesystem embedded
// in a booter partition.
if ( booterUFS )
{
#endif
}
} while (0);
#if UNUSED
/*
* If no FDisk partition, then we will check for
}
}
if ( countPtr ) *countPtr = map ? map->bvrcnt : 0;
if (countPtr)
{
*countPtr = map ? map->bvrcnt : 0;
}
return map ? map->bvr : NULL;
return map ? map->bvr : NULL;
}
//==============================================================================
static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr )
{
struct DiskBVMap *map;
struct Block0 *block0_p;
unsigned int blksize;
unsigned int factor;
verbose("Attempting to scan APM boot volumes [biosdev=%02Xh]:\n", biosdev);
void *buffer = malloc(BPS);
struct DiskBVMap*map;
struct Block0*block0_p;
unsigned intblksize;
unsigned intfactor;
verbose("Attempting to scan APM boot volumes [biosdev=%02Xh]:\n", biosdev);
void*buffer = malloc(BPS);
if (!buffer)
{
return NULL;
}
bzero(buffer,BPS);
/* Check for alternate block size */
{
return NULL;
}
block0_p = buffer;
if (OSSwapBigToHostInt16(block0_p->sbSig) == BLOCK0_SIGNATURE)
{
if (strcmp(dpme_p->dpme_type, "Apple_HFS") == 0)
{
bvr = newAPMBVRef(biosdev, i, OSSwapBigToHostInt32(dpme_p->dpme_pblock_start) * factor, dpme_p,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, 0);
bvr->next = map->bvr;
bvr = newAPMBVRef(biosdev,
i,
OSSwapBigToHostInt32(dpme_p->dpme_pblock_start) * factor,
dpme_p,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, 0);
bvr->next = map->bvr;
map->bvr = bvr;
map->bvrcnt++;
}
}
} while (0);
if ( buffer ) free(buffer);
if ( countPtr ) *countPtr = map ? map->bvrcnt : 0;
if (buffer)
{
free(buffer);
}
if (countPtr)
{
*countPtr = map ? map->bvrcnt : 0;
}
return map ? map->bvr : NULL;
}
//==============================================================================
static BVRef diskScanGPTBootVolumes(int biosdev, int *countPtr)
static BVRef diskScanGPTBootVolumes(int biosdev, int * countPtr)
{
verbose("Attempting to scan GPT boot volumes [biosdev=%02Xh]:\n", biosdev);
struct DiskBVMap *map = NULL;
void *buffer = malloc(BPS);
verbose("Attempting to scan GPT boot volumes [biosdev=%02Xh]:\n", biosdev);
struct DiskBVMap*map= NULL;
void*buffer = malloc(BPS);
int error;
if ( !buffer )
{
verbose("[diskScanGPTBootVolumes] Error! Can't allocate memory for buffer.\n");
if ( !buffer )
{
verbose("[diskScanGPTBootVolumes] Error! Can't allocate memory for buffer.\n");
goto scanErr;
}
}
if ((error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer )) != 0)
{
verbose("[diskScanGPTBootVolumes] Error(%d)! Failed to read boot sector.\n", error);
goto scanErr;
}
struct REAL_disk_blk0 *fdiskMap = buffer;
if ( OSSwapLittleToHostInt16(fdiskMap->signature) != DISK_SIGNATURE )
{
// means the FDISK code will wind up parsing it.
if ( fdiskID )
{
verbose("[diskScanGPTBootVolumes] Error! Two GPT protective MBR (fdisk=0xEE) partitions found on same device, skipping.\n");
verbose("[diskScanGPTBootVolumes] Error! Two GPT protective MBR (fdisk=0xEE) partitions found on same device, skipping.\n");
goto scanErr;
}
if ( fdiskID == 0 )
{
verbose("[diskScanGPTBootVolumes] Error! No GPT protective MBR (fdisk=0xEE) partition found on this device, skipping.\n");
verbose("[diskScanGPTBootVolumes] Error! No GPT protective MBR (fdisk=0xEE) partition found on this device, skipping.\n");
goto scanErr;
}
if ((error = readBytes(biosdev, 1, 0, BPS, buffer)) != 0)
{
verbose("[diskScanGPTBootVolumes] Error(%d)! Failed to read GPT header, skipping.\n", error);
verbose("[diskScanGPTBootVolumes] Error(%d)! Failed to read GPT header, skipping.\n", error);
goto scanErr;
}
gpt_hdr *headerMap = buffer;
char hdrSig[9];
memcpy(hdrSig, headerMap->hdr_sig, 8);
hdrSig[8] = 0;
char hdrSig[9];
memcpy(hdrSig, headerMap->hdr_sig, 8);
hdrSig[8] = 0;
// Determine whether the partition header signature is present.
if (memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG)))
{
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header signature '%s' or not present, skipping.\n", hdrSig);
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header signature '%s' or not present, skipping.\n", hdrSig);
goto scanErr;
}
if ((headerSize < offsetof(gpt_hdr, padding)) || (headerSize > BPS))
{
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header size (=%d), skipping.\n", headerSize);
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header size (=%d), skipping.\n", headerSize);
goto scanErr;
}
/*
if ( headerSize > BPS )
{
verbose("Wrong GPT header size (%d)\n", headerSize);
verbose("Wrong GPT header size (%d)\n", headerSize);
goto scanErr;
}
*/
// Determine whether the partition header checksum is valid.
headerMap->hdr_crc_self = 0;
UInt32 headerCRC = 0;
UInt32 headerCRC = 0;
if ((headerCRC = crc32(0, headerMap, headerSize)) != headerCheck)
{
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header CRC32 (=%d), skipping.\n", headerCheck);
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT header CRC32 (=%d), skipping.\n", headerCheck);
goto scanErr;
}
// Determine whether the partition entry size is valid.
UInt64 gptBlock = 0;
UInt32 gptCheck = 0;
UInt32 gptCount = 0;
UInt32 gptID = 0;
gpt_ent *gptMap = NULL;
UInt32 gptSize = 0;
UInt64gptBlock= 0;
UInt32gptCheck= 0;
UInt32gptCount= 0;
UInt32gptID= 0;
gpt_ent*gptMap= NULL;
UInt32gptSize= 0;
gptBlock = OSSwapLittleToHostInt64(headerMap->hdr_lba_table);
gptCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_table);
if ( gptSize < sizeof(gpt_ent) )
{
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT partition entry size (=%d), skipping.\n", gptSize);
verbose("[diskScanGPTBootVolumes] Error! Wrong GPT partition entry size (=%d), skipping.\n", gptSize);
goto scanErr;
}
// fdisk like partition type id.
int fsType;
BVRef bvr;
unsigned int bvrFlags;
BVRef bvr;
unsigned int bvrFlags;
for (gptID = 1; gptID <= gptCount; ++gptID)
{
bvr = NULL; bvrFlags = 0; fsType = 0;
{
bvr = NULL;
bvrFlags = 0;
fsType = 0;
// size on disk can be larger than sizeof(gpt_ent)
gptMap = (gpt_ent *)(buffer + ((gptID - 1) * gptSize));
// The IOGUIDPartitionScheme.cpp code uses byte-based UUIDs, we don't.
if (isPartitionUsed(gptMap))
{
{
// Getting fdisk like partition type.
fsType = probeFileSystem(biosdev, gptMap->ent_lba_start);
// turbo - save our booter partition
// turbo - save our booter partition
// zef - only on original boot device
if (efi_guid_compare(&GPT_EFISYS_GUID, (EFI_GUID const *)gptMap->ent_type) == 0)
{
{
switch (fsType)
{
{
case FDISK_HFS:
if (readBootSector(biosdev, gptMap->ent_lba_start, (void *)0x7e00) == 0)
{
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0, kBIOSDevTypeHardDrive, kBVFlagEFISystem);
}
break;
if (readBootSector(biosdev, gptMap->ent_lba_start, (void *)0x7e00) == 0)
{
bvr = newGPTBVRef(biosdev,
gptID,
gptMap->ent_lba_start,
gptMap,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive,
kBVFlagEFISystem);
}
break;
case FDISK_FAT32:
if (testFAT32EFIBootSector(biosdev, gptMap->ent_lba_start, (void *)0x7e00) == 0)
{
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0, kBIOSDevTypeHardDrive, kBVFlagEFISystem);
}
break;
if (testFAT32EFIBootSector(biosdev, gptMap->ent_lba_start, (void *)0x7e00) == 0)
{
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0,
kBIOSDevTypeHardDrive,
kBVFlagEFISystem);
}
break;
default:
if (biosdev == gBIOSDev) gBIOSBootVolume = bvr;
break;
if (biosdev == gBIOSDev)
{
gBIOSBootVolume = bvr;
}
break;
}
if (bvr)
{
strlcpy(bvr->type_name, "EFI", BVSTRLEN);
}
}
if (bvr) strlcpy(bvr->type_name, "EFI", BVSTRLEN);
}
if ((efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) ||
(efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const *)gptMap->ent_type) == 0))
{
bvrFlags = (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) ? kBVFlagBooter : 0;
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, bvrFlags);
if ( bvr )
{
strlcpy(bvr->type_name, (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) ? "Apple_HFS" : "Apple_Boot", BVSTRLEN);
}
}
// zef - foreign OS support
if ((efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ||
(efi_guid_compare(&GPT_BASICDATA2_GUID, (EFI_GUID const*)gptMap->ent_type) == 0))
{
switch (fsType)
if ((efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) || (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const *)gptMap->ent_type) == 0))
{
case FDISK_NTFS:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, NTFSGetUUID, NTFSGetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
if (bvr) strlcpy(bvr->type_name, "Microsoft Basic Data", BVSTRLEN);
break;
case 0xE7: // exFAT
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
EXFATInitPartition,
EXFATLoadFile,
EXFATReadFile,
EXFATGetDirEntry,
EXFATGetFileBlock,
EXFATGetUUID,
EXFATGetDescription,
EXFATFree,
0, kBIOSDevTypeHardDrive, 0);
if (bvr) strlcpy(bvr->type_name, "Microsoft Basic Data", BVSTRLEN);
break;
case FDISK_DOS12:
case FDISK_DOS16B:
case FDISK_FAT32:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_LINUX:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, EX2GetUUID, EX2GetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
bvrFlags = (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) ? kBVFlagBooter : 0;
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive,
bvrFlags);
default:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, 0, 0,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
if ( bvr )
{
strlcpy(bvr->type_name, (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const *)gptMap->ent_type) == 0) ? "Apple_HFS" : "Apple_Boot", BVSTRLEN);
}
}
// zef - foreign OS support
if ((efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) || (efi_guid_compare(&GPT_BASICDATA2_GUID, (EFI_GUID const*)gptMap->ent_type) == 0))
{
switch (fsType)
{
case FDISK_NTFS:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, NTFSGetUUID, NTFSGetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
if (bvr)
{
strlcpy(bvr->type_name, "Microsoft Basic Data", BVSTRLEN);
}
break;
case 0xE7: // exFAT
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
EXFATInitPartition,
EXFATLoadFile,
EXFATReadFile,
EXFATGetDirEntry,
EXFATGetFileBlock,
EXFATGetUUID,
EXFATGetDescription,
EXFATFree,
0,
kBIOSDevTypeHardDrive,
0);
if (bvr)
{
strlcpy(bvr->type_name, "Microsoft Basic Data", BVSTRLEN);
}
break;
case FDISK_DOS12:
case FDISK_DOS16B:
case FDISK_FAT32:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
MSDOSInitPartition,
MSDOSLoadFile,
MSDOSReadFile,
MSDOSGetDirEntry,
MSDOSGetFileBlock,
MSDOSGetUUID,
MSDOSGetDescription,
MSDOSFree,
0,
kBIOSDevTypeHardDrive,
0);
break;
case FDISK_LINUX:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, EX2GetUUID, EX2GetDescription,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
default:
bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
0, 0, 0, 0, 0, 0, 0,
(BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
break;
}
if ( bvr )
{
strlcpy(bvr->type_name, (efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ? "Microsoft Basic Data" : "Microsoft Reserved", BVSTRLEN);
}
}
if ( bvr )
{
char stringuuid[100];
efi_guid_unparse_upper((EFI_GUID *)gptMap->ent_uuid, stringuuid);
verbose("[%d] %s | %s | %s | %s\n", bvr->part_no, stringuuid, bvr->type_name, getNameForValue(fdiskTypes, fsType), bvr->name);
// Fixup bvr with the fake fdisk partition type.
if (fsType > 0)
{
bvr->part_type = fsType;
}
bvr->next = map->bvr;
map->bvr = bvr;
++map->bvrcnt;
}
}
if ( bvr )
{
strlcpy(bvr->type_name, (efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ? "Microsoft Basic Data" : "Microsoft Reserved", BVSTRLEN);
}
}
if ( bvr )
scanErr:
if ( buffer )
{
char stringuuid[100];
efi_guid_unparse_upper((EFI_GUID *)gptMap->ent_uuid, stringuuid);
verbose("[%d] %s | %s | %s | %s\n", bvr->part_no, stringuuid, bvr->type_name, getNameForValue(fdiskTypes, fsType), bvr->name);
// Fixup bvr with the fake fdisk partition type.
if (fsType > 0) {
bvr->part_type = fsType;
}
free(buffer);
}
bvr->next = map->bvr;
map->bvr = bvr;
++map->bvrcnt;
if ( countPtr )
{
*countPtr = map ? map->bvrcnt : 0;
}
}
}
scanErr:
if ( buffer ) free(buffer);
if ( countPtr ) *countPtr = map ? map->bvrcnt : 0;
return map ? map->bvr : NULL;
}
// OS X Recovery
sprintf(dirSpec, "hd(%d,%d)/com.apple.recovery.boot/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion)) {
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisInstaller = true;
valid = true;
} else {
}
else
{
// OS X Standard
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion)) {
bvr->OSisServer = false;
bvr->OSisInstaller = false;
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisServer = false;
bvr->OSisInstaller = false;
valid = true;
}
else
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisServer = true;
bvr->OSisInstaller = false;
bvr->OSisInstaller = false;
valid = true;
}
/*else
{
sprintf(dirSpec, "hd(%d,%d)/.IAProductInfo", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion)) {
bvr->OSisInstaller = false;
valid = true;
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisInstaller = false;
valid = true;
}
}
*/
}
}
const char *val = "";
int len = 0;
bvr->OSVersion[0] = 0;
if (valid) {
const char *val = "";
int len = 0;
bvr->OSVersion[0] = 0;
if (valid)
{
if (getValueForKey(kProductVersion, &val, &len, &systemVersion) && len)
{
strncat(bvr->OSVersion, val, sizeof(bvr->OSVersion) - 1);
} else {
strncat(bvr->OSVersion, val, sizeof(bvr->OSVersion) - 1);
}
else
{
valid = false;
}
}
if (!valid) {
if (!valid)
{
int fh = -1;
sprintf(dirSpec, "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
{
valid = true;
bvr->OSisInstaller = true;
strncat(bvr->OSVersion, "10.7", sizeof(bvr->OSVersion) - 1); // 10.7 +
len = 4;
strncat(bvr->OSVersion, "10.7", sizeof(bvr->OSVersion) - 1); // 10.7 +
len = 4;
close(fh);
}
else
valid = true;
bvr->OSisInstaller = true;
strncat(bvr->OSVersion, "10.9", sizeof(bvr->OSVersion) - 1); // 10.9 +
len = 4;
close(fh);
} else {
strncat(bvr->OSVersion, "Unknown", sizeof(bvr->OSVersion) - 1);
len = 0;
len = 4;
close(fh);
}
else
{
strncat(bvr->OSVersion, "Unknown", sizeof(bvr->OSVersion) - 1);
len = 0;
close(fh);
}
}
}
return valid;
}
static void scanFSLevelBVRSettings(BVRef chain)
{
BVRef bvr;
char dirSpec[512], fileSpec[512], label[BVSTRLEN];
int ret, fh, fileSize, error;;
long flags;
u_int32_t time;
BVRefbvr;
chardirSpec[512], fileSpec[512];
charlabel[BVSTRLEN];
intret;
longflags;
u_int32_ttime;
intfh, fileSize, error;
for (bvr = chain; bvr; bvr = bvr->next)
{
ret = -1;
error = 0;
// Check for alternate volume label on boot helper partitions.
if (bvr->flags & kBVFlagBooter) {
if (bvr->flags & kBVFlagBooter)
{
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no);
sprintf(fileSpec, "%s", ".disk_label.contentDetails");
ret = GetFileInfo(dirSpec, fileSpec, &flags, &time);
if (getOSVersion(bvr, bvr->OSVersion) == true)
{
bvr->flags |= kBVFlagSystemVolume;
verbose("hd(%d,%d) %s Mac OS X %s\n", BIOS_DEV_UNIT(bvr), bvr->part_no, bvr->name, bvr->OSVersion);
verbose("hd(%d,%d) %s Mac OS X %s\n", BIOS_DEV_UNIT(bvr), bvr->part_no, bvr->name, bvr->OSVersion);
}
}
}
}
void rescanBIOSDevice(int biosdev)
{
struct DiskBVMap *oldMap = diskResetBootVolumes(biosdev);
if (oldMap == NULL)
{
return;
}
CacheReset();
diskFreeMap(oldMap);
oldMap = NULL;
}
else
{
stop("");
stop("diskResetBootVolumes error\n");
return NULL;
}
}
// Return the old map, either to be freed, or reinserted later
{
bvr = diskScanFDiskBootVolumes(biosdev, &count);
}
if (bvr == NULL)
{
bvr = diskScanAPMBootVolumes(biosdev, &count);
}
if (bvr)
{
scanFSLevelBVRSettings(bvr);
{
bvr = map->bvr;
}
if (countPtr)
{
*countPtr += count;
}
return bvr;
}
{
continue;
}
bzero(newBVR,sizeof(*newBVR));
bcopy(bvr, newBVR, sizeof(*newBVR));
/*
#if DEBUG //Azi: warning - too big for boot-log.. far too big.. i mean HUGE!! :P
for (bvr = chain; bvr; bvr = bvr->next)
{
if (!bvr)
{
break;
}
printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible);
}
pause("count: %d\n", bvCount);
pause("\n[DEBUG] count: %d. ", bvCount);
#endif
*count = bvCount;
while (bvr)
{
if (!bvr)
{
break;
}
nextBVR = bvr->next;
if (bvr->filtered)
branches/Bungo/i386/libsaio/cpu.h
4040
4141
4242
43
43
4444
4545
46
47
48
49
46
47
48
49
5050
5151
5252
......
191191
192192
193193
194
194
195195
196196
197197
extern void scan_cpu(PlatformInfo_t *);
#define bit(n) (1ULL << (n))
#define bit(n)(1ULL << (n))
#define bitmask(h,l)((bit(h) | (bit(h)-1)) & ~(bit(l)-1))
#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
#define hbit(n) (1ULL << ((n)+32))
#define min(a,b) ((a) < (b) ? (a) : (b))
#define quad32(hi,lo) ((((uint32_t)(hi)) << 16) | (((uint32_t)(lo)) & 0xFFFF))
#define quad64(hi,lo) ((((uint64_t)(hi)) << 32) | (((uint64_t)(lo)) & 0xFFFFFFFFUL))
#define hbit(n)(1ULL << ((n)+32))
#define min(a,b)((a) < (b) ? (a) : (b))
#define quad32(hi,lo)((((uint32_t)(hi)) << 16) | (((uint32_t)(lo)) & 0xFFFF))
#define quad64(hi,lo)((((uint64_t)(hi)) << 32) | (((uint64_t)(lo)) & 0xFFFFFFFFUL))
#defineCPUID_VID_INTEL "GenuineIntel"
#defineCPUID_VID_AMD "AuthenticAMD"
#define IA32_ENERGY_PERF_BIAS0x01B0
#define MSR_PACKAGE_THERM_STATUS0x01B1
#define IA32_PLATFORM_DCA_CAP0x01F8
#define MSR_POWER_CTL 0x01FC // MSR 000001FC 0000-0000-0004-005F
#define MSR_POWER_CTL0x01FC // MSR 000001FC 0000-0000-0004-005F
// Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's.
#define MSR_RAPL_POWER_UNIT0x606 /* R/O */
branches/Bungo/i386/libsaio/smbios.c
3434
3535
3636
37
38
39
37
38
39
4040
41
41
4242
4343
4444
4545
4646
47
48
49
50
47
48
49
50
5151
52
53
52
53
5454
55
55
5656
5757
5858
5959
60
61
60
61
6262
63
64
65
66
63
64
65
66
6767
6868
69
69
7070
7171
7272
7373
7474
75
76
77
78
79
75
76
77
78
79
8080
8181
8282
8383
8484
85
86
87
85
86
87
8888
8989
9090
9191
92
93
94
95
96
92
93
94
95
96
9797
9898
9999
100100
101
102
103
104
105
106
107
101
102
103
104
105
106
107
108108
109
109
110110
111111
112112
......
115115
116116
117117
118
118
119119
120120
121121
122122
123
123
124124
125125
126126
127127
128
128
129129
130130
131131
......
195195
196196
197197
198
198
199199
200200
201201
......
208208
209209
210210
211
211
212212
213213
214
214
215215
216216
217
217
218218
219219
220220
221
221
222222
223223
224224
225225
226226
227
227
228228
229229
230
230
231231
232232
233
233
234234
235235
236
236
237237
238238
239
239
240240
241241
242
242
243243
244244
245245
246246
247
247
248248
249249
250
250
251251
252252
253253
254254
255255
256256
257
257
258258
259259
260
260
261261
262262
263263
264
264
265265
266266
267
267
268268
269269
270
270
271271
272272
273
273
274274
275275
276
276
277277
278278
279
279
280280
281281
282282
......
285285
286286
287287
288
288
289289
290290
291
291
292292
293293
294
294
295295
296296
297
297
298298
299299
300
300
301301
302302
303303
......
308308
309309
310310
311
311
312312
313313
314
314
315315
316316
317
317
318318
319319
320
320
321321
322322
323
323
324324
325325
326
326
327327
328328
329
329
330330
331331
332332
333333
334334
335335
336
336
337337
338338
339339
......
372372
373373
374374
375
375
376376
377377
378378
379379
380
380
381381
382382
383383
384384
385
385
386386
387387
388388
......
390390
391391
392392
393
394
393
394
395395
396396
397397
......
565565
566566
567567
568
568
569569
570570
571571
......
617617
618618
619619
620
620
621621
622
622
623623
624624
625625
......
707707
708708
709709
710
711
710
711
712712
713713
714714
......
720720
721721
722722
723
724
723
724
725725
726726
727
727
728728
729729
730730
......
734734
735735
736736
737
738
737
738
739739
740740
741
741
742742
743743
744744
745745
746746
747747
748
749
748
749
750750
751
751
752752
753753
754754
......
757757
758758
759759
760
761
762
763
760
761
762
763
764764
765765
766766
......
780780
781781
782782
783
783
784
784785
785786
786787
787788
788789
789790
790
791
791
792
793
794
792795
793796
794
795
797
798
799
800
801
796802
797803
798804
......
801807
802808
803809
804
810
811
805812
806813
807
808
809814
815
816
810817
811818
812819
......
817824
818825
819826
820
827
828
821829
822830
823831
824
832
833
825834
826835
827836
......
829838
830839
831840
832
833
841
842
843
844
834845
835846
836847
837848
838
849
850
839851
840852
841853
......
854866
855867
856868
857
869
870
858871
859872
860873
861
874
875
862876
863877
864878
......
866880
867881
868882
869
883
884
885
870886
871887
872888
......
877893
878894
879895
880
881
896
897
898
899
882900
883901
884902
885903
886
904
905
887906
888907
889908
890909
891910
892911
912
893913
894914
895915
896916
897
917
918
898919
899920
900921
901
922
923
902924
903925
904926
905
906
927
928
929
930
931
907932
908933
909934
......
922947
923948
924949
925
926
950
951
952
953
927954
928955
929956
930957
931958
932
959
960
933961
934962
935963
......
953981
954982
955983
956
984
985
957986
958987
959988
......
10051034
10061035
10071036
1008
1009
1010
1037
1038
1039
1040
1041
10111042
10121043
10131044
......
10291060
10301061
10311062
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
10421073
10431074
10441075
10451076
10461077
1047
1048
1049
1050
1078
1079
1080
1081
10511082
1052
1053
1083
1084
10541085
10551086
10561087
10571088
10581089
1059
1090
1091
1092
10601093
10611094
10621095
......
10681101
10691102
10701103
1071
1104
1105
10721106
10731107
10741108
......
10961130
10971131
10981132
1099
1133
1134
11001135
1101
1136
1137
11021138
11031139
11041140
......
11061142
11071143
11081144
1109
1145
1146
11101147
11111148
11121149
1113
1150
1151
11141152
11151153
11161154
......
11351173
11361174
11371175
1138
1176
1177
11391178
1140
1179
1180
1181
11411182
11421183
11431184
11441185
11451186
1146
1187
1188
11471189
11481190
1149
1191
1192
11501193
11511194
11521195
11531196
11541197
1155
1198
1199
11561200
11571201
11581202
11591203
11601204
1161
1205
1206
11621207
11631208
11641209
1165
1210
1211
1212
11661213
11671214
11681215
1169
1216
1217
11701218
11711219
11721220
......
11781226
11791227
11801228
1181
1229
1230
11821231
11831232
11841233
......
12121261
12131262
12141263
1215
1264
1265
12161266
12171267
12181268
......
12421292
12431293
12441294
1245
1295
1296
12461297
12471298
12481299
......
12511302
12521303
12531304
1254
1305
1306
12551307
12561308
12571309
12581310
12591311
12601312
1261
1313
1314
12621315
12631316
12641317
1265
1318
1319
12661320
12671321
12681322
12691323
12701324
1271
1272
1325
1326
12731327
12741328
12751329
1276
1330
12771331
12781332
12791333
......
12831337
12841338
12851339
1286
1340
1341
12871342
12881343
12891344
12901345
12911346
12921347
1293
1348
1349
12941350
12951351
12961352
12971353
1298
1354
1355
12991356
13001357
13011358
......
13041361
13051362
13061363
1307
1364
13081365
13091366
13101367
......
13121369
13131370
13141371
1315
1372
1373
13161374
13171375
13181376
......
13391397
13401398
13411399
1342
1400
1401
13431402
13441403
13451404
......
13571416
13581417
13591418
1360
1361
1419
1420
13621421
1363
1422
13641423
13651424
1366
1367
1425
1426
13681427
13691428
13701429
13711430
1372
1431
1432
13731433
1374
1434
1435
13751436
13761437
13771438
......
14021463
14031464
14041465
1405
1466
1467
14061468
14071469
14081470
14091471
14101472
14111473
1412
1413
1414
1415
1416
1417
1418
1474
1475
1476
1477
1478
1479
1480
14191481
14201482
14211483
......
14281490
14291491
14301492
1431
1493
1494
14321495
14331496
1434
1497
1498
14351499
14361500
14371501
......
14431507
14441508
14451509
1446
1510
1511
14471512
14481513
14491514
/* =======================
BIOS Information (Type 0)
========================= */
#define kSMBBIOSInformationVendorKey "SMbiosvendor" // Apple Inc.
#define kSMBBIOSInformationVersionKey "SMbiosversion" // MP31.88Z.006C.B05.0802291410
#define kSMBBIOSInformationReleaseDateKey "SMbiosdate" // 02/29/08
#define kSMBBIOSInformationVendorKey"SMbiosvendor"// Apple Inc.
#define kSMBBIOSInformationVersionKey"SMbiosversion"// MP31.88Z.006C.B05.0802291410
#define kSMBBIOSInformationReleaseDateKey"SMbiosdate"// 02/29/08
// Bungo
#define kSMBBIOSInformationReleaseKey "SMbiosrelease" // BIOS Revision
#define kSMBBIOSInformationReleaseKey"SMbiosrelease"// BIOS Revision
// example: BIOS Revision: 1.23 --> 2 bytes: Major=0x01, Minor=0x17 --> after swap: 0x1701hex = 5889dec (SMBIOS_spec_DSP0134_2.7.1)
/* =========================
System Information (Type 1)
=========================== */
#define kSMBSystemInformationManufacturerKey "SMmanufacturer" // Apple Inc.
#define kSMBSystemInformationProductNameKey "SMproductname" // MacPro3,1
#define kSMBSystemInformationVersionKey "SMsystemversion" // 1.0
#define kSMBSystemInformationSerialNumberKey "SMserial" // Serial number
#define kSMBSystemInformationManufacturerKey"SMmanufacturer"// Apple Inc.
#define kSMBSystemInformationProductNameKey"SMproductname"// MacPro3,1
#define kSMBSystemInformationVersionKey"SMsystemversion"// 1.0
#define kSMBSystemInformationSerialNumberKey"SMserial"// Serial number
//Bungo
#define kSMBSystemInformationUUIDKey "SMsystemuuid" // ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'
#define kSMBSystemInformationSKUNumberKey "SMskunumber" // System SKU#
#define kSMBSystemInformationUUIDKey"SMsystemuuid"// ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'
#define kSMBSystemInformationSKUNumberKey"SMskunumber"// System SKU#
#define kSMBSystemInformationFamilyKey "SMfamily" // MacPro
#define kSMBSystemInformationFamilyKey"SMfamily"// MacPro
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
#define kSMBBaseBoardManufacturerKey "SMboardmanufacturer" // Apple Inc.
#define kSMBBaseBoardProductKey "SMboardproduct" // Mac-F2268DC8
#define kSMBBaseBoardManufacturerKey"SMboardmanufacturer"// Apple Inc.
#define kSMBBaseBoardProductKey"SMboardproduct"// Mac-F2268DC8
// Bungo
#define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1
#define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M
#define kSMBBaseBoardAssetTagKey "SMboardassettag" // Base Board Asset Tag# Bungo: renamed folowing convention
#define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component
#define kSMBBaseBoardVersionKey"SMboardversion"// MacPro3,1
#define kSMBBaseBoardSerialNumberKey"SMboardserial"// C02140302D5DMT31M
#define kSMBBaseBoardAssetTagKey"SMboardassettag"// Base Board Asset Tag# Bungo: renamed folowing convention
#define kSMBBaseBoardLocationInChassisKey"SMboardlocation"// Part Component
// ErmaC BoardType 0x0a(10) or 0x0b(11) MacPro Family
#define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
#define kSMBBaseBoardTypeKey"SMboardtype"// 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
// Bungo
/* =======================
System Enclosure (Type 3)
========================= */
#define kSMBSystemEnclosureManufacturerKey "SMchassismanufacturer" // Apple Inc.
#define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop
#define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8
#define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number
#define kSMBSystemEnclosureAssetTagKey "SMchassisassettag" // Pro-Enclosure Bungo: renamed folowing convention
#define kSMBSystemEnclosureManufacturerKey"SMchassismanufacturer"// Apple Inc.
#define kSMBSystemEnclosureTypeKey"SMchassistype"// 7 Desktop
#define kSMBSystemEnclosureVersionKey"SMchassisversion"// Mac-F42C88C8
#define kSMBSystemEnclosureSerialNumberKey"SMchassisserial"// Serial number
#define kSMBSystemEnclosureAssetTagKey"SMchassisassettag"// Pro-Enclosure Bungo: renamed folowing convention
/* ============================
Processor Information (Type 4)
============================== */
// Bungo
#define kSMBProcessorInformationSocketKey "SMcpusocket"
#define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer"
#define kSMBProcessorInformationVersionKey "SMcpuversion"
#define kSMBProcessorInformationSocketKey"SMcpusocket"
#define kSMBProcessorInformationManufacturerKey"SMcpumanufacturer"
#define kSMBProcessorInformationVersionKey"SMcpuversion"
//
#define kSMBProcessorInformationExternalClockKey"SMexternalclock"
#define kSMBProcessorInformationMaximumClockKey"SMmaximalclock"
// Bungo
#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock"
#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade"
#define kSMBProcessorInformationSerialNumberKey "SMcpuserial"
#define kSMBProcessorInformationAssetTagKey "SMcpuassettag" // Bungo: renamed folowing convention
#define kSMBProcessorInformationPartNumberKey "SMcpupartnumber"
#define kSMBProcessorInformationCurrentClockKey"SMcurrentclock"
#define kSMBProcessorInformationUpgradeKey"SMcpuupgrade"
#define kSMBProcessorInformationSerialNumberKey"SMcpuserial"
#define kSMBProcessorInformationAssetTagKey"SMcpuassettag"// Bungo: renamed folowing convention
#define kSMBProcessorInformationPartNumberKey"SMcpupartnumber"
/* =====================
Memory Device (Type 17)
======================= */
#define kSMBMemoryDeviceDeviceLocatorKey "SMmemdevloc" //
#define kSMBMemoryDeviceBankLocatorKey "SMmembankloc" //
#define kSMBMemoryDeviceMemoryTypeKey "SMmemtype" //
#define kSMBMemoryDeviceMemorySpeedKey "SMmemspeed" //
#define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" //
#define kSMBMemoryDeviceSerialNumberKey "SMmemserial" //
#define kSMBMemoryDevicePartNumberKey "SMmempart" //
#define kSMBMemoryDeviceDeviceLocatorKey"SMmemdevloc" //
#define kSMBMemoryDeviceBankLocatorKey"SMmembankloc" //
#define kSMBMemoryDeviceMemoryTypeKey"SMmemtype" //
#define kSMBMemoryDeviceMemorySpeedKey"SMmemspeed" //
#define kSMBMemoryDeviceManufacturerKey"SMmemmanufacturer" //
#define kSMBMemoryDeviceSerialNumberKey"SMmemserial" //
#define kSMBMemoryDevicePartNumberKey"SMmempart" //
// Bungo:
#define kSMBMemoryDeviceAssetTagKey "SMmemassettag" //
#define kSMBMemoryDeviceAssetTagKey"SMmemassettag" //
/* ===========================================
Memory SPD Data (Apple Specific - Type 130)
/* ============================================
OEM Processor Type (Apple Specific - Type 131)
============================================== */
#define kSMBOemProcessorTypeKey "SMoemcputype" // Bungo: renamed from SMcputype
#define kSMBOemProcessorTypeKey"SMoemcputype"// Bungo: renamed from SMcputype
/* =================================================
OEM Processor Bus Speed (Apple Specific - Type 132)
=================================================== */
#define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed
#define kSMBOemProcessorBusSpeedKey"SMoemcpubusspeed"// Bungo: renamed from SMbusspeed
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
//#define kSMBOemPlatformFeatureKey "SMoemplatformfeature"
//#define kSMBOemPlatformFeatureKey"SMoemplatformfeature"
/* ==================================================*/
#define getFieldOffset(struct, field)((uint8_t)(uint32_t)&(((struct *)0)->field))
typedef struct
{
uint8_ttype;
SMBValueTypevalueType;
SMBValueTypevalueType;
uint8_tfieldOffset;
char*keyString;
bool(*getSMBValue)(returnType *);
BIOS Information (Type 0)
========================= */
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, vendor),
kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor }, // SMbiosvendor - Apple Inc.
kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor },// SMbiosvendor - Apple Inc.
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, version),
kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version }, // SMbiosversion - MP31.88Z.006C.B05.0802291410
kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version },// SMbiosversion - MP31.88Z.006C.B05.0802291410
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, releaseDate),
kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate }, // SMbiosdate - 02/29/08
kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate },// SMbiosdate - 02/29/08
// Bungo
{ kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor),
kSMBBIOSInformationReleaseKey, NULL,(char **)&defaultBIOSInfo.release }, // SMbiosrelease - 0.1 (256)
kSMBBIOSInformationReleaseKey, NULL,(char **)&defaultBIOSInfo.release },// SMbiosrelease - 0.1 (256)
/* =========================
System Information (Type 1)
=========================== */
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, manufacturer),
kSMBSystemInformationManufacturerKey, NULL,&defaultSystemInfo.manufacturer}, // SMmanufacturer - Apple Inc.
kSMBSystemInformationManufacturerKey, NULL,&defaultSystemInfo.manufacturer},// SMmanufacturer - Apple Inc.
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, productName),
kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName }, // SMproductname - MacPro3,1
kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName },// SMproductname - MacPro3,1
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, version),
kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version }, // SMsystemversion - 1.0
kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version },// SMsystemversion - 1.0
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, serialNumber),
kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number
kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber },// SMserial - Serial number
/* Bungo:
{kSMBTypeSystemInformation,kSMBByte,getFieldOffset(SMBSystemInformation, uuid),
kSMBSystemInformationUUIDKey, NULL, NULL}, // SMsystemuuid
kSMBSystemInformationUUIDKey, NULL, NULL},// SMsystemuuid
{kSMBTypeSystemInformation,kSMBByte,getFieldOffset(SMBSystemInformation, wakeupReason),
NULL, NULL, NULL}, // reason for system wakeup
NULL, NULL, NULL},// reason for system wakeup
*/
// Bungo
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, skuNumber),
kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU#
kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber},// SMskunumber - System SKU#
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, family),
kSMBSystemInformationFamilyKey,NULL,&defaultSystemInfo.family}, // SMfamily - MacPro
kSMBSystemInformationFamilyKey,NULL,&defaultSystemInfo.family},// SMfamily - MacPro
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, manufacturer),
kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc.
kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer },// SMboardmanufacturer - Apple Inc.
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, product),
kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product }, // SMboardproduct - Mac-F2268DC8
kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product },// SMboardproduct - Mac-F2268DC8
// Bungo
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, version),
kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version }, // SMboardversion - MacPro3,1
kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version },// SMboardversion - MacPro3,1
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, serialNumber),
kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M
kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber },// SMboardserial - C02140302D5DMT31M
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTag),
kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassettag - Base Board Asset Tag#
kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag },// SMboardassettag - Base Board Asset Tag#
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis },// SMboardlocation - Part Component
{kSMBTypeBaseBoard,kSMBByte,getFieldOffset(SMBBaseBoard, boardType),
kSMBBaseBoardTypeKey,NULL, (char **)&defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
kSMBBaseBoardTypeKey,NULL, (char **)&defaultBaseBoard.boardType },// SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
/*{kSMBTypeBaseBoard,kSMBByte, getFieldOffset(SMBBaseBoard, numberOfContainedHandles),
NULL , NULL, NULL }, // numberOfContainedHandles = 0
NULL , NULL, NULL },// numberOfContainedHandles = 0
*/
//
System Enclosure (Type 3)
========================= */
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, manufacturer),
kSMBSystemEnclosureManufacturerKey, NULL,&defaultChassis.manufacturer }, // SMchassismanufacturer - Apple Inc.
kSMBSystemEnclosureManufacturerKey, NULL,&defaultChassis.manufacturer },// SMchassismanufacturer - Apple Inc.
{kSMBTypeSystemEnclosure, kSMBByte,getFieldOffset(SMBSystemEnclosure, chassisType),
kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType}, // SMchassistype - 7
kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType},// SMchassistype - 7
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version),
kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version }, // SMchassisversion - Mac-F42C88C8
kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version },// SMchassisversion - Mac-F42C88C8
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber),
kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial
kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber },// SMchassisserial
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag),
kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure
kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag },// SMchassisassettag - Pro Enclosure
/*
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, skuNumber),
Processor Information (Type 4)
============================== */
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, socketDesignation),
kSMBProcessorInformationSocketKey, NULL, NULL}, // SMcpusocket -
kSMBProcessorInformationSocketKey, NULL, NULL},// SMcpusocket -
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, manufacturer),
kSMBProcessorInformationManufacturerKey, NULL, NULL}, // SMcpumanufacturer - Intel(R) Corporation
kSMBProcessorInformationManufacturerKey, NULL, NULL},// SMcpumanufacturer - Intel(R) Corporation
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, processorVersion),
kSMBProcessorInformationVersionKey, NULL, NULL}, // SMcpuversion
kSMBProcessorInformationVersionKey, NULL, NULL},// SMcpuversion
{kSMBTypeProcessorInformation,kSMBWord, getFieldOffset(SMBProcessorInformation, externalClock),
kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,NULL}, // SMcpuexternalclock
kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,NULL},// SMcpuexternalclock
{kSMBTypeProcessorInformation,kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock),
kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,NULL}, // SMcpumaximumclock
kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,NULL},// SMcpumaximumclock
// Bungo
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, currentClock),
kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentclock
kSMBProcessorInformationCurrentClockKey, NULL, NULL},// SMcpucurrentclock
{kSMBTypeProcessorInformation,kSMBByte,getFieldOffset(SMBProcessorInformation, processorUpgrade),
kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade
kSMBProcessorInformationUpgradeKey, NULL, NULL},// SMcpuupgrade
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),
kSMBProcessorInformationSerialNumberKey, NULL, NULL},
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag
kSMBProcessorInformationAssetTagKey, NULL, NULL},// SMcpuassettag
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),
kSMBProcessorInformationPartNumberKey, NULL, NULL},
// Apple Specific
//-------------------------------------------------------------------------------------------------------------------------
// OEM Processor Type (Apple Specific - Type 131)
{kSMBTypeOemProcessorType,kSMBWord,getFieldOffset(SMBOemProcessorType, ProcessorType),kSMBOemProcessorTypeKey,
{kSMBTypeOemProcessorType,kSMBWord,getFieldOffset(SMBOemProcessorType, ProcessorType),kSMBOemProcessorTypeKey,
getSMBOemProcessorType,NULL},
// OEM Processor Bus Speed (Apple Specific - Type 132)
{kSMBTypeOemProcessorBusSpeed,kSMBWord,getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),kSMBOemProcessorBusSpeedKey,
getSMBOemProcessorBusSpeed,NULL}
getSMBOemProcessorBusSpeed,NULL}
// OEM Platform Feature (Apple Specific - Type 133)
/*
{kSMBTypeOemPlatformFeature,kSMBWord,getFieldOffset(SMBOemPlatformFeature, PlatformFeature),kSMBOemPlatformFeatureKey,
getSMBOemPlatformFeature,NULL}
getSMBOemPlatformFeature,NULL}
*/
};
uint64_t smbios_p = 0;
SMBEntryPoint *origeps= 0;
SMBEntryPoint *neweps= 0;
SMBEntryPoint *origeps= 0;
SMBEntryPoint *neweps= 0;
static uint8_t stringIndex;// increament when a string is added and set the field value accordingly
static uint8_t stringsSize;// add string size
//#define KDefauktMacProBoardAssetTagNumber"Pro-Enclosure"
//#define kDefaultMacProBoardType"0xB" // 11
#define kDefaultMacPro "MacPro3,1"
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
#define kDefaultMacProBIOSReleaseDate"08/03/2010"
//#define kDefaultMacProSystemVersion"1.3"
/* ============================================ */
bool useSMBIOSdefaults = true; // Bungo
bool useSMBIOSdefaults = true;// Bungo
/** FIXED
SMBByte PlatformType= 1; // Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED.
SMBByte PlatformType= 1;// Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED.
**/
/* Rewrite this function */
void setDefaultSMBData(void) // Bungo: setting data from real Macs
defaultChassis.chassisType = kSMBchassisAllInOne;
break;
case CPUID_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPUID_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPUID_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPUID_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultiMacSandy;
case CPUID_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
defaultBIOSInfo.version = kDefaultMacProNehalemBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacProNehalemBIOSReleaseDate;
defaultBIOSInfo.version= kDefaultMacProNehalemBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProNehalemBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProNehalem;
defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;
defaultSystemInfo.family = kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
defaultChassis.chassisType = kSMBchassisTower;
case CPUID_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPUID_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPUID_MODEL_IVYBRIDGE_EP:// Intel Core i7, Xeon E5 v2 LGA2011 (22nm)
defaultBIOSInfo.version = kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacProWestmereBIOSReleaseDate;
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProWestmere;
defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;
defaultSystemInfo.family = kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
defaultChassis.chassisType = kSMBchassisTower;
break;
default:
defaultBIOSInfo.version = kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate;
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacPro;
defaultSystemInfo.family = kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
break;
}
default:
defaultBIOSInfo.version = kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate;
defaultSystemInfo.productName = kDefaultMacPro;
defaultSystemInfo.family = kDefaultMacProFamily;
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacPro;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
int len;
char key[24];
if (current != structHeader->handle) {
if (current != structHeader->handle)
{
idx++;
current = structHeader->handle;
}
sprintf(key, "%s%d", keyString, idx);
if (value) {
if (getIntForKey(key, (int *)&(value->dword), SMBPlist)) {
if (value)
{
if (getIntForKey(key, (int *)&(value->dword), SMBPlist))
{
return true;
}
} else {
if (getValueForKey(key, string, &len, SMBPlist)) {
}
else
{
if (getValueForKey(key, string, &len, SMBPlist))
{
return true;
}
}
char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field)
{
if (!field || !structHeader) {
if (!field || !structHeader)
{
return NULL;
}
uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;
uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;
for (field--; (field > 0) && (*stringPtr > 0) &&(*(uint16_t *)stringPtr != 0);
field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));
{
int strSize;
if (!field) {
if (!field)
{
return;
}
if (!string) {
if (!string)
{
*field = 0;
return;
}
strSize = strlen(string);
// remove any spaces found at the end but only in MemoryDevice avoiding errors
if (structHeader->type == kSMBTypeMemoryDevice) {
while ((strSize != 0) && (string[strSize - 1] == ' ')) {
if (structHeader->type == kSMBTypeMemoryDevice)
{
while ((strSize != 0) && (string[strSize - 1] == ' '))
{
strSize--;
}
}
if (strSize == 0) {
if (strSize == 0)
{
*field = 0;
return;
}
bool parsed;
int val;
if (numOfSetters <= idx) {
if (numOfSetters <= idx)
{
return false;
}
switch (SMBSetters[idx].valueType) {
switch (SMBSetters[idx].valueType)
{
case kSMBString:
{
if (SMBSetters[idx].keyString)
if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))
{
break;
} else {
}
else
{
if (structPtr->orig->type == kSMBTypeMemoryDevice)// MemoryDevice only
{
if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))
}
}
if (SMBSetters[idx].getSMBValue) {
if (SMBSetters[idx].getSMBValue((returnType *)&string)) {
if (SMBSetters[idx].getSMBValue)
{
if (SMBSetters[idx].getSMBValue((returnType *)&string))
{
break;
}
}
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))
{
string = *(SMBSetters[idx].defaultValue);
break;
}
string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);
break;
}
case kSMBByte:
case kSMBWord:
case kSMBDWord:
case kSMBQWord:
if (SMBSetters[idx].keyString) {
if (SMBSetters[idx].keyString)
{
parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);
if (!parsed)
{
if (structPtr->orig->type == kSMBTypeMemoryDevice) { // MemoryDevice only
if (structPtr->orig->type == kSMBTypeMemoryDevice) // MemoryDevice only
{
parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);
}
}
if (parsed) {
switch (SMBSetters[idx].valueType) {
if (parsed)
{
switch (SMBSetters[idx].valueType)
{
case kSMBByte:
value->byte = (uint8_t)val;
break;
}
}
if (SMBSetters[idx].getSMBValue) {
if (SMBSetters[idx].getSMBValue(value)) {
if (SMBSetters[idx].getSMBValue)
{
if (SMBSetters[idx].getSMBValue(value))
{
return true;
}
}
// #if 0 Bungo: enables code below
// if (*(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))
{
// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo
switch (SMBSetters[idx].valueType) {
case kSMBByte:
}
// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"
if ((SMBSetters[idx].valueType == kSMBString) && string) {
if ((SMBSetters[idx].valueType == kSMBString) && string)
{
setSMBStringForField(structPtr->new, string, &value->byte);
}
return true;
{
SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;
if (Platform.CPU.Vendor != CPUID_VENDOR_INTEL)
return false;
if (Platform.CPU.Vendor != CPUID_VENDOR_INTEL)
{
return false;
}
switch (Platform.CPU.Family)
{
case 0x06:
case CPUID_MODEL_HASWELL_SVR:
case CPUID_MODEL_HASWELL_ULT:
case CPUID_MODEL_CRYSTALWELL:
p->header.type= kSMBTypeOemProcessorBusSpeed;
p->header.length= sizeof(SMBOemProcessorBusSpeed);
p->header.handle= handle++;
setSMBValue(structPtr, numOfSetters - 1, (returnType *)&(p->ProcessorBusSpeed));
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);
tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;
structureCount++;
p->header.type= kSMBTypeOemProcessorBusSpeed;
p->header.length= sizeof(SMBOemProcessorBusSpeed);
p->header.handle= handle++;
setSMBValue(structPtr, numOfSetters - 1, (returnType *)&(p->ProcessorBusSpeed));
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);
tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;
structureCount++;
return true;
default:
break;
}
break;
default:
break;
break;
default:
break;
}
return false;
return false;
}
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
/*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) {
/*
void addSMBOemPlatformFeature(SMBStructPtrs *structPtr)
{
SMBOemPlatformFeature *p = (SMBOemPlatformFeature *)structPtr->new;
p->header.type= kSMBTypeOemPlatformFeature;
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemPPlatformFeature) + 2);
tableLength += sizeof(SMBOemPlatformFeature) + 2;
structureCount++;
}*/
}
*/
//-------------------------------------------------------------------------------------------------------------------------
// EndOfTable
// http://forge.voodooprojects.org/p/chameleon/issues/361/
bool forceFullMemInfo = false;
if (structPtr->orig->type == kSMBTypeMemoryDevice) {
if (structPtr->orig->type == kSMBTypeMemoryDevice)
{
getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig);
if (forceFullMemInfo) {
if (forceFullMemInfo)
{
structPtr->orig->length = 27;
}
}*/
stringIndex = 1;
stringsSize = 0;
if (handle < structPtr->orig->handle) {
if (handle < structPtr->orig->handle)
{
handle = structPtr->orig->handle;
}
// Bungo: fix unsuported tables lengths from original smbios: extend shorter or truncate longer - we use SMBIOS rev. 2.4 like Apple uses
switch (structPtr->orig->type) {
switch (structPtr->orig->type)
{
case kSMBTypeBIOSInformation:
structSize = sizeof(SMBBIOSInformation);
break;
}
// memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
if (structPtr->orig->length <= structSize) {
if (structPtr->orig->length <= structSize)
{
memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
} else {
}
else
{
memcpy((void *)structPtr->new, structPtr->orig, structSize);
}
structPtr->new->length = structSize;
for (i = 0; i < numOfSetters; i++) {
for (i = 0; i < numOfSetters; i++)
{
// Bungo:
//if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) {
if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) {
if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize))
{
setterFound = true;
setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));
}
}
if (setterFound) {
if (setterFound)
{
// Bungo:
// ptr = (uint8_t *)structPtr->new + structPtr->orig->length;
ptr = (uint8_t *)structPtr->new + structPtr->new->length;
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structSize = ptr - (uint8_t *)structPtr->new;
} else {
}
else
{
ptr = (uint8_t *)structPtr->orig + structPtr->orig->length;
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
tableLength += structSize;
if (structSize > maxStructSize) {
if (structSize > maxStructSize)
{
maxStructSize = structSize;
}
ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
ptr = ((SMBSystemInformation *)structHeader)->uuid;
if (!sysId || !ret) { // no or bad custom uuid,...
if (!sysId || !ret) // no or bad custom uuid,...
{
sysId = 0;
ret = Platform.UUID; // ...use original (factory) system uuid
}
for (i = 0, isZero = 1, isOnes = 1; i < UUID_LEN; i++) // check if empty (zeroed) or setable (FFed), means: no uuid present
{
if (ret[i] != 0x00) {
if (ret[i] != 0x00)
{
isZero = 0;
}
if (ret[i] != 0xff) {
if (ret[i] != 0xff)
{
isOnes = 0;
}
}
if (isZero || isOnes) { // if empty or setable...
verbose("System UUID: incorrect or not present. Fixing [00112233-4455-6677-8899-AABBCCDDEEFF]\n");
ret = fixedUUID; // ...set a fixed value for system uuid: <00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF>
verbose("System UUID: incorrect or not present. Fixing [00112233-4455-6677-8899-AABBCCDDEEFF]\n");
ret = fixedUUID; // ...set a fixed value for system uuid: <00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF>
}
memcpy(ptr, ret, UUID_LEN); // save uuid into the patched SMBIOS Table 1
return ptr;
} // Bungo: end fix
uint8_t *buffer;
// bool setSMB = true; Bungo: now we use useSMBIOSdefaults
if (!origeps) {
if (!origeps)
{
return;
}
neweps = origeps;
structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));
if (!structPtr) {
if (!structPtr)
{
return;
}
buffer = (uint8_t *)malloc(SMB_ALLOC_SIZE);
if (!buffer) {
if (!buffer)
{
free(structPtr);
return;
}
structPtr->new = (SMBStructHeader *)buffer;
//Bungo:
//getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig);
//getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig);
getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);
// if (setSMB)
setDefaultSMBData();
setupNewSMBIOSTable(origeps, structPtr);
neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));
if (!neweps) {
if (!neweps)
{
free(buffer);
free(structPtr);
return;
neweps->dmi.structureCount= structureCount;
neweps->dmi.bcdRevision= 0x24; // ... and 2.4 DMI rev. as real Macs
if (!neweps->dmi.tableAddress) {
if (!neweps->dmi.tableAddress)
{
free(buffer);
free(structPtr);
return;
free(buffer);
free(structPtr);
verbose("\n");
verbose("\n");
verbose("SMBIOS orig: rev.: %d.%d, DMI rev.: %d.%d, @%08X\n", origeps->majorVersion, origeps->minorVersion, origeps->dmi.bcdRevision >> 4, origeps->dmi.bcdRevision & 0x0F, origeps);
verbose("SMBIOS new: rev.: %d.%d, DMI rev.: %d.%d, @%08X\n", neweps->majorVersion, neweps->minorVersion, neweps->dmi.bcdRevision >> 4, neweps->dmi.bcdRevision & 0x0F, neweps);
verbose("SMBIOS new: rev.: %d.%d, DMI rev.: %d.%d, @%08X\n", neweps->majorVersion, neweps->minorVersion, neweps->dmi.bcdRevision >> 4, neweps->dmi.bcdRevision & 0x0F, neweps);
decodeSMBIOSTable(neweps);
smbios_p = (EFI_PTR32)neweps; // save a patched smbios ptr for efi config table
smbios_p = (EFI_PTR32)neweps; // save a patched smbios ptr for efi config table
}
void *getSmbios(int which)
{
switch (which) {
switch (which)
{
case SMBIOS_ORIGINAL:
if (!origeps) {
if (!origeps)
{
origeps = getAddressOfSmbiosTable();
}
return origeps;
break;
case kSMBTypeSystemEnclosure: // Bungo: determine platform type
switch (((SMBSystemEnclosure *)structHeader)->chassisType) {
switch (((SMBSystemEnclosure *)structHeader)->chassisType)
{
case kSMBchassisPortable:
case kSMBchassisLaptop:
case kSMBchassisNotebook:
case kSMBchassisHandHeld:
case kSMBchassisSubNotebook:
Platform.Type = 2; // notebook (MacBooks/Pros)
break;
case kSMBchassisMiniTower:
case kSMBchassisTower:
case kSMBchassisBlade:
case kSMBchassisBladeEnclosing:
Platform.Type = 3; // workstation (Mac Pro, Xserve)
break;
break;
case kSMBchassisMiniTower:
case kSMBchassisTower:
case kSMBchassisBlade:
case kSMBchassisBladeEnclosing:
Platform.Type = 3; // workstation (Mac Pro, Xserve)
break;
default:
Platform.Type = 1; // defulting to 1 desktop (iMac, MacMini)
break;
case kSMBTypeMemoryDevice:
Platform.DMI.CntMemorySlots++;
if (((SMBMemoryDevice *)structHeader)->memorySize != 0){
if (((SMBMemoryDevice *)structHeader)->memorySize != 0)
{
Platform.DMI.MemoryModules++;
}
if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0){
if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)
{
Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;
}
dimmnbr++;
structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);
if (((uint16_t *)structPtr)[0] == 0) {
if (((uint16_t *)structPtr)[0] == 0)
{
structPtr += 2;
}
branches/Bungo/i386/libsaio/smbios_decode.c
230230
231231
232232
233
233
234
234235
235236
236
237
238
237239
238240
239241
......
279281
280282
281283
282
284
285
283286
284
287
288
289
285290
286291
287292
288293
289
294
295
290296
291
297
298
299
292300
293301
294302
......
311319
312320
313321
314
322
323
315324
316
325
326
327
317328
318329
319330
......
329340
330341
331342
332
343
344
333345
334
346
347
348
335349
336350
337351
......
362376
363377
364378
365
379
380
381
366382
367383
368384
369385
370
371
372
386
387
388
373389
374390
375391
......
378394
379395
380396
381
397
398
382399
383
400
401
402
384403
385404
386405
......
442461
443462
444463
445
464
465
446466
447467
448468
......
468488
469489
470490
471
491
492
472493
473
494
495
496
474497
475498
476499
477500
478501
479502
480
481
482
483
484
485
486
487
488
489
490
491
492
493
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
494518
495
496
497
519
520
521
522
523
498524
499525
500526
501
527
528
502529
503
530
531
532
504533
505534
506535
......
574603
575604
576605
577
606
578607
579608
580609
......
636665
637666
638667
639
668
640669
641670
642671
......
648677
649678
650679
651
680
681
652682
653683
654684
655685
656686
657
658
687
688
689
659690
660691
{
char *str = NULL;
str = getSMBStringForField(structHeader, field);
if (!field) {
if (!field)
{
str = NotSpecifiedStr;
}
else if (mask) {
else if (mask)
{
str = PrivateStr;
}
verbose("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->version, neverMask));
verbose("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->serialNumber, privateData));
uint8_t *uuid = ((SMBSystemInformation *)structHeader)->uuid;
if (privateData) {
if (privateData)
{
verbose("\tUUID: %s\n", PrivateStr);
} else {
}
else
{
verbose("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
}
if (((SMBSystemInformation *)structHeader)->wakeupReason > 8) {
if (((SMBSystemInformation *)structHeader)->wakeupReason > 8)
{
verbose("\tWake-up Type: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tWake-up Type: %s\n", SMBWakeUpTypes[((SMBSystemInformation *)structHeader)->wakeupReason]);
}
verbose("\tSKU Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->skuNumber, neverMask)); // System SKU#
// Feature Flags (BYTE)
verbose("\tLocation In Chassis: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->locationInChassis, neverMask)); // Part Component
// Chassis Handle (WORD)
if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect)) {
if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect))
{
verbose("\tType: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tType: %s\n", SMBBaseBoardTypes[(((SMBBaseBoard *)structHeader)->boardType - 1)]);
}
// Number of Contained Object Handles (n) (BYTE)
printHeader(structHeader);
verbose("Chassis Information\n");
verbose("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->manufacturer, neverMask));
if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing)) {
if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing))
{
verbose("\tType: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tType: %s\n", SMBChassisTypes[(((SMBSystemEnclosure *)structHeader)->chassisType - 1)]);
}
// Lock:
verbose("\tSocket Designation: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->socketDesignation, neverMask));
if ((((SMBProcessorInformation *)structHeader)->processorType < kSMBprocessorTypeOther) || (((SMBProcessorInformation *)structHeader)->processorType > kSMBprocessorTypeGPU)) {
verbose("\tType: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]);
}
verbose("\tFamily: 0x%X\n", ((SMBProcessorInformation *)structHeader)->processorFamily);
verbose("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->manufacturer, neverMask));
uint64_t procID = ((SMBProcessorInformation *)structHeader)->processorID;
// verbose("\tID: %02X %02X %02X %02X %02X %02X %02X %02X\n", bitfield(procID, 63, 56), bitfield(procID, 55, 48), bitfield(procID, 47, 40), bitfield(procID, 39, 32), bitfield(procID, 31, 24), bitfield(procID, 23, 16), bitfield(procID, 15, 8), bitfield(procID, 7, 0));
verbose("\tID: %02X %02X %02X %02X %02X %02X %02X %02X\n", (procID >> 56) & 0xFF, (procID >> 48) & 0xFF, (procID >> 40) & 0xFF, (procID >> 32) & 0xFF, (procID >> 24) & 0xFF, (procID >> 16) & 0xFF, (procID >> 8) & 0xFF, (procID >> 0) & 0xFF);
uint64_t procID = ((SMBProcessorInformation *)structHeader)->processorID;
//verbose("\tID: %02X %02X %02X %02X %02X %02X %02X %02X\n", bitfield(procID, 63, 56), bitfield(procID, 55, 48), bitfield(procID, 47, 40), bitfield(procID, 39, 32), bitfield(procID, 31, 24), bitfield(procID, 23, 16), bitfield(procID, 15, 8), bitfield(procID, 7, 0));
verbose("\tID: %02X %02X %02X %02X %02X %02X %02X %02X\n", (procID >> 56) & 0xFF, (procID >> 48) & 0xFF, (procID >> 40) & 0xFF, (procID >> 32) & 0xFF, (procID >> 24) & 0xFF, (procID >> 16) & 0xFF, (procID >> 8) & 0xFF, (procID >> 0) & 0xFF);
//verbose("\tSignature: Type=%02X, Family=%02X, Model=%02X, Stepping=%02X\n", (eax >> 12) & 0x3, ((eax >> 20) & 0xFF) + ((eax >> 8) & 0x0F), ((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F), eax & 0xF);
// Flags:
verbose("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask));
verbose("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock);
verbose("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock);
// Status: Populated/Unpopulated
if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) {
if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C))
{
verbose("\tUpgrade: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]);
}
// L1 Cache Handle:
printHeader(structHeader);
verbose("OEM Strings\n");
SMBByte i;
for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++) {
for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++)
{
verbose("\tString %d: %s\n", i, stringPtr);
stringPtr = stringPtr + strlen(stringPtr) + 1;
}
printHeader(structHeader);
verbose("Memory Device\n");
// Aray Handle
if (((SMBMemoryDevice *)structHeader)->errorHandle == 0xFFFF) {
if (((SMBMemoryDevice *)structHeader)->errorHandle == 0xFFFF)
{
verbose("\tError Information Handle: No Error\n");
} else {
}
else
{
verbose("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);
}
// Total Width:
// Data Width:
switch (((SMBMemoryDevice *)structHeader)->memorySize)
{
case 0:
verbose("\tSize: No Module Installed\n");
break;
case 0x7FFF:
verbose("\tSize: 32GB or more\n");
break;
case 0xFFFF:
verbose("\tSize: Unknown\n");
break;
default:
verbose("\tSize: %d %s\n", ((SMBMemoryDevice *)structHeader)->memorySize & 0x7FFF, ((((SMBMemoryDevice *)structHeader)->memorySize & 0x8000) == 0x8000) ? "kB" : "MB");
break;
}
if ((((SMBMemoryDevice *)structHeader)->formFactor < 0x01) || (((SMBMemoryDevice *)structHeader)->formFactor > 0x0F)) {
case 0:
verbose("\tSize: No Module Installed\n");
break;
case 0x7FFF:
verbose("\tSize: 32GB or more\n");
break;
case 0xFFFF:
verbose("\tSize: Unknown\n");
break;
default:
verbose("\tSize: %d %s\n", ((SMBMemoryDevice *)structHeader)->memorySize & 0x7FFF, ((((SMBMemoryDevice *)structHeader)->memorySize & 0x8000) == 0x8000) ? "kB" : "MB");
break;
}
if ((((SMBMemoryDevice *)structHeader)->formFactor < 0x01) || (((SMBMemoryDevice *)structHeader)->formFactor > 0x0F))
{
verbose("\tForm Factor: %s\n", OutOfSpecStr);
} else {
verbose("\tForm Factor: %s\n", SMBMemoryDeviceFormFactors[((SMBMemoryDevice *)structHeader)->formFactor - 1]);
}
}
else
{
verbose("\tForm Factor: %s\n", SMBMemoryDeviceFormFactors[((SMBMemoryDevice *)structHeader)->formFactor - 1]);
}
// Set:
verbose("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask));
verbose("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask));
if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount) {
if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount)
{
verbose("\tMemory Type: %s\n", OutOfSpecStr);
} else {
}
else
{
verbose("\tMemory Type: %s\n", SMBMemoryDeviceTypes[((SMBMemoryDevice *)structHeader)->memoryType]);
}
// Type Detail:
getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig); // Bungo: chek if mask some data
verbose("\n");
verbose("\n");
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
switch (structHeader->type)
//break;
case kSMBTypeEndOfTable: // Type 127
printHeader(structHeader);
printHeader(structHeader);
//verbose("Handle 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);
verbose("End of Table\n");
break;
ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structHeader = (SMBStructHeader *)ptr;
}
if (gVerboseMode) pause("");
verbose("\n");
#if DEBUG_SMBIOS
pause("\n[DEBUG_SMBIOS] ");
#endif
}
branches/Bungo/i386/libsaio/pci.c
1616
1717
1818
19
19
2020
2121
2222
......
7575
7676
7777
78
79
78
79
80
81
8082
8183
82
84
85
8386
8487
88
8589
86
90
91
8792
8893
94
8995
9096
9197
......
99105
100106
101107
102
103
104
105
106
107
108
109
110
111
108
109
110
111
112
113
114
115
116
117
118
119
112120
121
113122
114123
115124
116
125
126
117127
118128
119129
......
131141
132142
133143
144
134145
135146
136147
......
144155
145156
146157
147
158
159
148160
149161
150162
......
154166
155167
156168
157
169
158170
159171
160172
......
164176
165177
166178
167
179
168180
169181
170182
......
176188
177189
178190
179
191
192
180193
181194
182195
183
196
197
198
184199
185200
186201
#if DEBUG_PCI
#define DBG(x...)printf(x)
#else
#define DBG(x...) msglog(x)
#define DBG(x...)msglog(x)
#endif
pci_dt_t*root_pci_dev;
uint8_tsecondary_bus;
uint8_theader_type;
for (dev = 0; dev < 32; dev++) {
for (func = 0; func < 8; func++) {
for (dev = 0; dev < 32; dev++)
{
for (func = 0; func < 8; func++)
{
pci_addr = PCIADDR(bus, dev, func);
id = pci_config_read32(pci_addr, PCI_VENDOR_ID);
if (!id || id == 0xfffffffful) {
if (!id || id == 0xfffffffful)
{
continue;
}
new = (pci_dt_t*)malloc(sizeof(pci_dt_t));
if (!new) {
if (!new)
{
continue;
}
bzero(new, sizeof(pci_dt_t));
new->dev.addr= pci_addr;
new->parent= start;
header_type = pci_config_read8(pci_addr, PCI_HEADER_TYPE);
switch (header_type & 0x7f) {
case PCI_HEADER_TYPE_BRIDGE:
case PCI_HEADER_TYPE_CARDBUS:
secondary_bus = pci_config_read8(pci_addr, PCI_SECONDARY_BUS);
if (secondary_bus != 0) {
scan_pci_bus(new, secondary_bus);
}
break;
default:
break;
switch (header_type & 0x7f)
{
case PCI_HEADER_TYPE_BRIDGE:
case PCI_HEADER_TYPE_CARDBUS:
secondary_bus = pci_config_read8(pci_addr, PCI_SECONDARY_BUS);
if (secondary_bus != 0)
{
scan_pci_bus(new, secondary_bus);
}
break;
default:
break;
}
*current = new;
current = &new->next;
if ((func == 0) && ((header_type & 0x80) == 0)) {
if ((func == 0) && ((header_type & 0x80) == 0))
{
break;
}
}
{
return;
}
rcba = pci_config_read32(PCIADDR(0, 0x1f, 0), 0xf0) & ~1; //this is LPC host
fd = (uint32_t *)(rcba + 0x3418);
/* set SMBus Disable (SD) to 0 */
{
root_pci_dev = malloc(sizeof(pci_dt_t));
if (!root_pci_dev) {
if (!root_pci_dev)
{
return;
}
#if DEBUG_PCI
dump_pci_dt(root_pci_dev->children);
pause("");
pause("\n[DEBUG_PCI] ");
#endif
}
{
pci_dt_t*current;
pci_dt_t*end;
int dev_path_len = 0;
intdev_path_len = 0;
dev_path[0] = 0;
end = root_pci_dev;
while (current->parent != end)
current = current->parent;
end = current;
if (current->parent == root_pci_dev) {
if (current->parent == root_pci_dev)
{
dev_path_len +=
snprintf(dev_path + dev_path_len, sizeof(dev_path) - dev_path_len, "PciRoot(0x%x)/Pci(0x%x,0x%x)", uid,
current->dev.bits.dev, current->dev.bits.func);
} else {
}
else
{
dev_path_len +=
snprintf(dev_path + dev_path_len, sizeof(dev_path) - dev_path_len, "/Pci(0x%x,0x%x)",
current->dev.bits.dev, current->dev.bits.func);
branches/Bungo/i386/libsaio/biosfn.c
560560
561561
562562
563
563
564564
565565
566566
......
730730
731731
732732
733
733
734734
735735
736736
printf("drive_num: %x\n", pkt.drive_num);
printf("device_spec: %x\n", pkt.device_spec);
pause();
pause("\n[DEBUG] ");
#endif
/* Some BIOSes erroneously return cf = 1 */
print_drive_info(di);
printf("uses_ebios = 0x%x\n", dp->uses_ebios);
printf("result %d\n", ret);
pause();
pause("\n[DEBUG] ");
#endif
if (ret == 0) {
branches/Bungo/i386/libsaio/convert.c
1010
1111
1212
13
14
15
16
13
14
15
16
1717
1818
1919
2020
21
21
2222
2323
2424
2525
2626
27
28
29
30
31
32
27
28
29
30
31
32
33
34
3335
3436
3537
......
6769
6870
6971
70
71
72
73
7274
7375
7476
......
8385
8486
8587
86
87
88
89
90
91
88
89
90
91
92
93
9294
93
94
95
96
97
95
96
97
98
99
98100
99
100
101
102
103
104
105
106
107
101
102
103
104
105
106
107
108
109
108110
109111
110
111
112
113
114
115
116
112
113
114
115
116
117
118
117119
118120
119121
120122
121
122
123
124
123125
124
125
126
127
126
127
128
129
128130
129
130
131
132
133
134
135
136
137
138
139
140
141
131
132
133
134
135
136
137
138
139
140
141
142
143
142144
143145
144146
/** Transform a 16 bytes hexadecimal value UUID to a string */
const char * getStringFromUUID(const EFI_CHAR8* eUUID)
{
static char msg[UUID_LEN*2 + 8] = "";
if (!eUUID) return "";
const unsigned char * uuid = (unsigned char*) eUUID;
sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
static char msg[UUID_LEN*2 + 8] = "";
if (!eUUID) return "";
const unsigned char * uuid = (unsigned char*) eUUID;
sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10],uuid[11],
uuid[12],uuid[13],uuid[14],uuid[15]);
return msg ;
return msg ;
}
/** Parse an UUID string into an (EFI_CHAR8*) buffer */
EFI_CHAR8* getUUIDFromString(const char *source)
{
if (!source) return 0;
inti = strlen(source);
if (i != 36) { // e.g 00112233-4455-6677-8899-AABBCCDDEEFF
verbose("[ERROR] UUID='%s' has incorrect length=%d. Use format: 00112233-4455-6677-8899-AABBCCDDEEFF.\n", source, i);
return 0;
}
if (!source) return 0;
inti = strlen(source);
if (i != 36)
{
// e.g 00112233-4455-6677-8899-AABBCCDDEEFF
verbose("[ERROR] UUID='%s' has incorrect length=%d. Use format: 00112233-4455-6677-8899-AABBCCDDEEFF.\n", source, i);
return 0;
}
char*p = (char *)source;
charbuf[3];
uint32_tvalue = 0, i, digit;
for(i = 0; i < strlen(buff); i++)
{
if (buff[i] >= 48 && buff[i] <= 57)// '0' through '9'
digit = buff[i] - 48;
if (buff[i] >= 48 && buff[i] <= 57)// '0' through '9'
digit = buff[i] - 48;
else if (buff[i] >= 65 && buff[i] <= 70)// 'A' through 'F'
digit = buff[i] - 55;
else if (buff[i] >= 97 && buff[i] <= 102)// 'a' through 'f'
void *convertHexStr2Binary(const char *hexStr, int *outLength)
{
int len;
char hexNibble;
char hexByte[2];
uint8_t binChar;
uint8_t *binStr;
int hexStrIdx, binStrIdx, hexNibbleIdx;
int len;
char hexNibble;
char hexByte[2];
uint8_t binChar;
uint8_t *binStr;
int hexStrIdx, binStrIdx, hexNibbleIdx;
len = strlen(hexStr);
if (len > 1)
{
// the resulting binary will be the half size of the input hex string
binStr = malloc(len / 2);
len = strlen(hexStr);
if (len > 1)
{
// the resulting binary will be the half size of the input hex string
binStr = malloc(len / 2);
binStrIdx = 0;
hexNibbleIdx = 0;
for (hexStrIdx = 0; hexStrIdx < len; hexStrIdx++)
{
hexNibble = hexStr[hexStrIdx];
// ignore all chars except valid hex numbers
if ( (hexNibble >= '0' && hexNibble <= '9') ||
(hexNibble >= 'A' && hexNibble <= 'F') ||
binStrIdx = 0;
hexNibbleIdx = 0;
for (hexStrIdx = 0; hexStrIdx < len; hexStrIdx++)
{
hexNibble = hexStr[hexStrIdx];
// ignore all chars except valid hex numbers
if ( (hexNibble >= '0' && hexNibble <= '9') ||
(hexNibble >= 'A' && hexNibble <= 'F') ||
(hexNibble >= 'a' && hexNibble <= 'f') )
{
hexByte[hexNibbleIdx++] = hexNibble;
// found both two nibbles, convert to binary
if (hexNibbleIdx == 2)
{
binChar = 0;
hexByte[hexNibbleIdx++] = hexNibble;
// found both two nibbles, convert to binary
if (hexNibbleIdx == 2)
{
binChar = 0;
for (hexNibbleIdx = 0; hexNibbleIdx < sizeof(hexByte); hexNibbleIdx++)
{
if (hexNibbleIdx > 0)
{
binChar = binChar << 4;
}
binChar = binChar << 4;
}
if (hexByte[hexNibbleIdx] <= '9') binChar += hexByte[hexNibbleIdx] - '0';
else if (hexByte[hexNibbleIdx] <= 'F') binChar += hexByte[hexNibbleIdx] - ('A' - 10);
else if (hexByte[hexNibbleIdx] <= 'f') binChar += hexByte[hexNibbleIdx] - ('a' - 10);
}
if (hexByte[hexNibbleIdx] <= '9') binChar += hexByte[hexNibbleIdx] - '0';
else if (hexByte[hexNibbleIdx] <= 'F') binChar += hexByte[hexNibbleIdx] - ('A' - 10);
else if (hexByte[hexNibbleIdx] <= 'f') binChar += hexByte[hexNibbleIdx] - ('a' - 10);
}
binStr[binStrIdx++] = binChar;
hexNibbleIdx = 0;
}
}
}
*outLength = binStrIdx;
return binStr;
}
else
{
*outLength = 0;
return NULL;
}
binStr[binStrIdx++] = binChar;
hexNibbleIdx = 0;
}
}
}
*outLength = binStrIdx;
return binStr;
}
else
{
*outLength = 0;
return NULL;
}
}
// FIXME: can't use my original code here,
branches/Bungo/i386/libsaio/saio_types.h
7373
7474
7575
76
76
7777
7878
7979
......
144144
145145
146146
147
148
149
147
148
149
150150
151151
152152
......
167167
168168
169169
170
171
172
173
174
175
176
177
170
171
172
173
174
175
176
177
178178
179179
180
181
182
180
181
182
183183
184184
185185
186186
187187
188188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216216
217217
218218
......
225225
226226
227227
228
228
229229
230230
231231
232232
233233
234
234
235235
236236
237237
......
241241
242242
243243
244
245
246
247
244
245
246
247
248248
249249
250250
251251
252252
253
253
254254
255
255
256256
257257
258258
typedef struct {
charplist[IO_CONFIG_DATA_SIZE];// buffer for plist
TagPtrdictionary; // buffer for xml dictionary
TagPtrdictionary;// buffer for xml dictionary
boolcanOverride;// flag to mark a dictionary can be overriden
} config_file_t;
} FinderInfo;
struct BootVolume;
typedef struct BootVolume *BVRef;
typedef struct BootVolume *CICell;
structBootVolume;
typedef structBootVolume *BVRef;
typedef structBootVolume *CICell;
typedef long (*FSInit)(CICell ih);
typedef long (*FSLoadFile)(CICell ih, char * filePath);
int i_filesize; /* size of file */
};
#define BPS 512 /* sector size of the device */
#define F_READ 0x1/* file opened for reading */
#define F_WRITE 0x2/* file opened for writing */
#define F_ALLOC 0x4/* buffer allocated */
#define F_FILE 0x8/* file instead of device */
#define F_NBSF 0x10/* no bad sector forwarding */
#define F_SSI 0x40/* set skip sector inhibit */
#define F_MEM 0x80/* memory instead of file or device */
#define BPS 512/* sector size of the device */
#define F_READ 0x1/* file opened for reading */
#define F_WRITE 0x2/* file opened for writing */
#define F_ALLOC 0x4/* buffer allocated */
#define F_FILE 0x8/* file instead of device */
#define F_NBSF 0x10/* no bad sector forwarding */
#define F_SSI 0x40/* set skip sector inhibit */
#define F_MEM 0x80/* memory instead of file or device */
struct dirstuff {
char * dir_path;/* directory path */
long long dir_index;/* directory entry index */
BVRef dir_bvr; /* volume reference */
char * dir_path;/* directory path */
long long dir_index;/* directory entry index */
BVRef dir_bvr;/* volume reference */
};
#define BVSTRLEN 36 // changed from 32 to 36 due to gpt partition name length
#define OSVERSTRLEN 9
struct BootVolume {
BVRef next; /* list linkage pointer */
int biosdev; /* BIOS device number */
int type; /* device type (floppy, hd, network) */
unsigned intflags; /* attribute flags */
BVGetDescriptiondescription; /* BVGetDescription function */
int part_no; /* partition number (1 based) */
unsigned intpart_boff; /* partition block offset */
unsigned intpart_type; /* partition type */
unsigned intfs_boff; /* 1st block # of next read */
unsigned intfs_byteoff; /* Byte offset for read within block */
FSLoadFile fs_loadfile; /* FSLoadFile function */
FSReadFile fs_readfile; /* FSReadFile function */
FSGetDirEntryfs_getdirentry; /* FSGetDirEntry function */
FSGetFileBlockfs_getfileblock; /* FSGetFileBlock function */
FSGetUUID fs_getuuid; /* FSGetUUID function */
unsigned intbps; /* bytes per sector for this device */
char name[BVSTRLEN]; /* (name of partition) */
char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */
BVFree bv_free; /* BVFree function */
uint32_t modTime;
char label[BVSTRLEN]; /* partition volume label */
char altlabel[BVSTRLEN]; /* alternate partition volume label */
bool filtered; /* newFilteredBVChain() will set to TRUE */
bool visible; /* will shown in the device list */
char OSVersion[OSVERSTRLEN]; /* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductVersion' e.g. "10.10.10" - hope will not reach e.g. 111.222.333 soon:) If so, OSVERSTRLEN 9 change to 12 */
bool OSisServer; /* 1 = OS X server , 0 = OS X client */
bool OSisInstaller; /* 1 = OS X Install partition / recovery partition , 0 = OS X Install */
BVRefnext;/* list linkage pointer */
intbiosdev;/* BIOS device number */
inttype;/* device type (floppy, hd, network) */
unsigned intflags;/* attribute flags */
BVGetDescriptiondescription;/* BVGetDescription function */
intpart_no;/* partition number (1 based) */
unsigned intpart_boff;/* partition block offset */
unsigned intpart_type;/* partition type */
unsigned intfs_boff;/* 1st block # of next read */
unsigned intfs_byteoff;/* Byte offset for read within block */
FSLoadFilefs_loadfile;/* FSLoadFile function */
FSReadFilefs_readfile;/* FSReadFile function */
FSGetDirEntryfs_getdirentry;/* FSGetDirEntry function */
FSGetFileBlockfs_getfileblock;/* FSGetFileBlock function */
FSGetUUIDfs_getuuid;/* FSGetUUID function */
unsigned intbps;/* bytes per sector for this device */
charname[BVSTRLEN];/* (name of partition) */
chartype_name[BVSTRLEN];/* (type of partition, eg. Apple_HFS) */
BVFreebv_free;/* BVFree function */
uint32_tmodTime;
charlabel[BVSTRLEN];/* partition volume label */
charaltlabel[BVSTRLEN];/* alternate partition volume label */
boolfiltered;/* newFilteredBVChain() will set to TRUE */
boolvisible;/* will shown in the device list */
charOSVersion[OSVERSTRLEN]; /* Null terminated string from '/System/Library/CoreServices/SystemVersion.plist/ProductVersion' e.g. "10.10.10" - hope will not reach e.g. 111.222.333 soon:) If so, OSVERSTRLEN 9 change to 12 */
boolOSisServer;/* 1 = OS X server , 0 = OS X client */
boolOSisInstaller;/* 1 = OS X Install partition / recovery partition , 0 = OS X Install */
};
kBVFlagEFISystem= 0x10,
kBVFlagBooter= 0x20,
kBVFlagSystemVolume= 0x40,
kBVFlagInstallVolume= 0x80
kBVFlagInstallVolume= 0x80
};
enum
{
kBIOSDevTypeFloppy= 0x00,
kBIOSDevTypeHardDrive= 0x80,
kBIOSDevTypeHardDrive= 0x80,
kBIOSDevTypeNetwork= 0xE0,
kBIOSDevUnitMask= 0x0F,
kBIOSDevTypeMask= 0xF0,
enum
{
//KPartitionTypeFAT12= 0x01, // FAT12
kPartitionTypeHPFS = 0x07, // Mac OS X
kPartitionTypeFAT16 = 0x06, // FAT16
kPartitionTypeFAT32 = 0x0C, // FAT32
kPartitionTypeEXT3 = 0x83, // Linux
kPartitionTypeHPFS= 0x07, // Mac OS X
kPartitionTypeFAT16= 0x06, // FAT16
kPartitionTypeFAT32= 0x0C, // FAT32
kPartitionTypeEXT3= 0x83, // Linux
kPartitionTypeOSXBoot= 0xAB, // Mac OS X Boot partition
kPartitionTypeFreeBSD= 0xA5, // FreeBSD
kPartitionTypeOpenBSD= 0xA6, // OpenBSD
//kPartitionTypeNeXTSTEP= 0xA7 // NeXTSTEP
//kPartitionTypeNetBSD= 0xA9 // NetBSD
kPartitionTypeHFS = 0xAF, // Mac OS X
kPartitionTypeHFS= 0xAF, // Mac OS X
//kPartitionTypeSolaris= 0xBE, // Solaris
kPartitionTypeBEFS = 0xEB, // BeOS BFS
kPartitionTypeBEFS= 0xEB, // BeOS BFS
//kPartitionTypeBeOS= 0xEB, // BeOS BFS
//kPartitionTypeSkyOS= 0xEC, // SkyOS
};
branches/Bungo/i386/libsaio/msdos.c
5252
5353
5454
55
55
5656
57
58
59
60
57
58
59
60
6161
6262
6363
......
9393
9494
9595
96
97
96
97
9898
99
100
99
100
101101
102
102
103103
104104
105105
......
149149
150150
151151
152
153
152
154153
155154
156155
......
181180
182181
183182
184
185
186
187
183
184
185
186
188187
189188
190189
......
252251
253252
254253
255
256
254
257255
258256
259257
......
280278
281279
282280
283
284
281
285282
286283
287284
......
346343
347344
348345
349
350
346
351347
352348
353349
......
391387
392388
393389
394
390
391
392
395393
396394
397395
......
417415
418416
419417
420
421
418
422419
423
420
421
422
424423
425424
426425
427426
428427
429
428
429
430
431
430432
431433
432434
......
568570
569571
570572
571
572
573
573574
574575
575576
......
605606
606607
607608
608
609
609
610610
611611
612612
......
633633
634634
635635
636
636637
638
639
637640
638641
642
639643
644
645
640646
641647
642648
......
645651
646652
647653
654
648655
656
657
649658
650659
651660
......
662671
663672
664673
665
666
674
675
667676
668677
669678
......
683692
684693
685694
695
686696
687697
688698
......
691701
692702
693703
704
705
694706
695707
696708
......
707719
708720
709721
710
722
711723
712724
713725
726
714727
728
729
715730
716731
717732
......
745760
746761
747762
763
748764
765
749766
750767
751768
752769
770
753771
754772
755773
756774
757775
758776
777
759778
760779
761780
762781
763
782
783
764784
765785
766786
767787
768788
769789
790
770791
792
793
771794
772795
773796
......
782805
783806
784807
785
808
786809
787810
788811
......
794817
795818
796819
797
798
820
799821
800822
801823
......
816838
817839
818840
841
819842
843
820844
821845
822846
823847
848
849
824850
825851
826852
......
828854
829855
830856
857
831858
859
832860
833861
834862
835863
836864
837865
866
838867
839868
840869
841870
842871
872
843873
844
874
875
876
845877
878
879
846880
847881
882
848883
849884
850885
......
870905
871906
872907
908
873909
874
875910
876911
877912
878913
879914
880915
916
881917
918
882919
920
921
883922
923
884924
925
926
885927
928
886929
887930
888931
889932
933
934
890935
936
891937
892938
893939
894940
895941
942
896943
944
897945
946
898947
899
948
949
900950
901951
902
952
953
903954
904955
956
905957
958
959
906960
907961
908962
909963
964
910965
966
967
911968
912969
913970
914971
915972
973
916974
975
976
917977
918978
919979
......
9441004
9451005
9461006
947
948
949
950
951
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
9521017
1018
9531019
9541020
9551021
1022
9561023
957
1024
1025
9581026
9591027
9601028
961
9621029
9631030
9641031
......
9731040
9741041
9751042
1043
1044
1045
9761046
9771047
9781048
......
9811051
9821052
9831053
1054
1055
9841056
985
1057
1058
9861059
9871060
9881061
......
9971070
9981071
9991072
1073
10001074
1001
1075
1076
10021077
10031078
10041079
......
10221097
10231098
10241099
1025
1100
10261101
10271102
10281103
10291104
1030
1031
1105
10321106
10331107
10341108
......
10361110
10371111
10381112
1039
1113
10401114
10411115
10421116
......
10481122
10491123
10501124
1051
1125
1126
10521127
10531128
10541129
1055
1056
1130
10571131
#include "msdos.h"
#define LABEL_LENGTH11
#define MSDOS_CACHE_BLOCKSIZE BPS
#define MSDOS_CACHE_BLOCKSIZEBPS
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
#defineCLUST_RSRVD160xfff8/* reserved cluster range */
#defineCLUST_RSRVD120xff8/* reserved cluster range */
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
#defineCLUST_RSRVD160xfff8/* reserved cluster range */
#defineCLUST_RSRVD120xff8/* reserved cluster range */
#define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c))
for (i = 0, c = 0; i <= 11; i++)
{
c = (u_char)*src++;
if (c < ' ' + !i || strchr("\"*+,./:;<=>?[\\]|", c))
c = (u_char)*src++;
if (c < ' ' + !i || strchr("\"*+,./:;<=>?[\\]|", c))
{
break;
}
break;
}
}
return i && !c;
return i && !c;
}
#endif /* UNUSED */
}
long
MSDOSInitPartition (CICell ih)
long MSDOSInitPartition (CICell ih)
{
union bootsector *bsp;
struct bpb33 *b33;
Seek(ih, 0);
Read(ih, (long)buf, 512);
bsp = (union bootsector *)buf;
b33 = (struct bpb33 *)bsp->bs33.bsBPB;
b50 = (struct bpb50 *)bsp->bs50.bsBPB;
b710 = (struct bpb710 *)bsp->bs710.bsBPB;
bsp = (union bootsector *)buf;
b33 = (struct bpb33 *)bsp->bs33.bsBPB;
b50 = (struct bpb50 *)bsp->bs50.bsBPB;
b710 = (struct bpb710 *)bsp->bs710.bsBPB;
/* We only work with 512, 1024, and 2048 byte sectors */
return 0;
}
static int
readSector(CICell ih, off_t readOffset, char *buf, int size)
static int readSector(CICell ih, off_t readOffset, char *buf, int size)
{
// Caching only FAT entries (4 bytes) by utlizing the cache with sector aligned read requests.
if (size < BPS)
return 0;
}
static int
msdosreadcluster (CICell ih, uint8_t *buf, int size, off_t *cluster)
static int msdosreadcluster (CICell ih, uint8_t *buf, int size, off_t *cluster)
{
off_t readOffset;
char tmpbuf[8];
}
}
static struct direntry *
getnextdirent (CICell ih, uint16_t *longname, struct msdosdirstate *st)
static struct direntry *getnextdirent (CICell ih, uint16_t *longname, struct msdosdirstate *st)
{
struct direntry *dirp;
while (1)
bcopy (&(wdirp->wePart1),longname+WIN_CHARS*(num-1),sizeof (wdirp->wePart1));
bcopy (&(wdirp->wePart2),longname+WIN_CHARS*(num-1)+5,sizeof (wdirp->wePart2));
bcopy (&(wdirp->wePart3),longname+WIN_CHARS*(num-1)+11,sizeof (wdirp->wePart3));
} else {
}
else
{
uint8_t labelchecksum;
int i;
longname[st->vfatnumber*WIN_CHARS]=0;
}
}
static void
initRoot (struct msdosdirstate *st)
static void initRoot (struct msdosdirstate *st)
{
if (msdosrootDirSectors) {/* FAT12 or FAT16 */
if (msdosrootDirSectors)
{
/* FAT12 or FAT16 */
st->root16 = 1;
st->vfatchecksum = 0;
st->nument = 0;
st->cluster = 0;
st->vfatnumber = 0;
} else {/* FAT32 */
}
else
{
/* FAT32 */
st->root16 = 0;
st->vfatchecksum = 0;
st->nument = 0;
{0x00A0,0x00A0}
};
static int
checkname (uint16_t *ucsname, int ucslen, struct direntry *dirp, uint16_t *vfatname)
static int checkname (uint16_t *ucsname, int ucslen, struct direntry *dirp, uint16_t *vfatname)
{
uint16_t tmp[15];
if (vfatname[0])
}
static struct direntry *
getdirpfrompath (CICell ih, char *dirspec, uint8_t *buf)
static struct direntry *getdirpfrompath (CICell ih, char *dirspec, uint8_t *buf)
{
struct msdosdirstate st;
struct direntry *dirp;
{
for (;*ptr && *ptr!='/';ptr++);
if (!*ptr)
{
return dirp;
}
ptr++;
if (!*ptr)
{
return dirp;
}
for (slash=ptr;*slash && *slash!='/';slash++);
c=*slash;
*slash=0;
ucsname[ucslenhost]=0;
*slash=c;
if (!(dirp->deAttributes & ATTR_DIRECTORY))
{
return 0;
}
st.root16 = 0;
st.vfatchecksum = 0;
st.nument = 0;
char ** name, long * flags, u_int32_t * time,
FinderInfo * finderInfo, long * infoValid)
{
struct msdosdirstate *st;
struct direntry *dirp;
struct msdosdirstate*st;
struct direntry*dirp;
uint16_tvfatname[WIN_MAXLEN+2*WIN_CHARS];
if (MSDOSInitPartition (ih)<0)
{
{
return -1;
}
bzero(st,sizeof (struct msdosdirstate) );
if (dirPath[0])
{
uint8_t *buf=malloc(msdosclustersize);
free (st);
return -1;
}
bzero(buf,msdosclustersize );
dirp = getdirpfrompath (ih, dirPath, buf);
if (!dirp || !(dirp->deAttributes & ATTR_DIRECTORY))
{
if (msdosfatbits == 32)
{
st->cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;
}
}
}
else
{
initRoot (st);
}
*dirIndex = (long long) (long) st;
}
while((dirp = getnextdirent (ih, vfatname, st))&& (dirp->deAttributes & ATTR_VOLUME));
free (st);
return -1;
}
for (i=7;i>=0;i--)
{
if (dirp->deName[i]!=' ')
{
break;
}
}
j=i+1;
tmp[i+1]=0;
for(;i>=0;i--)
tmp[i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i]-128][0]:tolower(dirp->deName[i]);
for (i=2;i>=0;i--)
{
if (dirp->deName[8+i]!=' ')
{
break;
}
}
if (i>=0)
{
tmp[j++]='.';
tmp[j+i+1]=0;
k=j+i+1;
for(;i>=0;i--)
{
tmp[j+i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i+8]-128][0]:tolower(dirp->deName[i+8]);
}
j=k;
}
{
*flags = kFileTypeFlat;
}
// Calculate a fake timestamp using modification date and time values.
*time = ((dirp->deMDate & 0x7FFF) << 16) + dirp->deMTime;
return 0;
}
long
MSDOSReadFile(CICell ih, char * filePath, void *base, uint64_t offset, uint64_t length)
long MSDOSReadFile(CICell ih, char * filePath, void *base, uint64_t offset, uint64_t length)
{
uint8_t *buf;
off_t cluster;
{
filePath++;
}
buf = malloc(msdosclustersize);
if (!buf)
{
return -1;
}
bzero(buf,msdosclustersize);
dirp = getdirpfrompath (ih, filePath, buf);
if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY))
free (buf);
return -1;
}
cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);
if (msdosfatbits == 32)
{
cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;
}
size = (uint32_t)OSReadLittleInt32 ((dirp->deFileSize),0);
if (size<=offset)
{
free (buf);
return -1;
}
nskip=offset/msdosclustersize;
for (i=0;i<nskip;i++)
for (i = 0; i < nskip; i++)
{
msdosreadcluster (ih, 0, 0, &cluster);
}
msdosreadcluster (ih, buf, msdosclustersize, &cluster);
toread=length;
if (length==0 || length>size-offset)
{
toread=size-offset;
else
{
return wastoread-toread;
}
}
}
long MSDOSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock)
{
uint8_t *buf;
off_t cluster;
struct direntry *dirp;
if (MSDOSInitPartition (ih)<0)
{
return -1;
}
if (filePath[0] == '/')
{
filePath++;
}
buf = malloc(msdosclustersize);
if (!buf)
{
return -1;
}
bzero(buf,msdosclustersize);
dirp = getdirpfrompath (ih, filePath, buf);
if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY))
{
free (buf);
return -1;
}
cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);
if (msdosfatbits == 32)
{
cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;
}
off_t clusn;
switch (msdosfatbits) {
switch (msdosfatbits)
{
case 32:
if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD32)
{
return -1;
}
clusn = cluster - CLUST_FIRST;
break;
case 16:
if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD16)
{
return 0;
}
clusn = cluster - CLUST_FIRST;
break;
case 12:
if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD12)
{
return 0;
}
clusn = cluster - CLUST_FIRST;
break;
default:
label[0] = 0xE5;
/* Remove any trailing spaces */
for (i=LABEL_LENGTH-1; i>=0; --i) {
if (label[i] == ' ')
label[i] = 0;
else
break;
for (i=LABEL_LENGTH-1; i>=0; --i)
{
if (label[i] == ' ')
{
label[i] = 0;
}
else
{
break;
}
}
labelucs[i++]=0;
len=i;
for (;i>=0;--i)
{
labelucs[i]=label[i]>=128?cp850[label[i]-128][1]:(label[i]);
}
utf_encodestr(labelucs, len, (uint8_t *)str, strMaxLen, OSHostByteOrder() );
}
void MSDOSGetDescription(CICell ih, char *str, long strMaxLen)
{
struct direntry *dirp;
return;
}
bzero(label,sizeof(label));
bzero(vfatlabel,sizeof(vfatlabel));
label[0] = '\0';
initRoot(&st);
{
return;
}
bzero(st.buf,msdosclustersize);
while ((dirp = getnextdirent (ih, vfatlabel, &st)))
if (dirp->deAttributes & ATTR_VOLUME) {
if (dirp->deAttributes & ATTR_VOLUME)
{
strncpy((char *)label, (char *)dirp->deName, LABEL_LENGTH);
labelfound = 1;
break;
utf_encodestr(vfatlabel, i, (u_int8_t *)str, strMaxLen, OSLittleEndian );
}
else if (labelfound)
{
fixLabel(label, str, strMaxLen);
}
/* else look in the boot blocks */
if (!labelfound || str[0] == '\0')
{
free (buf);
fixLabel(label, str, strMaxLen);
}
verbose("MSDOS: label=%s\n", str);
verbose("MSDOS: label=%s\n", str);
return;
}
long
MSDOSGetUUID(CICell ih, char *uuidStr)
long MSDOSGetUUID(CICell ih, char *uuidStr)
{
char *buf = malloc (512);
if (!buf)
return -1;
}
union bootsector *bsp = (union bootsector *)buf;
if (MSDOSInitPartition (ih)<0)
{
free (buf);
if (msdosfatbits == 32) { /* It's FAT32 */
memcpy(uuidStr+12, (char *)((struct extboot *)bsp->bs710.bsExt)->exVolumeID, 4);
}
else if (msdosfatbits == 16) {
else if (msdosfatbits == 16)
{
memcpy(uuidStr+12, (char *)((struct extboot *)bsp->bs50.bsExt)->exVolumeID, 4);
}
free (buf);
return 0;
return 0;
}
branches/Bungo/i386/libsaio/state_generator.c
4040
4141
4242
43
43
4444
45
45
4646
4747
4848
4949
5050
51
51
5252
53
53
5454
55
55
5656
57
57
5858
5959
6060
61
61
6262
6363
6464
......
6666
6767
6868
69
69
7070
7171
7272
7373
7474
75
75
7676
7777
78
78
7979
80
80
8181
8282
8383
8484
8585
8686
87
87
8888
8989
9090
......
526526
527527
528528
529
529
530530
531531
532532
......
592592
593593
594594
595
595
596596
597597
598598
void get_acpi_cpu_names(unsigned char *dsdt, uint32_t length)
{
uint32_t i;
verbose("ACPIpatcher: start finding cpu names. Length %d\n", length);
for (i=0; i<length-7; i++)
{
if (dsdt[i] == 0x5B && dsdt[i+1] == 0x83) // ProcessorOP
{
verbose("ACPIpatcher: DSDT[%X%X]\n", dsdt[i], dsdt[i+1]);
uint32_t offset = i + 3 + (dsdt[i+2] >> 6);
bool add_name = true;
uint8_t j;
for (j=0; j<4; j++)
{
char c = dsdt[offset+j];
if (!aml_isvalidchar(c))
{
add_name = false;
break;
}
}
if (add_name)
{
acpi_cpu_name[acpi_cpu_count] = malloc(4);
memcpy(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);
i = offset + 5;
if (acpi_cpu_count == 0)
acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8);
verbose("ACPIpatcher: found ACPI CPU [%c%c%c%c]\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]);
if (++acpi_cpu_count == 32) {
return;
}
}
}
}
verbose("ACPIpatcher: finished finding cpu names. Found: %d.\n", acpi_cpu_count);
}
aml_add_byte(tmpl, 0x06);// C6
aml_add_word(tmpl, 0x0046);// Latency
aml_add_dword(tmpl, 0x0000015E);// Power
}
}
if (c7_enabled) //C7
{
p_blk_lo = (acpi_cpu_p_blk + 6) & 0xff;
aml_add_byte(tmpl, 0x06);// C6
aml_add_word(tmpl, 0x0046);// Latency as in MacPro6,1
aml_add_dword(tmpl, 0x0000015E);// Power
}
}
if (c7_enabled) // C7
{
tmpl = aml_add_package(pack);
branches/Bungo/i386/libsaio/md5c.c
149149
150150
151151
152
152
153
153154
154155
155156
......
159160
160161
161162
162
163
164
163165
164166
165167
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) {
if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3))
{
context->count[1]++;
}
/* Transform as many times as possible. */
if (inputLen >= partLen) {
if (inputLen >= partLen)
{
memcpy((void *)&context->buffer[index], (const void *)input,
partLen);
MD5Transform (context->state, context->buffer);
branches/Bungo/i386/libsaio/fake_efi.c
110110
111111
112112
113
114
115
113
114
115
116116
117117
118118
......
167167
168168
169169
170
171
172
173
174
175
176
177
178
179
180
181170
171
172
173
174
175
176
177
178
179
180
181
182182
183183
184184
......
460460
461461
462462
463
463
464464
465465
466466
......
581581
582582
583583
584
585
586
587
588
589
584
585
586
587
588
589
590590
591591
592592
593593
594594
595
595
596596
597597
598598
599599
600600
601
601
602602
603603
604604
605605
606606
607
608
609
610
611
612
613
614
615
607
608
609
610
616611
612
613
614
615
616
617617
618618
619
620
621
622
623
619
620
621
622
623
624624
625
626
627
625
626
627
628628
629629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
674689
675690
676691
......
679694
680695
681696
682
683
684
685
686
687
697
698
699
700
701
702
703
704
688705
689706
690
691
692
693
694
695
696
697
698
699
700
701
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
702723
703724
704725
......
716737
717738
718739
719
740
720741
721
742
722743
723744
724745
725746
726
727
747
748
749
728750
729
751
752
753
754
730755
731756
732757
733758
734759
735760
736
761
737762
738763
739764
......
741766
742767
743768
744
769
770
745771
746772
747773
748774
749775
750
776
777
778
751779
752780
753781
......
758786
759787
760788
761
762
763
764
765
766
767
768
789
790
791
792
793
794
795
769796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
770813
771814
772815
......
774817
775818
776819
777
820
821
778822
779823
780824
781825
782
826
827
783828
784829
785830
786
831
832
787833
788834
789835
......
791837
792838
793839
794
840
841
795842
796843
797844
798845
799846
800847
801
848
849
802850
803851
804852
805853
806
854
855
807856
808857
809858
810859
811860
812
813
861
862
814863
815864
816865
......
828877
829878
830879
831
880
832881
833882
834883
......
837886
838887
839888
840
889
841890
842891
843892
......
863912
864913
865914
866
867
915
916
868917
869918
870919
871920
872
921
873922
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
9571007
9581008
9591009
960
961
962
963
964
965
966
967
968
969
970
971
972
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
9731029
9741030
9751031
......
10031059
10041060
10051061
1006
1062
10071063
10081064
10091065
......
10281084
10291085
10301086
1031
1087
10321088
10331089
10341090
10351091
10361092
10371093
1038
1094
10391095
10401096
10411097
......
10451101
10461102
10471103
1048
1049
1050
1104
1105
1106
10511107
10521108
1053
1054
1055
1109
1110
1111
10561112
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
12501351
12511352
12521353
......
12611362
12621363
12631364
1264
1265
1365
1366
12661367
1267
1268
1269
1270
1271
1272
1273
1368
1369
1370
1371
1372
1373
1374
12741375
12751376
1276
1277
1377
1378
12781379
1279
1380
12801381
12811382
12821383
......
12901391
12911392
12921393
1293
1394
12941395
12951396
1296
1297
1298
1397
1398
1399
12991400
static uint8_t const UNSUPPORTEDRET_INSTRUCTIONS_64[] = {0x48, 0xb8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3};
/* EFI Guides */
EFI_GUID const gEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID;
EFI_GUID const gEfiAcpiTableGuid = EFI_ACPI_TABLE_GUID;
EFI_GUID const gEfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID;
EFI_GUID const gEfiSmbiosTableGuid= EFI_SMBIOS_TABLE_GUID;
EFI_GUID const gEfiAcpiTableGuid= EFI_ACPI_TABLE_GUID;
EFI_GUID const gEfiAcpi20TableGuid= EFI_ACPI_20_TABLE_GUID;
EFI_SYSTEM_TABLE_32 *gST32 = NULL;
EFI_SYSTEM_TABLE_64 *gST64 = NULL;
{
DT__AddProperty(tableNode, "alias", strlen(alias)+1, (void *)alias);
}
i++;
if (archCpuType == CPU_TYPE_I386)
{
gST32->NumberOfTableEntries = i;
}
else
{
gST64->NumberOfTableEntries = i;
}
i++;
if (archCpuType == CPU_TYPE_I386)
{
gST32->NumberOfTableEntries = i;
}
else
{
gST64->NumberOfTableEntries = i;
}
return EFI_SUCCESS;
}
return EFI_UNSUPPORTED;
static const char BOARDID_PROP[] = "board-id";
static const char DEV_PATHS_SUP_PROP[] = "DevicePathsSupported";
static const char MACHINE_SIG_PROP[] = "machine-signature";
static EFI_UINT32 const ZERO_U32 = 0;
//static EFI_UINT32 const ZERO_U32 = 0;
static EFI_UINT32 const ONE_U32 = 1;
//static EFI_UINT32 const *VALUE[] = { &ZERO_U32 , &ONE_U32 };
static const char RANDOM_SEED_PROP[] = "random-seed";
bool getKernelCompat(EFI_UINT8 *compat)
{
int kernelFileRef;
EFI_UINT8 readBytes;
char kernelFilePath[512], kernelHeaderBuf[sizeof(struct fat_header) + 4*sizeof(struct fat_arch)];
//strlcpy(kernelFilePath, bootInfo->bootFile, sizeof(kernelFilePath)); // user defined path
snprintf(kernelFilePath, sizeof(kernelFilePath), "%s", bootInfo->bootFile); // user defined path
int kernelFileRef;
EFI_UINT8 readBytes;
char kernelFilePath[512], kernelHeaderBuf[sizeof(struct fat_header) + 4*sizeof(struct fat_arch)];
//strlcpy(kernelFilePath, bootInfo->bootFile, sizeof(kernelFilePath)); // user defined path
snprintf(kernelFilePath, sizeof(kernelFilePath), "%s", bootInfo->bootFile); // user defined path
if ((kernelFileRef = open(kernelFilePath, 0)) >= 0)
{
}
else
{
snprintf(kernelFilePath, sizeof(kernelFilePath), "/%s", bootInfo->bootFile); // append a leading '/'
snprintf(kernelFilePath, sizeof(kernelFilePath), "/%s", bootInfo->bootFile); // append a leading '/'
if ((kernelFileRef = open(kernelFilePath, 0)) >= 0)
{
}
else
{
snprintf(kernelFilePath, sizeof(kernelFilePath), "/System/Library/Kernels/%s", bootInfo->bootFile); // Yosemite path
snprintf(kernelFilePath, sizeof(kernelFilePath), "/System/Library/Kernels/%s", bootInfo->bootFile); // Yosemite path
if ((kernelFileRef = open(kernelFilePath, 0)) >= 0)
{
}
else
{
verbose("EfiKernelCompat: can't find any kernel file!\n");
return false;
}
}
}
verbose("EfiKernelCompat: reading kernel header from file: %s ... ", kernelFilePath);
if ((readBytes = read(kernelFileRef, kernelHeaderBuf, sizeof(struct fat_header) + 4*sizeof(struct fat_arch))) > 0) {
verbose("OK, read %d bytes.\n", readBytes);
verbose("EfiKernelCompat: can't find any kernel file!\n");
return false;
}
}
}
verbose("EfiKernelCompat: reading kernel header from file: %s ... ", kernelFilePath);
if ((readBytes = read(kernelFileRef, kernelHeaderBuf, sizeof(struct fat_header) + 4*sizeof(struct fat_arch))) > 0) {
verbose("OK, read %d bytes.\n", readBytes);
}
else
{
verbose("EROR, can't read kernel file!\n");
return false;
}
struct fat_header *fatHeaderPtr = (struct fat_header *)kernelHeaderBuf;
verbose("EROR, can't read kernel file!\n");
return false;
}
struct fat_header *fatHeaderPtr = (struct fat_header *)kernelHeaderBuf;
struct fat_arch *fatArchPtr = (struct fat_arch *)(kernelHeaderBuf + sizeof(struct fat_header));
struct mach_header *thinHeaderPtr = (struct mach_header *)kernelHeaderBuf;
bool swapit = false;
struct mach_header *thinHeaderPtr = (struct mach_header *)kernelHeaderBuf;
bool swapit = false;
switch (fatHeaderPtr->magic)
{
case FAT_CIGAM:
swapit = true;
fatHeaderPtr->nfat_arch = OSSwapInt32(fatHeaderPtr->nfat_arch);
case FAT_MAGIC:
*compat = 0;
verbose("EfiKernelCompat: kernel file is a fat binary: %d archs compatibility [", fatHeaderPtr->nfat_arch);
if (fatHeaderPtr->nfat_arch > 4) fatHeaderPtr->nfat_arch = 4;
for (; fatHeaderPtr->nfat_arch > 0; fatHeaderPtr->nfat_arch--, fatArchPtr++) {
if (swapit) fatArchPtr->cputype = OSSwapInt32(fatArchPtr->cputype);
switch(fatArchPtr->cputype) {
case CPU_TYPE_I386:
verbose(" i386");
break;
case CPU_TYPE_X86_64:
verbose(" x86_64");
break;
case CPU_TYPE_POWERPC:
verbose(" PPC");
break;
case CPU_TYPE_POWERPC64:
verbose(" PPC64");
break;
default:
verbose(" 0x%x", fatArchPtr->cputype);
}
if (fatHeaderPtr->nfat_arch - 1 > 0) verbose(" | ");
*compat |= (!(fatArchPtr->cputype ^ CPU_TYPE_I386) << 0) | (!(fatArchPtr->cputype ^ CPU_TYPE_X86_64) << 1) | (!(fatArchPtr->cputype ^ CPU_TYPE_POWERPC) << 2) | (!(fatArchPtr->cputype ^ CPU_TYPE_POWERPC64) << 3);
}
verbose(" ]\n");
break;
case MH_CIGAM:
case MH_CIGAM_64:
thinHeaderPtr->cputype = OSSwapInt32(thinHeaderPtr->cputype);
case MH_MAGIC:
case MH_MAGIC_64:
*compat = (!(thinHeaderPtr->cputype ^ CPU_TYPE_I386) << 0) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_X86_64) << 1) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_POWERPC) << 2) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_POWERPC64) << 3);
verbose("EfiKernelCompat: kernel file is a thin binary: 1 arch compatibility found [ %s ].\n", !((thinHeaderPtr->cputype & 0x000000FF) ^ 0x00000007) ? (!((thinHeaderPtr->cputype & 0xFF000000) ^ 0x01000000) ? "x86_64" : "i386") : (!((thinHeaderPtr->cputype & 0xFF000000) ^ 0x01000000) ? "PPC64" : "PPC"));
break;
default:
verbose("EfiKernelCompat: unknown kernel file '%s'. Can't determine arch compatibility!\n", kernelFilePath);
return false;
}
return true;
case FAT_CIGAM:
swapit = true;
fatHeaderPtr->nfat_arch = OSSwapInt32(fatHeaderPtr->nfat_arch);
case FAT_MAGIC:
*compat = 0;
verbose("EfiKernelCompat: kernel file is a fat binary: %d archs compatibility [", fatHeaderPtr->nfat_arch);
if (fatHeaderPtr->nfat_arch > 4)
{
fatHeaderPtr->nfat_arch = 4;
}
for (; fatHeaderPtr->nfat_arch > 0; fatHeaderPtr->nfat_arch--, fatArchPtr++)
{
if (swapit)
{
fatArchPtr->cputype = OSSwapInt32(fatArchPtr->cputype);
}
switch(fatArchPtr->cputype)
{
case CPU_TYPE_I386:
verbose(" i386");
break;
case CPU_TYPE_X86_64:
verbose(" x86_64");
break;
case CPU_TYPE_POWERPC:
verbose(" PPC");
break;
case CPU_TYPE_POWERPC64:
verbose(" PPC64");
break;
default:
verbose(" 0x%x", fatArchPtr->cputype);
}
if (fatHeaderPtr->nfat_arch - 1 > 0)
{
verbose(" | ");
}
*compat |= (!(fatArchPtr->cputype ^ CPU_TYPE_I386) << 0) | (!(fatArchPtr->cputype ^ CPU_TYPE_X86_64) << 1) | (!(fatArchPtr->cputype ^ CPU_TYPE_POWERPC) << 2) | (!(fatArchPtr->cputype ^ CPU_TYPE_POWERPC64) << 3);
}
verbose(" ]\n");
break;
case MH_CIGAM:
case MH_CIGAM_64:
thinHeaderPtr->cputype = OSSwapInt32(thinHeaderPtr->cputype);
case MH_MAGIC:
case MH_MAGIC_64:
*compat = (!(thinHeaderPtr->cputype ^ CPU_TYPE_I386) << 0) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_X86_64) << 1) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_POWERPC) << 2) | (!(thinHeaderPtr->cputype ^ CPU_TYPE_POWERPC64) << 3);
verbose("EfiKernelCompat: kernel file is a thin binary: 1 arch compatibility found [ %s ].\n", !((thinHeaderPtr->cputype & 0x000000FF) ^ 0x00000007) ? (!((thinHeaderPtr->cputype & 0xFF000000) ^ 0x01000000) ? "x86_64" : "i386") : (!((thinHeaderPtr->cputype & 0xFF000000) ^ 0x01000000) ? "PPC64" : "PPC"));
break;
default:
verbose("EfiKernelCompat: unknown kernel file '%s'. Can't determine arch compatibility!\n", kernelFilePath);
return false;
}
return true;
}
/*
static void setupEfiConfigurationTable()
{
// smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);
if (smbios_p) {
if (EFI_SUCCESS == addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL)) {
verbose("Fake EFI: sucesfuly added %sbit configuration table for SMBIOS: guid {EB9D2D31-2D88-11D3-9A16-0090273FC14D}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
if (smbios_p)
{
if (EFI_SUCCESS == addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL))
{
verbose("Fake EFI: sucesfuly added %sbit configuration table for SMBIOS: guid {EB9D2D31-2D88-11D3-9A16-0090273FC14D}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
// Setup ACPI with DSDT overrides (mackerintel's patch)
//setupAcpi();
if (acpi10_p) {
if (EFI_SUCCESS == addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI")) {
verbose("Fake EFI: sucesfuly added %sbit configuration table for ACPI: guid {EB9D2D30-2D88-11D3-9A16-0090273FC14D}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
if (acpi20_p) {
if (EFI_SUCCESS == addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20")) {
verbose("Fake EFI: sucesfuly added %sbit configuration table for ACPI_20: guid {8868E871-E4F1-11D3-BC22-0080C73C8881}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
if (acpi10_p)
{
if (EFI_SUCCESS == addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI"))
{
verbose("Fake EFI: sucesfuly added %sbit configuration table for ACPI: guid {EB9D2D30-2D88-11D3-9A16-0090273FC14D}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
if (acpi20_p)
{
if (EFI_SUCCESS == addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20")) {
verbose("Fake EFI: sucesfuly added %sbit configuration table for ACPI_20: guid {8868E871-E4F1-11D3-BC22-0080C73C8881}.\n", (archCpuType == CPU_TYPE_I386) ? "32":"64");
}
}
// We've obviously changed the count.. so fix up the CRC32
if (archCpuType == CPU_TYPE_I386)
{
{
EFI_CHAR16* ret16 = 0;
size_t len = 0;
Node *efiNode = DT__FindNode("/efi", true);
if (efiNode == 0)
if (efiNode == 0)
{
stop("Couldn't get '/efi' node");
}
/* Bungo: we have 64 bit ability fake efi but mode may be changed 32/64, like in Macs
if (archCpuType == CPU_TYPE_I386) {
/* Bungo: we have 64 bit ability fake efi but mode may be changed 32/64, like Macs
if (archCpuType == CPU_TYPE_I386)
{
DT__AddProperty(efiNode, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (EFI_CHAR8 *)FIRMWARE_ABI_32_PROP_VALUE);
} else { */
}
else
{
*/
DT__AddProperty(efiNode, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (EFI_CHAR8 *)FIRMWARE_ABI_64_PROP_VALUE);
//}
// So, added 'efi-mode' property to tell us what mode we use 32 or 64 bit
DT__AddProperty(efiNode, EFI_MODE_PROP, sizeof(EFI_UINT8), (EFI_UINT8 *)&bootArgs->efiMode);
DT__AddProperty(efiNode, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32 *)&FIRMWARE_REVISION);
DT__AddProperty(efiNode, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16 *)FIRMWARE_VENDOR);
DT__AddProperty(efiNode, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16 *)&FIRMWARE_VENDOR);
// TODO: Fill in other efi properties if necessary
// is set up. That is, name and table properties
Node *runtimeServicesNode = DT__AddChild(efiNode, "runtime-services");
if (archCpuType == CPU_TYPE_I386) {
if (archCpuType == CPU_TYPE_I386)
{
// The value of the table property is the 32-bit physical address for the RuntimeServices table.
// Since the EFI system table already has a pointer to it, we simply use the address of that pointer
// for the pointer to the property data. Warning.. DT finalization calls free on that but we're not
// the only thing to use a non-malloc'd pointer for something in the DT
DT__AddProperty(runtimeServicesNode, "table", sizeof(EFI_UINT64), &gST32->RuntimeServices);
} else {
}
else
{
DT__AddProperty(runtimeServicesNode, "table", sizeof(EFI_UINT64), &gST64->RuntimeServices);
}
// Set up the /efi/kernel-compatibility node only if 10.7 or better
if (MacOSVerCurrent >= MacOSVer2Int("10.7"))
{
Node *EfiKernelCompatNode = DT__AddChild(efiNode, "kernel-compatibility");
EFI_UINT8 compat = (archCpuType == CPU_TYPE_I386) ? 0b00000001 : 0b00000010;
getKernelCompat(&compat);
if (compat & 0b00000001) DT__AddProperty(EfiKernelCompatNode, "i386", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
if (compat & 0b00000010) DT__AddProperty(EfiKernelCompatNode, "x86_64", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
if (compat & 0b00000100) DT__AddProperty(EfiKernelCompatNode, "PPC", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
if (compat & 0b00001000) DT__AddProperty(EfiKernelCompatNode, "PPC64", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
}
Node *EfiKernelCompatNode = DT__AddChild(efiNode, "kernel-compatibility");
EFI_UINT8 compat = (archCpuType == CPU_TYPE_I386) ? 0b00000001 : 0b00000010;
getKernelCompat(&compat);
if (compat & 0b00000001)
{
DT__AddProperty(EfiKernelCompatNode, "i386", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
}
if (compat & 0b00000010)
{
DT__AddProperty(EfiKernelCompatNode, "x86_64", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
}
if (compat & 0b00000100)
{
DT__AddProperty(EfiKernelCompatNode, "PPC", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
}
if (compat & 0b00001000)
{
DT__AddProperty(EfiKernelCompatNode, "PPC64", sizeof(EFI_UINT32), (EFI_UINT32 *)&ONE_U32);
}
}
// Now fill in the /efi/platform Node
Node *efiPlatformNode = DT__AddChild(efiNode, "platform");
// the value in the fsbFrequency global and not an malloc'd pointer
// because the DT_AddProperty function does not copy its args.
if (Platform.CPU.FSBFrequency != 0) {
if (Platform.CPU.FSBFrequency != 0)
{
DT__AddProperty(efiPlatformNode, FSB_Frequency_prop, sizeof(EFI_UINT64), (EFI_UINT64 *)&Platform.CPU.FSBFrequency);
}
// Export TSC and CPU frequencies for use by the kernel or KEXTs
if (Platform.CPU.TSCFrequency != 0) {
if (Platform.CPU.TSCFrequency != 0)
{
DT__AddProperty(efiPlatformNode, TSC_Frequency_prop, sizeof(EFI_UINT64), (EFI_UINT64 *)&Platform.CPU.TSCFrequency);
}
if (Platform.CPU.CPUFrequency != 0) {
if (Platform.CPU.CPUFrequency != 0)
{
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(EFI_UINT64), (EFI_UINT64 *)&Platform.CPU.CPUFrequency);
}
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
if ((ret=getSystemID())) {
if ((ret=getSystemID()))
{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32*) ret);
}
*/
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, Platform.UUID);
// Export SystemSerialNumber if present
if ((ret16=getSmbiosChar16("SMserial", &len))) {
if ((ret16=getSmbiosChar16("SMserial", &len)))
{
DT__AddProperty(efiPlatformNode, SYSTEM_SERIAL_PROP, len, ret16);
}
// Export Model if present
if ((ret16=getSmbiosChar16("SMproductname", &len))) {
if ((ret16=getSmbiosChar16("SMproductname", &len)))
{
DT__AddProperty(efiPlatformNode, MODEL_PROP, len, ret16);
}
// Fill /efi/device-properties.
setupDeviceProperties(efiNode);
// Add configuration table entries to both the services table and the device tree
// Add configuration table entries to both the services table and the device tree
setupEfiConfigurationTable();
}
const char *boardid = getStringForKey("SMboardproduct", &bootInfo->smbiosConfig);
if (boardid)
{
DT__AddProperty(node, BOARDID_PROP, strlen(boardid)+1, (EFI_CHAR16 *)boardid);
DT__AddProperty(node, BOARDID_PROP, strlen(boardid)+1, (EFI_CHAR16*)boardid);
}
}
*
setupRootNode()
{
}
*/
/*
length = strlen(bootInfo->bootFile);
if (length)
{
DT__AddProperty(chosenNode, "boot-file", length + 1, bootInfo->bootFile);
}
DT__AddProperty(chosenNode, "boot-file", length + 1, bootInfo->bootFile);
}
// TODO:
//DT__AddProperty(chosenNode, "boot-device-path", bootDPsize, gBootDP);
//DT__AddProperty(chosenNode, "boot-file-path", bootFPsize, gBootFP);
//DT__AddProperty(chosenNode, "boot-kernelchache-adler32", sizeof(adler32), adler32);
DT__AddProperty(chosenNode, MACHINE_SIG_PROP, sizeof(Platform.HWSignature), (EFI_UINT32 *)&Platform.HWSignature);
// add if Yosemite or better only
if (MacOSVerCurrent >= MacOSVer2Int("10.10"))
{
//
// Pike R. Alpha - 12 October 2014
//
UInt8 index = 0;
EFI_UINT16 PMTimerValue = 0;
EFI_UINT32 randomValue, tempValue, cpuTick;
EFI_UINT32 ecx, esi, edi;
EFI_UINT32 rcx, rdx, rsi, rdi;
randomValue = tempValue = ecx = esi = edi = 0;// xor%ecx,%ecx
cpuTick = rcx = rdx = rsi = rdi = 0;
// LEAF_1 - Feature Information (Function 01h).
if (Platform.CPU.CPUID[CPUID_1][2] & 0x40000000)// Checking ecx:bit-30
{
//
// i5/i7 Ivy Bridge and Haswell processors with RDRAND support.
//
// EFI_UINT32 seedBuffer[16] = {0};
//
// Main loop to get 16 qwords (four bytes each).
//
EFI_UINT32 *seedPtr = (EFI_UINT32 *)RANDOM_SEED_PROP_VALUE;
for (index = 0; index < 16; index++)// 0x17e12:
{
randomValue = computeRand();// callq0x18e20
cpuTick = getCPUTick();// callq0x121a7
randomValue = (randomValue ^ cpuTick);// xor%rdi,%rax
seedPtr[index] = randomValue;// mov%rax,(%r15,%rsi,8)
}// jb0x17e12
}
else
{
//
// All other processors without RDRAND support.
//
// EFI_UINT8 seedBuffer[64] = {0};
//
// Main loop to get the 64 bytes.
//
EFI_UINT8 *seedPtr = (EFI_UINT8 *)RANDOM_SEED_PROP_VALUE;
do// 0x17e55:
{
PMTimerValue = inw(0x408);// in(%dx),%ax
esi = PMTimerValue;// movzwl%ax,%esi
if (esi < ecx)// cmp%ecx,%esi
{
continue;// jb0x17e55(retry)
}
cpuTick = getCPUTick();// callq0x121a7
rcx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
rdx = (cpuTick >> 10);// mov%rax,%rdx
// shr$0x10,%rdx
rdi = rsi;// mov%rsi,%rdi
rdi = (rdi ^ cpuTick);// xor%rax,%rdi
rdi = (rdi ^ rcx);// xor%rcx,%rdi
rdi = (rdi ^ rdx);// xor%rdx,%rdi
//RANDOM_SEED_PROP_VALUE[index] = (EFI_UINT8)(rdi & 0xff);// mov%dil,(%r15,%r12,1)
seedPtr[index] = (EFI_UINT8)(rdi & 0xff);
edi = (edi & 0x2f);// and$0x2f,%edi
edi = (edi + esi);// add%esi,%edi
index++;// incr12
ecx = (edi & 0xffff);// movzwl%di,%ecx
} while (index < 64);// cmp%r14d,%r12d
// jne0x17e55(next)
}
DT__AddProperty(chosenNode, RANDOM_SEED_PROP, sizeof(RANDOM_SEED_PROP_VALUE), (EFI_UINT8 *)RANDOM_SEED_PROP_VALUE);
}
// setup '/chosen/memory-map' node
Node *memoryMapNode = DT__FindNode("/chosen/memory-map", false);
// add if Yosemite or better only
if (MacOSVerCurrent >= MacOSVer2Int("10.10"))
{
//
// Pike R. Alpha - 12 October 2014
//
UInt8 index = 0;
EFI_UINT16 PMTimerValue = 0;
EFI_UINT32 randomValue, tempValue, cpuTick;
EFI_UINT32 ecx, esi, edi;
EFI_UINT32 rcx, rdx, rsi, rdi;
randomValue = tempValue = ecx = esi = edi = 0;// xor%ecx,%ecx
cpuTick = rcx = rdx = rsi = rdi = 0;
// LEAF_1 - Feature Information (Function 01h).
if (Platform.CPU.CPUID[CPUID_1][2] & 0x40000000)// Checking ecx:bit-30
{
//
// i5/i7 Ivy Bridge and Haswell processors with RDRAND support.
//
// EFI_UINT32 seedBuffer[16] = {0};
//
// Main loop to get 16 qwords (four bytes each).
//
EFI_UINT32 *seedPtr = (EFI_UINT32 *)RANDOM_SEED_PROP_VALUE;
for (index = 0; index < 16; index++)// 0x17e12:
{
randomValue = computeRand();// callq0x18e20
cpuTick = getCPUTick();// callq0x121a7
randomValue = (randomValue ^ cpuTick);// xor%rdi,%rax
seedPtr[index] = randomValue;// mov%rax,(%r15,%rsi,8)
}// jb0x17e12
}
else
{
//
// All other processors without RDRAND support.
//
//EFI_UINT8 seedBuffer[64] = {0};
//
// Main loop to get the 64 bytes.
//
EFI_UINT8 *seedPtr = (EFI_UINT8 *)RANDOM_SEED_PROP_VALUE;
do// 0x17e55:
{
PMTimerValue = inw(0x408);// in(%dx),%ax
esi = PMTimerValue;// movzwl%ax,%esi
if (esi < ecx)// cmp%ecx,%esi
{
continue;// jb0x17e55(retry)
}
cpuTick = getCPUTick();// callq0x121a7
//printf("value: 0x%llx\n", getCPUTick());
rcx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
rdx = (cpuTick >> 10);// mov%rax,%rdx
// shr$0x10,%rdx
rdi = rsi;// mov%rsi,%rdi
rdi = (rdi ^ cpuTick);// xor%rax,%rdi
rdi = (rdi ^ rcx);// xor%rcx,%rdi
rdi = (rdi ^ rdx);// xor%rdx,%rdi
//RANDOM_SEED_PROP_VALUE[index] = (EFI_UINT8)(rdi & 0xff);// mov%dil,(%r15,%r12,1)
seedPtr[index] = (EFI_UINT8)(rdi & 0xff);
edi = (edi & 0x2f);// and$0x2f,%edi
edi = (edi + esi);// add%esi,%edi
index++;// incr12
ecx = (edi & 0xffff);// movzwl%di,%ecx
} while (index < 64);// cmp%r14d,%r12d
// jne0x17e55(next)
}
DT__AddProperty(chosenNode, RANDOM_SEED_PROP, sizeof(RANDOM_SEED_PROP_VALUE), (EFI_UINT8 *)RANDOM_SEED_PROP_VALUE);
}
// setup '/chosen/memory-map' node
Node *memoryMapNode = DT__FindNode("/chosen/memory-map", false);
if (memoryMapNode == NULL)
{
verbose("setupChosenNode:Couldn't get '/chosen/memory-map' node\n");
} else { /*
static EFI_UINT64 BootClutPropValue = 0;
static EFI_UINT64 FailedBootPictPropValue = 0;
BootClutPropValue = ((EFI_UINT64)sizeof(appleClut8) << 32) | (EFI_UINT64)(EFI_UINT8 *)&appleClut8;
FailedBootPictPropValue = ((EFI_UINT64)(sizeof(gFailedBootPict) + 32) << 32) | (EFI_UINT64)(EFI_UINT8 *)&gFailedBootPict;
if (MacOSVerCurrent < MacOSVer2Int("10.7.3")) {
DT__AddProperty(node, "BootCLUT", sizeof(EFI_UINT64), (EFI_UINT64 *)&BootClutPropValue);
DT__AddProperty(node, "Pict-FailedBoot", sizeof(EFI_UINT64), (EFI_UINT64 *)&FailedBootPictPropValue);
} else {
DT__AddProperty(node, "FailedCLUT", sizeof(EFI_UINT64), (EFI_UINT64 *)&BootClutPropValue);
DT__AddProperty(node, "FailedImage", sizeof(EFI_UINT64), (EFI_UINT64 *)&FailedBootPictPropValue);
} */
}
}
else
{
/*
static EFI_UINT64 BootClutPropValue = 0;
static EFI_UINT64 FailedBootPictPropValue = 0;
BootClutPropValue = ((EFI_UINT64)sizeof(appleClut8) << 32) | (EFI_UINT64)(EFI_UINT8 *)&appleClut8;
FailedBootPictPropValue = ((EFI_UINT64)(sizeof(gFailedBootPict) + 32) << 32) | (EFI_UINT64)(EFI_UINT8 *)&gFailedBootPict;
if (MacOSVerCurrent < MacOSVer2Int("10.7.3")) {
DT__AddProperty(node, "BootCLUT", sizeof(EFI_UINT64), (EFI_UINT64 *)&BootClutPropValue);
DT__AddProperty(node, "Pict-FailedBoot", sizeof(EFI_UINT64), (EFI_UINT64 *)&FailedBootPictPropValue);
}
else
{
DT__AddProperty(node, "FailedCLUT", sizeof(EFI_UINT64), (EFI_UINT64 *)&BootClutPropValue);
DT__AddProperty(node, "FailedImage", sizeof(EFI_UINT64), (EFI_UINT64 *)&FailedBootPictPropValue);
}
*/
}
}
/*
if (err)
{
verbose("setupSmbiosConfigFile: no SMBIOS replacement found.\n");
verbose("setupSmbiosConfigFile: No SMBIOS replacement found.\n");
}
// get a chance to scan mem dynamically if user asks for it while having the config options
origeps = getSmbios(SMBIOS_ORIGINAL);
if (!origeps)
{
verbose("saveOriginalSMBIOS: original SMBIOS not found\n");
verbose("saveOriginalSMBIOS: original SMBIOS not found\n");
return;
}
tableAddress = (void *)AllocateKernelMemory(origeps->dmi.tableLength);
if (!tableAddress)
{
verbose("saveOriginalSMBIOS: can not allocate memory for original SMBIOS\n");
verbose("saveOriginalSMBIOS: can not allocate memory for original SMBIOS\n");
return;
}
char saveOriginalACPI()
{
verbose("\nsaveOriginalACPI: Saving OEM tables into IODT:/chosen/acpi...\n");
Node *node = DT__FindNode("/chosen/acpi", true);
verbose("\nsaveOriginalACPI: Saving OEM tables into IODT:/chosen/acpi...\n");
Node *node = DT__FindNode("/chosen/acpi", true);
if (!node)
{
verbose("saveOriginalACPI: node '/chosen/acpi' not found, can't save any OEM tables.\n\n");
return 0;
}
verbose("saveOriginalACPI: node '/chosen/acpi' not found, can't save any OEM tables.\n\n");
return 0;
}
struct acpi_2_rsdp *RSDP = getRSDPaddress();
if (!RSDP) {
verbose("saveOriginalACPI: OEM RSDP not found or incorrect, can't save any OEM tables.\n\n");
return 0;
}
uint8_t r,
total_number = 1,
ssdt_number = 0,
nameLen = strlen("XXXX@XXXXXXXX");
uint32_t length = RSDP->Revision ? RSDP->Length : 20;
char *nameBuf = malloc(nameLen);
sprintf(nameBuf, "RSDP@%08X", (uint32_t)RSDP);
verbose("saveOriginalACPI: OEM table %s found, length=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, RSDP);
uint32_t total_length = length;
struct acpi_2_header *RSDT = (struct acpi_2_header *)(RSDP->RsdtAddress),
*XSDT = (struct acpi_2_header *)(uint32_t)(RSDP->XsdtAddress);
void *origTable = NULL,
*origTable2 = NULL,
*origTable3 = NULL,
*origTable4 = NULL;
if ((RSDP->RsdtAddress > 0) && (RSDP->RsdtAddress < 0xFFFFFFFF) && tableSign(RSDT->Signature, "RSDT")) {
origTable = (void *)(RSDT + 1);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "RSDT@%08X", (uint32_t)RSDT);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, RSDT->Length);
DT__AddProperty(node, nameBuf, RSDT->Length, RSDT);
total_length += RSDT->Length;
total_number++;
for ( ; origTable < ((void *)RSDT + RSDT->Length); origTable += 4) {
origTable2 = (void *)(*(uint32_t *)origTable);
length = ((struct acpi_2_header *)origTable2)->Length;
total_length += length;
total_number++;
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "SSDT")) {
ssdt_number++;
if (strcmp(((struct acpi_2_header *)origTable2)->OEMTableId, "CpuPm") == 0) {
nameLen = strlen("SSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT@%08X", (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
origTable2 += sizeof(struct acpi_2_header) + 15;
r = *((uint8_t *)origTable2 - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (; r > 0; r--, origTable2 += sizeof(struct ssdt_pmref)) {
origTable3 = (void *)(((struct ssdt_pmref *)origTable2)->addr);
if (!((uint32_t)origTable3 > 0) && !((uint32_t)origTable3 < 0xFFFFFFFF)) continue; // incorrect, dropping
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("SSDT_@XXXXXXXX") + strlen((char *)((struct acpi_2_header *)origTable3)->OEMTableId);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT_%s@%08X", (char *)((struct acpi_2_header *)origTable3)->OEMTableId, (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
} else {
nameLen = strlen("SSDT-@XXXXXXXX") + ((ssdt_number < 10)? 1:2);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT-%d@%08X", ssdt_number, (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
}
} else {
nameLen = strlen("XXXX@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "%c%c%c%c@%08X", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "FACP")) {
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->FACS);
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("FACS@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "FACS@%08X", (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->DSDT);
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("DSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "DSDT@%08X", (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
}
}
} else {
verbose("saveOriginalACPI: OEM table RSDT@%08x not found or incorrect.\n", RSDP->RsdtAddress);
}
if (gVerboseMode) pause("");
if (RSDP->Revision > 0) {
verbose("\n");
if ((RSDP->XsdtAddress > 0) && (RSDP->XsdtAddress < 0xFFFFFFFF) && tableSign(XSDT->Signature, "XSDT")) {
verbose("saveOriginalACPI: OEM table XSDT@%016X found, lenght=%d: saving.\n", (uint32_t)XSDT, XSDT->Length);
nameLen = strlen("XSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "XSDT@%08X", (uint32_t)XSDT);
DT__AddProperty(node, nameBuf, XSDT->Length, XSDT);
total_number++;
total_length += XSDT->Length;
for (origTable = (void *)(RSDT + 1), origTable4 = (void *)(XSDT + 1); origTable4 < ((void *)XSDT + XSDT->Length); origTable += 4, origTable4 += 8) {
origTable2 = (void *)(uint32_t)(*(uint64_t *)origTable4);
length = ((struct acpi_2_header *)origTable2)->Length;
verbose("saveOriginalACPI: OEM table X_%c%c%c%c@%016X found, lenght=%d: ", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2, length);
if (*(uint32_t *)origTable != (uint32_t)origTable2) { // already saved?
verbose("saving.\n");
nameLen = strlen("X_XXXX@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_%c%c%c%c@%08X", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2);
DT__AddProperty(node, nameBuf, length, origTable2);
total_length += length;
total_number++;
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "SSDT") && (strcmp(((struct acpi_2_header *)origTable2)->OEMTableId, "CpuPm") == 0)) {
// Get rest of ssdts from ssdt_pmref
r = *((uint8_t *)origTable2 - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (; r > 0; r--, origTable2 += sizeof(struct ssdt_pmref)) {
origTable3 = (void *)(((struct ssdt_pmref *)origTable2)->addr);
if (!((uint32_t)origTable3 > 0) && !((uint32_t)origTable3 < 0xFFFFFFFF)) continue; // incorrect, dropping
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("SSDT_@XXXXXXXX") + strlen((char *)((struct acpi_2_header *)origTable3)->OEMTableId);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT_%s@%08X", (char *)((struct acpi_2_header *)origTable3)->OEMTableId, (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
continue;
}
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "FACP")) {
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->X_FACS); // take x_facs assuming facs (from x_facp) should be equal to it
length = ((struct acpi_2_rsdt *)origTable3)->Length;
verbose("saveOriginalACPI: OEM table X_FACS@%016X found, lenght=%d: ", (uint32_t)origTable3, length);
if (origTable3 != (void *)(((struct acpi_2_fadt *)origTable2)->FACS)) {
verbose("saving.\n");
nameLen = strlen("X_FACS@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_FACS@%08X", (uint32_t)origTable3);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
} else {
verbose("already saved.\n");
}
// assuming only one dsdt in system, so x_facp should contain pointer to it same as facp
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->X_DSDT);
length = ((struct acpi_2_rsdt *)origTable3)->Length;
verbose("saveOriginalACPI: OEM table X_DSDT@%016X found, lenght=%d: ", origTable3, length);
if (origTable3 != (void *)(((struct acpi_2_fadt *)origTable2)->DSDT)) {
verbose("saving.\n");
nameLen = strlen("X_DSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_DSDT@%08X", origTable3);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
} else {
verbose("already saved.\n");
}
continue;
}
} else {
verbose("already saved.\n");
}
}
} else {
verbose("saveOriginalACPI: OEM table XSDT@%08X%08X not found or incorrect.\n", (uint32_t)(RSDP->XsdtAddress >> 32), (uint32_t)(RSDP->XsdtAddress & 0xFFFFFFFF));
}
}
if (!RSDT && !XSDT) {
verbose("saveOriginalACPI: OEM RSDT & XSDT not found or incorrect, can't save any tables.\n\n");
return 0;
}
verbose("saveOriginalACPI: %d OEM table%s found and saved, total lenght=%d.\n\n", total_number, (total_number != 1) ? "s" : "", total_length);
if (gVerboseMode) pause("");
return total_number;
struct acpi_2_rsdp *RSDP = getRSDPaddress();
if (!RSDP)
{
verbose("saveOriginalACPI: OEM RSDP not found or incorrect, can't save any OEM tables.\n\n");
return 0;
}
uint8_t r;
uint8_t total_number = 1;
uint8_t ssdt_number = 0;
uint8_t nameLen = strlen("XXXX@XXXXXXXX");
uint32_t length = RSDP->Revision ? RSDP->Length : 20;
char *nameBuf = malloc(nameLen);
sprintf(nameBuf, "RSDP@%08X", (uint32_t)RSDP);
verbose("saveOriginalACPI: OEM table %s found, length=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, RSDP);
uint32_t total_length = length;
struct acpi_2_header *RSDT = (struct acpi_2_header *)(RSDP->RsdtAddress);
struct acpi_2_header *XSDT = (struct acpi_2_header *)(uint32_t)(RSDP->XsdtAddress);
void *origTable = NULL;
void *origTable2 = NULL;
void *origTable3 = NULL;
void *origTable4 = NULL;
if ((RSDP->RsdtAddress > 0) && (RSDP->RsdtAddress < 0xFFFFFFFF) && tableSign(RSDT->Signature, "RSDT"))
{
origTable = (void *)(RSDT + 1);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "RSDT@%08X", (uint32_t)RSDT);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, RSDT->Length);
DT__AddProperty(node, nameBuf, RSDT->Length, RSDT);
total_length += RSDT->Length;
total_number++;
for ( ; origTable < ((void *)RSDT + RSDT->Length); origTable += 4)
{
origTable2 = (void *)(*(uint32_t *)origTable);
length = ((struct acpi_2_header *)origTable2)->Length;
total_length += length;
total_number++;
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "SSDT"))
{
ssdt_number++;
if (strcmp(((struct acpi_2_header *)origTable2)->OEMTableId, "CpuPm") == 0)
{
nameLen = strlen("SSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT@%08X", (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
origTable2 += sizeof(struct acpi_2_header) + 15;
r = *((uint8_t *)origTable2 - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (; r > 0; r--, origTable2 += sizeof(struct ssdt_pmref))
{
origTable3 = (void *)(((struct ssdt_pmref *)origTable2)->addr);
if (!((uint32_t)origTable3 > 0) && !((uint32_t)origTable3 < 0xFFFFFFFF)) // incorrect, dropping
{
continue;
}
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("SSDT_@XXXXXXXX") + strlen((char *)((struct acpi_2_header *)origTable3)->OEMTableId);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT_%s@%08X", (char *)((struct acpi_2_header *)origTable3)->OEMTableId, (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
}
else
{
nameLen = strlen("SSDT-@XXXXXXXX") + ((ssdt_number < 10)? 1:2);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT-%d@%08X", ssdt_number, (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
}
}
else
{
nameLen = strlen("XXXX@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "%c%c%c%c@%08X", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable2);
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "FACP"))
{
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->FACS);
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("FACS@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "FACS@%08X", (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->DSDT);
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("DSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "DSDT@%08X", (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
}
}
}
else
{
verbose("saveOriginalACPI: OEM table RSDT@%08x not found or incorrect.\n", RSDP->RsdtAddress);
}
#if DEBUG
pause("\n[DEBUG_FAKEEFI] ");
#endif
if (RSDP->Revision > 0)
{
verbose("\n");
if ((RSDP->XsdtAddress > 0) && (RSDP->XsdtAddress < 0xFFFFFFFF) && tableSign(XSDT->Signature, "XSDT"))
{
verbose("saveOriginalACPI: OEM table XSDT@%016X found, lenght=%d: saving.\n", (uint32_t)XSDT, XSDT->Length);
nameLen = strlen("XSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "XSDT@%08X", (uint32_t)XSDT);
DT__AddProperty(node, nameBuf, XSDT->Length, XSDT);
total_number++;
total_length += XSDT->Length;
for (origTable = (void *)(RSDT + 1), origTable4 = (void *)(XSDT + 1); origTable4 < ((void *)XSDT + XSDT->Length); origTable += 4, origTable4 += 8)
{
origTable2 = (void *)(uint32_t)(*(uint64_t *)origTable4);
length = ((struct acpi_2_header *)origTable2)->Length;
verbose("saveOriginalACPI: OEM table X_%c%c%c%c@%016X found, lenght=%d: ", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2, length);
if (*(uint32_t *)origTable != (uint32_t)origTable2) // already saved?
{
verbose("saving.\n");
nameLen = strlen("X_XXXX@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_%c%c%c%c@%08X", ((char *)origTable2)[0], ((char *)origTable2)[1], ((char *)origTable2)[2], ((char *)origTable2)[3], (uint32_t)origTable2);
DT__AddProperty(node, nameBuf, length, origTable2);
total_length += length;
total_number++;
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "SSDT") && (strcmp(((struct acpi_2_header *)origTable2)->OEMTableId, "CpuPm") == 0))
{
// Get rest of ssdts from ssdt_pmref
r = *((uint8_t *)origTable2 - 2) / 3; // e.g: Name (SSDT, Package (0x0C) -> 0x0C / 3 = 4 is number of sub SSDTs
for (; r > 0; r--, origTable2 += sizeof(struct ssdt_pmref))
{
origTable3 = (void *)(((struct ssdt_pmref *)origTable2)->addr);
if (!((uint32_t)origTable3 > 0) && !((uint32_t)origTable3 < 0xFFFFFFFF)) // incorrect, dropping
{
continue;
}
length = ((struct acpi_2_header *)origTable3)->Length;
nameLen = strlen("SSDT_@XXXXXXXX") + strlen((char *)((struct acpi_2_header *)origTable3)->OEMTableId);
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "SSDT_%s@%08X", (char *)((struct acpi_2_header *)origTable3)->OEMTableId, (uint32_t)origTable3);
verbose("saveOriginalACPI: OEM table %s found, lenght=%d: saving.\n", nameBuf, length);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
continue;
}
if (tableSign(((struct acpi_2_header *)origTable2)->Signature, "FACP"))
{
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->X_FACS); // take x_facs assuming facs (from x_facp) should be equal to it
length = ((struct acpi_2_rsdt *)origTable3)->Length;
verbose("saveOriginalACPI: OEM table X_FACS@%016X found, lenght=%d: ", (uint32_t)origTable3, length);
if (origTable3 != (void *)(((struct acpi_2_fadt *)origTable2)->FACS))
{
verbose("saving.\n");
nameLen = strlen("X_FACS@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_FACS@%08X", (uint32_t)origTable3);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
else
{
verbose("already saved.\n");
}
// assuming only one dsdt in system, so x_facp should contain pointer to it same as facp
origTable3 = (void *)(((struct acpi_2_fadt *)origTable2)->X_DSDT);
length = ((struct acpi_2_rsdt *)origTable3)->Length;
verbose("saveOriginalACPI: OEM table X_DSDT@%016X found, lenght=%d: ", origTable3, length);
if (origTable3 != (void *)(((struct acpi_2_fadt *)origTable2)->DSDT))
{
verbose("saving.\n");
nameLen = strlen("X_DSDT@XXXXXXXX");
nameBuf = malloc(nameLen + 1);
sprintf(nameBuf, "X_DSDT@%08X", origTable3);
DT__AddProperty(node, nameBuf, length, origTable3);
total_length += length;
total_number++;
}
else
{
verbose("already saved.\n");
}
continue;
}
}
else
{
verbose("already saved.\n");
}
}
}
else
{
verbose("saveOriginalACPI: OEM table XSDT@%08X%08X not found or incorrect.\n", (uint32_t)(RSDP->XsdtAddress >> 32), (uint32_t)(RSDP->XsdtAddress & 0xFFFFFFFF));
}
}
if (!RSDT && !XSDT)
{
verbose("saveOriginalACPI: OEM RSDT & XSDT not found or incorrect, can't save any tables.\n\n");
return 0;
}
verbose("saveOriginalACPI: %d OEM table%s found and saved, total lenght=%d.\n\n", total_number, (total_number != 1) ? "s" : "", total_length);
#if DEBUG
pause("\n[DEBUG_FAKEEFI] ");
#endif
return total_number;
}
/*
// load smbios.plist file if any
setupSmbiosConfigFile();
// Setup ACPI with DSDT overrides (mackerintel's patch)
// Setup ACPI with DSDT overrides (mackerintel's patch)
setupAcpi();
setupSMBIOS();
// Setup board-id: need to be called after getSmbios!
setupBoardId();
// Setup system-type: We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()
setupSMBIOS();
// Setup board-id: need to be called after getSmbios!
setupBoardId();
// Setup system-type: We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()
// because we need to take care of FACP original content, if it is correct.
setupSystemType();
// Setup the '/' node
// Setup the '/' node
//setupRootNode();
// Setup the '/chosen' node
setupChosenNode();
setupEfiTables64();
}
// Setup efi node
// Setup efi node
setupEfiNode();
saveOriginalSMBIOS();
saveOriginalACPI();
saveOriginalSMBIOS();
saveOriginalACPI();
}
branches/Bungo/i386/libsaio/smbios_getters.c
3030
3131
3232
33
33
34
3435
3536
3637
......
4142
4243
4344
45
4446
4547
4648
4749
48
50
4951
5052
5153
5254
5355
54
56
5557
5658
5759
......
9092
9193
9294
93
95
9496
9597
9698
......
99101
100102
101103
102
103
104
105
106
107
108
109
110
104
105
106
107
108
109
110
111
112
111113
112114
113
114
115
116
117
115
116
117
118
119
118120
119121
120
121
122
123
124
125
126
127
128
129
122
123
124
125
126
127
128
129
130
131
130132
131133
132
133
134
135
136
137
138
139
134
135
136
137
138
139
140
141
140142
141143
142144
143
144
145
146
145147
146148
147149
148150
149
151
150152
151153
152154
......
186188
187189
188190
189
191
190192
191193
192194
......
206208
207209
208210
209
211
210212
211213
212214
......
381383
382384
383385
384
385
386
387386
387
388
389
388390
389391
390392
switch (Platform.CPU.Family)
{
case 0x06:
switch (Platform.CPU.Model) {
switch (Platform.CPU.Model)
{
// set external clock to 0 for SANDY
// removes FSB info from system profiler as on real mac's.
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_HASWELL_SVR:
case CPUID_MODEL_HASWELL_ULT:
case CPUID_MODEL_CRYSTALWELL:
value->word = 0;
break;
default:
value->word = (uint16_t)(Platform.CPU.FSBFrequency/1000000LL);
break;
break;
}
break;
default:
value->word = (uint16_t)(Platform.CPU.FSBFrequency/1000000LL);
break;
break;
}
}
else
case CPUID_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_FIELDS:// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPUID_MODEL_DALES:
case CPUID_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
case CPUID_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
case CPUID_MODEL_DALES_32NM:// Intel Core i3, i5 LGA1156 (32nm)
case CPUID_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPUID_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPUID_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPUID_MODEL_IVYBRIDGE_EP:
case CPUID_MODEL_HASWELL:
{
// thanks to dgobe for i3/i5/i7 bus speed detection
int nhm_bus = 0x3F;
static long possible_nhm_bus[] = {0xFF, 0x7F, 0x3F};
unsigned long did, vid;
unsigned int i;
// Nehalem supports Scrubbing
// First, locate the PCI bus where the MCH is located
{
// thanks to dgobe for i3/i5/i7 bus speed detection
int nhm_bus = 0x3F;
static long possible_nhm_bus[] = {0xFF, 0x7F, 0x3F};
unsigned long did, vid;
unsigned int i;
// Nehalem supports Scrubbing
// First, locate the PCI bus where the MCH is located
for(i = 0; i < (sizeof(possible_nhm_bus)/sizeof(possible_nhm_bus[0])); i++)
{
vid = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x00);
did = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x02);
vid &= 0xFFFF;
did &= 0xFF00;
vid = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x00);
did = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x02);
vid &= 0xFFFF;
did &= 0xFF00;
if(vid == 0x8086 && did >= 0x2C00)
{
nhm_bus = possible_nhm_bus[i];
}
}
unsigned long qpimult, qpibusspeed;
qpimult = pci_config_read32(PCIADDR(nhm_bus, 2, 1), 0x50);
qpimult &= 0x7F;
verbose("qpimult %d\n", qpimult);
qpibusspeed = (qpimult * 2 * (Platform.CPU.FSBFrequency/1000000LL));
// Rek: rounding decimals to match original mac profile info
nhm_bus = possible_nhm_bus[i];
}
}
unsigned long qpimult, qpibusspeed;
qpimult = pci_config_read32(PCIADDR(nhm_bus, 2, 1), 0x50);
qpimult &= 0x7F;
verbose("qpimult %d\n", qpimult);
qpibusspeed = (qpimult * 2 * (Platform.CPU.FSBFrequency/1000000LL));
// Rek: rounding decimals to match original mac profile info
if (qpibusspeed%100 != 0)
{
qpibusspeed = ((qpibusspeed+50)/100)*100;
}
verbose("qpibusspeed %d\n", qpibusspeed);
value->word = qpibusspeed;
return true;
}
break;
qpibusspeed = ((qpibusspeed+50)/100)*100;
}
verbose("qpibusspeed %d\n", qpibusspeed);
value->word = qpibusspeed;
return true;
}
break;
default:
break;
}
break;
break;
default:
break;
}
}
return false; //Unsupported CPU type
}
{
case CPUID_MODEL_PENTIUM_M:
case CPUID_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
case CPUID_MODEL_NOCONA:
case CPUID_MODEL_NOCONA:
case CPUID_MODEL_IRWINDALE:
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
if (strstr(Platform.CPU.BrandString, XEON))
{
value->word = 0x402;// 1026 - Xeon
return true;
return true;
}
if (Platform.CPU.NoCores <= 2)
{
default:
break; // Unsupported CPU type
}
break;
default:
break;
default:
break;
}
}
branches/Bungo/i386/libsaio/state_generator.h
1515
1616
1717
18
19
20
18
19
20
2121
22
23
24
22
23
24
2525
2626
#include "aml_generator.h"
#include "libsaio.h"
extern uint8_t acpi_cpu_count;
extern uint32_t acpi_cpu_p_blk;
extern char *acpi_cpu_name[32];
externuint8_t acpi_cpu_count;
externuint32_t acpi_cpu_p_blk;
externchar *acpi_cpu_name[32];
void get_acpi_cpu_names(uint8_t *dsdt, uint32_t length);
struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt *fadt);
struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt *dsdt);
voidget_acpi_cpu_names(uint8_t *dsdt, uint32_t length);
structacpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt *fadt);
structacpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt *dsdt);
#endif /* !__LIBSAIO_STATE_GENERATOR_H */
branches/Bungo/i386/boot0/boot0.s
769769
770770
771771
772
772
773773
774774
775775
......
779779
780780
781781
782
782
783783
784784
785785
;--------------------------------------------------------------------------
; NULL terminated strings.
;
log_title_strdb 10, 13, 'boot0: ', 0
log_title_strdb 10, 13, 'boot0: ', 0
%if VERBOSE
gpt_strdb 'GPT', 0
done_strdb 'done', 0
%endif
boot_error_str db 'error', 0
boot_error_str db 'error', 0
;--------------------------------------------------------------------------
; Pad the rest of the 512 byte sized booter with zeroes. The last
branches/Bungo/i386/boot0/boot0hfs.s
763763
764764
765765
766
766
767767
768768
769769
......
771771
772772
773773
774
774
775775
776776
777777
;--------------------------------------------------------------------------
; NULL terminated strings.
;
log_title_strdb 10, 13, 'boot0: ', 0
log_title_strdb 10, 13, 'boot0: ', 0
%if VERBOSE
gpt_strdb 'GPT', 0
done_strdb 'done', 0
%endif
boot_error_str db 'error', 0
boot_error_str db 'error', 0
;--------------------------------------------------------------------------
; Pad the rest of the 512 byte sized booter with zeroes. The last
branches/Bungo/i386/boot0/boot0md.s
866866
867867
868868
869
869
870870
871871
872872
......
874874
875875
876876
877
877
878878
879879
880880
;--------------------------------------------------------------------------
; NULL terminated strings.
;
log_title_strdb 10, 13, 'boot0:', 0
log_title_strdb 10, 13, 'boot0:', 0
gpt_strdb 'GPT', 0
;test_strdb 'test', 0
%endif
boot_error_str db 'error', 0
boot_error_str db 'error', 0
;--------------------------------------------------------------------------
; Pad the rest of the 512 byte sized booter with zeroes. The last
branches/Bungo/i386/boot1/boot1h.s
14321432
14331433
14341434
1435
1435
14361436
14371437
14381438
%if VERBOSE
log_title_strdb'boot1: ', NULL
error_str db'error', NULL
error_strdb'error', NULL
%endif
searchCatalogKeyddkHFSRootFolderID
branches/Bungo/i386/boot2/graphics.c
5050
5151
5252
53
53
5454
5555
5656
......
5858
5959
6060
61
61
6262
6363
6464
......
6767
6868
6969
70
70
7171
72
72
7373
7474
7575
......
8989
9090
9191
92
92
9393
9494
9595
9696
97
97
9898
9999
100100
......
104104
105105
106106
107
108
109
110
111
112
107
108
109
110
111
112
113113
114114
115115
......
173173
174174
175175
176
176
177
178
177179
178180
179181
180182
181
183
182184
183185
184186
185
187
188
189
186190
187191
188192
......
252256
253257
254258
255
256
257
258
259
260
259
260
261
262
263
264
261265
262
266
263267
264
268
265269
266
270
267271
268
269
270
271
272
273
274
272
273
274
275
276
277
278
275279
276
280
277281
278282
279283
280284
281285
282286
283
284
287
288
285289
286
290
287291
288
289
290
291
292292
293
294
295
296
297
298
299
300
293
294
295
301296
297
298
299
300
301
302
303
304
305
302306
303
307
304308
305309
306310
307311
308312
309
313
310314
311
315
312316
313
314
315
316
317
317
318
319
318320
319
321
320322
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
347
348
349
323
350324
351
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
352354
353
354
355
356
357
355
358356
359
357
358
359
360
361
360362
361
362
363
364
365
366
367
368
363
369364
370
365
366
367
368
369
370
371
372
371373
372
373
374
375
376
377
374
378375
379
380
381
382
383
384
376
377
378
379
380
381
385382
386
387
388
383
384
385
386
387
388
389389
390
390
391
392
393
394
391395
392396
393397
......
437441
438442
439443
440
441
442
443
444
445
446
447
444448
445449
446450
......
448452
449453
450454
451
452
453
454
455
456
455
456
457
458
459
460
461
457462
458463
459464
......
471476
472477
473478
474
475
476
477
478
479
479
480
481
482
483
484
485
486
480487
481488
482489
......
487494
488495
489496
490
491
492
493
497
498
499
500
494501
495
496
497
502
503
504
498505
499506
500507
501508
502509
503510
504
505
506
507
511
512
513
514
508515
509516
510517
......
551558
552559
553560
554
561
555562
556563
557564
......
583590
584591
585592
586
593
587594
588595
589596
......
890897
891898
892899
893
894
895
900
901
902
896903
897904
898905
899906
900
901
907
908
902909
903
904
905
910
911
912
906913
907914
908915
909916
910917
911
912
913
918
919
920
914921
915922
916923
......
926933
927934
928935
929
930
936
937
931938
932939
933
934
935
936
940
941
942
943
937944
938945
939946
......
10201027
10211028
10221029
1023
1030
10241031
10251032
10261033
......
10281035
10291036
10301037
1031
1038
10321039
10331040
10341041
......
10681075
10691076
10701077
1071
1078
10721079
10731080
10741081
......
11291136
11301137
11311138
1139
11321140
1133
11341141
11351142
11361143
......
11431150
11441151
11451152
1146
1147
1153
1154
11481155
1149
1150
1151
1156
1157
1158
11521159
11531160
11541161
11551162
1156
1163
11571164
1158
1159
1160
1161
1162
1163
1165
1166
1167
1168
1169
1170
11641171
1165
1166
1172
1173
11671174
1168
1169
1170
1171
1172
1173
1175
1176
1177
1178
1179
1180
11741181
1175
1182
11761183
11771184
11781185
......
11821189
11831190
11841191
1185
1186
1192
1193
11871194
1188
1189
1190
1191
1192
1193
1195
11941196
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1197
1198
1199
1200
12061201
1207
1208
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
12091213
1210
1214
1215
1216
1217
12111218
12121219
12131220
12141221
12151222
12161223
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
12451257
12461258
12471259
......
12511263
12521264
12531265
1254
1255
1256
1266
1267
1268
12571269
1258
1259
1260
1270
1271
1272
12611273
12621274
12631275
1264
1265
1276
1277
12661278
12671279
12681280
1269
1270
1271
1272
1281
1282
1283
1284
12731285
1274
1275
1276
1277
1278
1279
1280
1281
1286
1287
1288
1289
1290
1291
1292
1293
12821294
12831295
1284
1285
1296
1297
12861298
1287
1299
12881300
12891301
12901302
......
12941306
12951307
12961308
1297
1298
1299
1309
1310
1311
13001312
13011313
13021314
......
13061318
13071319
13081320
1309
1321
13101322
13111323
13121324
......
13351347
13361348
13371349
1338
1350
13391351
13401352
13411353
......
13761388
13771389
13781390
1379
1380
1391
1392
13811393
13821394
1383
1395
13841396
13851397
13861398
static uint16_t GraphicsModeCurrent = 0;
#define VIDEO(x) (bootArgs->Video.v_ ## x)
//==========================================================================
// getVBEVideoRam
{
VBEInfoBlock vbeInfo;
int err /*, small */;
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) )
return 0;
// small = (vbeInfo.TotalMemory < 16);
return vbeInfo.TotalMemory * 64 * 1024;
}
{
return 0;
}
if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) )
{
return 0;
}
buff = malloc(sizeof(char) * 256);
if (!buff)
{
small = (vbeInfo.TotalMemory < 16);
snprintf(buff, 256,
"VESA v%d.%d %d%s (%s)\n",
vbeInfo.VESAVersion >> 8,
vbeInfo.VESAVersion & 0xf,
small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16),
small ? "KB" : "MB",
VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) );
"VESA v%d.%d %d%s (%s)\n",
vbeInfo.VESAVersion >> 8,
vbeInfo.VESAVersion & 0xf,
small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16),
small ? "KB" : "MB",
VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) );
return buff;
}
if (line++ >= 20)
{
pause("");
#if DEBUG
pause("\n[DEBUG_GFX] ");
#endif
line = 0;
clearScreenRows(0, 24);
setCursorPosition( 0, 0, 1 );
}
}
}
if (line != 0)
{
pause("");
#if DEBUG
pause("\n[DEBUG_GFX] ");
#endif
}
setActiveDisplayPage(0);
unsigned short*vesaVersion
)
{
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
VBEModeInfoBlock modeInfo;
unsigned char modeBitsPerPixel;
unsigned short matchedMode = modeEndOfList;
int err;
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
VBEModeInfoBlock modeInfo;
unsigned char modeBitsPerPixel;
unsigned short matchedMode = modeEndOfList;
int err;
// Clear output mode info.
// Clear output mode info.
bzero( outModeInfo, sizeof(*outModeInfo) );
bzero( outModeInfo, sizeof(*outModeInfo) );
// Get VBE controller info containing the list of supported modes.
// Get VBE controller info containing the list of supported modes.
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
return modeEndOfList;
}
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
return modeEndOfList;
}
// Report the VESA major/minor version number.
// Report the VESA major/minor version number.
if (vesaVersion)
{
*vesaVersion = vbeInfo.VESAVersion;
}
// Loop through the mode list, and find the matching mode.
// Loop through the mode list, and find the matching mode.
//#if DEBUG
verbose("\nGraphics Modes [VESA %d.%d %dMB mode=0x%04X]:\n", vbeInfo.VESAVersion >> 8, vbeInfo.VESAVersion & 0xf, (vbeInfo.TotalMemory * 64)/1024, getCurrentGraphicsMode());
verbose("\nGraphics Modes [VESA %d.%d %dMB mode=0x%04X]:\n", vbeInfo.VESAVersion >> 8, vbeInfo.VESAVersion & 0xf, (vbeInfo.TotalMemory * 64)/1024, getCurrentGraphicsMode());
//#endif
for ( modePtr = VBEDecodeFP(unsigned short *, vbeInfo.VideoModePtr); *modePtr != modeEndOfList; modePtr++ )
{
// Get mode information.
bzero( &modeInfo, sizeof(modeInfo) );
err = getVBEModeInfo( *modePtr, &modeInfo );
if ( err != errSuccess )
{
verbose("\t%x: mode not suported. [ERROR: %d]\n", *modePtr, err);
continue;
}
for ( modePtr = VBEDecodeFP(unsigned short *, vbeInfo.VideoModePtr); *modePtr != modeEndOfList; modePtr++ )
{
// Get mode information.
bzero( &modeInfo, sizeof(modeInfo) );
err = getVBEModeInfo( *modePtr, &modeInfo );
if ( err != errSuccess )
{
verbose("\t%x: mode not suported. [ERROR: %d]\n", *modePtr, err);
continue;
}
//#if DEBUG
verbose("\t0x%04X: res=%dx%dx%d, mm=%d, attr=0x%04X %s\n",
verbose("\t0x%04X: res=%dx%dx%d, mm=%d, attr=0x%04X %s\n",
*modePtr, modeInfo.XResolution, modeInfo.YResolution,
modeInfo.BitsPerPixel, modeInfo.MemoryModel,
modeInfo.ModeAttributes, (*modePtr == GraphicsModeCurrent)? "<-":"");
//#endif
// Filter out unwanted modes based on mode attributes.
// Filter out unwanted modes based on mode attributes.
if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet )
if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet )
|| ( ( modeInfo.ModeAttributes & attributesClear ) != 0 ) )
{
continue;
}
// Pixel depth in bits.
{
continue;
}
modeBitsPerPixel = modeInfo.BitsPerPixel;
// Pixel depth in bits.
if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) )
{
// Text mode, 16 colors.
}
else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) )
{
// Packed pixel, 256 colors.
}
else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 5 )
&& ( modeInfo.GreenMaskSize == 5 )
&& ( modeInfo.BlueMaskSize == 5 ) )
{
// Direct color, 16 bpp (1:5:5:5).
modeInfo.BitsPerPixel = modeBitsPerPixel = 16;
}
else if ( ( modeBitsPerPixel == 32 )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 8 )
&& ( modeInfo.GreenMaskSize == 8 )
&& ( modeInfo.BlueMaskSize == 8 ) )
{
// Direct color, 32 bpp (8:8:8:8).
}
else
{
continue; // Not a supported mode.
}
modeBitsPerPixel = modeInfo.BitsPerPixel;
// Modes larger than the specified dimensions are skipped.
if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) )
{
// Text mode, 16 colors.
}
else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) )
{
// Packed pixel, 256 colors.
}
else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 5 )
&& ( modeInfo.GreenMaskSize == 5 )
&& ( modeInfo.BlueMaskSize == 5 ) )
{
// Direct color, 16 bpp (1:5:5:5).
modeInfo.BitsPerPixel = modeBitsPerPixel = 16;
}
else if ( ( modeBitsPerPixel == 32 )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 8 )
&& ( modeInfo.GreenMaskSize == 8 )
&& ( modeInfo.BlueMaskSize == 8 ) )
{
// Direct color, 32 bpp (8:8:8:8).
}
else
{
continue; // Not a supported mode.
}
if ( ( modeInfo.XResolution > width ) ||
( modeInfo.YResolution > height ) )
{
continue;
}
// Modes larger than the specified dimensions are skipped.
// Perfect match, we're done looking.
if ( ( modeInfo.XResolution > width ) ||
( modeInfo.YResolution > height ) )
{
continue;
}
if ( ( modeInfo.XResolution == width ) &&
( modeInfo.YResolution == height ) &&
( modeBitsPerPixel == bitsPerPixel ) )
{
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
break;
}
// Perfect match, we're done looking.
// Save the next "best" mode in case a perfect match is not found.
if ( ( modeInfo.XResolution == width ) &&
( modeInfo.YResolution == height ) &&
( modeBitsPerPixel == bitsPerPixel ) )
{
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
break;
}
if ( modeInfo.XResolution == outModeInfo->XResolution &&
modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more depth.
}
// Save the next "best" mode in case a perfect match is not found.
if ( modeInfo.XResolution < outModeInfo->XResolution ||
modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more resolution.
}
if ( modeInfo.XResolution == outModeInfo->XResolution &&
modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more depth.
}
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
}
if ( modeInfo.XResolution < outModeInfo->XResolution ||
modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more resolution.
}
return matchedMode;
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
}
return matchedMode;
}
//==========================================================================
uint16_t getCurrentGraphicsMode()
{
if (getVBECurrentMode(&GraphicsModeCurrent) != errSuccess)
GraphicsModeCurrent = 0;
GraphicsModeCurrent &= 0x3FFF;
return GraphicsModeCurrent;
if (getVBECurrentMode(&GraphicsModeCurrent) != errSuccess)
GraphicsModeCurrent = 0;
GraphicsModeCurrent &= 0x3FFF;
return GraphicsModeCurrent;
}
//==========================================================================
int getCurrentEDID()
{
struct EDID edid;
//edid_mode mode;
uint8_t status = getVBEEDID(&edid);
if (status == errSuccess) {
struct EDID edid;
//edid_mode mode;
uint8_t status = getVBEEDID(&edid);
if (status == errSuccess)
{
/*
if (fb_parse_edid(&edid, &mode)) {
DBG("EDID first timing block info:\n");
}
DBG("EDID read!\n", status);
*/
} else {
verbose("Failed to get EDID! [ERROR: 0x%02X]\n", status);
}
return status;
}
else
{
verbose("Failed to get EDID! [ERROR: 0x%02X]\n", status);
}
return status;
}
//==========================================================================
// setVESAGraphicsMode
unsigned char bitsPerPixel,
unsigned short refreshRate )
{
VBEModeInfoBlock minfo;
unsigned short modeOld, mode;
unsigned short vesaVersion;
int err = errFuncNotSupported;
VBEModeInfoBlock minfo;
unsigned short modeOld, mode;
unsigned short vesaVersion;
int err = errFuncNotSupported;
modeOld = getCurrentGraphicsMode();
do {
mode = getVESAModeWithProperties( width, height, bitsPerPixel,
modeOld = getCurrentGraphicsMode();
do {
mode = getVESAModeWithProperties( width, height, bitsPerPixel,
maColorModeBit |
maModeIsSupportedBit |
maGraphicsModeBit |
maLinearFrameBufferAvailBit,
0,
&minfo, &vesaVersion );
if ( mode == modeEndOfList )
{
break;
}
if ( mode == modeEndOfList )
{
break;
}
//
// FIXME : generateCRTCTiming() causes crash.
{
break;
}
verbose("Succesfuly set mode: 0x%04X (old mode: 0x%04X)\n", getCurrentGraphicsMode(), modeOld);
// Set 8-bit color palette.
bootArgs->Video.v_rowBytes = minfo.BytesPerScanline;
bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
} while ( 0 );
} while ( 0 );
return err;
}
unsigned short height,
unsigned char colorIndex )
{
long pixelBytes;
long color = lookUpCLUTIndex( colorIndex, VIDEO(depth) );
char * vram;
long pixelBytes;
long color = lookUpCLUTIndex( colorIndex, VIDEO(depth) );
char * vram;
pixelBytes = VIDEO(depth) / 8;
vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x;
width = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
width = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
while ( height-- )
{
int rem = ( pixelBytes * width ) % 4;
while ( height-- )
{
int rem = ( pixelBytes * width ) % 4;
if ( rem )
{
bcopy( &color, vram, rem );
}
stosl( vram + rem, color, pixelBytes * width / 4 );
vram += VIDEO(rowBytes);
}
stosl( vram + rem, color, pixelBytes * width / 4 );
vram += VIDEO(rowBytes);
}
}
//==========================================================================
long pixelBytes = VIDEO(depth) / 8;
unsigned char * vram = (unsigned char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
while ( height-- )
{
bcopy( data, vram, drawWidth * pixelBytes );
vram += VIDEO(rowBytes);
data += width * pixelBytes;
}
bcopy( data, vram, drawWidth * pixelBytes );
vram += VIDEO(rowBytes);
data += width * pixelBytes;
}
}
//==============================================================================
screen = (uint8_t *) VIDEO (baseAddr);
rowBytes = VIDEO (rowBytes);
// Set the screen to 75% grey.
drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */);
drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */);
}
pixelShift = VIDEO (depth) >> 4;
{
return;
}
screen += ((VIDEO (width)
- kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1))
+ (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes;
else
{
*((uint32_t *)out) = (result << 16) | (result << 8) | result;// 32
}
}
}
out += (1 << pixelShift);
else
{
*((uint32_t *)out) = (result << 16) | (result << 8) | result;// 32
}
}
}
out += (1 << pixelShift);
}
out += (kIOHibernateProgressSpacing << pixelShift);
static int setVESATextMode( unsigned short cols, unsigned short rows, unsigned char bitsPerPixel )
{
VBEModeInfoBlock minfo;
unsigned short mode = modeEndOfList;
VBEModeInfoBlock minfo;
unsigned short mode = modeEndOfList;
if ( (cols != 80) || (rows != 25) ) // not 80x25 mode
{
mode = getVESAModeWithProperties( cols, rows, bitsPerPixel,
if ( (cols != 80) || (rows != 25) ) // not 80x25 mode
{
mode = getVESAModeWithProperties( cols, rows, bitsPerPixel,
maColorModeBit |
maModeIsSupportedBit,
maGraphicsModeBit,
&minfo, NULL );
}
}
if ( ( mode == modeEndOfList ) || ( setVBEMode(mode, NULL) != errSuccess ) )
{
video_mode( 2 ); // VGA BIOS, 80x25 text mode.
minfo.XResolution = 80;
minfo.YResolution = 25;
}
if ( ( mode == modeEndOfList ) || ( setVBEMode(mode, NULL) != errSuccess ) )
{
video_mode( 2 ); // VGA BIOS, 80x25 text mode.
minfo.XResolution = 80;
minfo.YResolution = 25;
}
// Update KernBootStruct using info provided by the selected
// VESA mode.
// Update KernBootStruct using info provided by the selected
// VESA mode.
bootArgs->Video.v_display = VGA_TEXT_MODE;
bootArgs->Video.v_baseAddr = 0xb8000;
bootArgs->Video.v_width = minfo.XResolution;
bootArgs->Video.v_height = minfo.YResolution;
bootArgs->Video.v_depth = 8;
bootArgs->Video.v_rowBytes = 0x8000;
bootArgs->Video.v_display = VGA_TEXT_MODE;
bootArgs->Video.v_baseAddr = 0xb8000;
bootArgs->Video.v_width = minfo.XResolution;
bootArgs->Video.v_height = minfo.YResolution;
bootArgs->Video.v_depth = 8;
bootArgs->Video.v_rowBytes = 0x8000;
return errSuccess; // always return success
return errSuccess; // always return success
}
//==========================================================================
unsigned long numbers[],
unsigned long maxArrayCount )
{
char *propStr;
unsigned long count = 0;
char *propStr;
unsigned long count = 0;
propStr = newStringForKey((char *)propKey , &bootInfo->chameleonConfig);
if (propStr)
{
char *delimiter = propStr;
char *p = propStr;
propStr = newStringForKey((char *)propKey , &bootInfo->chameleonConfig);
while ((count < maxArrayCount) && (*p != '\0'))
{
unsigned long val = strtoul(p, &delimiter, 10);
if (p != delimiter)
{
numbers[count++] = val;
p = delimiter;
}
while ((*p != '\0') && !isdigit(*p))
p++;
}
if (propStr)
{
char *delimiter = propStr;
char *p = propStr;
free(propStr);
}
while ((count < maxArrayCount) && (*p != '\0'))
{
unsigned long val = strtoul(p, &delimiter, 10);
if (p != delimiter)
{
numbers[count++] = val;
p = delimiter;
}
while ((*p != '\0') && !isdigit(*p))
p++;
}
return count;
free(propStr);
}
return count;
}
//==============================================================================
int initGraphicsMode ()
{
unsigned long params[4];
int count;
params[3] = 0;
count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4);
// Try to find a resolution if "Graphics Mode" setting is not available.
if ( count < 3 )
{
// Use the default resolution if we don't have an initialized GUI.
if (gui.screen.width == 0 || gui.screen.height == 0)
{
gui.screen.width = DEFAULT_SCREEN_WIDTH;
gui.screen.height = DEFAULT_SCREEN_HEIGHT;
}
params[0] = gui.screen.width;
params[1] = gui.screen.height;
params[2] = 32;
}
// Map from pixel format to bits per pixel.
if ( params[2] == 256 ) params[2] = 8;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
return setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
unsigned long params[4];
int count;
params[3] = 0;
count = getNumberArrayFromProperty( kGraphicsModeKey, params, 4 );
// Try to find a resolution if "Graphics Mode" setting is not available.
if ( count < 3 )
{
// Use the default resolution if we don't have an initialized GUI.
if (gui.screen.width == 0 || gui.screen.height == 0)
{
gui.screen.width = DEFAULT_SCREEN_WIDTH;
gui.screen.height = DEFAULT_SCREEN_HEIGHT;
}
params[0] = gui.screen.width;
params[1] = gui.screen.height;
params[2] = 32;
}
// Map from pixel format to bits per pixel.
if ( params[2] == 256 )
params[2] = 8;
if ( params[2] == 555 )
params[2] = 16;
if ( params[2] == 888 )
params[2] = 32;
return setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
}
//==========================================================================
void setVideoMode( int mode, int drawgraphics)
{
unsigned long params[4];
int count;
int err = errSuccess;
unsigned long params[4];
int count;
int err = errSuccess;
if ( mode == GRAPHICS_MODE )
{
if ( (err=initGraphicsMode ()) == errSuccess )
if ( mode == GRAPHICS_MODE )
{
if ( (err = initGraphicsMode()) == errSuccess )
{
if (gVerboseMode)
{
// Tell the kernel to use text mode on a linear frame buffer display
bootArgs->Video.v_display = FB_TEXT_MODE;
// Tell the kernel to use text mode on a linear frame buffer display
bootArgs->Video.v_display = FB_TEXT_MODE;
}
else
{
bootArgs->Video.v_display = GRAPHICS_MODE;
}
}
}
bootArgs->Video.v_display = GRAPHICS_MODE;
}
}
}
if ( (mode == VGA_TEXT_MODE) || (err != errSuccess) )
{
count = getNumberArrayFromProperty(kTextModeKey, params, 2);
if ( count < 2 )
{
params[0] = 80; // Default text mode is 80x25.
params[1] = 25;
}
if ( (mode == VGA_TEXT_MODE) || (err != errSuccess) )
{
count = getNumberArrayFromProperty(kTextModeKey, params, 2);
if ( count < 2 )
{
params[0] = 80; // Default text mode is 80x25.
params[1] = 25;
}
setVESATextMode(params[0], params[1], 4);
bootArgs->Video.v_display = VGA_TEXT_MODE;
}
bootArgs->Video.v_display = VGA_TEXT_MODE;
}
currentIndicator = 0;
currentIndicator = 0;
}
//==============================================================================
VBEModeInfoBlock minfo;
unsigned short vesaVersion;
unsigned short mode = modeEndOfList;
unsigned short vesaVersion;
unsigned short mode = modeEndOfList;
getNumberArrayFromProperty(kGraphicsModeKey, params, 4);
mode = getVESAModeWithProperties(params[0], params[1], params[2],
maLinearFrameBufferAvailBit,
0,
&minfo, &vesaVersion);
params[0] = minfo.XResolution;
params[1] = minfo.YResolution;
params[2] = 32;
void spinActivityIndicator(int sectors)
{
static unsigned long lastTickTime = 0, currentTickTime;
if (previewTotalSectors && previewSaveunder)
{
int blob, lastBlob;
void clearActivityIndicator( void )
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
putchar(' ');
putchar('\b');
}
}
}
//==============================================================================
branches/Bungo/i386/boot2/drivers.c
7474
7575
7676
77
78
79
80
81
82
83
84
77
78
79
80
81
82
83
84
8585
8686
8787
......
110110
111111
112112
113
114
115
116
117
118
113
114
115
116
117
118
119119
120120
121121
......
241241
242242
243243
244
244
245
245246
246247
247248
248249
249250
250251
251
252
253
252254
253255
254256
......
900902
901903
902904
903
905
904906
905907
906908
......
925927
926928
927929
928
930
929931
930932
931933
932
933
934
934
935
936
935937
936
938
937939
938
940
939941
940942
941943
942
943
944
944
945
946
945947
946
948
947949
948
949
950
951
950
951
952
953
952954
953955
954956
......
958960
959961
960962
961
963
962964
963965
964966
......
967969
968970
969971
970
971
972
973
972
973
974
975
974976
975977
976
977
978
978
979
980
979981
980
982
981983
982
984
983985
984
986
985987
986988
987989
988990
989
991
990992
991993
992994
993995
994996
995997
996
998
997999
9981000
#define kDriverPackageSignature2 'MOSX'
struct DriversPackage {
unsigned long signature1;
unsigned long signature2;
unsigned long length;
unsigned long adler32;
unsigned long version;
unsigned long numDrivers;
unsigned long reserved1;
unsigned long reserved2;
unsigned long signature1;
unsigned long signature2;
unsigned long length;
unsigned long adler32;
unsigned long version;
unsigned long numDrivers;
unsigned long reserved1;
unsigned long reserved2;
};
typedef struct DriversPackage DriversPackage;
static long InitDriverSupport(void);
ModulePtr gModuleHead, gModuleTail;
static TagPtr gPersonalityHead, gPersonalityTail;
static char *gExtensionsSpec;
static char *gDriverSpec;
static char *gFileSpec;
static char *gTempSpec;
static char *gFileName;
static TagPtrgPersonalityHead, gPersonalityTail;
static char*gExtensionsSpec;
static char*gDriverSpec;
static char*gFileSpec;
static char*gTempSpec;
static char*gFileName;
// Bungo:
char gDarwinBuildVerStr[256] = "Darwin Kernel Version";
if (gMKextName[0] != '\0')
{
verbose("LoadDrivers: Loading from '%s'\n", gMKextName);
if ( LoadDriverMKext(gMKextName) != 0 ) {
if ( LoadDriverMKext(gMKextName) != 0 )
{
error("Could not load %s\n", gMKextName);
return -1;
}
}
else
{
if (MacOSVerCurrent >= MacOSVer2Int("10.9")) { // issue 352
if (MacOSVerCurrent >= MacOSVer2Int("10.9")) // issue 352
{
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
strcat(gExtensionsSpec, "Library/");
FileLoadDrivers(gExtensionsSpec, 0);
verbose("Decompressing Kernel Cache");
/*
if ((kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) &&
(kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn')))
(kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn')))
{
error("ERROR: kernel compression is bad!\n");
return -1;
switch (kernel_header->compress_type)
{
case OSSwapBigToHostConstInt32('lzvn'):
verbose(" using 'lzvn': ");
verbose(" using 'lzvn': ");
size = lzvn_decode((u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));
if (uncompressed_size != size)
{
error("ERROR! Size mismatch from 'lzvn' (found: %d, expected: %d).\n", size, uncompressed_size);
return -1;
}
error("ERROR! Size mismatch from 'lzvn' (found: %d, expected: %d).\n", size, uncompressed_size);
return -1;
}
break;
case OSSwapBigToHostConstInt32('lzss'):
verbose(" using 'lzss': ");
verbose(" using 'lzss': ");
size = decompress_lzss((u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));
if (uncompressed_size != size)
{
error("ERROR! Size mismatch from 'lzss' (found: %d, expected: %d).\n", size, uncompressed_size);
return -1;
}
error("ERROR! Size mismatch from 'lzss' (found: %d, expected: %d).\n", size, uncompressed_size);
return -1;
}
break;
default:
verbose(": ");
uint32_t compress_type = OSSwapBigToHostInt32(kernel_header->compress_type);
error("ERROR! Unknown kernel compression type: '%c%c%c%c'!\n", ((char *)&compress_type)[0], ((char *)&compress_type)[1], ((char *)&compress_type)[2], ((char *)&compress_type)[3]);
return -1;
verbose(": ");
uint32_t compress_type = OSSwapBigToHostInt32(kernel_header->compress_type);
error("ERROR! Unknown kernel compression type: '%c%c%c%c'!\n", ((char *)&compress_type)[0], ((char *)&compress_type)[1], ((char *)&compress_type)[2], ((char *)&compress_type)[3]);
return -1;
}
// MinusZwei
error("ERROR! Adler mismatch (found: %X, expected: %X).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32));
return -1;
}
verbose("OK.\n");
verbose("OK.\n");
}
ret = ThinFatFile(&binary, &len);
archCpuType=CPU_TYPE_I386;
ret = ThinFatFile(&binary, &len);
}
// Bungo: scan binary for Darwin Kernel Version string
uint32_t offset = 0;
//strncpy(gDarwinBuildVerStr, "Darwin Kernel Version", sizeof(gDarwinBuildVerStr));
// Bungo: scan binary for Darwin Kernel Version string
uint32_t offset = 0;
strncpy(gDarwinBuildVerStr, "Darwin Kernel Version", sizeof(gDarwinBuildVerStr));
while ((offset < 0xFFFFFFFF - (uint32_t)binary - 256) && memcmp(binary + offset, gDarwinBuildVerStr, 21))
{
offset++;
}
if (offset < 0xFFFFFFFF - (uint32_t)binary - 256)
offset++;
}
if (offset < 0xFFFFFFFF - (uint32_t)binary - 256)
{
strncpy(gDarwinBuildVerStr, (char *)(binary + offset), sizeof(gDarwinBuildVerStr));
strncpy(gDarwinBuildVerStr, (char *)(binary + offset), sizeof(gDarwinBuildVerStr));
}
else
else
{
strcat(gDarwinBuildVerStr, ": Unknown");
strcat(gDarwinBuildVerStr, ": Unknown");
}
// Notify modules that the kernel has been decompressed, thinned and is about to be decoded
execute_hook("DecodeKernel", (void *)binary, NULL, NULL, NULL);
ret = DecodeMachO(binary, rentry, raddr, rsize);
if (ret < 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = DecodeMachO(binary, rentry, raddr, rsize);
}
return ret;
}
branches/Bungo/i386/boot2/lzvn.c
3838
3939
4040
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
5858
5959
6060
......
7474
7575
7676
77
77
7878
7979
80
80
8181
82
82
8383
8484
8585
8686
8787
8888
89
89
9090
9191
92
92
9393
9494
9595
......
9797
9898
9999
100
100
101101
102102
103103
......
108108
109109
110110
111
111112
112
113113
114114
115115
......
126126
127127
128128
129
129
130130
131131
132132
......
147147
148148
149149
150
150151
151
152152
153153
154154
......
168168
169169
170170
171
171172
172
173173
174174
175175
......
208208
209209
210210
211
211212
212
213213
214214
215215
......
223223
224224
225225
226
226
227227
228228
229229
......
238238
239239
240240
241
242
241
242
243243
244244
245245
......
346346
347347
348348
349
349
350350
351351
352352
// jmpq *(%rbx,%r9,8)
#define LABEL_JUMP \
do { \
r8 = *(uint64_t *)rdx; \
r9 = r8 & 0xFF; \
switch (Llzvn_tableref[r9]) { \
case 0: goto Llzvn_table0; break; \
case 1: goto Llzvn_table1; break; \
case 2: return rax; \
case 3: goto Llzvn_table3; break; \
case 4: goto Llzvn_table4; break; \
case 5: return 0; \
case 6: goto Llzvn_table6; break; \
case 7: goto Llzvn_table7; break; \
case 8: goto Llzvn_table8; break; \
case 9: goto Llzvn_table9; break; \
case 10: goto Llzvn_table10; break; \
} \
} while (0)
do { \
r8 = *(uint64_t *)rdx; \
r9 = r8 & 0xFF; \
switch (Llzvn_tableref[r9]) { \
case 0: goto Llzvn_table0; break; \
case 1: goto Llzvn_table1; break; \
case 2: return rax; \
case 3: goto Llzvn_table3; break; \
case 4: goto Llzvn_table4; break; \
case 5: return 0; \
case 6: goto Llzvn_table6; break; \
case 7: goto Llzvn_table7; break; \
case 8: goto Llzvn_table8; break; \
case 9: goto Llzvn_table9; break; \
case 10: goto Llzvn_table10; break; \
} \
} while (0)
size_t lzvn_decode(void * dst,
uint64_t r10 = 0;
uint64_t r11 = 0;
uint64_t r12 = 0;
uint64_t addr = 0;
unsigned char byte_data = 0;
short jmp = 0;
// lea Llzvn_tableref(%rip),%rbx
//
// this will load the address of the tableref label into the %rbx
// register. in our code, this is the 'Llzvn_tableref' array
//
// for clearness, it will be used directly.
rax = 0; // xor %rax,%rax
r12 = 0; // xor %r12,%r12
// sub $0x8,%rsi
// jb Llzvn_exit
jmp = rsi < 0x8 ? 1 : 0;
if (jmp) {
return 0;
}
// lea -0x8(%rdx,%rcx,1),%rcx
// cmp %rcx,%rdx
// ja Llzvn_exit
LABEL_JUMP;
Llzvn_table0:
r9 >>= 0x6; // shr $0x6,%r9
rdx = rdx + r9 + 0x1; // lea 0x1(%rdx,%r9,1),%rdx
r10 >>= 0x3; // shr $0x3,%r10
r10 += 0x3; // add $0x3,%r10
goto Llzvn_l10; // jmp Llzvn_l10
Llzvn_table1:
r9 >>= 0x6; // shr $0x6,%r9
rdx = rdx + r9 + 0x2; // lea 0x2(%rdx,%r9,1),%rdx
r10 += 0x3; // add $0x3,%r10
r8 >>= 0x10; // shr $0x10,%r8
goto Llzvn_l10;
Llzvn_table3:
r9 >>= 0x6; // shr $0x6,%r9
rdx = rdx + r9 + 0x3; // lea 0x3(%rdx,%r9,1),%rdx
r8 >>= 0x10; // shr $0x10,%r8
r10 += 0x3; // add $0x3,%r10
goto Llzvn_l10; // jmp Llzvn_l10
Llzvn_table4:
// add $0x1,%rdx
// cmp %rcx,%rdx
r12 &= r8; // and %r8,%r12
r8 >>= 0xE; // shr $0xe,%r8
goto Llzvn_l10; // jmp Llzvn_l10
Llzvn_table7:
r8 >>= 0x8; // shr $0x8,%r8
r8 &= 0xFF; // and $0xff,%r8
rdx = rdx + r8 + 0x1; // lea 0x1(%rdx,%r8,1),%rdx
goto Llzvn_l0; // jmp Llzvn_l0
Llzvn_table9:
rdx += 0x2; // add $0x2,%rdx
r10 &= 0xFF; // and $0xff,%r10
r10 += 0x10; // add $0x10,%r10
goto Llzvn_l11;
Llzvn_table10:
rdx += 1; // add $0x1,%rdx
}
while (jmp);
}
// mov %rax,%r8
r8 = rax;
branches/Bungo/i386/boot2/Makefile
3636
3737
3838
39
39
4040
4141
4242
......
8080
8181
8282
83
83
8484
8585
8686
INC = -I. -I$(SRCROOT) -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include
LIBS= -L$(SYMDIR) -lsaio -lsa -lklibc
LIBDEP= libsaio.a libsa.a libklibc.a
LIBDEP= libsaio.a libsa.a libklibc.a
OTHER_FILES =
endif
@${MKDIRS} $(OBJROOT)/../boot2_modules/
@### First pass, don't worry abount segment alignment.
@echo "[LD] boot.sys"
@$(CC) -Wl,-preload -Wl,-alias,boot2,start \
branches/Bungo/i386/boot2/boot.c
7272
7373
7474
75
75
76
77
78
79
7680
7781
7882
......
8084
8185
8286
83
87
88
8489
8590
86
8791
92
93
94
95
8896
8997
9098
......
134142
135143
136144
137
145
138146
139147
140148
141149
142
150
143151
144152
145153
......
156164
157165
158166
159
167
160168
161169
162170
......
202210
203211
204212
205
206
207
208
209
210
213
214
215
216
217
218
211219
212220
213
221
222
223
214224
215225
216226
217
227
218228
219
229
220230
221231
222232
......
225235
226236
227237
228
229
238
230239
231
240
241
242
232243
233244
234245
235
236246
237247
238248
......
252262
253263
254264
255
265
266
256267
257268
258269
......
273284
274285
275286
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
313324
314325
315326
......
359370
360371
361372
362
373
374
363375
364376
365377
......
369381
370382
371383
372
373
374
375
384
385
386
376387
377388
378389
379390
380391
381392
382
383
384
385
393
394
395
386396
387397
388398
......
390400
391401
392402
393
403
404
405
406
394407
395408
396409
......
484497
485498
486499
487
488
489
490500
501
502
503
491504
492
493
505
494506
495507
496508
497509
498
499
500
510
511
512
501513
502514
503515
......
523535
524536
525537
526
527
528
529
530
531
532
533
534
535
538
539
540
541
542
543
544
545
546
547
536548
537
549
538550
539551
540552
......
543555
544556
545557
546
558
547559
548560
549561
......
557569
558570
559571
560
572
561573
562574
563575
......
568580
569581
570582
571
583
572584
573585
574586
......
685697
686698
687699
688
689
690
691
692
693
694
695
696
697
698
699
700
700
701
702
701703
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
723719
724
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
725748
726
749
727750
728751
729752
730
753
754
731755
732
733756
734757
735758
......
742765
743766
744767
768
745769
746
770
771
772
747773
774
748775
749
750
776
777
751778
752779
753780
754781
755782
756783
757
784
758785
759786
760787
......
769796
770797
771798
772
799
773800
774801
775802
......
790817
791818
792819
793
820
821
794822
795823
796824
......
800828
801829
802830
803
831
832
833
804834
805835
806836
......
864894
865895
866896
867
868
897
898
869899
870900
871901
*/
#define kBootErrorTimeout 5
boolgOverrideKernel, gEnableCDROMRescan, gScanSingleDrive, useGUI;
boolgOverrideKernel;
boolgEnableCDROMRescan;
boolgScanSingleDrive;
booluseGUI;
static boolgUnloadPXEOnExit = false;
static chargCacheNameAdler[64 + 256];
chargRootDevice[ROOT_DEVICE_SIZE];
chargMKextName[512];
int bvCount = 0, gDeviceCount = 0;
intbvCount = 0;
intgDeviceCount = 0;
//intmenucount = 0;
longgBootMode; /* defaults to 0 == kBootModeNormal */
BVRefbvr, menuBVR, bvChain;
BVRefbvr;
BVRefmenuBVR;
BVRefbvChain;
static unsigned longAdler32(unsigned char *buffer, long length);
//static voidselectBiosDevice(void);
bootArgs->kaddr = bootArgs->ksize = 0;
execute_hook("ExecKernel", (void *)binary, NULL, NULL, NULL);
ret = DecodeKernel(binary,
&kernelEntry,
(char **) &bootArgs->kaddr,
(int *)&bootArgs->ksize);
if ( ret != 0 )
{
return ret;
// Load boot drivers from the specifed root path.
//if (!gHaveKernelCache)
{
LoadDrivers("/");
LoadDrivers("/");
}
execute_hook("DriversLoaded", (void *)binary, NULL, NULL, NULL);
{
drawBootGraphics();
}
getCurrentEDID();
verbose("GUI Graphics: %dx%dx%d.\n", gui.screen.width, gui.screen.height, bootArgs->Video.v_depth);
verbose("Boot Graphics: %dx%dx%d, mode=0x%04X.\n", bootArgs->Video.v_width, bootArgs->Video.v_height, bootArgs->Video.v_depth, getCurrentGraphicsMode());
getCurrentEDID();
verbose("GUI Graphics: %dx%dx%d.\n", gui.screen.width, gui.screen.height, bootArgs->Video.v_depth);
verbose("Boot Graphics: %dx%dx%d, mode=0x%04X.\n", bootArgs->Video.v_width, bootArgs->Video.v_height, bootArgs->Video.v_depth, getCurrentGraphicsMode());
verbose("Starting Mac OS X %s [0x%08X], %s\n", gBootVolume->OSVersion, MacOSVerCurrent, gDarwinBuildVerStr);
verbose("Boot Args: %s\n", bootArgs->CommandLine);
#if DEBUG
pause("\n[DEBUG] ");
#endif
setupBooterLog();
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
if (MacOSVerCurrent >= MacOSVer2Int("10.7"))
if (MacOSVerCurrent >= MacOSVer2Int("10.7"))
//if (!((checkOSVersion("10.4")) || (checkOSVersion("10.5")) || (checkOSVersion("10.6"))) )
{
// Notify modules that the kernel is about to be started
// Masking out so that Lion doesn't doublefault
outb(0x21, 0xff);/* Maskout all interrupts Pic1 */
outb(0xa1, 0xff);/* Maskout all interrupts Pic2 */
if (gVerboseMode) pause("");
startprog( kernelEntry, bootArgs );
} else {
}
else
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void *)kernelEntry, (void*)bootArgsPreLion, NULL, NULL);
if (gVerboseMode) pause("");
startprog( kernelEntry, bootArgsPreLion );
}
unsigned long adler32;
u_int32_t time, cachetime, kerneltime, exttime;
if ((gBootMode & kBootModeSafe) != 0) {
if((gBootMode & kBootModeSafe) != 0)
{
verbose("Kernel Cache ignored.\n");
return -1;
}
}
// Snow Leopard prelink kernel cache file
else
{
if (MacOSVerCurrent >= MacOSVer2Int("10.6")) // OSX is Snow (10.6)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
int lnam = strlen(kernelCacheFile) + 9; //with adler32
char* name;
u_int32_t prev_time = 0;
struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow);
/* TODO: handle error? */
if (cacheDir)
{
while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0)
{
if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time
&& strstr(name, kernelCacheFile) && (name[lnam] != '.'))
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name);
prev_time = time;
}
}
verbose("Kernel Cache file path (Mac OS X 10.6.X): %s\n", kernelCacheFile);
}
closedir(cacheDir);
}
else
{
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile);
adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler));
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32);
verbose("Reseted kernel cache file path: %s\n", kernelCacheFile);
}
{
if (MacOSVerCurrent >= MacOSVer2Int("10.6")) // OSX is Snow (10.6)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
intlnam = strlen(kernelCacheFile) + 9; //with adler32
char*name;
u_int32_t prev_time = 0;
struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow);
/* TODO: handle error? */
if (cacheDir)
{
while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0)
{
if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time
&& strstr(name, kernelCacheFile) && (name[lnam] != '.'))
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name);
prev_time = time;
}
}
verbose("Kernel Cache file path (Mac OS X 10.6.X): %s\n", kernelCacheFile);
}
closedir(cacheDir);
}
else
{
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile);
adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler));
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32);
verbose("Reseted kernel cache file path: %s\n", kernelCacheFile);
}
}
}
}
// Exit if kernel cache file wasn't found
if (ret == -1) {
if (ret == -1)
{
verbose("No Kernel Cache File '%s' found\n", kernelCacheFile);
return -1;
}
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)
&& (kerneltime > cachetime)) {
verbose("Kernel file '%s' is more recent than Kernel Cache '%s'! Ignoring Kernel Cache.\n",
bootInfo->bootFile, kernelCacheFile);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
{
verbose("Kernel file '%s' is more recent than Kernel Cache '%s'! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile);
return -1;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
&& (exttime > cachetime)) {
verbose("Folder '/System/Library/Extensions' is more recent than Kernel Cache file '%s'! Ignoring Kernel Cache.\n",
kernelCacheFile);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
verbose("Folder '/System/Library/Extensions' is more recent than Kernel Cache file '%s'! Ignoring Kernel Cache.\n", kernelCacheFile);
return -1;
}
verbose("Loading Kernel Cache from: '%s%s' (%s)\n", gBootVolume->label, gBootVolume->altlabel, gBootVolume->type_name);
ret = LoadThinFatFile(kernelCachePath, binary);
if (gVerboseMode) pause("");
#if DEBUG
pause("\n[DEBUG] ");
#endif
return ret; // ret contain the length of the binary
}
{
gEnableCDROMRescan = true;
}
// Disable rescanPrompt option by default
rescanPrompt = false;
// Disable rescanPrompt option by default
rescanPrompt = false;
// Ask the user for Rescan option by setting "Rescan Prompt"=y in system config.
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig)
&& rescanPrompt && biosDevIsCDROM(gBIOSDev))
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev))
{
gEnableCDROMRescan = promptForRescanOption();
}
// Disable ScanSingleDrive option by default
gScanSingleDrive = false;
// Disable ScanSingleDrive option by default
gScanSingleDrive = false;
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig) && gScanSingleDrive)
{
init_module_system();
#if DEBUG
if (gBootVolume) {
verbose("Default: %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n",
gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
}
else {
verbose("Boot Volume not selected yet.\n");
}
verbose("bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n",
gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
pause("");
if (gBootVolume)
{
verbose("Default: %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
}
else
{
verbose("Boot Volume not selected yet.\n");
}
verbose("bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
pause("\n[DEBUG] ");
#endif
useGUI = true;
// Override useGUI default
getBoolForKey(kGUIKey, &useGUI, &bootInfo->chameleonConfig);
// initGUI() returned with an error, disabling GUI.
useGUI = false;
}
setBootGlobals(bvChain);
// Parse args, load and start kernel.
u_int32_tsleeptime, time;
void*binary = (void *)kLoadAddr;
char bootFile[sizeof(bootInfo->bootFile)];
charbootFile[sizeof(bootInfo->bootFile)];
charbootFilePath[512];
charkernelCacheFile[512];
status = getBootOptions(firstRun);
firstRun = false;
if (status == -1) continue;
status = processBootOptions();
// Status == 1 means to chainboot
if ( status ==1 ) break;
}
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
if (useKernelCache) {
do {
// Determine the name of the Kernel Cache
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) {
if (val[0] == '\\')
{
len--;
val++;
}
/* FIXME: check len vs sizeof(kernelCacheFile) */
strlcpy(kernelCacheFile, val, len + 1);
}
else
if (useKernelCache)
{
do
{
kernelCacheFile[0] = 0; // Use default kernel cache file
}
if (gOverrideKernel && kernelCacheFile[0] == 0) {
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile);
useKernelCache = false;
break;
}
if (gMKextName[0] != 0) {
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n",
gMKextName);
useKernelCache = false;
break;
}
if (gBootFileType != kBlockDeviceType)
useKernelCache = false;
} while(0);
} else {
verbose("Kernel Cache using disabled by user.");
}
// Determine the name of the Kernel Cache
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig))
{
if (val[0] == '\\')
{
len--;
val++;
}
/* FIXME: check len vs sizeof(kernelCacheFile) */
strlcpy(kernelCacheFile, val, len + 1);
}
else
{
kernelCacheFile[0] = 0; // Use default kernel cache file
}
do {
if (gOverrideKernel && kernelCacheFile[0] == 0)
{
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile);
useKernelCache = false;
break;
}
if (gMKextName[0] != 0)
{
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n", gMKextName);
useKernelCache = false;
break;
}
if (gBootFileType != kBlockDeviceType)
{
useKernelCache = false;
}
} while(0);
}
else
{
verbose("Kernel Cache using disabled by user.");
}
do
{
if (useKernelCache)
{
{
ret = LoadKernelCache(kernelCacheFile, &binary);
if (ret >= 0)
{
break;
break;
}
}
}
bool bootFileWithDevice = false;
// Check if bootFile start with a device ex: bt(0,0)/Extra/mach_kernel
if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
{
if (MacOSVerCurrent >= MacOSVer2Int("10.10")) // OSX is 10.10 or newer
{
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos "%s", bootInfo->bootFile); // Yosemite: '/System/Library/Kernels/'
else
}
else
{
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathPreYos "%s", bootInfo->bootFile); // append a leading '/'
}
}
else
{
else
{
strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
}
// Try to load kernel image from alternate locations on boot helper partitions.
ret = -1;
if ((gBootVolume->flags & kBVFlagBooter) && !bootFileWithDevice)
{
{
snprintf(bootFilePath, sizeof(bootFilePath), "com.apple.boot.P%s", bootFile);
ret = GetFileInfo(NULL, bootFilePath, &flags, &time);
if (ret == -1)
}
}
if (ret == -1)
{
{
// No alternate location found, using the original kernel image path.
strlcpy(bootFilePath, bootFile, sizeof(bootFilePath));
}
sleep(8);
#endif
if (ret <= 0) {
if (ret <= 0)
{
error("Can't find boot file: '%s'\n", bootFile);
sleep(1);
gUnloadPXEOnExit = false;
break;
}
pause("");
#if DEBUG
pause("\n[DEBUG] ");
#endif
}
else
uint32_t getMacOSVerCurrent()
{
MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion);
return MacOSVerCurrent;
MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion);
return MacOSVerCurrent;
}
#define BASE 65521L /* largest prime smaller than 65536 */
branches/Bungo/i386/boot2/boot.h
4242
4343
4444
45
46
47
45
46
47
4848
4949
50
51
50
51
5252
5353
54
55
54
55
5656
5757
5858
......
6161
6262
6363
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
9393
9494
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122122
123123
124
124
125125
126126
127
127
128128
129129
130
131
130
131
132132
133133
134
134
135135
136136
137137
138138
139
139
140140
141141
142142
143143
144
145
146
147
148
149
150
151
144
145
146
147
148
149
150
151
152152
153153
154
155
156
154
155
156
157157
158158
159
159
160160
161161
162
163
164
162
163
164
165165
166166
167
167
168168
169169
170170
171171
172
173
174
175
176
177
178
179
180
181
182
172
173
174
175
176
177
178
179
180
181
182
183183
184184
185
185
186186
187187
188
189
188
189
190190
191191
192192
193193
194
195
196
197
198
194
195
196
197
198
199199
200200
201201
202202
203
204
203
204
205205
206206
207207
......
240240
241241
242242
243
244
243
244
245245
246246
247247
......
329329
330330
331331
332
333
334
335
332
333
334
335
336336
337
338
339
340
341
337
338
339
340
341
342342
343343
344344
......
350350
351351
352352
353
353
354354
355355
356356
* Paths used by chameleon
*/
//kernel cache
#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"
// kernel cache
#define kDefaultCachePathLeo"/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow"/System/Library/Caches/com.apple.kext.caches/Startup/"
// Lion installer
#define kLionInstallerDataFolder "/Mac OS X Install Data/"
#define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist"
#define kLionInstallerDataFolder"/Mac OS X Install Data/"
#define kLionInstallerPlistkLionInstallerDataFolder "com.apple.Boot.plist"
// Mountain Lion installer
#define kMLionInstallerDataFolder "/OS X Install Data/"
#define kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist"
#define kMLionInstallerDataFolder"/OS X Install Data/"
#define kMLionInstallerPlistkMLionInstallerDataFolder "com.apple.Boot.plist"
//kernel path
#define kDefaultKernelPathPreYos"/"
/*
* Keys used in system Boot.plist
*/
#define kGraphicsModeKey "Graphics Mode"
#define kTextModeKey "Text Mode"
#define kQuietBootKey "Quiet Boot"
#define kKernelFlagsKey "Kernel Flags"
#define kKernelArchKey "Kernel Architecture"
#define kMKextCacheKey "MKext Cache"
#define kKernelNameKey "Kernel"
#define kKernelCacheKey "Kernel Cache"
#define kUseKernelCache "UseKernelCache"/* boot.c */
#define kBootDeviceKey "Boot Device"
#define kTimeoutKey "Timeout"
#define kRootDeviceKey "rd"
#define kBootUUIDKey "boot-uuid"
#define kHelperRootUUIDKey "Root UUID"
#define kPlatformKey "platform"
#define kACPIKey "acpi"
#define kCDROMPromptKey "CD-ROM Prompt"
#define kCDROMOptionKey "CD-ROM Option Key"
#define kRescanPromptKey "Rescan Prompt"
#define kRescanKey "Rescan"
#define kScanSingleDriveKey "Scan Single Drive"
#define kInstantMenuKey "Instant Menu"
#define kYosemiteKernel "kernel"
#define kDefaultKernel "mach_kernel"
#define kOSXKernel "kernel"// Yosemite
#define kGUIKey "GUI"
#define kBootBannerKey "Boot Banner"
#define kShowInfoKey "ShowInfo"/* gui.c */
#define kWaitForKeypressKey "Wait"
#define kGraphicsModeKey"Graphics Mode"
#define kTextModeKey"Text Mode"
#define kQuietBootKey"Quiet Boot"
#define kKernelFlagsKey"Kernel Flags"
#define kKernelArchKey"Kernel Architecture"
#define kMKextCacheKey"MKext Cache"
#define kKernelNameKey"Kernel"
#define kKernelCacheKey"Kernel Cache"
#define kUseKernelCache"UseKernelCache"/* boot.c */
#define kBootDeviceKey"Boot Device"
#define kTimeoutKey"Timeout"
#define kRootDeviceKey"rd"
#define kBootUUIDKey"boot-uuid"
#define kHelperRootUUIDKey"Root UUID"
#define kPlatformKey"platform"
#define kACPIKey"acpi"
#define kCDROMPromptKey"CD-ROM Prompt"
#define kCDROMOptionKey"CD-ROM Option Key"
#define kRescanPromptKey"Rescan Prompt"
#define kRescanKey"Rescan"
#define kScanSingleDriveKey"Scan Single Drive"
#define kInstantMenuKey"Instant Menu"
#define kYosemiteKernel"kernel"
#define kDefaultKernel"mach_kernel"
#define kOSXKernel"kernel"// Yosemite
#define kGUIKey"GUI"
#define kBootBannerKey"Boot Banner"
#define kShowInfoKey"ShowInfo"// gui.c
#define kWaitForKeypressKey"Wait"
/* AsereBLN: added these keys */
#define kUseAtiROM "UseAtiROM"/* ati.c */
#define kWake "Wake"/* boot.c */
#define kForceWake "ForceWake"/* boot.c */
#define kWakeImage "WakeImage"/* boot.c */
#define kProductVersion "ProductVersion"/* disk.c */
#define karch "arch"/* boot.c */
#define kDSDT "DSDT"// path to custom DSDT.aml /* acpi_patcher.c */
#define kDropSSDT "DropSSDT"/* acpi_patcher.c */
#define kDeviceProperties "device-properties"/* device_inject.c */
#define kHidePartition "Hide Partition"/* disk.c */
#define kRenamePartition "Rename Partition"/* disk.c */
#define kSMBIOSKey "SMBIOS"/* fake_efi.c */
//#define kSystemID "SystemId"/* fake_efi.c */
#define kSystemType "SystemType"/* fake_efi.c */
#define kUseNvidiaROM "UseNvidiaROM"/* nvidia.c */
#define kVBIOS "VBIOS"/* nvidia.c && ati.c */
#define kPCIRootUID "PCIRootUID"/* pci_root.c */
#define kEthernetBuiltIn "EthernetBuiltIn"/* pci_setup.c */
#define kGraphicsEnabler "GraphicsEnabler"/* pci_setup.c */
#define kForceHPET "ForceHPET"/* pci_setup.c */
#define kUseMemDetect "UseMemDetect"/* platform.c */
#define kSMBIOSdefaults "SMBIOSdefaults"/* smbios_patcher.c */
#define kUSBBusFix "USBBusFix"/* usb.c */
#define kEHCIacquire "EHCIacquire"/* usb.c */
#define kUHCIreset "UHCIreset"/* usb.c */
#define kEHCIhard "EHCIhard"/* usb.c */
#define kDefaultPartition "Default Partition"/* sys.c */
#define kUseAtiROM"UseAtiROM"/* ati.c */
#define kWake"Wake"/* boot.c */
#define kForceWake"ForceWake"/* boot.c */
#define kWakeImage"WakeImage"/* boot.c */
#define kProductVersion"ProductVersion"/* disk.c */
#define karch"arch"/* boot.c */
#define kDSDT"DSDT"// path to custom DSDT.aml /* acpi_patcher.c */
#define kDropSSDT"DropSSDT"/* acpi_patcher.c */
#define kDeviceProperties"device-properties"/* device_inject.c */
#define kHidePartition"Hide Partition"/* disk.c */
#define kRenamePartition"Rename Partition"/* disk.c */
#define kSMBIOSKey"SMBIOS"/* fake_efi.c */
//#define kSystemID"SystemId"/* fake_efi.c */
#define kSystemType"SystemType"/* fake_efi.c */
#define kUseNvidiaROM"UseNvidiaROM"/* nvidia.c */
#define kVBIOS"VBIOS"/* nvidia.c && ati.c */
#define kPCIRootUID"PCIRootUID"/* pci_root.c */
#define kEthernetBuiltIn"EthernetBuiltIn"/* pci_setup.c */
#define kGraphicsEnabler"GraphicsEnabler"/* pci_setup.c */
#define kForceHPET"ForceHPET"/* pci_setup.c */
#define kUseMemDetect"UseMemDetect"/* platform.c */
#define kSMBIOSdefaults"SMBIOSdefaults"/* smbios_patcher.c */
#define kUSBBusFix"USBBusFix"/* usb.c */
#define kEHCIacquire"EHCIacquire"/* usb.c */
#define kUHCIreset"UHCIreset"/* usb.c */
#define kEHCIhard"EHCIhard"/* usb.c */
#define kDefaultPartition"Default Partition"/* sys.c */
/* Zenith432: added this */
#define kXHCILegacyOff "XHCILegacyOff"/* usb.c */
#define kXHCILegacyOff"XHCILegacyOff"/* usb.c */
/* Duvel300: added this */
#define kRestartFix "RestartFix"/* acpi_patcher.c */
#define kRestartFix"RestartFix"/* acpi_patcher.c */
/* Slice: added this */
#define kPS2RestartFix "PS2RestartFix"/* acpi_patcher.c */
#define kUseIntelHDMI "UseIntelHDMI"/* ati.c && nvidia.c && gma.c */
#define kPS2RestartFix"PS2RestartFix"/* acpi_patcher.c */
#define kUseIntelHDMI"UseIntelHDMI"/* ati.c && nvidia.c && gma.c */
/* Signal64: added this key */
#define kLegacyOff "USBLegacyOff"/* usb.c */
#define kLegacyOff"USBLegacyOff"/* usb.c */
/* Lebidou: added this key */
/* Meklort: added this key */
#define kMD0Image "md0"/* ramdisk.h */
#define kMD0Image"md0"/* ramdisk.h */
/* Andyvand: added these keys */
/* Mojodojo: added these keys */
#define kGeneratePStates "GeneratePStates"/* acpi_patcher.c */
#define kGenerateCStates "GenerateCStates"/* acpi_patcher.c */
#define kCSTUsingSystemIO "CSTUsingSystemIO"/* acpi_patcher.c */
#define kEnableC2State "EnableC2State"/* acpi_patcher.c */
#define kEnableC3State "EnableC3State"/* acpi_patcher.c */
#define kEnableC4State "EnableC4State"/* acpi_patcher.c */
#define kEnableC6State "EnableC6State"/* acpi_patcher.c */
#define kEnableC7State "EnableC7State"/* acpi_patcher.c */
#define kGeneratePStates"GeneratePStates"/* acpi_patcher.c */
#define kGenerateCStates"GenerateCStates"/* acpi_patcher.c */
#define kCSTUsingSystemIO"CSTUsingSystemIO"/* acpi_patcher.c */
#define kEnableC2State"EnableC2State"/* acpi_patcher.c */
#define kEnableC3State"EnableC3State"/* acpi_patcher.c */
#define kEnableC4State"EnableC4State"/* acpi_patcher.c */
#define kEnableC6State"EnableC6State"/* acpi_patcher.c */
#define kEnableC7State"EnableC7State"/* acpi_patcher.c */
/* valv: added these keys */
#define kbusratio "busratio"/* cpu.c */
#define kDcfg0 "display_0"/* nvidia.c */
#define kDcfg1 "display_1"/* nvidia.c */
#define kbusratio"busratio"/* cpu.c */
#define kDcfg0"display_0"/* nvidia.c */
#define kDcfg1"display_1"/* nvidia.c */
/* Marchrius: added these keys */
#define kEnableBacklight "EnableBacklight"/* nvidia.c */
#define kEnableBacklight"EnableBacklight"/* nvidia.c */
/* Kabyl: added these keys */
#define kAtiConfig "AtiConfig"/* ati.c */
#define kAtiPorts "AtiPorts"/* ati.c */
#define kATYbinimage "ATYbinimage"/* ati.c */
#define kAtiConfig"AtiConfig"/* ati.c */
#define kAtiPorts"AtiPorts"/* ati.c */
#define kATYbinimage"ATYbinimage"/* ati.c */
/* cosmo1: added these keys */
#define kEnableHDMIAudio "EnableHDMIAudio"/* ati.c && nvidia.c */
#define kEnableHDMIAudio"EnableHDMIAudio"/* ati.c && nvidia.c */
/* cparm: added these keys */
/* ErmaC: added these keys */
#define kEnableDualLink "EnableDualLink"/* nvidia.c && gma.c*/
#define kNvidiaGeneric "NvidiaGeneric"/* nvidia.c */
#define kSkipIntelGfx "SkipIntelGfx"/* pci_setup.c */
#define kSkipNvidiaGfx "SkipNvidiaGfx"/* pci_setup.c */
#define kSkipAtiGfx "SkipAtiGfx"/* pci_setup.c */
#define kIntelCapriFB "IntelCapriFB"/* gma.c was HD4K-ig */
#define kIntelAzulFB "IntelAzulFB"/* gma.c was HD5K-ig */
#define kAAPLCustomIG "InjectIntel-ig"/* gma.c */
#define kHDAEnabler "HDAEnabler"/* pci_setup.c */
#define kHDEFLayoutID "HDEFLayoutID"/* hda.c */
#define kHDAULayoutID "HDAULayoutID"/* hda.c */
#define kEnableDualLink"EnableDualLink"/* nvidia.c && gma.c*/
#define kNvidiaGeneric"NvidiaGeneric"/* nvidia.c */
#define kSkipIntelGfx"SkipIntelGfx"/* pci_setup.c */
#define kSkipNvidiaGfx"SkipNvidiaGfx"/* pci_setup.c */
#define kSkipAtiGfx"SkipAtiGfx"/* pci_setup.c */
#define kIntelCapriFB"IntelCapriFB"/* gma.c was HD4K-ig */
#define kIntelAzulFB"IntelAzulFB"/* gma.c was HD5K-ig */
#define kAAPLCustomIG"InjectIntel-ig"/* gma.c */
#define kHDAEnabler"HDAEnabler"/* pci_setup.c */
#define kHDEFLayoutID"HDEFLayoutID"/* hda.c */
#define kHDAULayoutID"HDAULayoutID"/* hda.c */
/* Karas: added these keys */
#define kMemFullInfo "ForceFullMemInfo"/* smbios.c */
#define kMemFullInfo"ForceFullMemInfo"/* smbios.c */
/* Bungo: added these keys */
#define kPrivateData "PrivateData"/* smbios_decode.c */
#define kProductUserVisibleVersion "ProductUserVisibleVersion"/* disk.c */
#define kPrivateData"PrivateData"/* smbios_decode.c */
#define kProductUserVisibleVersion"ProductUserVisibleVersion"/* disk.c */
/*
* Flags to the booter or kernel
*/
#define kVerboseModeFlag "-v"
#define kSafeModeFlag "-x"
#define kIgnoreCachesFlag "-f"
#define kIgnoreBootFileFlag "-F"
#define kSingleUserModeFlag "-s"
#define kVerboseModeFlag"-v"
#define kSafeModeFlag"-x"
#define kIgnoreCachesFlag"-f"
#define kIgnoreBootFileFlag"-F"
#define kSingleUserModeFlag"-s"
/*
* Booter behavior control
*/
#define kBootTimeout -1
#define kCDBootTimeout 8
#define kBootTimeout-1
#define kCDBootTimeout8
/*
* A global set by boot() to record the device that the booter was loaded from.
*/
extern void *loadACPITable(const char *filename);
// Bungo:
extern void *new_dsdt,
*new_ecdt;
extern void *new_dsdt;
extern void *new_ecdt;
/*
* smbios.c
/*
* lzvn.c
*/
extern size_t lzvn_decode(void * dst,
size_t dst_size,
const void * src,
size_t src_size);
extern size_t lzvn_decode(void*dst,
size_tdst_size,
const void*src,
size_tsrc_size);
/*
extern size_t lzvn_encode(void *dst,
size_t dst_size,
const void *src,
size_t src_size,
void *work);
extern size_t lzvn_encode(void*dst,
size_tdst_size,
const void*src,
size_tsrc_size,
void*work);
*/
struct compressed_kernel_header {
u_int32_t reserved[11];
char platform_name[64];
char root_path[256];
u_int8_t data[0];
u_int8_t data[0];
};
typedef struct compressed_kernel_header compressed_kernel_header;
branches/Bungo/i386/boot2/modules.c
5858
5959
6060
61
62
61
62
6363
6464
6565
......
8585
8686
8787
88
88
89
8990
90
91
92
9193
9294
9395
......
207209
208210
209211
210
212
211213
212214
213215
......
220222
221223
222224
223
224
225
226
227
225
226
227
228
229
228230
229231
230232
......
243245
244246
245247
246
247
248
249
248250
249
251
250252
251253
252254
......
254256
255257
256258
257
259
258260
259
261
260262
261263
262264
......
306308
307309
308310
309
310
311
311
312
313
312314
313315
314316
......
338340
339341
340342
343
341344
342345
343346
......
371374
372375
373376
374
377
375378
376379
377380
......
488491
489492
490493
491
494
492495
493496
494497
......
931934
932935
933936
934
937
935938
936939
937940
......
950953
951954
952955
953
956
954957
955958
956959
......
968971
969972
970973
971
974
972975
973976
974977
......
993996
994997
995998
996
999
9971000
9981001
9991002
......
11241127
11251128
11261129
1127
1130
11281131
11291132
11301133
11311134
1132
1135
11331136
11341137
11351138
......
11381141
11391142
11401143
1144
11411145
11421146
11431147
......
11791183
11801184
11811185
1186
11821187
1183
11841188
11851189
11861190
......
11901194
11911195
11921196
1193
1197
11941198
11951199
11961200
......
12131217
12141218
12151219
1216
1220
12171221
12181222
12191223
12201224
12211225
1222
1226
12231227
12241228
12251229
*/
int init_module_system()
{
// Start any modules that were compiled in first.
start_built_in_modules();
// Start any modules that were compiled in first.
start_built_in_modules();
int retVal = 0;
}
else
{
// The module does not have a valid start function
#if CONFIG_MODULE_DEBUG
// The module does not have a valid start function
error("[ERROR!] Unable to start a module '%s' at 0x%08X.\n", SYMBOLS_MODULE, module_data);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
#endif
}
}
// Check to see if the module has already been loaded
if(is_module_loaded(module))
{
verbose("Module '%s' already loaded.\n", module);
verbose("Module '%s' already loaded.\n", module);
return 1;
}
}
unsigned int moduleSize = file_size(fh);
if(moduleSize == 0)
{
verbose("[WARNING!] The module '%s' has a file size=%d. Not loading.\n", modString, moduleSize);
return 0;
}
if(moduleSize == 0)
{
verbose("[WARNING!] The module '%s' has a file size=%d. Not loading.\n", modString, moduleSize);
return 0;
}
char* module_base = (char*) malloc(moduleSize);
if (moduleSize && read(fh, module_base, moduleSize) == moduleSize)
else // The module does not have a valid start function. This may be a library.
{
#if CONFIG_MODULE_DEBUG
error("[debug load_module] [WARNING!] Unable to start module '%s'.\n", module);
pause("");
error("[debug load_module] [WARNING!] Unable to start module '%s'.\n", module);
pause("[CONFIG_MODULE_DEBUG] ");
#else
verbose("[WARNING!] Unable to start module '%s'.\n", module);
verbose("[WARNING!] Unable to start module '%s'.\n", module);
#endif
}
}
{
#if CONFIG_MODULE_DEBUG
error("[debug load_module] [WARNING!] Unable to read in module '%s'.\n", module);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
#else
verbose("[WARNING!] Unable to read in module '%s'.\n", module);
verbose("[WARNING!] Unable to read in module '%s'.\n", module);
#endif
retVal = 0;
}
loadedModules = new_entry;
if(!name) name = "Unknown";
if(!author) author = "Unknown";
if(!description) description = "";
if(!name) name = "Unknown";
if(!author) author = "Unknown";
if(!description) description = "";
new_entry->name = name;
new_entry->author = author;
{
entry = entry->next;
}
}
//verbose("'%s' module not loaded.\n", name);
#if CONFIG_MODULE_DEBUG
printf("[debug lookup_all_symbols] [WARNING!] Unable to locate symbol %s.\n", name);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
#endif
if(strcmp(name, VOID_SYMBOL) == 0) return 0xFFFFFFFF;
}
}
break;
case LC_SEGMENT_64:// 64bit macho's
case LC_SEGMENT_64:// 64bit macho's
{
segCommand64 = binary + binaryIndex;
UInt32 sectionIndex;
else
{
error("[ERROR!] Unable to bind symbol %s.\n", symbolName);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
segmentAddress += sizeof(void*);
else
{
error("[ERROR!] Unable to bind symbol %s.\n", symbolName);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
segmentAddress += tmp + sizeof(void*);
else
{
error("[ERROR!] Unable to bind symbol %s.\n", symbolName);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
else
{
error("[ERROR!] Unable to bind symbol %s.\n", symbolName);
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
break;
default:
newCallback->next = hook->callbacks;
hook->callbacks = newCallback;
newCallback->callback = callback;
verbose("Added.\n");
verbose("Added.\n");
}
else
{
// create new hook
verbose("Hook not exists, creating a new hook.\n");
verbose("Hook not exists, creating a new hook.\n");
moduleHook_t *newHook = malloc(sizeof(moduleHook_t));
newHook->name = name;
newHook->callbacks = malloc(sizeof(callbackList_t));
newHook->next = moduleCallbacks;
moduleCallbacks = newHook;
}
#if CONFIG_MODULE_DEBUG
printf("Hook: %s\n", hooks->name);
hooks = hooks->next;
}
pause("[CONFIG_MODULE_DEBUG] ");
}
#endif
/********************************************************************************/
void dyld_stub_binder()
{
printf("[ERROR!] 'dyld_stub_binder' was called, should have been take care of by the linker.\n");
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
#else /* CONFIG_MODULES */
void register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*))
{
error("[WARNING!] 'register_hook_callback' is not supported when compiled in.\n");
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
}
int replace_function(const char* symbol, void* newAddress)
{
error("[WARNING!] 'replace_functions' is not supported when compiled in.\n");
pause("");
pause("[CONFIG_MODULE_DEBUG] ");
return 0;
}
branches/Bungo/i386/boot2/bmdecompress.c
4141
4242
4343
44
45
46
47
48
49
4450
4551
4652
......
153159
154160
155161
162
163
164
165
166
167
156168
157169
158170
uint16_t * sc1 = malloc((width+2) * sizeof(uint16_t));
uint16_t * sc2 = malloc((width+2) * sizeof(uint16_t));
uint16_t * sc3 = malloc((width+2) * sizeof(uint16_t));
if (!sc0 || !sc1 || !sc2 || !sc3)
{
return;
}
uint32_t sr0, sr1, sr2, sr3;
bzero(sc0, (width+2) * sizeof(uint16_t));
uint16_t * sc1 = malloc((width+2) * sizeof(uint16_t));
uint16_t * sc2 = malloc((width+2) * sizeof(uint16_t));
uint16_t * sc3 = malloc((width+2) * sizeof(uint16_t));
if (!sc0 || !sc1 || !sc2 || !sc3)
{
return;
}
uint32_t sr0, sr1, sr2, sr3;
bzero(sc0, (width+2) * sizeof(uint16_t));
branches/Bungo/i386/boot2/gui.c
889889
890890
891891
892
893
892
893
894894
895895
896896
......
911911
912912
913913
914
914
915
915916
916917
917
918
919
918920
919921
920
921
922
923
922924
923925
924926
......
929931
930932
931933
932
934
933935
934936
935937
......
21932195
21942196
21952197
2196
2197
2198
2199
21982200
21992201
22002202
......
22052207
22062208
22072209
2208
2209
2210
2211
22102212
22112213
22122214
int initGUI(void)
{
intval;
int len;
intval;
intlen;
chardirspec[256];
getValueForKey( "Theme", &theme_name, &len, &bootInfo->chameleonConfig );
#endif
}
// parse display size parameters
if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && (val > 0)) {
if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && (val > 0))
{
screen_params[0] = val;
}
if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && (val > 0)) {
if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && (val > 0))
{
screen_params[1] = val;
}
verbose("\ninitGUI: theme res.=%dx%d.\n", screen_params[0], screen_params[1]);
verbose("initGUI: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("\ninitGUI: theme res.=%dx%d.\n", screen_params[0], screen_params[1]);
verbose("initGUI: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
// Initalizing GUI strucutre.
bzero(&gui, sizeof(gui_t));
// set our screen structure with the mode width & height
gui.screen.width = screen_params[0];
gui.screen.height = screen_params[1];
verbose("\ninitGUI: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("\ninitGUI: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
// load graphics otherwise fail and return
if (loadGraphics() == 0) {
} else {
screen_params[1] = DEFAULT_SCREEN_HEIGHT;
}
verbose("\ndrawBootGraphics: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("drawBootGraphics: boot res.=%dx%d.\n", screen_params[0], screen_params[1]);
verbose("\ndrawBootGraphics: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("drawBootGraphics: boot res.=%dx%d.\n", screen_params[0], screen_params[1]);
// Save current screen resolution.
oldScreenWidth = gui.screen.width;
// find best matching vesa mode for our requested width & height
getGraphicModeParams(screen_params);
verbose("\ndrawBootGraphics: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("drawBootGraphics: boot res.=%dx%d.\n", screen_params[0], screen_params[1]);
verbose("\ndrawBootGraphics: gui res.=%dx%d.\n", gui.screen.width, gui.screen.height);
verbose("drawBootGraphics: boot res.=%dx%d.\n", screen_params[0], screen_params[1]);
// Set graphics mode if the booter was in text mode or the screen resolution has changed.
if (bootArgs->Video.v_display == VGA_TEXT_MODE || (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) ) {
branches/Bungo/i386/boot2/options.c
3939
4040
4141
42
43
44
42
43
44
4545
4646
4747
......
7070
7171
7272
73
74
75
76
73
74
75
76
7777
7878
7979
8080
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
98113
99114
100115
......
143158
144159
145160
146
147
148
149
150
161
162
163
151164
165
166
152167
153168
154169
......
157172
158173
159174
160
175
161176
162177
163178
164179
165
180
166181
167182
168
183
169184
170185
171186
172
187
173188
174
189
175190
176
177
191
192
178193
179194
180195
181196
182197
183198
184
185
199
200
186201
187
188
189
202
203
204
190205
191
192
193
206
207
208
194209
195
196
197
198
210
211
212
213
199214
200215
201216
202217
203218
204219
205
206
220
221
207222
208223
209224
......
211226
212227
213228
214
229
215230
216
231
217232
218
233
219234
220235
221236
222237
223
224
225
226
227
238
239
240
241
242
228243
229244
230245
......
257272
258273
259274
260
275
261276
262277
263278
......
295310
296311
297312
298
313
299314
300
301
302
303
304
305
315
316
317
318
319
320
306321
307
308
309
310
311
312
313
314
315
322
323
324
325
326
327
316328
329
330
331
332
333
317334
318335
319336
320337
321338
322
323
324
325
326
339
340
341
342
343
327344
328345
329
330
331
332
346
347
348
349
333350
334
335
336
337
351
352
353
354
355
356
357
358
338359
339
360
340361
341
362
342363
343364
344365
......
410431
411432
412433
413
434
414435
415
416
417
436
437
438
418439
419440
420441
......
423444
424445
425446
426
447
427448
428449
429450
......
737758
738759
739760
740
761
741762
742763
743764
......
11481169
11491170
11501171
1151
1152
1172
1173
11531174
11541175
11551176
11561177
11571178
11581179
1159
1160
1161
1162
1180
1181
1182
1183
1184
11631185
11641186
11651187
1166
1167
1168
1169
1170
1188
1189
1190
1191
1192
11711193
11721194
11731195
......
12311253
12321254
12331255
1234
1235
1256
1257
1258
1259
12361260
12371261
12381262
......
12501274
12511275
12521276
1253
1277
1278
12541279
12551280
1256
1257
1258
1259
1260
1281
1282
1283
1284
1285
12611286
12621287
1263
1288
12641289
12651290
12661291
1267
1268
1269
1292
1293
1294
12701295
12711296
1272
1297
1298
12731299
12741300
12751301
......
13651391
13661392
13671393
1368
1394
13691395
13701396
13711397
......
13791405
13801406
13811407
1382
1383
1408
1409
13841410
13851411
13861412
......
13981424
13991425
14001426
1401
1427
1428
14021429
14031430
14041431
#endif
chargMacOSVersion[OSVERSTRLEN];
uint32_t MacOSVerCurrent = 0;
bool showBootBanner = true; //Azi:showinfo
static bool shouldboot = false;
uint32_tMacOSVerCurrent = 0;
boolshowBootBanner = true; //Azi:showinfo
static boolshouldboot = false;
extern int multiboot_timeout;
extern int multiboot_timeout_set;
// MacOSVer2Int - converts OS ver. string to uint32 (e.g "10.9.5" -> 0x0A090500) for easy comparing
uint32_t MacOSVer2Int(const char *osver)
{
uint32_t result = 0;
uint8_t *resptr = (uint8_t *)&result;
uint8_t len = strlen(osver);
uint8_t i, j, m;
uint32_t result = 0;
uint8_t *resptr = (uint8_t *)&result;
uint8_t len = strlen(osver);
uint8_t i, j, m;
#define CHR2UINT(c) ((uint8_t)(c - '0'))
#define ISDIGIT(c) ((c >= '0') && (c <= '9'))
#define ISDOT(c) (c == '.')
if (!osver || (len < 4) || (len > OSVERSTRLEN - 1) || !ISDIGIT(osver[0]) || !ISDOT(osver[2]) || !ISDIGIT(osver[len - 1])) {
verbose("ERROR: wrong Mac OS version string syntax: '%s'\n", osver);
return 0;
}
for (i = 0, j = 3, m = 1; i < len; i++) {
if (ISDIGIT(osver[i])) {
resptr[j] = resptr[j] * m + CHR2UINT(osver[i]);
m = 10;
} else if (ISDOT(osver[i])) {
if (j > 0) j--;
else return 0;
m = 1;
} else return 0;
}
return result;
if (!osver || (len < 4) || (len > OSVERSTRLEN - 1) || !ISDIGIT(osver[0]) || !ISDOT(osver[2]) || !ISDIGIT(osver[len - 1]))
{
verbose("ERROR: wrong Mac OS version string syntax: '%s'\n", osver);
return 0;
}
for (i = 0, j = 3, m = 1; i < len; i++)
{
if (ISDIGIT(osver[i]))
{
resptr[j] = resptr[j] * m + CHR2UINT(osver[i]);
m = 10;
}
else if (ISDOT(osver[i]))
{
if (j > 0)
{
j--;
}
else
{
return 0;
}
m = 1;
}
else
{
return 0;
}
}
return result;
}
//==========================================================================
static int countdown( const char * msg, int row, int timeout )
{
unsigned long time;
int ch = 0;
int col = strlen(msg) + 1;
flushKeyboardBuffer();
unsigned long time;
int ch = 0;
int col = strlen(msg) + 1;
flushKeyboardBuffer();
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
moveCursor( 0, row );
} else {
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
// make this screen the new background
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
}
int multi_buff = 18 * (timeout);
int multi = ++multi_buff;
int multi = ++multi_buff;
int lasttime=0;
int lasttime=0;
for ( time = time18(), timeout++; timeout > 0; )
{
for ( time = time18(), timeout++; timeout > 0; )
{
if( time18() > lasttime)
{
multi--;
lasttime=time18();
}
if ( (ch = readKeyboardStatus()) )
break;
if ( (ch = readKeyboardStatus()) )
break;
// Count can be interrupted by holding down shift,
// control or alt key
if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 )
// Count can be interrupted by holding down shift,
// control or alt key
if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 )
{
ch = 1;
break;
}
ch = 1;
break;
}
if ( time18() >= time )
{
time += 18;
timeout--;
if ( time18() >= time )
{
time += 18;
timeout--;
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
moveCursor( col, row );
printf("(%d) ", timeout);
}
}
}
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) );
updateVRAM();
}
}
}
flushKeyboardBuffer();
flushKeyboardBuffer();
return ch;
return ch;
}
//==========================================================================
char gBootArgs[BOOT_STRING_LEN];
static char *gBootArgsPtr = gBootArgs;
static char *gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
static char booterCommand[BOOT_STRING_LEN];
static char booterParam[BOOT_STRING_LEN];
chargBootArgs[BOOT_STRING_LEN];
static char*gBootArgsPtr = gBootArgs;
static char*gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
static charbooterCommand[BOOT_STRING_LEN];
static charbooterParam[BOOT_STRING_LEN];
static void clearBootArgs(void)
{
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
changeCursor( 0, row, kCursorTypeUnderline, 0 );
changeCursor( 0, row, kCursorTypeUnderline, 0 );
clearScreenRows( row, kScreenLastRow );
}
static void updateBootArgs( int key )
{
key = ASCII_KEY(key);
key = ASCII_KEY(key);
switch ( key )
{
case KEY_BKSP:
if ( gBootArgsPtr > gBootArgs )
{
*--gBootArgsPtr = '\0';
switch ( key )
{
case KEY_BKSP:
if ( gBootArgsPtr > gBootArgs )
{
*--gBootArgsPtr = '\0';
int x, y, t;
getCursorPositionAndType( &x, &y, &t );
if ( x == 0 && y )
{
x = 80; y--;
}
if (x) {
x--;
}
int x, y, t;
getCursorPositionAndType( &x, &y, &t );
if ( x == 0 && y )
{
x = 80; y--;
}
if (x)
{
x--;
}
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
}
else
{
updateGraphicBootPrompt();
}
}
else
{
updateGraphicBootPrompt();
}
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
*gBootArgsPtr++ = key;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
*gBootArgsPtr++ = key;
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
updateGraphicBootPrompt();
else if ( key >= ' ' && key < 0x7f)
putchar(key);
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
updateGraphicBootPrompt();
}
else if ( key >= ' ' && key < 0x7f)
{
putchar(key);
}
}
break;
}
}
}
//==========================================================================
// Draw the visible items.
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection);
else {
}
else
{
changeCursor( 0, row, kCursorTypeHidden, &cursorState );
for ( i = gMenuTop; i <= gMenuBottom; i++ )
}
restoreCursor( &cursorState );
}
}
}
//==========================================================================
dump_pci_dt(root_pci_dev->children);
pause("");
pause("\n[dump lspci] ");
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
setActiveDisplayPage(0);
bool copyArgument(const char *argName, const char *val, int cnt, char **argP, int *cntRemainingP)
{
int argLen = argName ? strlen(argName) : 0;
int len = argLen + cnt + 1; // + 1 to account for space.
int argLen = argName ? strlen(argName) : 0;
int len = argLen + cnt + 1; // +1 to account for space
if (argName)
{
len++; // +1 to account for '='
}
if (len > *cntRemainingP) {
error("Warning: boot arguments too long, truncating\n");
return false;
}
if (len > *cntRemainingP)
{
error("Warning: boot arguments too long, truncating\n");
return false;
}
if (argName)
{
strncpy( *argP, argName, argLen );
*argP += argLen;
*argP[0] = '=';
(*argP)++;
}
strncpy(*argP, argName, argLen);
*argP += argLen;
*argP[0] = '=';
(*argP)++;
}
strncpy(*argP, val, cnt);
*argP += cnt;
skipblanks( &cp );
// Update the unit and partition number.
if (gBootVolume) {
if (!(gBootVolume->flags & kBVFlagNativeBoot)) {
if (gBootVolume)
{
if (!(gBootVolume->flags & kBVFlagNativeBoot))
{
readBootSector(gBootVolume->biosdev, gBootVolume->part_boff, (void *)0x7c00);
//
// Setup edx, and signal intention to chain load the
}
// If no boot volume fail immediately because we're just going to fail
// trying to load the config file anyway.
else {
else
{
return -1;
}
// Save a version of mac os we're booting.
MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion);
// so copy it and trim
gMacOSVersion[0] = 0;
// Save a version of mac os we're booting.
MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion);
// so copy it and trim
gMacOSVersion[0] = 0;
if (MacOSVerCurrent >= MacOSVer2Int("10.10"))
{
strncat(gMacOSVersion, gBootVolume->OSVersion, 5);
strncat(gMacOSVersion, gBootVolume->OSVersion, 5);
}
else
{
strncat(gMacOSVersion, gBootVolume->OSVersion, 4);
}
strncat(gMacOSVersion, gBootVolume->OSVersion, 4);
}
// Load config table specified by the user, or use the default.
if (!getValueForBootKey(cp, "config", &val, &cnt)) {
if (!getValueForBootKey(cp, "config", &val, &cnt))
{
val = 0;
cnt = 0;
}
gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString);
}
}
verbose("Boot UUID [%s (%s), %s]: %s\n", gBootVolume->label, gBootVolume->altlabel, gBootVolume->type_name, gBootUUIDString);
verbose("Boot UUID [%s (%s), %s]: %s\n", gBootVolume->label, gBootVolume->altlabel, gBootVolume->type_name, gBootUUIDString);
if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config,
&argP, &cntRemaining, gRootDevice, ROOT_DEVICE_SIZE))
val = valueBuffer;
if (cnt > 0)
{
copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining);
}
copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining);
}
}
else
{
}
}
/* Bungo
if (cnt > 0) {
if (cnt > 0)
{
copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining);
}
*/
branches/Bungo/i386/config/confdata.c
107107
108108
109109
110
110
111
111112
112113
113114
const char *src;
*res_ptr = 0;
res_ptr[SYMBOL_MAXLENGTH] = 0;
while ((src = strchr(in, '$'))) {
while ((src = strchr(in, '$')))
{
struct symbol *sym;
const char *symval;
char *name_ptr = name;
branches/Bungo/i386/libsa/zalloc.c
7878
7979
8080
81
81
82
8283
8384
8485
......
108109
109110
110111
111
112
112
113
114
115
113116
114117
115118
......
154157
155158
156159
157
158
160
161
162
163
159164
160165
161166
162167
163
168
169
164170
165171
166172
......
186192
187193
188194
189
195
196
190197
191198
192199
......
207214
208215
209216
210
211
217
218
219
220
212221
213222
214223
......
218227
219228
220229
221
230
231
222232
223233
224234
......
227237
228238
229239
230
240
241
231242
232243
233244
234245
235246
236
237
238
247
248
249
250
251
252
239253
240254
241255
......
246260
247261
248262
249
250
263
264
265
266
251267
252268
253269
......
270286
271287
272288
273
274
289
290
291
292
275293
276294
277295
......
287305
288306
289307
290
308
309
291310
292311
293312
......
301320
302321
303322
304
323
324
305325
306326
307327
......
311331
312332
313333
314
315
334
335
336
337
316338
317339
318340
zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;
zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes;
if (size == 0) {
if (size == 0)
{
size = ZALLOC_LEN;
}
size = ((size + 0xf) & ~0xf);
if (size == 0) {
if (zerror) {
if (size == 0)
{
if (zerror)
{
(*zerror)((char *)0xdeadbeef, 0, file, line);
}
}
#endif
done:
if ((ret == 0) || (ret + size >= zalloc_end)) {
if (zerror) {
if ((ret == 0) || (ret + size >= zalloc_end))
{
if (zerror)
{
(*zerror)(ret, size, file, line);
}
}
if (ret != 0) {
if (ret != 0)
{
bzero(ret, size);
}
#if ZDEBUG
rp = 0;
#endif
if (!start) {
if (!start)
{
return;
}
break;
}
}
if (!found) {
if (zerror) {
if (!found)
{
if (zerror)
{
(*zerror)(pointer, rp, "free", 0);
} else {
return;
zalloced_size -= tsize;
#endif
for (i = 0; i < availableNodes; i++) {
for (i = 0; i < availableNodes; i++)
{
if ((start + tsize) == zavailable[i].start) // merge it in
{
zavailable[i].start = start;
return;
}
if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start)) {
if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start))
{
zavailable[i-1].size += tsize;
zcoalesce();
return;
}
if ((start + tsize) < zavailable[i].start) {
if (++availableNodes > totalNodes) {
if (zerror) {
if ((start + tsize) < zavailable[i].start)
{
if (++availableNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 0, "free", 0);
}
}
}
}
if (++availableNodes > totalNodes) {
if (zerror) {
if (++availableNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 1, "free", 0);
}
}
zalloced[allocedNodes].start = start;
zalloced[allocedNodes].size = size;
if (++allocedNodes > totalNodes) {
if (zerror) {
if (++allocedNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 2, "zallocate", 0);
}
};
z1 = zp + i;
z2 = z1 + 1;
for (; i >= ndx; i--, z1--, z2--) {
for (; i >= ndx; i--, z1--, z2--)
{
*z2 = *z1;
}
}
z1 = zp + ndx;
z2 = z1 + 1;
for (i = ndx; i < totalNodes - 1; i++, z1++, z2++) {
for (i = ndx; i < totalNodes - 1; i++, z1++, z2++)
{
*z1 = *z2;
}
}
{
int i;
for (i = 0; i < availableNodes-1; i++) {
if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start ) {
for (i = 0; i < availableNodes-1; i++)
{
if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start )
{
zavailable[i].size += zavailable[i + 1].size;
zdelete(zavailable, i + 1); availableNodes--;
return;
branches/Bungo/i386/libsa/string.c
141141
142142
143143
144
145
146
147
144
145
146
147
148148
149149
150150
151151
152
152
153153
154
154
155155
156
157
156
157
158158
159159
160160
......
181181
182182
183183
184
184
185185
186186
187187
......
193193
194194
195195
196
196
197197
198198
199
199
200200
201
201
202202
203203
204204
/* Derived from FreeBSD source */
int strncmp(const char * s1, const char * s2, size_t n)
{
if (!n)
return 0;
do {
if (*s1 != *s2++)
if (!n)
return 0;
do {
if (*s1 != *s2++)
{
return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
}
if (!*s1++)
if (!*s1++)
{
break;
break;
}
} while (--n);
return 0;
} while (--n);
return 0;
}
char *
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
--n;
--n;
if (n > 0) {
bzero(s1, n);
stpncpy(char * s1, const char * s2, size_t n)
{
while (n && (*s1++ = *s2++))
--n;
--n;
if (n > 0)
{
bzero(s1, n);
bzero(s1, n);
}
return s1;
return s1;
}
char *
branches/Bungo/i386/libsa/prf.c
118118
119119
120120
121
122
123
124
121
122
123
124
125
125126
126127
127128
flag |= SPACE;
goto again;
case '0':
if (minwidth == 0) {
/* this is a flag */
flag |= ZERO;
goto again;
if (minwidth == 0)
{
/* this is a flag */
flag |= ZERO;
goto again;
} /* fall through */
case '1':
case '2':
branches/Bungo/CREDITS
77
88
99
10
10
1111
1212
1313
Thanks to:
---------
bumby, kalyway, Krazubu, Eddie11c, JaS, fassl, XyZ, SMF, flama, Galaxy, sckevyn, MasterChief, smith@@, blackosx, DHP, nawcom, scorpius, macman, dmazar, Pike R. Alpha, Micky1979, Bungo, MinusZwei
bumby, kalyway, Krazubu, Eddie11c, JaS, fassl, XyZ, SMF, flama, Galaxy, sckevyn, MasterChief, smith@@, blackosx, DHP, nawcom, scorpius, dmazar, Pike R. Alpha, Micky1979, Bungo, MinusZwei
Package:
---------
branches/Bungo/doc/BootHelp.txt
7979
8080
8181
82
83
84
82
83
84
8585
8686
8787
KeyLayout=keymap Use to change the keyboard mapping of the bootloader
(e.g. KeyLayout=mac-fr)
HDAEnabler=Yes|No Automatic device-properties generation for audio controllers.
HDEFLayoutID=<value> Inject alternate value of layout-id for HDEF (HEX).
HDAULayoutID=<value> Inject alternate value of layout-id for HDAU (HEX).
HDAEnabler=Yes|No Automatic device-properties generation for audio controllers.
HDEFLayoutID=<value> Inject alternate value of layout-id for HDEF (HEX).
HDAULayoutID=<value> Inject alternate value of layout-id for HDAU (HEX).
GraphicsEnabler=Yes|No Automatic device-properties generation for graphics cards.
SkipIntelGfx=Yes|No Skip the Automatic device-properties generation for Intel cards.
branches/Bungo/Make.rules
8383
8484
8585
86
86
8787
8888
8989
@echo "#define I386BOOT_VERSION \"5.0.132\"" > $@
@echo "#define I386BOOT_BUILDDATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $@
@echo "#define I386BOOT_CHAMELEONVERSION \"`cat $(SRCROOT)/version`\"" >> $@
@echo "#define I386BOOT_CHAMELEONREVISION \"`svnversion -n | tr -d [:alpha:]`\"" >> $@
@echo "#define I386BOOT_CHAMELEONREVISION \"2540\"" >> $@
CONFIG_HEADERS=$(CONFIG_FILES) $(HEADER_VERSION)
branches/Bungo/CHANGES
1
21
32
43
- Zenith432 : Use caching with ExFat filesystem
- Zenith432 : Add turning off USB legacy for XHCI (XHCILegacyOff)
- ErmaC : C6 & C7 States credits to Clover Team.
- ErmaC : define recursive cpu series for BrandString

Archive Download the corresponding diff file

Revision: 2839