Index: branches/Bungo/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/Bungo/Chameleon.xcodeproj/project.pbxproj (revision 2838) +++ branches/Bungo/Chameleon.xcodeproj/project.pbxproj (revision 2839) @@ -111,6 +111,8 @@ 360A04CC1861F48F0091F464 /* vbe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = ""; }; 360A04CD1861F48F0091F464 /* xml.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; 360A04CE1861F48F0091F464 /* xml.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; + 361BC70214BD977700236488 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = ""; }; + 361BC70B14BD97C800236488 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pkg.zip; path = Icons/pkg.zip; sourceTree = ""; }; 369689D014BD0AF10013D77F /* BLOCKERS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BLOCKERS; sourceTree = ""; }; 369689D114BD0AF10013D77F /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; 369689D214BD0B470013D77F /* version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = version; sourceTree = ""; }; @@ -175,6 +177,15 @@ 36AB75DB14BD0866005B8045 /* text_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text_scroll_prev.png; sourceTree = ""; }; 36AB75DC14BD0866005B8045 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = ""; }; 36AB75DD14BD0866005B8045 /* thumb.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = thumb.png; sourceTree = ""; }; + 36AB75E114BD091C005B8045 /* InstallLog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = InstallLog.sh; sourceTree = ""; }; + 36AB75E314BD0925005B8045 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; + 36AB75E414BD092D005B8045 /* preinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preinstall; sourceTree = ""; }; + 36AB75E514BD095E005B8045 /* Control.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Control.txt; path = OptionalSettings/Control.txt; sourceTree = ""; }; + 36AB75E614BD095E005B8045 /* General.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = General.txt; path = OptionalSettings/General.txt; sourceTree = ""; }; + 36AB75E714BD095E005B8045 /* KernelFlags.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = KernelFlags.txt; path = OptionalSettings/KernelFlags.txt; sourceTree = ""; }; + 36AB75E814BD095E005B8045 /* PowerManagement.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = PowerManagement.txt; path = OptionalSettings/PowerManagement.txt; sourceTree = ""; }; + 36AB75E914BD095E005B8045 /* Resolution.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Resolution.txt; path = OptionalSettings/Resolution.txt; sourceTree = ""; }; + 36AB75EA14BD095E005B8045 /* Video.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Video.txt; path = OptionalSettings/Video.txt; sourceTree = ""; }; 36AE6E5716D644BC00D083A6 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = KernelPatcher/Cconfig; sourceTree = ""; }; 36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = KernelPatcher.dylib; path = KernelPatcher/KernelPatcher.dylib; sourceTree = ""; }; 36AE6E5916D644BC00D083A6 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = KernelPatcher/Makefile; sourceTree = ""; }; @@ -189,178 +200,6 @@ 6648DC1B1A5AA2AE00A7BB54 /* device_hfsraid_yos_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_yos_o.png; sourceTree = ""; }; 6648DC1C1A5AA2AE00A7BB54 /* device_hfsraid_yos.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_yos.png; sourceTree = ""; }; 6648DC1D1A5AA2D600A7BB54 /* lzvn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzvn.c; sourceTree = ""; }; - 667B35931A5EF2B400FD5ED9 /* clean_po_headers.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_po_headers.sh; sourceTree = ""; }; - 667B35951A5EF2B400FD5ED9 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; - 667B35991A5EF2B400FD5ED9 /* BibTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BibTeX.pm; sourceTree = ""; }; - 667B359A1A5EF2B400FD5ED9 /* Chooser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Chooser.pm; sourceTree = ""; }; - 667B359B1A5EF2B400FD5ED9 /* Common.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Common.pm; sourceTree = ""; }; - 667B359C1A5EF2B400FD5ED9 /* Debconf.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Debconf.pm; sourceTree = ""; }; - 667B359D1A5EF2B400FD5ED9 /* Dia.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Dia.pm; sourceTree = ""; }; - 667B359E1A5EF2B400FD5ED9 /* Docbook.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Docbook.pm; sourceTree = ""; }; - 667B359F1A5EF2B400FD5ED9 /* Guide.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Guide.pm; sourceTree = ""; }; - 667B35A01A5EF2B400FD5ED9 /* Halibut.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Halibut.pm; sourceTree = ""; }; - 667B35A11A5EF2B400FD5ED9 /* Html.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Html.pm; sourceTree = ""; }; - 667B35A21A5EF2B400FD5ED9 /* Ini.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Ini.pm; sourceTree = ""; }; - 667B35A31A5EF2B400FD5ED9 /* KernelHelp.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = KernelHelp.pm; sourceTree = ""; }; - 667B35A41A5EF2B400FD5ED9 /* LaTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = LaTeX.pm; sourceTree = ""; }; - 667B35A51A5EF2B400FD5ED9 /* Man.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Man.pm; sourceTree = ""; }; - 667B35A61A5EF2B400FD5ED9 /* NewsDebian.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = NewsDebian.pm; sourceTree = ""; }; - 667B35A71A5EF2B400FD5ED9 /* Po.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Po.pm; sourceTree = ""; }; - 667B35A81A5EF2B400FD5ED9 /* Pod.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Pod.pm; sourceTree = ""; }; - 667B35A91A5EF2B400FD5ED9 /* Prop.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Prop.pm; sourceTree = ""; }; - 667B35AA1A5EF2B400FD5ED9 /* Sgml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Sgml.pm; sourceTree = ""; }; - 667B35AB1A5EF2B400FD5ED9 /* TeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TeX.pm; sourceTree = ""; }; - 667B35AC1A5EF2B400FD5ED9 /* Texinfo.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Texinfo.pm; sourceTree = ""; }; - 667B35AD1A5EF2B400FD5ED9 /* Text.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Text.pm; sourceTree = ""; }; - 667B35AE1A5EF2B400FD5ED9 /* TransTractor.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TransTractor.pm; sourceTree = ""; }; - 667B35AF1A5EF2B400FD5ED9 /* Wml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Wml.pm; sourceTree = ""; }; - 667B35B01A5EF2B400FD5ED9 /* Xhtml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xhtml.pm; sourceTree = ""; }; - 667B35B11A5EF2B400FD5ED9 /* Xml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xml.pm; sourceTree = ""; }; - 667B35B21A5EF2B400FD5ED9 /* MANIFEST */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MANIFEST; sourceTree = ""; }; - 667B35B31A5EF2B400FD5ED9 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = ""; }; - 667B35B41A5EF2B400FD5ED9 /* po4a */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = po4a; sourceTree = ""; }; - 667B35B51A5EF2B400FD5ED9 /* po4a-gettextize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-gettextize"; sourceTree = ""; }; - 667B35B61A5EF2B400FD5ED9 /* po4a-normalize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-normalize"; sourceTree = ""; }; - 667B35B71A5EF2B400FD5ED9 /* po4a-translate */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-translate"; sourceTree = ""; }; - 667B35B81A5EF2B400FD5ED9 /* po4a-updatepo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-updatepo"; sourceTree = ""; }; - 667B35B91A5EF2B400FD5ED9 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - 667B35BA1A5EF2B400FD5ED9 /* README.maintainers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.maintainers; sourceTree = ""; }; - 667B35BB1A5EF2B400FD5ED9 /* README.tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.tests; sourceTree = ""; }; - 667B35BC1A5EF2B400FD5ED9 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = ""; }; - 667B35BD1A5EF2B400FD5ED9 /* builddmg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = builddmg.sh; sourceTree = ""; }; - 667B35BE1A5EF2B400FD5ED9 /* buildpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = buildpkg.sh; sourceTree = ""; }; - 667B35BF1A5EF2B400FD5ED9 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = ""; }; - 667B35C01A5EF2B400FD5ED9 /* Distribution */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Distribution; sourceTree = ""; }; - 667B35C21A5EF2B400FD5ED9 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = pkg.zip; sourceTree = ""; }; - 667B35C41A5EF2B400FD5ED9 /* Audio.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Audio.txt; sourceTree = ""; }; - 667B35C51A5EF2B400FD5ED9 /* Control.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Control.txt; sourceTree = ""; }; - 667B35C61A5EF2B400FD5ED9 /* General.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = General.txt; sourceTree = ""; }; - 667B35C71A5EF2B400FD5ED9 /* HDAULayout.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HDAULayout.txt; sourceTree = ""; }; - 667B35C81A5EF2B400FD5ED9 /* HDEFLayout.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HDEFLayout.txt; sourceTree = ""; }; - 667B35C91A5EF2B400FD5ED9 /* IntelAzul.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IntelAzul.txt; sourceTree = ""; }; - 667B35CA1A5EF2B400FD5ED9 /* IntelCapri.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IntelCapri.txt; sourceTree = ""; }; - 667B35CB1A5EF2B400FD5ED9 /* KernelFlags.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KernelFlags.txt; sourceTree = ""; }; - 667B35CC1A5EF2B400FD5ED9 /* PowerManagement.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PowerManagement.txt; sourceTree = ""; }; - 667B35CD1A5EF2B400FD5ED9 /* Resolution.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Resolution.txt; sourceTree = ""; }; - 667B35CE1A5EF2B400FD5ED9 /* Video.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Video.txt; sourceTree = ""; }; - 667B35D01A5EF2B400FD5ED9 /* ar.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ar.po; sourceTree = ""; }; - 667B35D11A5EF2B400FD5ED9 /* bg.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bg.po; sourceTree = ""; }; - 667B35D21A5EF2B400FD5ED9 /* bs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bs.po; sourceTree = ""; }; - 667B35D31A5EF2B400FD5ED9 /* ca.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.po; sourceTree = ""; }; - 667B35D41A5EF2B400FD5ED9 /* chameleon.pot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = chameleon.pot; sourceTree = ""; }; - 667B35D51A5EF2B400FD5ED9 /* cs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs.po; sourceTree = ""; }; - 667B35D61A5EF2B400FD5ED9 /* de.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = de.po; sourceTree = ""; }; - 667B35D71A5EF2B400FD5ED9 /* el.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = el.po; sourceTree = ""; }; - 667B35D81A5EF2B400FD5ED9 /* en.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = en.po; sourceTree = ""; }; - 667B35D91A5EF2B400FD5ED9 /* es.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = es.po; sourceTree = ""; }; - 667B35DA1A5EF2B400FD5ED9 /* fa.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fa.po; sourceTree = ""; }; - 667B35DB1A5EF2B400FD5ED9 /* fr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fr.po; sourceTree = ""; }; - 667B35DC1A5EF2B400FD5ED9 /* he.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = he.po; sourceTree = ""; }; - 667B35DD1A5EF2B400FD5ED9 /* hr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hr.po; sourceTree = ""; }; - 667B35DE1A5EF2B400FD5ED9 /* hu.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hu.po; sourceTree = ""; }; - 667B35DF1A5EF2B400FD5ED9 /* id.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = id.po; sourceTree = ""; }; - 667B35E01A5EF2B400FD5ED9 /* it.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = it.po; sourceTree = ""; }; - 667B35E11A5EF2B400FD5ED9 /* ja.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ja.po; sourceTree = ""; }; - 667B35E21A5EF2B400FD5ED9 /* ko.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ko.po; sourceTree = ""; }; - 667B35E31A5EF2B400FD5ED9 /* mk.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mk.po; sourceTree = ""; }; - 667B35E41A5EF2B400FD5ED9 /* nl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl.po; sourceTree = ""; }; - 667B35E51A5EF2B400FD5ED9 /* pl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pl.po; sourceTree = ""; }; - 667B35E61A5EF2B400FD5ED9 /* pt-BR.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-BR.po"; sourceTree = ""; }; - 667B35E71A5EF2B400FD5ED9 /* pt-PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-PT.po"; sourceTree = ""; }; - 667B35E81A5EF2B400FD5ED9 /* pt.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pt.po; sourceTree = ""; }; - 667B35E91A5EF2B400FD5ED9 /* ro.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ro.po; sourceTree = ""; }; - 667B35EA1A5EF2B400FD5ED9 /* ru.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ru.po; sourceTree = ""; }; - 667B35EB1A5EF2B400FD5ED9 /* sr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sr.po; sourceTree = ""; }; - 667B35EC1A5EF2B400FD5ED9 /* zh_CN.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_CN.po; sourceTree = ""; }; - 667B35ED1A5EF2B400FD5ED9 /* zh_TW.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_TW.po; sourceTree = ""; }; - 667B35EE1A5EF2B400FD5ED9 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = ""; }; - 667B35F11A5EF2B400FD5ED9 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35F31A5EF2B400FD5ED9 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B35F41A5EF2B400FD5ED9 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35F51A5EF2B400FD5ED9 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B35F61A5EF2B400FD5ED9 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35F71A5EF2B400FD5ED9 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B35F81A5EF2B400FD5ED9 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35F91A5EF2B400FD5ED9 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B35FB1A5EF2B400FD5ED9 /* License.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = ""; }; - 667B35FC1A5EF2B400FD5ED9 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = cs.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35FD1A5EF2B400FD5ED9 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = cs.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B35FE1A5EF2B400FD5ED9 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B35FF1A5EF2B400FD5ED9 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36011A5EF2B400FD5ED9 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = ""; }; - 667B36021A5EF2B400FD5ED9 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36031A5EF2B400FD5ED9 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36041A5EF2B400FD5ED9 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36051A5EF2B400FD5ED9 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36061A5EF2B400FD5ED9 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36071A5EF2B400FD5ED9 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36081A5EF2B400FD5ED9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = fa.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36091A5EF2B400FD5ED9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = fa.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B360A1A5EF2B400FD5ED9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B360B1A5EF2B400FD5ED9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B360C1A5EF2B400FD5ED9 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B360D1A5EF2B400FD5ED9 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B360E1A5EF2B400FD5ED9 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B360F1A5EF2B400FD5ED9 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36101A5EF2B400FD5ED9 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = hu.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36111A5EF2B400FD5ED9 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = hu.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36121A5EF2B400FD5ED9 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36131A5EF2B400FD5ED9 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36141A5EF2B400FD5ED9 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36151A5EF2B400FD5ED9 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36161A5EF2B400FD5ED9 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36171A5EF2B400FD5ED9 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36181A5EF2B400FD5ED9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36191A5EF2B400FD5ED9 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B361A1A5EF2B400FD5ED9 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B361B1A5EF2B400FD5ED9 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B361C1A5EF2B400FD5ED9 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B361D1A5EF2B400FD5ED9 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B361E1A5EF2B400FD5ED9 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B361F1A5EF2B400FD5ED9 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36201A5EF2B400FD5ED9 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Conclusion.rtfd"; sourceTree = ""; }; - 667B36211A5EF2B400FD5ED9 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Welcome.rtfd"; sourceTree = ""; }; - 667B36221A5EF2B400FD5ED9 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Conclusion.rtfd"; sourceTree = ""; }; - 667B36231A5EF2B400FD5ED9 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Welcome.rtfd"; sourceTree = ""; }; - 667B36241A5EF2B400FD5ED9 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36251A5EF2B400FD5ED9 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36261A5EF2B400FD5ED9 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36271A5EF2B400FD5ED9 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36281A5EF2B400FD5ED9 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36291A5EF2B400FD5ED9 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B362B1A5EF2B400FD5ED9 /* Conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = ""; }; - 667B362C1A5EF2B400FD5ED9 /* Description.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Description.html; sourceTree = ""; }; - 667B362D1A5EF2B400FD5ED9 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; - 667B362E1A5EF2B400FD5ED9 /* Welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Welcome.html; sourceTree = ""; }; - 667B362F1A5EF2B400FD5ED9 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36301A5EF2B400FD5ED9 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36311A5EF2B400FD5ED9 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Conclusion.rtfd; sourceTree = ""; }; - 667B36321A5EF2B400FD5ED9 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Welcome.rtfd; sourceTree = ""; }; - 667B36361A5EF2B500FD5ED9 /* ESPpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ESPpostinstall; sourceTree = ""; }; - 667B36371A5EF2B500FD5ED9 /* Standardpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Standardpostinstall; sourceTree = ""; }; - 667B36391A5EF2B500FD5ED9 /* CheckDiskMicrocode.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckDiskMicrocode.sh; sourceTree = ""; }; - 667B363A1A5EF2B500FD5ED9 /* CheckFatType.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckFatType.sh; sourceTree = ""; }; - 667B363B1A5EF2B500FD5ED9 /* CheckGRUBLinuxLoader.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckGRUBLinuxLoader.sh; sourceTree = ""; }; - 667B363C1A5EF2B500FD5ED9 /* CheckPartitionScheme.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPartitionScheme.sh; sourceTree = ""; }; - 667B363D1A5EF2B500FD5ED9 /* CheckPreviousChameleon.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPreviousChameleon.sh; sourceTree = ""; }; - 667B363E1A5EF2B500FD5ED9 /* CheckProceed.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckProceed.sh; sourceTree = ""; }; - 667B363F1A5EF2B500FD5ED9 /* CheckWindowsDiskSignature.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckWindowsDiskSignature.sh; sourceTree = ""; }; - 667B36401A5EF2B500FD5ED9 /* MountESP.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = MountESP.sh; sourceTree = ""; }; - 667B36411A5EF2B500FD5ED9 /* patch */ = {isa = PBXFileReference; lastKnownFileType = file; path = patch; sourceTree = ""; }; - 667B36421A5EF2B500FD5ED9 /* SetActivePartition.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = SetActivePartition.sh; sourceTree = ""; }; - 667B36431A5EF2B500FD5ED9 /* UnMountEFIvolumes.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = UnMountEFIvolumes.sh; sourceTree = ""; }; - 667B36441A5EF2B500FD5ED9 /* WriteChameleonStage0.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage0.sh; sourceTree = ""; }; - 667B36451A5EF2B500FD5ED9 /* WriteChameleonStage1.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage1.sh; sourceTree = ""; }; - 667B36461A5EF2B500FD5ED9 /* WriteChameleonStage2.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage2.sh; sourceTree = ""; }; - 667B36491A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; - 667B364B1A5EF2B500FD5ED9 /* InstallLog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = InstallLog.sh; sourceTree = ""; }; - 667B364D1A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; - 667B364F1A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; - 667B36511A5EF2B500FD5ED9 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; - 667B36531A5EF2B500FD5ED9 /* clean_bootplist.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = clean_bootplist.pl; sourceTree = ""; }; - 667B36541A5EF2B500FD5ED9 /* preinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preinstall; sourceTree = ""; }; - 667B36551A5EF2B500FD5ED9 /* slimpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = slimpkg.sh; sourceTree = ""; }; - 667B36561A5EF2B500FD5ED9 /* smbios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = smbios.plist; sourceTree = ""; }; 668C4D6A1A19F9AF0098C523 /* device_hfsfusion_mav_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsfusion_mav_o.png; sourceTree = ""; }; 668C4D6B1A19F9AF0098C523 /* device_hfsfusion_mav.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsfusion_mav.png; sourceTree = ""; }; 668C4D6C1A19F9AF0098C523 /* device_hfsplus_mav_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_mav_o.png; sourceTree = ""; }; @@ -1006,6 +845,22 @@ 6DBAFFC413B0D4590047ED33 /* unistd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = ""; }; 6DBAFFC513B0D4590047ED33 /* unwind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unwind.h; sourceTree = ""; }; A31301A71503CB9900E8C718 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = ""; }; + A354B6271495124F00D81AA5 /* ESPpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ESPpostinstall; sourceTree = ""; }; + A354B62A1495124F00D81AA5 /* Standardpostinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Standardpostinstall; sourceTree = ""; }; + A354B62C149514DE00D81AA5 /* CheckDiskMicrocode.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckDiskMicrocode.sh; sourceTree = ""; }; + A354B62D149514DE00D81AA5 /* CheckFatType.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckFatType.sh; sourceTree = ""; }; + A354B62E149514DE00D81AA5 /* CheckGRUBLinuxLoader.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckGRUBLinuxLoader.sh; sourceTree = ""; }; + A354B62F149514DE00D81AA5 /* CheckPartitionScheme.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPartitionScheme.sh; sourceTree = ""; }; + A354B630149514DE00D81AA5 /* CheckPreviousChameleon.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckPreviousChameleon.sh; sourceTree = ""; }; + A354B631149514DE00D81AA5 /* CheckProceed.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckProceed.sh; sourceTree = ""; }; + A354B632149514DE00D81AA5 /* CheckWindowsDiskSignature.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = CheckWindowsDiskSignature.sh; sourceTree = ""; }; + A354B634149514DE00D81AA5 /* MountESP.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = MountESP.sh; sourceTree = ""; }; + A354B635149514DE00D81AA5 /* patch */ = {isa = PBXFileReference; lastKnownFileType = text; path = patch; sourceTree = ""; }; + A354B636149514DE00D81AA5 /* SetActivePartition.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = SetActivePartition.sh; sourceTree = ""; }; + A354B637149514DE00D81AA5 /* UnMountEFIvolumes.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = UnMountEFIvolumes.sh; sourceTree = ""; }; + A354B638149514DE00D81AA5 /* WriteChameleonStage0.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage0.sh; sourceTree = ""; }; + A354B639149514DE00D81AA5 /* WriteChameleonStage1.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage1.sh; sourceTree = ""; }; + A354B63A149514DE00D81AA5 /* WriteChameleonStage2.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = WriteChameleonStage2.sh; sourceTree = ""; }; A3561C731413FD7800E9B51E /* auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = auto.c; sourceTree = ""; }; A3561C741413FD7800E9B51E /* auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = auto.h; sourceTree = ""; }; A3561C751413FD7800E9B51E /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; @@ -1246,7 +1101,15 @@ A35D2176141A73B000969AC0 /* pc-fr.slt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pc-fr.slt"; sourceTree = ""; }; A35D2177141A73B000969AC0 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; A35D2178141A753E00969AC0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + A35D2187141A75DC00969AC0 /* slimpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = slimpkg.sh; sourceTree = ""; }; + A35D2188141A75DC00969AC0 /* buildpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = buildpkg.sh; sourceTree = ""; }; A360AA7D14136C1A00084D3F /* Make.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Make.rules; sourceTree = ""; }; + A396E2CC150247630025A245 /* License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = ""; }; + A396E2CE150247630025A245 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = ""; }; + A396E2D1150247630025A245 /* Description.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Description.html; sourceTree = ""; }; + A396E2D2150247630025A245 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; + A396E35915028C9C0025A245 /* Welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Welcome.html; sourceTree = ""; }; + A396E5821502D3320025A245 /* Conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = ""; }; A3F1F267141B9B3B00DDA709 /* Readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Readme.txt; sourceTree = ""; }; AB1DE71815B6E2D00088E06B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; AB1DE71A15B6E2D00088E06B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; @@ -1334,6 +1197,8 @@ B0056D8011F3868000754B65 /* coding_standards.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = coding_standards.txt; sourceTree = ""; }; B0056D8111F3868000754B65 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGES; sourceTree = ""; }; B0056D8211F3868000754B65 /* APPLE_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = ""; }; + B0056D8511F3868000754B65 /* Distribution */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Distribution; sourceTree = ""; }; + B0056DB911F3868000754B65 /* smbios.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = smbios.plist; sourceTree = ""; }; B0056DBD11F3868000754B65 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B0056DBE11F3868000754B65 /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = boot.png; sourceTree = ""; }; B0056DBF11F3868000754B65 /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_cdrom.png; sourceTree = ""; }; @@ -1392,6 +1257,73 @@ B0056E1A11F3868000754B65 /* Users_Guide0.5.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.5.pdf; sourceTree = ""; }; B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = ""; }; + B4118C63153EFEC200C8D926 /* clean_po_headers.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_po_headers.sh; sourceTree = ""; }; + B4118C65153EFEC200C8D926 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; + B4118C69153EFEC200C8D926 /* BibTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BibTeX.pm; sourceTree = ""; }; + B4118C6A153EFEC200C8D926 /* Chooser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Chooser.pm; sourceTree = ""; }; + B4118C6B153EFEC200C8D926 /* Common.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Common.pm; sourceTree = ""; }; + B4118C6C153EFEC200C8D926 /* Debconf.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Debconf.pm; sourceTree = ""; }; + B4118C6D153EFEC200C8D926 /* Dia.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Dia.pm; sourceTree = ""; }; + B4118C6E153EFEC200C8D926 /* Docbook.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Docbook.pm; sourceTree = ""; }; + B4118C6F153EFEC200C8D926 /* Guide.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Guide.pm; sourceTree = ""; }; + B4118C70153EFEC200C8D926 /* Halibut.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Halibut.pm; sourceTree = ""; }; + B4118C71153EFEC200C8D926 /* Html.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Html.pm; sourceTree = ""; }; + B4118C72153EFEC200C8D926 /* Ini.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Ini.pm; sourceTree = ""; }; + B4118C73153EFEC200C8D926 /* KernelHelp.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = KernelHelp.pm; sourceTree = ""; }; + B4118C74153EFEC200C8D926 /* LaTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = LaTeX.pm; sourceTree = ""; }; + B4118C75153EFEC200C8D926 /* Man.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Man.pm; sourceTree = ""; }; + B4118C76153EFEC200C8D926 /* NewsDebian.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = NewsDebian.pm; sourceTree = ""; }; + B4118C77153EFEC200C8D926 /* Po.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Po.pm; sourceTree = ""; }; + B4118C78153EFEC200C8D926 /* Pod.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Pod.pm; sourceTree = ""; }; + B4118C79153EFEC200C8D926 /* Prop.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Prop.pm; sourceTree = ""; }; + B4118C7A153EFEC200C8D926 /* Sgml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Sgml.pm; sourceTree = ""; }; + B4118C7B153EFEC200C8D926 /* TeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TeX.pm; sourceTree = ""; }; + B4118C7C153EFEC200C8D926 /* Texinfo.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Texinfo.pm; sourceTree = ""; }; + B4118C7D153EFEC200C8D926 /* Text.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Text.pm; sourceTree = ""; }; + B4118C7E153EFEC200C8D926 /* TransTractor.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TransTractor.pm; sourceTree = ""; }; + B4118C7F153EFEC200C8D926 /* Wml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Wml.pm; sourceTree = ""; }; + B4118C80153EFEC200C8D926 /* Xhtml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xhtml.pm; sourceTree = ""; }; + B4118C81153EFEC200C8D926 /* Xml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xml.pm; sourceTree = ""; }; + B4118C82153EFEC200C8D926 /* MANIFEST */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MANIFEST; sourceTree = ""; }; + B4118C83153EFEC200C8D926 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = ""; }; + B4118C84153EFEC200C8D926 /* po4a */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = po4a; sourceTree = ""; }; + B4118C85153EFEC200C8D926 /* po4a-gettextize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-gettextize"; sourceTree = ""; }; + B4118C86153EFEC200C8D926 /* po4a-normalize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-normalize"; sourceTree = ""; }; + B4118C87153EFEC200C8D926 /* po4a-translate */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-translate"; sourceTree = ""; }; + B4118C88153EFEC200C8D926 /* po4a-updatepo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-updatepo"; sourceTree = ""; }; + B4118C89153EFEC200C8D926 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + B4118C8A153EFEC200C8D926 /* README.maintainers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.maintainers; sourceTree = ""; }; + B4118C8B153EFEC200C8D926 /* README.tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.tests; sourceTree = ""; }; + B4118C8C153EFEC200C8D926 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = ""; }; + B4118C8F153EFF3300C8D926 /* ar.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ar.po; sourceTree = ""; }; + B4118C90153EFF3300C8D926 /* bg.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bg.po; sourceTree = ""; }; + B4118C91153EFF3300C8D926 /* bs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bs.po; sourceTree = ""; }; + B4118C92153EFF3300C8D926 /* ca.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.po; sourceTree = ""; }; + B4118C93153EFF3300C8D926 /* chameleon.pot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = chameleon.pot; sourceTree = ""; }; + B4118C94153EFF3300C8D926 /* cs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs.po; sourceTree = ""; }; + B4118C95153EFF3300C8D926 /* de.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = de.po; sourceTree = ""; }; + B4118C96153EFF3300C8D926 /* el.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = el.po; sourceTree = ""; }; + B4118C97153EFF3300C8D926 /* en.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = en.po; sourceTree = ""; }; + B4118C98153EFF3300C8D926 /* es.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = es.po; sourceTree = ""; }; + B4118C99153EFF3300C8D926 /* fa.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fa.po; sourceTree = ""; }; + B4118C9A153EFF3300C8D926 /* fr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fr.po; sourceTree = ""; }; + B4118C9B153EFF3300C8D926 /* he.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = he.po; sourceTree = ""; }; + B4118C9C153EFF3300C8D926 /* hr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hr.po; sourceTree = ""; }; + B4118C9D153EFF3300C8D926 /* hu.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hu.po; sourceTree = ""; }; + B4118C9E153EFF3300C8D926 /* id.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = id.po; sourceTree = ""; }; + B4118C9F153EFF3300C8D926 /* it.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = it.po; sourceTree = ""; }; + B4118CA0153EFF3300C8D926 /* ko.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ko.po; sourceTree = ""; }; + B4118CA1153EFF3300C8D926 /* mk.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mk.po; sourceTree = ""; }; + B4118CA2153EFF3300C8D926 /* nl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl.po; sourceTree = ""; }; + B4118CA3153EFF3300C8D926 /* pl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pl.po; sourceTree = ""; }; + B4118CA4153EFF3300C8D926 /* pt-BR.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-BR.po"; sourceTree = ""; }; + B4118CA5153EFF3300C8D926 /* pt-PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-PT.po"; sourceTree = ""; }; + B4118CA6153EFF3300C8D926 /* ro.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ro.po; sourceTree = ""; }; + B4118CA7153EFF3300C8D926 /* ru.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ru.po; sourceTree = ""; }; + B4118CA8153EFF3300C8D926 /* sr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sr.po; sourceTree = ""; }; + B4118CA9153EFF3300C8D926 /* zh_CN.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_CN.po; sourceTree = ""; }; + B4118CAA153EFF3300C8D926 /* zh_TW.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_TW.po; sourceTree = ""; }; + B4118CAB153EFF3D00C8D926 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = ""; }; B41899FB14BFBE2400ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FD14BFBE4500ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FE14BFBE5200ED5B0B /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = ""; }; @@ -1430,6 +1362,10 @@ B4189A2114BFBF1C00ED5B0B /* zconf.tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zconf.tab.c; path = config/zconf.tab.c; sourceTree = ""; }; B4189A2214BFBF5600ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B4189A2414BFBFD100ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; + B4AABE5914C3B8B90055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; + B4AABE5B14C3B8C70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; + B4AABE5D14C3B8D70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; + B4AABE5E14C3B8EF0055ECD1 /* clean_bootplist.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = clean_bootplist.pl; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -1450,7 +1386,7 @@ A360AA7D14136C1A00084D3F /* Make.rules */, B0056D7D11F3868000754B65 /* Makefile */, 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */, - 667B35911A5EF2B400FD5ED9 /* package */, + B0056D8311F3868000754B65 /* package */, B0146EFF11FDEF550010765C /* README */, A31301A71503CB9900E8C718 /* README.translators */, B0056D7C11F3868000754B65 /* TODO */, @@ -1459,344 +1395,97 @@ name = Chameleon; sourceTree = ""; }; - 36AE6E5616D6449A00D083A6 /* KernelPatcher */ = { + 361BC70414BD979700236488 /* Icons */ = { isa = PBXGroup; children = ( - 36AE6E5716D644BC00D083A6 /* Cconfig */, - 36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */, - 36AE6E5916D644BC00D083A6 /* Makefile */, + 361BC70B14BD97C800236488 /* pkg.zip */, ); - name = KernelPatcher; + name = Icons; sourceTree = ""; }; - 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 = ""; }; - 36AE6E5B16D644DB00D083A6 /* include */ = { + 364E0DE114BCFB7A00F55E58 /* InstallerLog */ = { isa = PBXGroup; children = ( - 36AE6E5C16D644E800D083A6 /* FileNVRAM.h */, + 36AB75E114BD091C005B8045 /* InstallLog.sh */, ); - name = include; + name = InstallerLog; + path = Scripts.templates/InstallerLog; sourceTree = ""; }; - 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 = ""; }; - 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 = ""; }; - 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 = ""; }; - 667B35961A5EF2B400FD5ED9 /* lib */ = { + 36AE6E5A16D644CB00D083A6 /* FileNVRAM */ = { isa = PBXGroup; children = ( - 667B35971A5EF2B400FD5ED9 /* Locale */, + 36AE6E5D16D644F300D083A6 /* Cconfig */, + 36AE6E5E16D644F300D083A6 /* FileNVRAM.dylib */, + 36AE6E5B16D644DB00D083A6 /* include */, + 36AE6E5F16D644F300D083A6 /* Makefile */, ); - path = lib; + name = FileNVRAM; sourceTree = ""; }; - 667B35971A5EF2B400FD5ED9 /* Locale */ = { + 36AE6E5B16D644DB00D083A6 /* include */ = { isa = PBXGroup; children = ( - 667B35981A5EF2B400FD5ED9 /* Po4a */, + 36AE6E5C16D644E800D083A6 /* FileNVRAM.h */, ); - path = Locale; + name = include; sourceTree = ""; }; - 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 = ""; }; - 667B35C11A5EF2B400FD5ED9 /* Icons */ = { - isa = PBXGroup; - children = ( - 667B35C21A5EF2B400FD5ED9 /* pkg.zip */, - ); - path = Icons; - sourceTree = ""; - }; - 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 = ""; - }; - 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 = ""; - }; - 667B35EF1A5EF2B400FD5ED9 /* Resources */ = { - isa = PBXGroup; - children = ( - 667B35F01A5EF2B400FD5ED9 /* Conclusion.rtfd */, - 667B35F21A5EF2B400FD5ED9 /* Welcome.rtfd */, - 667B35FA1A5EF2B400FD5ED9 /* common */, - 667B36001A5EF2B400FD5ED9 /* distribution */, - 667B362A1A5EF2B400FD5ED9 /* templates */, - ); - path = Resources; - sourceTree = ""; - }; - 667B35FA1A5EF2B400FD5ED9 /* common */ = { - isa = PBXGroup; - children = ( - 667B35FB1A5EF2B400FD5ED9 /* License.rtf */, - ); - path = common; - sourceTree = ""; - }; - 667B36001A5EF2B400FD5ED9 /* distribution */ = { - isa = PBXGroup; - children = ( - 667B36011A5EF2B400FD5ED9 /* background.tiff */, - ); - path = distribution; - sourceTree = ""; - }; - 667B362A1A5EF2B400FD5ED9 /* templates */ = { - isa = PBXGroup; - children = ( - 667B362B1A5EF2B400FD5ED9 /* Conclusion.html */, - 667B362C1A5EF2B400FD5ED9 /* Description.html */, - 667B362D1A5EF2B400FD5ED9 /* Localizable.strings */, - 667B362E1A5EF2B400FD5ED9 /* Welcome.html */, - ); - path = templates; - sourceTree = ""; - }; - 667B36331A5EF2B400FD5ED9 /* Resources.old */ = { - isa = PBXGroup; - children = ( - ); - path = Resources.old; - sourceTree = ""; - }; - 667B36341A5EF2B400FD5ED9 /* Scripts */ = { - isa = PBXGroup; - children = ( - 667B36351A5EF2B500FD5ED9 /* Main */, - 667B36381A5EF2B500FD5ED9 /* Sub */, - ); - path = Scripts; - sourceTree = ""; - }; - 667B36351A5EF2B500FD5ED9 /* Main */ = { - isa = PBXGroup; - children = ( - 667B36361A5EF2B500FD5ED9 /* ESPpostinstall */, - 667B36371A5EF2B500FD5ED9 /* Standardpostinstall */, - ); - path = Main; - sourceTree = ""; - }; - 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 = ""; - }; - 667B36471A5EF2B500FD5ED9 /* Scripts.templates */ = { - isa = PBXGroup; - children = ( - 667B36481A5EF2B500FD5ED9 /* AddOption */, - 667B364A1A5EF2B500FD5ED9 /* InstallerLog */, - 667B364C1A5EF2B500FD5ED9 /* InstallModule */, - 667B364E1A5EF2B500FD5ED9 /* InstallTheme */, - 667B36501A5EF2B500FD5ED9 /* Post */, - 667B36521A5EF2B500FD5ED9 /* Pre */, - ); - path = Scripts.templates; - sourceTree = ""; - }; - 667B36481A5EF2B500FD5ED9 /* AddOption */ = { - isa = PBXGroup; - children = ( - 667B36491A5EF2B500FD5ED9 /* postinstall */, - ); - path = AddOption; - sourceTree = ""; - }; - 667B364A1A5EF2B500FD5ED9 /* InstallerLog */ = { - isa = PBXGroup; - children = ( - 667B364B1A5EF2B500FD5ED9 /* InstallLog.sh */, - ); - path = InstallerLog; - sourceTree = ""; - }; - 667B364C1A5EF2B500FD5ED9 /* InstallModule */ = { - isa = PBXGroup; - children = ( - 667B364D1A5EF2B500FD5ED9 /* postinstall */, - ); - path = InstallModule; - sourceTree = ""; - }; - 667B364E1A5EF2B500FD5ED9 /* InstallTheme */ = { - isa = PBXGroup; - children = ( - 667B364F1A5EF2B500FD5ED9 /* postinstall */, - ); - path = InstallTheme; - sourceTree = ""; - }; - 667B36501A5EF2B500FD5ED9 /* Post */ = { - isa = PBXGroup; - children = ( - 667B36511A5EF2B500FD5ED9 /* postinstall */, - ); - path = Post; - sourceTree = ""; - }; - 667B36521A5EF2B500FD5ED9 /* Pre */ = { - isa = PBXGroup; - children = ( - 667B36531A5EF2B500FD5ED9 /* clean_bootplist.pl */, - 667B36541A5EF2B500FD5ED9 /* preinstall */, - ); - path = Pre; - sourceTree = ""; - }; 6DBAFD1713B0D4590047ED33 /* include */ = { isa = PBXGroup; children = ( @@ -2896,6 +2585,36 @@ path = ufs; sourceTree = ""; }; + A354B6261495124F00D81AA5 /* Main */ = { + isa = PBXGroup; + children = ( + A354B6271495124F00D81AA5 /* ESPpostinstall */, + A354B62A1495124F00D81AA5 /* Standardpostinstall */, + ); + path = Main; + sourceTree = ""; + }; + 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 = ""; + }; A3561C721413FD7800E9B51E /* fdisk */ = { isa = PBXGroup; children = ( @@ -3240,6 +2959,52 @@ path = "layouts-src"; sourceTree = ""; }; + A396E2CA150247630025A245 /* Resources */ = { + isa = PBXGroup; + children = ( + A396E2CB150247630025A245 /* common */, + A396E2CD150247630025A245 /* distribution */, + A396E2CF150247630025A245 /* templates */, + ); + path = Resources; + sourceTree = ""; + }; + A396E2CB150247630025A245 /* common */ = { + isa = PBXGroup; + children = ( + A396E2CC150247630025A245 /* License.rtf */, + ); + path = common; + sourceTree = ""; + }; + A396E2CD150247630025A245 /* distribution */ = { + isa = PBXGroup; + children = ( + A396E2CE150247630025A245 /* background.tiff */, + ); + path = distribution; + sourceTree = ""; + }; + A396E2CF150247630025A245 /* templates */ = { + isa = PBXGroup; + children = ( + A396E35915028C9C0025A245 /* Welcome.html */, + A396E2D1150247630025A245 /* Description.html */, + A396E5821502D3320025A245 /* Conclusion.html */, + A396E2D2150247630025A245 /* Localizable.strings */, + ); + path = templates; + sourceTree = ""; + }; + A3F1F20D141B9B0D00DDA709 /* Scripts */ = { + isa = PBXGroup; + children = ( + A354B6261495124F00D81AA5 /* Main */, + A354B62B149514DE00D81AA5 /* Sub */, + ); + path = Scripts; + sourceTree = ""; + }; AB1DE71715B6E2D00088E06B /* Sata */ = { isa = PBXGroup; children = ( @@ -3553,6 +3318,26 @@ path = util; sourceTree = ""; }; + 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 = ""; + }; B0056DBA11F3868000754B65 /* artwork */ = { isa = PBXGroup; children = ( @@ -3765,6 +3550,118 @@ path = User_Guide_src; sourceTree = ""; }; + B4118C62153EFEC200C8D926 /* bin */ = { + isa = PBXGroup; + children = ( + B4118C63153EFEC200C8D926 /* clean_po_headers.sh */, + B4118C64153EFEC200C8D926 /* po4a */, + ); + path = bin; + sourceTree = ""; + }; + 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 = ""; + }; + B4118C66153EFEC200C8D926 /* lib */ = { + isa = PBXGroup; + children = ( + B4118C67153EFEC200C8D926 /* Locale */, + ); + path = lib; + sourceTree = ""; + }; + B4118C67153EFEC200C8D926 /* Locale */ = { + isa = PBXGroup; + children = ( + B4118C68153EFEC200C8D926 /* Po4a */, + ); + path = Locale; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; B4189A0314BFBED900ED5B0B /* config */ = { isa = PBXGroup; children = ( @@ -3809,6 +3706,33 @@ name = lxdialog; sourceTree = ""; }; + B4AABE5814C3B8B90055ECD1 /* AddOption */ = { + isa = PBXGroup; + children = ( + B4AABE5914C3B8B90055ECD1 /* postinstall */, + ); + name = AddOption; + path = Scripts.templates/AddOption; + sourceTree = ""; + }; + B4AABE5A14C3B8C70055ECD1 /* InstallModule */ = { + isa = PBXGroup; + children = ( + B4AABE5B14C3B8C70055ECD1 /* postinstall */, + ); + name = InstallModule; + path = Scripts.templates/InstallModule; + sourceTree = ""; + }; + B4AABE5C14C3B8D70055ECD1 /* InstallTheme */ = { + isa = PBXGroup; + children = ( + B4AABE5D14C3B8D70055ECD1 /* postinstall */, + ); + name = InstallTheme; + path = Scripts.templates/InstallTheme; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXLegacyTarget section */ @@ -3876,7 +3800,6 @@ vi, zh_CN, zh_TW, - fa, ); mainGroup = 08FB7794FE84155DC02AAC07 /* Chameleon */; projectDirPath = ""; @@ -3887,84 +3810,11 @@ }; /* 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 = ""; - }; - 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 = ""; - }; -/* 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; @@ -3979,7 +3829,7 @@ 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 = ""; @@ -3991,10 +3841,10 @@ 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; }; @@ -4003,10 +3853,10 @@ 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; }; Index: branches/Bungo/i386/libsaio/console.c =================================================================== --- branches/Bungo/i386/libsaio/console.c (revision 2838) +++ branches/Bungo/i386/libsaio/console.c (revision 2839) @@ -69,13 +69,13 @@ // 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; @@ -100,27 +100,27 @@ 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) @@ -129,8 +129,8 @@ 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, ...) @@ -138,11 +138,13 @@ 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; } @@ -152,13 +154,14 @@ prf(fmt, ap, sputc, &pi); va_end(ap); cursor += strlen((char *)cursor); - - return 0; + + return 0; } void setupBooterLog(void) { - if (!msgbuf) { + if (!msgbuf) + { return; } @@ -215,7 +218,7 @@ int printf(const char * fmt, ...) { va_list ap; - + va_start(ap, fmt); if (bootArgs->Video.v_display == VGA_TEXT_MODE) { @@ -299,23 +302,23 @@ 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); @@ -344,17 +347,20 @@ /** 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"); } Index: branches/Bungo/i386/libsaio/exfat.c =================================================================== --- branches/Bungo/i386/libsaio/exfat.c (revision 2838) +++ branches/Bungo/i386/libsaio/exfat.c (revision 2839) @@ -48,10 +48,8 @@ #if DEBUG_EXFAT #define DBG(x...) printf(x) -#define PAUSE() getchar() #else -#define DBG(x...) -#define PAUSE() +#define DBG(x...) msglog(x) #endif #define EXFAT_BBID &gExfatID[0] @@ -240,7 +238,7 @@ } if (invalidate) { - gCachedFATBlockAddress = INVALID_FAT_ADDRESS; + gCachedFATBlockAddress = INVALID_FAT_ADDRESS; } return 0; } @@ -870,7 +868,7 @@ int loopControl = 0; DBG("EXFAT: start %x:%x\n", ih->biosdev, ih->part_no); - + buf = (char *)malloc(MAX_BLOCK_SIZE); if (buf == 0) { @@ -888,7 +886,7 @@ // 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: @@ -927,7 +925,7 @@ 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); @@ -957,7 +955,9 @@ DBG("EXFAT: label=%s\n", str); free(buf); - PAUSE(); +#if DEBUG_EXFAT + pause("\n[DEBUG_EXFAT] "); +#endif return; error: @@ -967,8 +967,10 @@ } DBG("EXFAT: error\n"); - PAUSE(); - return; +#if DEBUG_EXFAT + pause("\n[DEBUG_EXFAT] "); +#endif + return; } /** @@ -979,61 +981,61 @@ 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; } Index: branches/Bungo/i386/libsaio/bootstruct.c =================================================================== --- branches/Bungo/i386/libsaio/bootstruct.c (revision 2838) +++ branches/Bungo/i386/libsaio/bootstruct.c (revision 2839) @@ -45,10 +45,10 @@ * 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]; @@ -83,22 +83,22 @@ // 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); @@ -144,7 +144,7 @@ EfiMemoryRange *memoryMap; MemoryRange *range; int memoryMapCount = bootInfo->memoryMapCount; - + if (memoryMapCount == 0) { // XXX could make a two-part map here @@ -154,11 +154,11 @@ // 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]; @@ -184,10 +184,10 @@ 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 @@ -224,7 +224,7 @@ bootArgsPreLion->kaddr = bootArgs->kaddr; bootArgsPreLion->ksize = bootArgs->ksize; - + bootArgsPreLion->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart; bootArgsPreLion->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount; bootArgsPreLion->efiSystemTable = bootArgs->efiSystemTable; Index: branches/Bungo/i386/libsaio/ntfs_private.h =================================================================== --- branches/Bungo/i386/libsaio/ntfs_private.h (revision 2838) +++ branches/Bungo/i386/libsaio/ntfs_private.h (revision 2839) @@ -74,11 +74,10 @@ typedef u_int16_t wchar; #pragma pack(1) - -#define BBSIZE 1024 -#define BBOFF ((off_t)(0)) -#define BBLOCK ((daddr_t)(0)) -#define NTFS_MFTINO 0 +#define BBSIZE 1024 +#define BBOFF ((off_t)(0)) +#define BBLOCK ((daddr_t)(0)) +#define NTFS_MFTINO 0 #define NTFS_VOLUMEINO 3 #define NTFS_ATTRDEFINO 4 #define NTFS_ROOTINO 5 @@ -108,14 +107,14 @@ u_int16_t a_index; }; -#define NTFS_A_STD 0x10 -#define NTFS_A_ATTRLIST 0x20 -#define NTFS_A_NAME 0x30 +#define NTFS_A_STD 0x10 +#define NTFS_A_ATTRLIST 0x20 +#define NTFS_A_NAME 0x30 #define NTFS_A_VOLUMENAME 0x60 -#define NTFS_A_DATA 0x80 -#define NTFS_A_INDXROOT 0x90 -#define NTFS_A_INDX 0xA0 -#define NTFS_A_INDXBITMAP 0xB0 +#define NTFS_A_DATA 0x80 +#define NTFS_A_INDXROOT 0x90 +#define NTFS_A_INDX 0xA0 +#define NTFS_A_INDXBITMAP 0xB0 #define NTFS_MAXATTRNAME 255 @@ -140,7 +139,7 @@ } a_S_nr; } a_S; }; -#define a_r a_S.a_S_r +#define a_r a_S.a_S_r #define a_nr a_S.a_S_nr typedef struct { @@ -150,15 +149,15 @@ 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_RDONLY 0x01LL +#define NTFS_FFLAG_HIDDEN 0x02LL +#define NTFS_FFLAG_SYSTEM 0x04LL +#define NTFS_FFLAG_ARCHIVE 0x20LL #define NTFS_FFLAG_COMPRESSED 0x0800LL -#define NTFS_FFLAG_DIR 0x10000000LL +#define NTFS_FFLAG_DIR 0x10000000LL struct attr_name { - u_int32_t n_pnumber; /* Parent ntnode */ + u_int32_t n_pnumber; /* Parent ntnode */ u_int32_t reserved; ntfs_times_t n_times; u_int64_t n_size; @@ -179,7 +178,7 @@ 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_t ir_pad1; /* padding */ u_int16_t ir_pad2; /* padding */ }; @@ -221,7 +220,7 @@ 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_t unknown3; /* used by reparse points and external attributes? */ u_int8_t ie_fnamelen; u_int8_t ie_fnametype; wchar ie_fname[NTFS_MAXFILENAME]; @@ -244,8 +243,8 @@ }; #define NTFS_ATTRNAME_MAXLEN 0x40 -#define NTFS_ADFLAG_NONRES 0x0080 /* Attrib can be non resident */ -#define NTFS_ADFLAG_INDEX 0x0002 /* Attrib can be indexed */ +#define NTFS_ADFLAG_NONRES 0x0080 /* Attrib can be non resident */ +#define NTFS_ADFLAG_INDEX 0x0002 /* Attrib can be indexed */ struct attrdef { wchar ad_name[NTFS_ATTRNAME_MAXLEN]; u_int32_t ad_type; @@ -257,7 +256,7 @@ struct ntvattrdef { char ad_name[0x40]; - int ad_namelen; + int ad_namelen; u_int32_t ad_type; }; @@ -270,21 +269,21 @@ 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 */ }; /* @@ -303,50 +302,50 @@ #define NTFS_SYSNODESNUM 0x0B 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_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 */ #ifdef APPLE struct netexport ntm_export; /* NFS export information */ #endif }; -#define ntm_mftcn ntm_bootfile.bf_mftcn +#define ntm_mftcn ntm_bootfile.bf_mftcn #define ntm_mftmirrcn ntm_bootfile.bf_mftmirrcn #define ntm_mftrecsz ntm_bootfile.bf_mftrecsz -#define ntm_spc ntm_bootfile.bf_spc -#define ntm_bps ntm_bootfile.bf_bps +#define ntm_spc ntm_bootfile.bf_spc +#define ntm_bps ntm_bootfile.bf_bps #pragma pack() #define NTFS_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)) -#define VTOF(v) ((struct fnode *)((v)->v_data)) -#define FTOV(f) ((f)->f_vp) -#define FTONT(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)) +#define VTOF(v) ((struct fnode *)((v)->v_data)) +#define FTOV(f) ((f)->f_vp) +#define FTONT(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) -#define ntfs_bpbl (daddr_t)((ntmp)->ntm_bps) +#define ntfs_bpbl (daddr_t)((ntmp)->ntm_bps) #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_NTFSMNT); Index: branches/Bungo/i386/libsaio/ext2fs.c =================================================================== --- branches/Bungo/i386/libsaio/ext2fs.c (revision 2838) +++ branches/Bungo/i386/libsaio/ext2fs.c (revision 2839) @@ -37,7 +37,7 @@ } str[strMaxLen]=0; strncpy (str, buf+0x478, MIN(strMaxLen, 16)); - //verbose("EXT2: label=%s\n", str); + //verbose("EXT2: label=%s\n", str); free (buf); } Index: branches/Bungo/i386/libsaio/vbe.c =================================================================== --- branches/Bungo/i386/libsaio/vbe.c (revision 2838) +++ branches/Bungo/i386/libsaio/vbe.c (revision 2839) @@ -268,84 +268,84 @@ 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); } Index: branches/Bungo/i386/libsaio/bootstruct.h =================================================================== --- branches/Bungo/i386/libsaio/bootstruct.h (revision 2838) +++ branches/Bungo/i386/libsaio/bootstruct.h (revision 2839) @@ -47,7 +47,7 @@ /* * Maximum number of boot drivers that can be loaded. */ -#define NDRIVERS 500 +#define NDRIVERS 500 #define CONFIG_SIZE (40 * 4096) @@ -74,10 +74,12 @@ 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; /* @@ -90,11 +92,12 @@ /* * 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 */ }; Index: branches/Bungo/i386/libsaio/device_tree.c =================================================================== --- branches/Bungo/i386/libsaio/device_tree.c (revision 2838) +++ branches/Bungo/i386/libsaio/device_tree.c (revision 2839) @@ -82,8 +82,7 @@ //============================================================================== -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; @@ -143,8 +142,7 @@ //============================================================================== -Node * -DT__AddChild(Node *parent, const char *name) +Node *DT__AddChild(Node *parent, const char *name) { Node *node; @@ -206,8 +204,7 @@ //============================================================================== -void -DT__FreeProperty(Property *prop) +void DT__FreeProperty(Property *prop) { prop->next = freeProperties; freeProperties = prop; @@ -215,8 +212,7 @@ //============================================================================== -void -DT__FreeNode(Node *node) +void DT__FreeNode(Node *node) { node->next = freeNodes; freeNodes = node; @@ -224,39 +220,36 @@ //============================================================================== -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; @@ -265,7 +258,7 @@ for (prop = allocedProperties; prop != NULL; prop = prop->next) { - free((void *)(prop->name)); + free((void *)(prop->name)); free(prop->value); } @@ -289,15 +282,15 @@ //============================================================================== -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; } @@ -334,8 +327,7 @@ * 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; @@ -343,7 +335,8 @@ DPRINTF("DT__FlattenDeviceTree(0x%x, 0x%x)\n", buffer_p, length); #if DEBUG - if (buffer_p) { + if (buffer_p) + { DT__PrintTree(rootNode); } #endif @@ -387,8 +380,7 @@ //============================================================================== -char * -DT__GetName(Node *node) +char *DT__GetName(Node *node) { Property *prop; @@ -409,8 +401,7 @@ //============================================================================== // Bungo -Property * -DT__GetProperty(Node *node, const char *name) +Property *DT__GetProperty(Node *node, const char *name) { Property *prop; @@ -427,8 +418,7 @@ //============================================================================== -Node * -DT__FindNode(const char *path, bool createIfMissing) +Node *DT__FindNode(const char *path, bool createIfMissing) { Node *node, *child; DTPropertyNameBuf nameBuf; @@ -456,35 +446,35 @@ } *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; } @@ -495,8 +485,7 @@ //============================================================================== -void -DT__PrintNode(Node *node, int level) +void DT__PrintNode(Node *node, int level) { char spaces[10], *cp = spaces; Property *prop; @@ -533,8 +522,7 @@ //============================================================================== -static void -_PrintTree(Node *node, int level) +static void _PrintTree(Node *node, int level) { DT__PrintNode(node, level); @@ -548,8 +536,7 @@ //============================================================================== -void -DT__PrintTree(Node *node) +void DT__PrintTree(Node *node) { if (node == 0) node = rootNode; _PrintTree(node, 0); @@ -557,8 +544,7 @@ //============================================================================== -void -DT__PrintFlattenedNode(DTEntry entry, int level) +void DT__PrintFlattenedNode(DTEntry entry, int level) { char spaces[10], *cp = spaces; DTPropertyIterator propIter; @@ -589,8 +575,7 @@ //============================================================================== -static void -_PrintFlattenedTree(DTEntry entry, int level) +static void _PrintFlattenedTree(DTEntry entry, int level) { DTEntryIterator entryIter; @@ -611,16 +596,14 @@ //============================================================================== -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) { DTEntry dtEntry; DTPropertyIterator propIter; Index: branches/Bungo/i386/libsaio/hfs.c =================================================================== --- branches/Bungo/i386/libsaio/hfs.c (revision 2838) +++ branches/Bungo/i386/libsaio/hfs.c (revision 2839) @@ -443,7 +443,7 @@ if (HFSInitPartition(ih) == -1) { - verbose("HFSGetDescription: Init partition failed"); + verbose("HFSGetDescription: Init partition failed"); return; } @@ -460,7 +460,7 @@ strncpy(str, name, strMaxLen); str[strMaxLen] = '\0'; - //verbose("HFS: label=%s\n", str); + //verbose("HFS: label=%s\n", str); } //============================================================================== Index: branches/Bungo/i386/libsaio/vbe.h =================================================================== --- branches/Bungo/i386/libsaio/vbe.h (revision 2838) +++ branches/Bungo/i386/libsaio/vbe.h (revision 2839) @@ -58,11 +58,11 @@ */ 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, Index: branches/Bungo/i386/libsaio/acpi_patcher.c =================================================================== --- branches/Bungo/i386/libsaio/acpi_patcher.c (revision 2838) +++ branches/Bungo/i386/libsaio/acpi_patcher.c (revision 2839) @@ -28,8 +28,8 @@ #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) @@ -54,45 +54,45 @@ 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; } @@ -102,48 +102,48 @@ { /* 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; } @@ -157,30 +157,30 @@ // 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; + } + } } } } @@ -214,8 +214,8 @@ } close(fd); verbose("loadACPITable: Couldn't allocate memory for table: %s.\n", dirspec); - } - + } + return NULL; } @@ -228,14 +228,13 @@ 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 @@ -267,7 +266,7 @@ 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); @@ -278,117 +277,125 @@ } 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 @@ -419,34 +426,46 @@ 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"); } @@ -454,85 +473,99 @@ // 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); @@ -546,9 +579,10 @@ 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; @@ -558,105 +592,126 @@ 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; @@ -664,12 +719,14 @@ 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); } @@ -679,158 +736,192 @@ 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 @@ -839,73 +930,102 @@ 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; } Index: branches/Bungo/i386/libsaio/bootargs.h =================================================================== --- branches/Bungo/i386/libsaio/bootargs.h (revision 2838) +++ branches/Bungo/i386/libsaio/bootargs.h (revision 2839) @@ -44,21 +44,21 @@ }; 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 }; /* @@ -124,8 +124,8 @@ #define kBootArgsVersion2 2 #define kBootArgsRevision2_0 0 -#define kBootArgsEfiMode32 32 -#define kBootArgsEfiMode64 64 +#define kBootArgsEfiMode32 32 +#define kBootArgsEfiMode64 64 /* Bitfields for boot_args->flags */ #define kBootArgsFlagRebootOnPanic (1 << 0) @@ -209,6 +209,7 @@ 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 */ Index: branches/Bungo/i386/libsaio/spd.c =================================================================== --- branches/Bungo/i386/libsaio/spd.c (revision 2838) +++ branches/Bungo/i386/libsaio/spd.c (revision 2839) @@ -69,6 +69,19 @@ #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) @@ -111,30 +124,18 @@ /* 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; @@ -142,29 +143,39 @@ 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; } } @@ -179,20 +190,11 @@ /* 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: @@ -206,6 +208,21 @@ 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 } @@ -215,44 +232,53 @@ /* 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; } } @@ -262,16 +288,17 @@ 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) +{ + int i, speed; + uint8_t spd_size, spd_type; + uint32_t base, mmio, hostc; + uint16_t cmd; +// bool dump = 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); @@ -288,13 +315,14 @@ 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; @@ -305,13 +333,14 @@ //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: @@ -327,11 +356,17 @@ 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); @@ -339,17 +374,20 @@ 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; @@ -359,22 +397,22 @@ 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 @@ -420,15 +458,18 @@ 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; } Index: branches/Bungo/i386/libsaio/gma.c =================================================================== --- branches/Bungo/i386/libsaio/gma.c (revision 2838) +++ branches/Bungo/i386/libsaio/gma.c (revision 2839) @@ -50,7 +50,7 @@ #if DEBUG_GMA #define DBG(x...) printf(x) #else -#define DBG(x...) +#define DBG(x...) msglog(x) #endif static bool doit = false; @@ -397,7 +397,9 @@ 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; } @@ -527,7 +529,7 @@ 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); @@ -540,7 +542,7 @@ 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); @@ -604,8 +606,10 @@ 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; } @@ -717,12 +721,14 @@ 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; Index: branches/Bungo/i386/libsaio/pci_root.c =================================================================== --- branches/Bungo/i386/libsaio/pci_root.c (revision 2838) +++ branches/Bungo/i386/libsaio/pci_root.c (revision 2839) @@ -50,51 +50,74 @@ 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) @@ -106,51 +129,57 @@ 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; } Index: branches/Bungo/i386/libsaio/device_inject.c =================================================================== --- branches/Bungo/i386/libsaio/device_inject.c (revision 2838) +++ branches/Bungo/i386/libsaio/device_inject.c (revision 2839) @@ -23,11 +23,11 @@ #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_t devices_number = 1; +uint32_t builtin_set = 0; +DevPropString *string = 0; +uint8_t *stringdata = 0; +uint32_t stringlength = 0; char *efi_inject_get_devprop_string(uint32_t *len) { @@ -55,16 +55,19 @@ /* 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"); } } } @@ -73,7 +76,8 @@ { string = (struct DevPropString *)malloc(sizeof(struct DevPropString)); - if(string == NULL) { + if(string == NULL) + { return NULL; } @@ -85,20 +89,24 @@ DevPropDevice *devprop_add_device(DevPropString *string, char *path) { - DevPropDevice *device = NULL; - const char pciroot_string[] = "PciRoot(0x"; - const char pci_device_string[] = "Pci(0x"; + DevPropDevice *device = NULL; + const char pciroot_string[] = "PciRoot(0x"; + const char pci_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; } @@ -110,16 +118,23 @@ int x, curr = 0; char buff[] = "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; @@ -129,11 +144,16 @@ 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; @@ -144,24 +164,26 @@ } } - 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); int i; - 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; @@ -174,8 +196,10 @@ 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; } @@ -192,24 +216,27 @@ 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++; } @@ -218,31 +245,39 @@ 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); } @@ -345,9 +380,12 @@ } 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; } @@ -370,10 +408,11 @@ int hex2bin(const char *hex, uint8_t *bin, int len) { char *p; - int i; + int i; char buf[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; } @@ -381,8 +420,10 @@ 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; } @@ -400,15 +441,22 @@ 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; } @@ -420,16 +468,19 @@ 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; } Index: branches/Bungo/i386/libsaio/fdisk.h =================================================================== --- branches/Bungo/i386/libsaio/fdisk.h (revision 2838) +++ branches/Bungo/i386/libsaio/fdisk.h (revision 2839) @@ -35,35 +35,36 @@ #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_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_SIGNATURE 0xAA55 /* signature of the boot record */ -#define FDISK_NPART 4 /* number of entries in fdisk table */ +#define FDISK_NPART 4 /* number of entries in fdisk table */ #define FDISK_ACTIVE 0x80 /* indicator of active partition */ -#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ +#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ #define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ +#define FDISK_DOSEXT 0x05 /* extended DOS partition */ #define FDISK_DOS16B 0x06 /* 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_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_FREEBSD 0xA5 /* FreeBSD UFS2 partition */ #define FDISK_OPENBSD 0xA6 /* OpenBSD FFS partition */ #define FDISK_NEXTNAME 0xA7 /* Indicator of NeXT partition */ -#define FDISK_UFS 0xA8 /* Apple UFS partition */ +#define FDISK_UFS 0xA8 /* Apple UFS partition */ #define FDISK_NETBSD 0xA9 /* NetBSD disk label */ #define FDISK_BOOTER 0xAB /* Apple booter partition */ #define FDISK_ENCRYPTED 0xAE /* 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_HFS 0xAF /* Apple HFS partition */ +#define FDISK_BEFS 0xEB /* Haiku BeFS partition */ +#define FDISK_LINUX_RAID 0xFD /* Linux RAID */ #define FDISK_PSEUDO_EXFAT 0x107 /* Shared with FDISK_NTFS */ /* Index: branches/Bungo/i386/libsaio/nvidia.c =================================================================== --- branches/Bungo/i386/libsaio/nvidia.c (revision 2838) +++ branches/Bungo/i386/libsaio/nvidia.c (revision 2839) @@ -77,7 +77,7 @@ #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 bool showGeneric = false; static bool doit = false; char generic_name[128]; extern uint32_t devices_number; Index: branches/Bungo/i386/libsaio/ntfs.c =================================================================== --- branches/Bungo/i386/libsaio/ntfs.c (revision 2838) +++ branches/Bungo/i386/libsaio/ntfs.c (revision 2839) @@ -31,33 +31,35 @@ */ //#include "exfat.h" -#define BYTE_ORDER_MARK 0xFEFF +#define BYTE_ORDER_MARK 0xFEFF #include "ntfs_private.h" -#define FS_TYPE "ntfs" +#define FS_TYPE "ntfs" #define FS_NAME_FILE "NTFS" #define MAX_BLOCK_SIZE 2048 #define MAX_CLUSTER_SIZE 32768 -#define LABEL_LENGTH 1024 -#define UNKNOWN_LABEL "Untitled NTFS" +#define LABEL_LENGTH 1024 +#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_RECOGNIZED 0 -#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; @@ -104,10 +106,11 @@ * 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; @@ -160,7 +163,7 @@ 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; } @@ -184,7 +187,7 @@ */ 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; } @@ -290,7 +293,7 @@ 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; @@ -313,6 +316,7 @@ { return -1; } + bzero(buf,MAX_BLOCK_SIZE); /* * Read the boot sector, check signatures, and do some minimal @@ -329,26 +333,29 @@ 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. Index: branches/Bungo/i386/libsaio/ati.c =================================================================== --- branches/Bungo/i386/libsaio/ati.c (revision 2838) +++ branches/Bungo/i386/libsaio/ati.c (revision 2839) @@ -1706,39 +1706,39 @@ }; 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) @@ -1867,7 +1867,7 @@ val->type = kPtr; val->size = strlen((char *)rev); val->data = malloc(val->size); - + if (!val->data) { return false; Index: branches/Bungo/i386/libsaio/sys.c =================================================================== --- branches/Bungo/i386/libsaio/sys.c (revision 2838) +++ branches/Bungo/i386/libsaio/sys.c (revision 2839) @@ -130,30 +130,30 @@ //========================================================================== // 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) { @@ -208,14 +208,14 @@ } *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) @@ -291,27 +291,27 @@ 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]; + unsigned fmtbase, fmtidx, i; + uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 }; + char *p = uuidStr; + MD5_CTX md5c; + uint8_t mdresult[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; @@ -359,12 +359,12 @@ //========================================================================== // 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; + BVRef bvr; // Resolve the boot volume from the dir spec. @@ -375,19 +375,19 @@ 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; @@ -472,7 +472,7 @@ if (iob[fd].i_flgs == 0) { return fd; - } + } } stop("Out of file descriptors"); // not reached @@ -485,9 +485,9 @@ // 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) { @@ -504,21 +504,21 @@ 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; } //========================================================================== @@ -581,13 +581,13 @@ //========================================================================== int open_bvdev(const char *bvd, const char *path, int flags) { - const struct devsw *dp; - const char *cp; - BVRef bvr; - int i; - int len; - int unit; - int partition; + const struct devsw *dp; + const char *cp; + BVRef bvr; + int i; + int len; + int unit; + int partition; if ((i = open(path, flags)) >= 0) { @@ -639,7 +639,7 @@ return open_bvr(bvr, path, flags); } - } + } return -1; } @@ -662,7 +662,7 @@ //========================================================================== // 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) { @@ -695,9 +695,9 @@ //========================================================================== // 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; @@ -730,20 +730,20 @@ 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; } @@ -751,16 +751,16 @@ 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; } @@ -769,17 +769,17 @@ 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; } @@ -801,11 +801,11 @@ //========================================================================== -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; @@ -832,30 +832,30 @@ 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) { @@ -867,7 +867,7 @@ free(dirp); } - return 0; + return 0; } //========================================================================== @@ -894,7 +894,7 @@ //========================================================================== -const char *systemConfigDir() +const char * systemConfigDir() { if (gBootFileType == kNetworkDeviceType) { @@ -907,7 +907,7 @@ int gBootFileType; -void scanBootVolumes(int biosdev, int *count) +void scanBootVolumes(int biosdev, int * count) { BVRef bvr = 0; @@ -954,25 +954,27 @@ 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; } } @@ -991,39 +993,42 @@ 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. @@ -1037,9 +1042,9 @@ if (bvr->part_no == multiboot_skip_partition) { continue; + } } - } - + if ( (bvr->flags & kBVFlagPrimary) && (bvr->biosdev == gBIOSDev) ) { foundPrimary = true; @@ -1082,10 +1087,10 @@ } } } - + 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; } @@ -1139,11 +1144,11 @@ */ 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++) { @@ -1189,7 +1194,7 @@ 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). @@ -1201,11 +1206,11 @@ 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; @@ -1230,7 +1235,7 @@ { cp++; } - + biosdev = dp->biosdev + unit; bvr = newBootVolumeRef(biosdev, part); @@ -1294,7 +1299,7 @@ { // Fetch the volume list from the device. #if 0 - scanBootVolumes(biosdev, NULL); + scanBootVolumes( biosdev, NULL ); #endif bvrChain = getBVChainForBIOSDev(biosdev); @@ -1329,7 +1334,7 @@ { return 0; } - + *str = '\0'; if (bvr) @@ -1345,7 +1350,7 @@ return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no); } } - + return 0; } Index: branches/Bungo/i386/libsaio/load.c =================================================================== --- branches/Bungo/i386/libsaio/load.c (revision 2838) +++ branches/Bungo/i386/libsaio/load.c (revision 2839) @@ -58,7 +58,7 @@ cpu_type_t fapcputype; uint32_t fapoffset; uint32_t fapsize; - + if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */ { nfat = fhp->nfat_arch; @@ -145,7 +145,8 @@ 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; } */ @@ -200,16 +201,16 @@ #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; @@ -287,14 +288,14 @@ 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) { Index: branches/Bungo/i386/libsaio/acpi.h =================================================================== --- branches/Bungo/i386/libsaio/acpi.h (revision 2838) +++ branches/Bungo/i386/libsaio/acpi.h (revision 2839) @@ -33,13 +33,13 @@ // TODO Migrate struct acpi_2_rsdp { - // 1.0 + // 1.0 char Signature[8]; uint8_t Checksum; char OEMID[6]; uint8_t Revision; uint32_t RsdtAddress; - // 2.0 + // 2.0 uint32_t Length; uint64_t XsdtAddress; uint8_t ExtendedChecksum; @@ -101,13 +101,14 @@ uint32_t CreatorRevision; } __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 @@ -176,7 +177,7 @@ /* Begin Asere */ //Reset Fix uint32_t Flags; - // Reset Register + // Reset Register uint8_t Reset_SpaceID; uint8_t Reset_BitWidth; uint8_t Reset_BitOffset; @@ -191,16 +192,17 @@ uint8_t notimp2[96]; } __attribute__((packed)); -struct acpi_2_facs { - char Signature[4]; - uint32_t Length; - 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 +{ + char Signature[4]; + uint32_t Length; + 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 */ Index: branches/Bungo/i386/libsaio/cpu.c =================================================================== --- branches/Bungo/i386/libsaio/cpu.c (revision 2838) +++ branches/Bungo/i386/libsaio/cpu.c (revision 2839) @@ -243,7 +243,7 @@ /* 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; @@ -275,9 +275,9 @@ uint32_t max_ratio = 0; uint32_t min_ratio = 0; uint32_t reg[4]; - uint32_t cores_per_package = 0; - uint32_t logical_per_package = 1; - uint32_t threads_per_core = 1;; + uint32_t cores_per_package = 0; + uint32_t logical_per_package = 1; + uint32_t threads_per_core = 1;; uint8_t bus_ratio_max = 0; uint8_t bus_ratio_min = 0; @@ -288,52 +288,66 @@ const char *newratio; char str[128]; - char *s = 0; + char *s = 0; - int len = 0; - int myfsb = 0; - int i = 0; + int len = 0; + int myfsb = 0; + int i = 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]); } @@ -365,11 +379,15 @@ 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) { @@ -392,7 +410,7 @@ } } 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))) { /* @@ -404,65 +422,72 @@ 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; @@ -502,14 +527,15 @@ { 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 { @@ -556,9 +582,10 @@ 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) @@ -566,60 +593,65 @@ // 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); } } @@ -651,8 +683,8 @@ } else { - /* On lower models, currcoef defines TSC freq */ - /* XXX */ + // On lower models, currcoef defines TSC freq + // XXX maxcoef = currcoef; } @@ -685,7 +717,7 @@ break; } } - /* Mobile CPU */ + // Mobile CPU if (rdmsr64(MSR_IA32_PLATFORM_ID) & (1<<28)) { p->CPU.Features |= CPU_FEATURE_MOBILE; @@ -695,13 +727,13 @@ { 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 @@ -719,7 +751,7 @@ 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; @@ -727,7 +759,7 @@ break; - case 0x02: /* K11 */ + case 0x02: //* K11 *// // not implimented break; } @@ -750,8 +782,11 @@ fsbFrequency = ((cpuFrequency * currdiv) / currcoef); } //verbose("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } else { - if (!cpuFrequency) { + } + else + { + if (!cpuFrequency) + { fsbFrequency = (tscFrequency / maxcoef); } else @@ -767,7 +802,9 @@ { fsbFrequency = ((tscFrequency * currdiv) / currcoef); //verbose("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } else { + } + else + { fsbFrequency = (tscFrequency / currcoef); //verbose("%d\n", currcoef); } @@ -779,7 +816,7 @@ 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; } @@ -799,19 +836,20 @@ //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); @@ -819,11 +857,12 @@ 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 } Index: branches/Bungo/i386/libsaio/platform.h =================================================================== --- branches/Bungo/i386/libsaio/platform.h (revision 2838) +++ branches/Bungo/i386/libsaio/platform.h (revision 2839) @@ -30,26 +30,26 @@ #define CPUID_88 9 #define CPUID_MAX 10 -#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_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_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_IRWINDALE 0x04 // Xeon Paxville, Irwindale (90nm) +#define CPUID_MODEL_PRESLER 0x06 // Pentium 4, Pentium D (65nm) #define CPUID_MODEL_PENTIUM_M 0x09 // 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_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_CONROE 0x0F // -#define CPUID_MODEL_CELERON 0x16 // Merom, Conroe (65nm), Celeron (45nm) -#define CPUID_MODEL_PENRYN 0x17 // Wolfdale, Yorkfield, Harpertown, Penryn +#define CPUID_MODEL_CELERON 0x16 // Merom, Conroe (65nm), Celeron (45nm) +#define CPUID_MODEL_PENRYN 0x17 // Wolfdale, Yorkfield, Harpertown, Penryn //#define CPUID_MODEL_WOLFDALE 0x17 // 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_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_DALES_32NM 0x25 // Clarkdale, Arrandale #define CPUID_MODEL_ATOM_SAN 0x26 // Lincroft #define CPUID_MODEL_LINCROFT 0x27 // Bonnell @@ -62,7 +62,7 @@ #define CPUID_MODEL_ATOM_2000 0x36 // Cedarview / Saltwell #define CPUID_MODEL_SILVERMONT 0x37 // Atom E3000, Z3000 Atom Silvermont #define CPUID_MODEL_IVYBRIDGE 0x3A // Ivy Bridge -#define CPUID_MODEL_HASWELL 0x3C // Haswell DT +#define CPUID_MODEL_HASWELL 0x3C // Haswell DT #define CPUID_MODEL_BROADWELL 0x3D // Core M, Broadwell / Core-AVX2 //#define CPUID_MODEL_IVYBRIDGE_XEON 0x3E // Ivy Bridge Xeon #define CPUID_MODEL_IVYBRIDGE_EP 0x3E // Ivy Bridge Xeon @@ -167,13 +167,14 @@ uint8_t MaxDiv; // Min Multiplier uint8_t CurrCoef; // Current Multiplier uint8_t CurrDiv; - uint64_t TSCFrequency; // TSC Frequency Hz - uint64_t FSBFrequency; // FSB Frequency Hz - uint64_t CPUFrequency; // CPU Frequency Hz + uint64_t TSCFrequency; // TSC Frequency Hz + uint64_t FSBFrequency; // FSB Frequency Hz + uint64_t CPUFrequency; // CPU Frequency Hz uint32_t MaxRatio; // Max Bus Ratio uint32_t MinRatio; // Min Bus Ratio - char BrandString[48]; // 48 Byte Branding String - uint32_t CPUID[CPUID_MAX][4]; // CPUID 0..4, 80..81 Raw Values + char BrandString[48]; // 48 Byte Branding String + uint32_t CPUID[CPUID_MAX][4]; // CPUID 0..4, 80..81 Raw Values + } CPU; struct RAM { @@ -190,15 +191,15 @@ } RAM; struct DMI { - int MaxMemorySlots; // number of memory slots populated by SMBIOS - int CntMemorySlots; // number of memory slots counted - int MemoryModules; // number of memory modules installed - int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot + int MaxMemorySlots; // number of memory slots populated by SMBIOS + int CntMemorySlots; // number of memory slots counted + int MemoryModules; // number of memory modules installed + int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot } DMI; uint8_t Type; // 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_t HWSignature; // machine-signature (FACS: Hardware Signature) } PlatformInfo_t; extern PlatformInfo_t Platform; Index: branches/Bungo/i386/libsaio/disk.c =================================================================== --- branches/Bungo/i386/libsaio/disk.c (revision 2838) +++ branches/Bungo/i386/libsaio/disk.c (revision 2839) @@ -120,10 +120,10 @@ * 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 + 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 }; /* @@ -163,30 +163,32 @@ { { 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); //========================================================================== @@ -570,24 +572,24 @@ // 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; @@ -612,7 +614,7 @@ { result = FDISK_NTFS; } - else if (EXFATProbe(probeBuffer)) + else if (EXFATProbe(probeBuffer)) { result = 0xE7; } @@ -620,15 +622,15 @@ { 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; @@ -639,13 +641,14 @@ // Couldn't detect filesystem type result = 0; } - + exit: if (probeBuffer != NULL) { free((void *)probeBuffer); } - return result; + + return result; } //============================================================================== @@ -669,19 +672,19 @@ { 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; @@ -726,8 +729,8 @@ } else {*/ - bvr->flags |= kBVFlagForeignBoot; - // } + bvr->flags |= kBVFlagForeignBoot; + //} } else { @@ -740,8 +743,8 @@ { bvr->flags |= bvrFlags; } - - return bvr; + + return bvr; } //============================================================================== @@ -811,12 +814,12 @@ bvr = NULL; } } - + if ( bvr ) { bvr->flags |= bvrFlags; } - + return bvr; } @@ -883,19 +886,24 @@ // 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 ) { @@ -933,12 +941,12 @@ bvr = NULL; } } - + if ( bvr ) { bvr->flags |= bvrFlags; } - + return bvr; } @@ -953,19 +961,19 @@ 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; + int partno = -1; + BVRef bvr; #if UFS_SUPPORT - BVRef booterUFS = NULL; + BVRef booterUFS = NULL; #endif - int spc; - struct driveInfo di; - boot_drive_info_t *dp; + int spc; + struct driveInfo di; + 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) @@ -982,182 +990,241 @@ 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 ) { @@ -1174,6 +1241,7 @@ #endif } } while (0); + #if UNUSED /* * If no FDisk partition, then we will check for @@ -1217,29 +1285,32 @@ } } - 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 int blksize; + unsigned int factor; + 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 */ @@ -1247,7 +1318,7 @@ { return NULL; } - + block0_p = buffer; if (OSSwapBigToHostInt16(block0_p->sbSig) == BLOCK0_SIGNATURE) { @@ -1311,18 +1382,21 @@ 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++; } @@ -1330,10 +1404,16 @@ } } 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; } @@ -1349,26 +1429,26 @@ //============================================================================== -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 ) { @@ -1388,7 +1468,7 @@ // 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; } @@ -1399,7 +1479,7 @@ 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; } @@ -1407,21 +1487,21 @@ 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; } @@ -1432,35 +1512,35 @@ 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; + UInt64 gptBlock = 0; + UInt32 gptCheck = 0; + UInt32 gptCount = 0; + UInt32 gptID = 0; + gpt_ent *gptMap = NULL; + UInt32 gptSize = 0; gptBlock = OSSwapLittleToHostInt64(headerMap->hdr_lba_table); gptCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_table); @@ -1469,7 +1549,7 @@ 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; } @@ -1508,13 +1588,15 @@ // 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)); @@ -1523,161 +1605,194 @@ // 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; } @@ -1700,16 +1815,20 @@ // 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 @@ -1720,36 +1839,41 @@ 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); @@ -1758,8 +1882,8 @@ { 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 @@ -1772,16 +1896,18 @@ 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; } @@ -1789,18 +1915,21 @@ 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; + BVRef bvr; + char dirSpec[512], fileSpec[512]; + char label[BVSTRLEN]; + int ret; + long flags; + u_int32_t time; + int fh, 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); @@ -1837,9 +1966,10 @@ 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); } } + } } @@ -1848,6 +1978,11 @@ void rescanBIOSDevice(int biosdev) { struct DiskBVMap *oldMap = diskResetBootVolumes(biosdev); + if (oldMap == NULL) + { + return; + } + CacheReset(); diskFreeMap(oldMap); oldMap = NULL; @@ -1880,7 +2015,8 @@ } else { - stop(""); + stop("diskResetBootVolumes error\n"); + return NULL; } } // Return the old map, either to be freed, or reinserted later @@ -1931,12 +2067,12 @@ { bvr = diskScanFDiskBootVolumes(biosdev, &count); } - + if (bvr == NULL) { bvr = diskScanAPMBootVolumes(biosdev, &count); } - + if (bvr) { scanFSLevelBVRSettings(bvr); @@ -1946,12 +2082,12 @@ { bvr = map->bvr; } - + if (countPtr) { *countPtr += count; } - + return bvr; } @@ -2020,6 +2156,8 @@ { continue; } + bzero(newBVR,sizeof(*newBVR)); + bcopy(bvr, newBVR, sizeof(*newBVR)); /* @@ -2082,9 +2220,13 @@ #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; @@ -2103,6 +2245,11 @@ while (bvr) { + if (!bvr) + { + break; + } + nextBVR = bvr->next; if (bvr->filtered) Index: branches/Bungo/i386/libsaio/cpu.h =================================================================== --- branches/Bungo/i386/libsaio/cpu.h (revision 2838) +++ branches/Bungo/i386/libsaio/cpu.h (revision 2839) @@ -40,13 +40,13 @@ 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)) #define CPUID_VID_INTEL "GenuineIntel" #define CPUID_VID_AMD "AuthenticAMD" @@ -191,7 +191,7 @@ #define IA32_ENERGY_PERF_BIAS 0x01B0 #define MSR_PACKAGE_THERM_STATUS 0x01B1 #define IA32_PLATFORM_DCA_CAP 0x01F8 -#define MSR_POWER_CTL 0x01FC // MSR 000001FC 0000-0000-0004-005F +#define MSR_POWER_CTL 0x01FC // MSR 000001FC 0000-0000-0004-005F // Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's. #define MSR_RAPL_POWER_UNIT 0x606 /* R/O */ Index: branches/Bungo/i386/libsaio/smbios.c =================================================================== --- branches/Bungo/i386/libsaio/smbios.c (revision 2838) +++ branches/Bungo/i386/libsaio/smbios.c (revision 2839) @@ -34,79 +34,79 @@ /* ======================= 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) @@ -115,17 +115,17 @@ /* ============================================ 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)) @@ -195,7 +195,7 @@ typedef struct { uint8_t type; - SMBValueType valueType; + SMBValueType valueType; uint8_t fieldOffset; char *keyString; bool (*getSMBValue)(returnType *); @@ -208,75 +208,75 @@ 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 */ // @@ -285,19 +285,19 @@ 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), @@ -308,32 +308,32 @@ 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}, @@ -372,17 +372,17 @@ // 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} */ }; @@ -390,8 +390,8 @@ 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 @@ -565,7 +565,7 @@ //#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" @@ -617,9 +617,9 @@ /* ============================================ */ -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 @@ -707,8 +707,8 @@ 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; @@ -720,11 +720,11 @@ 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; @@ -734,21 +734,21 @@ 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; @@ -757,10 +757,10 @@ 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; @@ -780,19 +780,25 @@ 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; } } @@ -801,12 +807,13 @@ 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)); @@ -817,11 +824,13 @@ { int strSize; - if (!field) { + if (!field) + { return; } - if (!string) { + if (!string) + { *field = 0; return; } @@ -829,13 +838,16 @@ 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; } @@ -854,11 +866,13 @@ 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) @@ -866,7 +880,9 @@ 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)) @@ -877,33 +893,42 @@ } } - 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; @@ -922,14 +947,17 @@ } } - 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: @@ -953,7 +981,8 @@ } // 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; @@ -1005,9 +1034,11 @@ { 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: @@ -1029,34 +1060,36 @@ 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; @@ -1068,7 +1101,8 @@ structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemPPlatformFeature) + 2); tableLength += sizeof(SMBOemPlatformFeature) + 2; structureCount++; - }*/ + } +*/ //------------------------------------------------------------------------------------------------------------------------- // EndOfTable @@ -1096,9 +1130,11 @@ // 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; } }*/ @@ -1106,11 +1142,13 @@ 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; @@ -1135,38 +1173,48 @@ } // 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; } @@ -1178,7 +1226,8 @@ tableLength += structSize; - if (structSize > maxStructSize) { + if (structSize > maxStructSize) + { maxStructSize = structSize; } @@ -1212,7 +1261,8 @@ 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; } @@ -1242,7 +1292,8 @@ 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; } @@ -1251,29 +1302,32 @@ 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 @@ -1283,19 +1337,22 @@ 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; } @@ -1304,7 +1361,7 @@ structPtr->new = (SMBStructHeader *)buffer; //Bungo: - //getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); + //getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig); // if (setSMB) setDefaultSMBData(); @@ -1312,7 +1369,8 @@ setupNewSMBIOSTable(origeps, structPtr); neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint)); - if (!neweps) { + if (!neweps) + { free(buffer); free(structPtr); return; @@ -1339,7 +1397,8 @@ 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; @@ -1357,21 +1416,23 @@ 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; @@ -1402,20 +1463,21 @@ 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; @@ -1428,10 +1490,12 @@ 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++; @@ -1443,7 +1507,8 @@ 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; } Index: branches/Bungo/i386/libsaio/smbios_decode.c =================================================================== --- branches/Bungo/i386/libsaio/smbios_decode.c (revision 2838) +++ branches/Bungo/i386/libsaio/smbios_decode.c (revision 2839) @@ -230,10 +230,12 @@ { char *str = NULL; str = getSMBStringForField(structHeader, field); - if (!field) { + if (!field) + { str = NotSpecifiedStr; } - else if (mask) { + else if (mask) + { str = PrivateStr; } @@ -279,16 +281,22 @@ 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# @@ -311,9 +319,12 @@ // 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) @@ -329,9 +340,12 @@ 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: @@ -362,14 +376,16 @@ 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)); @@ -378,9 +394,12 @@ 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: @@ -442,7 +461,8 @@ 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; } @@ -468,39 +488,48 @@ 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: @@ -574,7 +603,7 @@ 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) @@ -636,7 +665,7 @@ // 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; @@ -648,13 +677,15 @@ 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 } Index: branches/Bungo/i386/libsaio/pci.c =================================================================== --- branches/Bungo/i386/libsaio/pci.c (revision 2838) +++ branches/Bungo/i386/libsaio/pci.c (revision 2839) @@ -16,7 +16,7 @@ #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; @@ -75,17 +75,23 @@ uint8_t secondary_bus; uint8_t header_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; @@ -99,21 +105,25 @@ 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; } } @@ -131,6 +141,7 @@ { 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 */ @@ -144,7 +155,8 @@ { root_pci_dev = malloc(sizeof(pci_dt_t)); - if (!root_pci_dev) { + if (!root_pci_dev) + { return; } @@ -154,7 +166,7 @@ #if DEBUG_PCI dump_pci_dt(root_pci_dev->children); - pause(""); + pause("\n[DEBUG_PCI] "); #endif } @@ -164,7 +176,7 @@ { pci_dt_t *current; pci_dt_t *end; - int dev_path_len = 0; + int dev_path_len = 0; dev_path[0] = 0; end = root_pci_dev; @@ -176,11 +188,14 @@ 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); Index: branches/Bungo/i386/libsaio/biosfn.c =================================================================== --- branches/Bungo/i386/libsaio/biosfn.c (revision 2838) +++ branches/Bungo/i386/libsaio/biosfn.c (revision 2839) @@ -560,7 +560,7 @@ 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 */ @@ -730,7 +730,7 @@ 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) { Index: branches/Bungo/i386/libsaio/convert.c =================================================================== --- branches/Bungo/i386/libsaio/convert.c (revision 2838) +++ branches/Bungo/i386/libsaio/convert.c (revision 2839) @@ -10,26 +10,28 @@ /** 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; - int i = 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; + int i = 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; char buf[3]; @@ -67,8 +69,8 @@ uint32_t value = 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' @@ -83,62 +85,62 @@ 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, Index: branches/Bungo/i386/libsaio/saio_types.h =================================================================== --- branches/Bungo/i386/libsaio/saio_types.h (revision 2838) +++ branches/Bungo/i386/libsaio/saio_types.h (revision 2839) @@ -73,7 +73,7 @@ typedef struct { char plist[IO_CONFIG_DATA_SIZE]; // buffer for plist - TagPtr dictionary; // buffer for xml dictionary + TagPtr dictionary; // buffer for xml dictionary bool canOverride; // flag to mark a dictionary can be overriden } config_file_t; @@ -144,9 +144,9 @@ } FinderInfo; -struct BootVolume; -typedef struct BootVolume *BVRef; -typedef struct BootVolume *CICell; +struct BootVolume; +typedef struct BootVolume *BVRef; +typedef struct BootVolume *CICell; typedef long (*FSInit)(CICell ih); typedef long (*FSLoadFile)(CICell ih, char * filePath); @@ -167,52 +167,52 @@ 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 int flags; /* attribute flags */ - BVGetDescription description; /* BVGetDescription function */ - int part_no; /* partition number (1 based) */ - unsigned int part_boff; /* partition block offset */ - unsigned int part_type; /* partition type */ - unsigned int fs_boff; /* 1st block # of next read */ - unsigned int fs_byteoff; /* Byte offset for read within block */ - FSLoadFile fs_loadfile; /* FSLoadFile function */ - FSReadFile fs_readfile; /* FSReadFile function */ - FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */ - FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */ - FSGetUUID fs_getuuid; /* FSGetUUID function */ - unsigned int bps; /* 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 */ + BVRef next; /* list linkage pointer */ + int biosdev; /* BIOS device number */ + int type; /* device type (floppy, hd, network) */ + unsigned int flags; /* attribute flags */ + BVGetDescription description; /* BVGetDescription function */ + int part_no; /* partition number (1 based) */ + unsigned int part_boff; /* partition block offset */ + unsigned int part_type; /* partition type */ + unsigned int fs_boff; /* 1st block # of next read */ + unsigned int fs_byteoff; /* Byte offset for read within block */ + FSLoadFile fs_loadfile; /* FSLoadFile function */ + FSReadFile fs_readfile; /* FSReadFile function */ + FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */ + FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */ + FSGetUUID fs_getuuid; /* FSGetUUID function */ + unsigned int bps; /* 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 */ }; @@ -225,13 +225,13 @@ kBVFlagEFISystem = 0x10, kBVFlagBooter = 0x20, kBVFlagSystemVolume = 0x40, - kBVFlagInstallVolume = 0x80 + kBVFlagInstallVolume = 0x80 }; enum { kBIOSDevTypeFloppy = 0x00, - kBIOSDevTypeHardDrive = 0x80, + kBIOSDevTypeHardDrive = 0x80, kBIOSDevTypeNetwork = 0xE0, kBIOSDevUnitMask = 0x0F, kBIOSDevTypeMask = 0xF0, @@ -241,18 +241,18 @@ 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 }; Index: branches/Bungo/i386/libsaio/msdos.c =================================================================== --- branches/Bungo/i386/libsaio/msdos.c (revision 2838) +++ branches/Bungo/i386/libsaio/msdos.c (revision 2839) @@ -52,12 +52,12 @@ #include "msdos.h" #define LABEL_LENGTH 11 -#define MSDOS_CACHE_BLOCKSIZE BPS +#define MSDOS_CACHE_BLOCKSIZE BPS -#define CLUST_FIRST 2/* reserved cluster range */ -#define CLUST_RSRVD32 0x0ffffff8 /* reserved cluster range */ -#define CLUST_RSRVD16 0xfff8 /* reserved cluster range */ -#define CLUST_RSRVD12 0xff8 /* reserved cluster range */ +#define CLUST_FIRST 2 /* reserved cluster range */ +#define CLUST_RSRVD32 0x0ffffff8 /* reserved cluster range */ +#define CLUST_RSRVD16 0xfff8 /* reserved cluster range */ +#define CLUST_RSRVD12 0xff8 /* reserved cluster range */ #define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c)) @@ -93,13 +93,13 @@ 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 */ @@ -149,8 +149,7 @@ } -long -MSDOSInitPartition (CICell ih) +long MSDOSInitPartition (CICell ih) { union bootsector *bsp; struct bpb33 *b33; @@ -181,10 +180,10 @@ 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 */ @@ -252,8 +251,7 @@ 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) @@ -280,8 +278,7 @@ 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]; @@ -346,8 +343,7 @@ } } -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) @@ -391,7 +387,9 @@ 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; @@ -417,16 +415,20 @@ } } -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; @@ -568,8 +570,7 @@ {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]) @@ -605,8 +606,7 @@ } -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; @@ -633,10 +633,16 @@ { for (;*ptr && *ptr!='/';ptr++); if (!*ptr) + { return dirp; + } + ptr++; if (!*ptr) + { return dirp; + } + for (slash=ptr;*slash && *slash!='/';slash++); c=*slash; *slash=0; @@ -645,7 +651,10 @@ ucsname[ucslenhost]=0; *slash=c; if (!(dirp->deAttributes & ATTR_DIRECTORY)) + { return 0; + } + st.root16 = 0; st.vfatchecksum = 0; st.nument = 0; @@ -662,8 +671,8 @@ 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_t vfatname[WIN_MAXLEN+2*WIN_CHARS]; if (MSDOSInitPartition (ih)<0) { @@ -683,6 +692,7 @@ { return -1; } + bzero(st,sizeof (struct msdosdirstate) ); if (dirPath[0]) { uint8_t *buf=malloc(msdosclustersize); @@ -691,6 +701,8 @@ free (st); return -1; } + bzero(buf,msdosclustersize ); + dirp = getdirpfrompath (ih, dirPath, buf); if (!dirp || !(dirp->deAttributes & ATTR_DIRECTORY)) { @@ -707,11 +719,14 @@ 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)); @@ -745,29 +760,37 @@ 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; } @@ -782,7 +805,7 @@ { *flags = kFileTypeFlat; } - + // Calculate a fake timestamp using modification date and time values. *time = ((dirp->deMDate & 0x7FFF) << 16) + dirp->deMTime; @@ -794,8 +817,7 @@ 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; @@ -816,11 +838,15 @@ { filePath++; } + buf = malloc(msdosclustersize); + if (!buf) { return -1; } + + bzero(buf,msdosclustersize); dirp = getdirpfrompath (ih, filePath, buf); if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) @@ -828,23 +854,32 @@ 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;isize-offset) { toread=size-offset; @@ -870,50 +905,75 @@ 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: @@ -944,21 +1004,28 @@ 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; @@ -973,6 +1040,9 @@ return; } + bzero(label,sizeof(label)); + bzero(vfatlabel,sizeof(vfatlabel)); + label[0] = '\0'; initRoot(&st); @@ -981,8 +1051,11 @@ { 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; @@ -997,8 +1070,10 @@ 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') { @@ -1022,13 +1097,12 @@ 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) @@ -1036,7 +1110,7 @@ return -1; } union bootsector *bsp = (union bootsector *)buf; - + if (MSDOSInitPartition (ih)<0) { free (buf); @@ -1048,10 +1122,10 @@ 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; } Index: branches/Bungo/i386/libsaio/state_generator.c =================================================================== --- branches/Bungo/i386/libsaio/state_generator.c (revision 2838) +++ branches/Bungo/i386/libsaio/state_generator.c (revision 2839) @@ -40,25 +40,25 @@ 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> 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; @@ -66,25 +66,25 @@ 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); } @@ -526,7 +526,7 @@ 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; @@ -592,7 +592,7 @@ 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); Index: branches/Bungo/i386/libsaio/md5c.c =================================================================== --- branches/Bungo/i386/libsaio/md5c.c (revision 2838) +++ branches/Bungo/i386/libsaio/md5c.c (revision 2839) @@ -149,7 +149,8 @@ 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]++; } @@ -159,7 +160,8 @@ /* 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); Index: branches/Bungo/i386/libsaio/fake_efi.c =================================================================== --- branches/Bungo/i386/libsaio/fake_efi.c (revision 2838) +++ branches/Bungo/i386/libsaio/fake_efi.c (revision 2839) @@ -110,9 +110,9 @@ 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; @@ -167,18 +167,18 @@ { 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; @@ -460,7 +460,7 @@ 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"; @@ -581,96 +581,111 @@ 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; } /* @@ -679,26 +694,32 @@ 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) { @@ -716,24 +737,28 @@ { 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 @@ -741,13 +766,16 @@ // 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); } @@ -758,15 +786,30 @@ // 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"); @@ -774,16 +817,19 @@ // 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); } @@ -791,26 +837,29 @@ // 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(); } @@ -828,7 +877,7 @@ 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); } } @@ -837,7 +886,7 @@ * setupRootNode() { - + } */ /* @@ -863,113 +912,120 @@ 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(); // callq 0x18e20 - cpuTick = getCPUTick(); // callq 0x121a7 - randomValue = (randomValue ^ cpuTick); // xor %rdi, %rax - seedPtr[index] = randomValue; // mov %rax,(%r15,%rsi,8) - } // jb 0x17e12 - } - 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; // jb 0x17e55 (retry) - } - - cpuTick = getCPUTick(); // callq 0x121a7 - 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++; // inc r12 - ecx = (edi & 0xffff); // movzwl %di, %ecx - - } while (index < 64); // cmp %r14d, %r12d - // jne 0x17e55 (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(); // callq 0x18e20 + cpuTick = getCPUTick(); // callq 0x121a7 + randomValue = (randomValue ^ cpuTick); // xor %rdi, %rax + seedPtr[index] = randomValue; // mov %rax,(%r15,%rsi,8) + } // jb 0x17e12 + } + 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; // jb 0x17e55 (retry) + } + + cpuTick = getCPUTick(); // callq 0x121a7 +// 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++; // inc r12 + ecx = (edi & 0xffff); // movzwl %di, %ecx + + } while (index < 64); // cmp %r14d, %r12d + // jne 0x17e55 (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); + } + */ + } } /* @@ -1003,7 +1059,7 @@ 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 @@ -1028,14 +1084,14 @@ 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; } @@ -1045,208 +1101,253 @@ 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; } /* @@ -1261,22 +1362,22 @@ // 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(); @@ -1290,10 +1391,10 @@ setupEfiTables64(); } - // Setup efi node + // Setup efi node setupEfiNode(); - saveOriginalSMBIOS(); - - saveOriginalACPI(); + saveOriginalSMBIOS(); + + saveOriginalACPI(); } Index: branches/Bungo/i386/libsaio/smbios_getters.c =================================================================== --- branches/Bungo/i386/libsaio/smbios_getters.c (revision 2838) +++ branches/Bungo/i386/libsaio/smbios_getters.c (revision 2839) @@ -30,7 +30,8 @@ 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: @@ -41,17 +42,18 @@ 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 @@ -90,7 +92,7 @@ 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 @@ -99,54 +101,54 @@ 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 } @@ -186,7 +188,7 @@ { 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")) { @@ -206,7 +208,7 @@ if (strstr(Platform.CPU.BrandString, XEON)) { value->word = 0x402; // 1026 - Xeon - return true; + return true; } if (Platform.CPU.NoCores <= 2) { @@ -381,10 +383,10 @@ default: break; // Unsupported CPU type } - break; - - default: break; + + default: + break; } } Index: branches/Bungo/i386/libsaio/state_generator.h =================================================================== --- branches/Bungo/i386/libsaio/state_generator.h (revision 2838) +++ branches/Bungo/i386/libsaio/state_generator.h (revision 2839) @@ -15,12 +15,12 @@ #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]; +extern uint8_t acpi_cpu_count; +extern uint32_t acpi_cpu_p_blk; +extern char *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); +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); #endif /* !__LIBSAIO_STATE_GENERATOR_H */ Index: branches/Bungo/i386/boot0/boot0.s =================================================================== --- branches/Bungo/i386/boot0/boot0.s (revision 2838) +++ branches/Bungo/i386/boot0/boot0.s (revision 2839) @@ -769,7 +769,7 @@ ;-------------------------------------------------------------------------- ; NULL terminated strings. ; -log_title_str db 10, 13, 'boot0: ', 0 +log_title_str db 10, 13, 'boot0: ', 0 %if VERBOSE gpt_str db 'GPT', 0 @@ -779,7 +779,7 @@ done_str db '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 Index: branches/Bungo/i386/boot0/boot0hfs.s =================================================================== --- branches/Bungo/i386/boot0/boot0hfs.s (revision 2838) +++ branches/Bungo/i386/boot0/boot0hfs.s (revision 2839) @@ -763,7 +763,7 @@ ;-------------------------------------------------------------------------- ; NULL terminated strings. ; -log_title_str db 10, 13, 'boot0: ', 0 +log_title_str db 10, 13, 'boot0: ', 0 %if VERBOSE gpt_str db 'GPT', 0 @@ -771,7 +771,7 @@ done_str db '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 Index: branches/Bungo/i386/boot0/boot0md.s =================================================================== --- branches/Bungo/i386/boot0/boot0md.s (revision 2838) +++ branches/Bungo/i386/boot0/boot0md.s (revision 2839) @@ -866,7 +866,7 @@ ;-------------------------------------------------------------------------- ; NULL terminated strings. ; -log_title_str db 10, 13, 'boot0:', 0 +log_title_str db 10, 13, 'boot0:', 0 gpt_str db 'GPT', 0 ;test_str db 'test', 0 @@ -874,7 +874,7 @@ %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 Index: branches/Bungo/i386/boot1/boot1h.s =================================================================== --- branches/Bungo/i386/boot1/boot1h.s (revision 2838) +++ branches/Bungo/i386/boot1/boot1h.s (revision 2839) @@ -1432,7 +1432,7 @@ %if VERBOSE log_title_str db 'boot1: ', NULL -error_str db 'error', NULL +error_str db 'error', NULL %endif searchCatalogKey dd kHFSRootFolderID Index: branches/Bungo/i386/boot2/graphics.c =================================================================== --- branches/Bungo/i386/boot2/graphics.c (revision 2838) +++ branches/Bungo/i386/boot2/graphics.c (revision 2839) @@ -50,7 +50,7 @@ static uint16_t GraphicsModeCurrent = 0; #define VIDEO(x) (bootArgs->Video.v_ ## x) - + //========================================================================== // getVBEVideoRam @@ -58,7 +58,7 @@ { VBEInfoBlock vbeInfo; int err /*, small */; - + bzero( &vbeInfo, sizeof(vbeInfo) ); strcpy( (char*)&vbeInfo, "VBE2" ); err = getVBEInfo( &vbeInfo ); @@ -67,9 +67,9 @@ if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) ) return 0; - + // small = (vbeInfo.TotalMemory < 16); - + return vbeInfo.TotalMemory * 64 * 1024; } @@ -89,12 +89,12 @@ { return 0; } - + if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) ) { return 0; } - + buff = malloc(sizeof(char) * 256); if (!buff) { @@ -104,12 +104,12 @@ 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; } @@ -173,16 +173,20 @@ 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); @@ -252,142 +256,142 @@ 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; } //========================================================================== @@ -437,10 +441,10 @@ uint16_t getCurrentGraphicsMode() { - if (getVBECurrentMode(&GraphicsModeCurrent) != errSuccess) - GraphicsModeCurrent = 0; - GraphicsModeCurrent &= 0x3FFF; - return GraphicsModeCurrent; + if (getVBECurrentMode(&GraphicsModeCurrent) != errSuccess) + GraphicsModeCurrent = 0; + GraphicsModeCurrent &= 0x3FFF; + return GraphicsModeCurrent; } //========================================================================== @@ -448,12 +452,13 @@ 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"); @@ -471,12 +476,14 @@ } 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 @@ -487,24 +494,24 @@ 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. @@ -551,7 +558,7 @@ { break; } - + verbose("Succesfuly set mode: 0x%04X (old mode: 0x%04X)\n", getCurrentGraphicsMode(), modeOld); // Set 8-bit color palette. @@ -583,7 +590,7 @@ bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); - } while ( 0 ); + } while ( 0 ); return err; } @@ -890,27 +897,27 @@ 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); + } } //========================================================================== @@ -926,14 +933,14 @@ 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; + } } //============================================================================== @@ -1020,7 +1027,7 @@ 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; @@ -1028,7 +1035,7 @@ { return; } - + screen += ((VIDEO (width) - kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1)) + (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes; @@ -1068,7 +1075,7 @@ else { *((uint32_t *)out) = (result << 16) | (result << 8) | result; // 32 - } + } } out += (1 << pixelShift); @@ -1129,8 +1136,8 @@ else { *((uint32_t *)out) = (result << 16) | (result << 8) | result; // 32 + } } - } out += (1 << pixelShift); } out += (kIOHibernateProgressSpacing << pixelShift); @@ -1143,36 +1150,36 @@ 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 } //========================================================================== @@ -1182,66 +1189,71 @@ 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] ); } //========================================================================== @@ -1251,40 +1263,40 @@ 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; } //============================================================================== @@ -1294,9 +1306,9 @@ 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], @@ -1306,7 +1318,7 @@ maLinearFrameBufferAvailBit, 0, &minfo, &vesaVersion); - + params[0] = minfo.XResolution; params[1] = minfo.YResolution; params[2] = 32; @@ -1335,7 +1347,7 @@ void spinActivityIndicator(int sectors) { static unsigned long lastTickTime = 0, currentTickTime; - + if (previewTotalSectors && previewSaveunder) { int blob, lastBlob; @@ -1376,11 +1388,11 @@ void clearActivityIndicator( void ) { - if ( getVideoMode() == VGA_TEXT_MODE ) - { + if ( getVideoMode() == VGA_TEXT_MODE ) + { putchar(' '); putchar('\b'); - } + } } //============================================================================== Index: branches/Bungo/i386/boot2/drivers.c =================================================================== --- branches/Bungo/i386/boot2/drivers.c (revision 2838) +++ branches/Bungo/i386/boot2/drivers.c (revision 2839) @@ -74,14 +74,14 @@ #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; @@ -110,12 +110,12 @@ 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 TagPtr gPersonalityHead, gPersonalityTail; +static char *gExtensionsSpec; +static char *gDriverSpec; +static char *gFileSpec; +static char *gTempSpec; +static char *gFileName; // Bungo: char gDarwinBuildVerStr[256] = "Darwin Kernel Version"; @@ -241,14 +241,16 @@ 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); @@ -900,7 +902,7 @@ 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; @@ -925,30 +927,30 @@ 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 @@ -958,7 +960,7 @@ 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); @@ -967,32 +969,32 @@ 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; } Index: branches/Bungo/i386/boot2/lzvn.c =================================================================== --- branches/Bungo/i386/boot2/lzvn.c (revision 2838) +++ branches/Bungo/i386/boot2/lzvn.c (revision 2839) @@ -38,23 +38,23 @@ // 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, @@ -74,22 +74,22 @@ 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; @@ -97,7 +97,7 @@ if (jmp) { return 0; } - + // lea -0x8(%rdx,%rcx,1),%rcx // cmp %rcx,%rdx // ja Llzvn_exit @@ -108,8 +108,8 @@ LABEL_JUMP; + - Llzvn_table0: r9 >>= 0x6; // shr $0x6,%r9 rdx = rdx + r9 + 0x1; // lea 0x1(%rdx,%r9,1),%rdx @@ -126,7 +126,7 @@ 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 @@ -147,8 +147,8 @@ 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 @@ -168,8 +168,8 @@ r8 >>= 0x10; // shr $0x10,%r8 r10 += 0x3; // add $0x3,%r10 goto Llzvn_l10; // jmp Llzvn_l10 + - Llzvn_table4: // add $0x1,%rdx // cmp %rcx,%rdx @@ -208,8 +208,8 @@ 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 @@ -223,7 +223,7 @@ rdx = rdx + r8 + 0x1; // lea 0x1(%rdx,%r8,1),%rdx goto Llzvn_l0; // jmp Llzvn_l0 - + Llzvn_table9: rdx += 0x2; // add $0x2,%rdx @@ -238,8 +238,8 @@ r10 &= 0xFF; // and $0xff,%r10 r10 += 0x10; // add $0x10,%r10 goto Llzvn_l11; - - + + Llzvn_table10: rdx += 1; // add $0x1,%rdx @@ -346,7 +346,7 @@ } while (jmp); } - + // mov %rax,%r8 r8 = rax; Index: branches/Bungo/i386/boot2/Makefile =================================================================== --- branches/Bungo/i386/boot2/Makefile (revision 2838) +++ branches/Bungo/i386/boot2/Makefile (revision 2839) @@ -36,7 +36,7 @@ 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 = @@ -80,7 +80,7 @@ endif @${MKDIRS} $(OBJROOT)/../boot2_modules/ - + @### First pass, don't worry abount segment alignment. @echo " [LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ Index: branches/Bungo/i386/boot2/boot.c =================================================================== --- branches/Bungo/i386/boot2/boot.c (revision 2838) +++ branches/Bungo/i386/boot2/boot.c (revision 2839) @@ -72,7 +72,11 @@ */ #define kBootErrorTimeout 5 -bool gOverrideKernel, gEnableCDROMRescan, gScanSingleDrive, useGUI; +bool gOverrideKernel; +bool gEnableCDROMRescan; +bool gScanSingleDrive; +bool useGUI; + static bool gUnloadPXEOnExit = false; static char gCacheNameAdler[64 + 256]; @@ -80,11 +84,15 @@ char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; -int bvCount = 0, gDeviceCount = 0; +int bvCount = 0; +int gDeviceCount = 0; //int menucount = 0; long gBootMode; /* defaults to 0 == kBootModeNormal */ -BVRef bvr, menuBVR, bvChain; +BVRef bvr; +BVRef menuBVR; +BVRef bvChain; + static unsigned long Adler32(unsigned char *buffer, long length); //static void selectBiosDevice(void); @@ -134,12 +142,12 @@ 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; @@ -156,7 +164,7 @@ // Load boot drivers from the specifed root path. //if (!gHaveKernelCache) { - LoadDrivers("/"); + LoadDrivers("/"); } execute_hook("DriversLoaded", (void *)binary, NULL, NULL, NULL); @@ -202,21 +210,23 @@ { 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 @@ -225,14 +235,14 @@ // 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 ); } @@ -252,7 +262,8 @@ 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; } @@ -273,43 +284,43 @@ } // 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"); + + 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); + } } } @@ -359,7 +370,8 @@ } // 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; } @@ -369,20 +381,18 @@ 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; } @@ -390,7 +400,10 @@ 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 } @@ -484,20 +497,19 @@ { 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) { @@ -523,18 +535,18 @@ 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); @@ -543,7 +555,7 @@ // initGUI() returned with an error, disabling GUI. useGUI = false; } - + setBootGlobals(bvChain); // Parse args, load and start kernel. @@ -557,7 +569,7 @@ u_int32_t sleeptime, time; void *binary = (void *)kLoadAddr; - char bootFile[sizeof(bootInfo->bootFile)]; + char bootFile[sizeof(bootInfo->bootFile)]; char bootFilePath[512]; char kernelCacheFile[512]; @@ -568,7 +580,7 @@ status = getBootOptions(firstRun); firstRun = false; if (status == -1) continue; - + status = processBootOptions(); // Status == 1 means to chainboot if ( status == 1 ) break; @@ -685,51 +697,62 @@ } 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 @@ -742,19 +765,23 @@ 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) @@ -769,7 +796,7 @@ } } if (ret == -1) - { + { // No alternate location found, using the original kernel image path. strlcpy(bootFilePath, bootFile, sizeof(bootFilePath)); } @@ -790,7 +817,8 @@ sleep(8); #endif - if (ret <= 0) { + if (ret <= 0) + { error("Can't find boot file: '%s'\n", bootFile); sleep(1); @@ -800,7 +828,9 @@ gUnloadPXEOnExit = false; break; } - pause(""); +#if DEBUG + pause("\n[DEBUG] "); +#endif } else @@ -864,8 +894,8 @@ uint32_t getMacOSVerCurrent() { - MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion); - return MacOSVerCurrent; + MacOSVerCurrent = MacOSVer2Int(gBootVolume->OSVersion); + return MacOSVerCurrent; } #define BASE 65521L /* largest prime smaller than 65536 */ Index: branches/Bungo/i386/boot2/boot.h =================================================================== --- branches/Bungo/i386/boot2/boot.h (revision 2838) +++ branches/Bungo/i386/boot2/boot.h (revision 2839) @@ -42,17 +42,17 @@ * 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 kLionInstallerPlist kLionInstallerDataFolder "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 kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist" //kernel path #define kDefaultKernelPathPreYos "/" @@ -61,147 +61,147 @@ /* * 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 kCDBootTimeout 8 /* * A global set by boot() to record the device that the booter was loaded from. @@ -240,8 +240,8 @@ */ extern void *loadACPITable(const char *filename); // Bungo: -extern void *new_dsdt, - *new_ecdt; +extern void *new_dsdt; +extern void *new_ecdt; /* * smbios.c @@ -329,16 +329,16 @@ /* * 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_t dst_size, + const void *src, + size_t src_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_t dst_size, + const void *src, + size_t src_size, + void *work); */ struct compressed_kernel_header { @@ -350,7 +350,7 @@ 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; Index: branches/Bungo/i386/boot2/modules.c =================================================================== --- branches/Bungo/i386/boot2/modules.c (revision 2838) +++ branches/Bungo/i386/boot2/modules.c (revision 2839) @@ -58,8 +58,8 @@ */ 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; @@ -85,9 +85,11 @@ } 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 } } @@ -207,7 +209,7 @@ // 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; } @@ -220,11 +222,11 @@ } 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) @@ -243,10 +245,10 @@ 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 } } @@ -254,9 +256,9 @@ { #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; } @@ -306,9 +308,9 @@ 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; @@ -338,6 +340,7 @@ { entry = entry->next; } + } //verbose("'%s' module not loaded.\n", name); @@ -371,7 +374,7 @@ #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; @@ -488,7 +491,7 @@ } } break; - case LC_SEGMENT_64: // 64bit macho's + case LC_SEGMENT_64: // 64bit macho's { segCommand64 = binary + binaryIndex; UInt32 sectionIndex; @@ -931,7 +934,7 @@ else { error("[ERROR!] Unable to bind symbol %s.\n", symbolName); - pause(""); + pause("[CONFIG_MODULE_DEBUG] "); } segmentAddress += sizeof(void*); @@ -950,7 +953,7 @@ else { error("[ERROR!] Unable to bind symbol %s.\n", symbolName); - pause(""); + pause("[CONFIG_MODULE_DEBUG] "); } segmentAddress += tmp + sizeof(void*); @@ -968,7 +971,7 @@ else { error("[ERROR!] Unable to bind symbol %s.\n", symbolName); - pause(""); + pause("[CONFIG_MODULE_DEBUG] "); } segmentAddress += (immediate * sizeof(void*)) + sizeof(void*); @@ -993,7 +996,7 @@ else { error("[ERROR!] Unable to bind symbol %s.\n", symbolName); - pause(""); + pause("[CONFIG_MODULE_DEBUG] "); } break; default: @@ -1124,12 +1127,12 @@ 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)); @@ -1138,6 +1141,7 @@ newHook->next = moduleCallbacks; moduleCallbacks = newHook; + } #if CONFIG_MODULE_DEBUG @@ -1179,8 +1183,8 @@ printf("Hook: %s\n", hooks->name); hooks = hooks->next; } + pause("[CONFIG_MODULE_DEBUG] "); } - #endif /********************************************************************************/ @@ -1190,7 +1194,7 @@ 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 */ @@ -1213,13 +1217,13 @@ 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; } Index: branches/Bungo/i386/boot2/bmdecompress.c =================================================================== --- branches/Bungo/i386/boot2/bmdecompress.c (revision 2838) +++ branches/Bungo/i386/boot2/bmdecompress.c (revision 2839) @@ -41,6 +41,12 @@ 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)); @@ -153,6 +159,12 @@ 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)); Index: branches/Bungo/i386/boot2/gui.c =================================================================== --- branches/Bungo/i386/boot2/gui.c (revision 2838) +++ branches/Bungo/i386/boot2/gui.c (revision 2839) @@ -889,8 +889,8 @@ int initGUI(void) { - int val; - int len; + int val; + int len; char dirspec[256]; getValueForKey( "Theme", &theme_name, &len, &bootInfo->chameleonConfig ); @@ -911,14 +911,16 @@ #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)); @@ -929,7 +931,7 @@ // 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) { @@ -2193,8 +2195,8 @@ } 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; @@ -2205,8 +2207,8 @@ // 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) ) { Index: branches/Bungo/i386/boot2/options.c =================================================================== --- branches/Bungo/i386/boot2/options.c (revision 2838) +++ branches/Bungo/i386/boot2/options.c (revision 2839) @@ -39,9 +39,9 @@ #endif char gMacOSVersion[OSVERSTRLEN]; -uint32_t MacOSVerCurrent = 0; -bool showBootBanner = true; //Azi:showinfo -static bool shouldboot = false; +uint32_t MacOSVerCurrent = 0; +bool showBootBanner = true; //Azi:showinfo +static bool shouldboot = false; extern int multiboot_timeout; extern int multiboot_timeout_set; @@ -70,31 +70,46 @@ // 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; } //========================================================================== @@ -143,12 +158,12 @@ 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 ); @@ -157,53 +172,53 @@ } 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 ) ); @@ -211,20 +226,20 @@ 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]; +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]; static void clearBootArgs(void) { @@ -257,7 +272,7 @@ if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { - changeCursor( 0, row, kCursorTypeUnderline, 0 ); + changeCursor( 0, row, kCursorTypeUnderline, 0 ); clearScreenRows( row, kScreenLastRow ); } @@ -295,50 +310,56 @@ 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; - } + } } //========================================================================== @@ -410,11 +431,11 @@ // 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++ ) @@ -423,7 +444,7 @@ } restoreCursor( &cursorState ); - } + } } //========================================================================== @@ -737,7 +758,7 @@ dump_pci_dt(root_pci_dev->children); - pause(""); + pause("\n[dump lspci] "); if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setActiveDisplayPage(0); @@ -1148,26 +1169,27 @@ 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; @@ -1231,8 +1253,10 @@ 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 @@ -1250,26 +1274,28 @@ } // 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; } @@ -1365,7 +1391,7 @@ 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)) @@ -1379,8 +1405,8 @@ val = valueBuffer; if (cnt > 0) { - copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); - } + copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); + } } else { @@ -1398,7 +1424,8 @@ } } /* Bungo - if (cnt > 0) { + if (cnt > 0) + { copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); } */ Index: branches/Bungo/i386/config/confdata.c =================================================================== --- branches/Bungo/i386/config/confdata.c (revision 2838) +++ branches/Bungo/i386/config/confdata.c (revision 2839) @@ -107,7 +107,8 @@ 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; Index: branches/Bungo/i386/libsa/zalloc.c =================================================================== --- branches/Bungo/i386/libsa/zalloc.c (revision 2838) +++ branches/Bungo/i386/libsa/zalloc.c (revision 2839) @@ -78,7 +78,8 @@ zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes; zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes; - if (size == 0) { + if (size == 0) + { size = ZALLOC_LEN; } @@ -108,8 +109,10 @@ size = ((size + 0xf) & ~0xf); - if (size == 0) { - if (zerror) { + if (size == 0) + { + if (zerror) + { (*zerror)((char *)0xdeadbeef, 0, file, line); } } @@ -154,13 +157,16 @@ #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 @@ -186,7 +192,8 @@ rp = 0; #endif - if (!start) { + if (!start) + { return; } @@ -207,8 +214,10 @@ break; } } - if (!found) { - if (zerror) { + if (!found) + { + if (zerror) + { (*zerror)(pointer, rp, "free", 0); } else { return; @@ -218,7 +227,8 @@ 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; @@ -227,15 +237,19 @@ 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); } } @@ -246,8 +260,10 @@ } } - if (++availableNodes > totalNodes) { - if (zerror) { + if (++availableNodes > totalNodes) + { + if (zerror) + { (*zerror)((char *)0xf000f000, 1, "free", 0); } } @@ -270,8 +286,10 @@ zalloced[allocedNodes].start = start; zalloced[allocedNodes].size = size; - if (++allocedNodes > totalNodes) { - if (zerror) { + if (++allocedNodes > totalNodes) + { + if (zerror) + { (*zerror)((char *)0xf000f000, 2, "zallocate", 0); } }; @@ -287,7 +305,8 @@ z1 = zp + i; z2 = z1 + 1; - for (; i >= ndx; i--, z1--, z2--) { + for (; i >= ndx; i--, z1--, z2--) + { *z2 = *z1; } } @@ -301,7 +320,8 @@ 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; } } @@ -311,8 +331,10 @@ { 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; Index: branches/Bungo/i386/libsa/string.c =================================================================== --- branches/Bungo/i386/libsa/string.c (revision 2838) +++ branches/Bungo/i386/libsa/string.c (revision 2839) @@ -141,20 +141,20 @@ /* 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 * @@ -181,7 +181,7 @@ { register char *ret = s1; while (n && (*s1++ = *s2++)) - --n; + --n; if (n > 0) { bzero(s1, n); @@ -193,12 +193,12 @@ 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 * Index: branches/Bungo/i386/libsa/prf.c =================================================================== --- branches/Bungo/i386/libsa/prf.c (revision 2838) +++ branches/Bungo/i386/libsa/prf.c (revision 2839) @@ -118,10 +118,11 @@ 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': Index: branches/Bungo/CREDITS =================================================================== --- branches/Bungo/CREDITS (revision 2838) +++ branches/Bungo/CREDITS (revision 2839) @@ -7,7 +7,7 @@ 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: --------- Index: branches/Bungo/doc/BootHelp.txt =================================================================== --- branches/Bungo/doc/BootHelp.txt (revision 2838) +++ branches/Bungo/doc/BootHelp.txt (revision 2839) @@ -79,9 +79,9 @@ 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= Inject alternate value of layout-id for HDEF (HEX). - HDAULayoutID= Inject alternate value of layout-id for HDAU (HEX). + HDAEnabler=Yes|No Automatic device-properties generation for audio controllers. + HDEFLayoutID= Inject alternate value of layout-id for HDEF (HEX). + HDAULayoutID= 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. Index: branches/Bungo/Make.rules =================================================================== --- branches/Bungo/Make.rules (revision 2838) +++ branches/Bungo/Make.rules (revision 2839) @@ -83,7 +83,7 @@ @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) Index: branches/Bungo/CHANGES =================================================================== --- branches/Bungo/CHANGES (revision 2838) +++ branches/Bungo/CHANGES (revision 2839) @@ -1,4 +1,3 @@ -- 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