From 8209394af9c2106a9bfa8f4401ae996f4a248d47 Mon Sep 17 00:00:00 2001 From: jief666 Date: Thu, 11 Feb 2021 14:41:59 +0300 Subject: [PATCH] Continuing to refactor SETTINGS_DATA. --- Include/Library/printf_lite.h | 2 +- .../openssl-1.0.1e/include/openssl/aes.h | 2 +- .../openssl-1.0.1e/include/openssl/asn1.h | 14 +- .../openssl-1.0.1e/include/openssl/asn1_mac.h | 2 +- .../openssl-1.0.1e/include/openssl/asn1t.h | 4 +- .../openssl-1.0.1e/include/openssl/bio.h | 4 +- .../openssl-1.0.1e/include/openssl/blowfish.h | 2 +- .../openssl-1.0.1e/include/openssl/bn.h | 6 +- .../openssl-1.0.1e/include/openssl/buffer.h | 2 +- .../openssl-1.0.1e/include/openssl/cast.h | 2 +- .../openssl-1.0.1e/include/openssl/cmac.h | 2 +- .../openssl-1.0.1e/include/openssl/comp.h | 2 +- .../openssl-1.0.1e/include/openssl/conf.h | 12 +- .../openssl-1.0.1e/include/openssl/conf_api.h | 4 +- .../openssl-1.0.1e/include/openssl/crypto.h | 14 +- .../openssl-1.0.1e/include/openssl/des.h | 4 +- .../openssl-1.0.1e/include/openssl/des_old.h | 8 +- .../openssl-1.0.1e/include/openssl/dh.h | 8 +- .../openssl-1.0.1e/include/openssl/dsa.h | 12 +- .../openssl-1.0.1e/include/openssl/dso.h | 2 +- .../openssl-1.0.1e/include/openssl/e_os2.h | 2 +- .../openssl-1.0.1e/include/openssl/ec.h | 8 +- .../openssl-1.0.1e/include/openssl/ecdh.h | 8 +- .../openssl-1.0.1e/include/openssl/ecdsa.h | 8 +- .../openssl-1.0.1e/include/openssl/engine.h | 26 +- .../openssl-1.0.1e/include/openssl/err.h | 8 +- .../openssl-1.0.1e/include/openssl/evp.h | 12 +- .../openssl-1.0.1e/include/openssl/hmac.h | 4 +- .../openssl-1.0.1e/include/openssl/idea.h | 2 +- .../openssl-1.0.1e/include/openssl/krb5_asn.h | 2 +- .../openssl-1.0.1e/include/openssl/lhash.h | 4 +- .../openssl-1.0.1e/include/openssl/md2.h | 2 +- .../openssl-1.0.1e/include/openssl/md4.h | 2 +- .../openssl-1.0.1e/include/openssl/md5.h | 2 +- .../openssl-1.0.1e/include/openssl/objects.h | 6 +- .../openssl-1.0.1e/include/openssl/ocsp.h | 8 +- .../openssl-1.0.1e/include/openssl/ossl_typ.h | 2 +- .../openssl-1.0.1e/include/openssl/pem.h | 14 +- .../openssl-1.0.1e/include/openssl/pkcs12.h | 4 +- .../openssl-1.0.1e/include/openssl/pkcs7.h | 10 +- .../openssl-1.0.1e/include/openssl/rand.h | 4 +- .../openssl-1.0.1e/include/openssl/rc2.h | 2 +- .../openssl-1.0.1e/include/openssl/rc4.h | 2 +- .../openssl-1.0.1e/include/openssl/ripemd.h | 2 +- .../openssl-1.0.1e/include/openssl/rsa.h | 10 +- .../include/openssl/safestack.h | 2 +- .../openssl-1.0.1e/include/openssl/sha.h | 2 +- .../openssl-1.0.1e/include/openssl/store.h | 10 +- .../openssl-1.0.1e/include/openssl/symhacks.h | 2 +- .../openssl-1.0.1e/include/openssl/ts.h | 26 +- .../openssl-1.0.1e/include/openssl/txt_db.h | 8 +- .../openssl-1.0.1e/include/openssl/ui.h | 6 +- .../include/openssl/ui_compat.h | 4 +- .../openssl-1.0.1e/include/openssl/whrlpool.h | 2 +- .../openssl-1.0.1e/include/openssl/x509.h | 36 +- .../openssl-1.0.1e/include/openssl/x509_vfy.h | 12 +- .../openssl-1.0.1e/include/openssl/x509v3.h | 6 +- .../rEFIt_UEFI/include/XToolsConf.h | 8 +- .../project.pbxproj | 9 + Xcode/cpp_tests/src/main.cpp | 2 +- Xcode/cpp_tests/src/xcode_utf_fixed.cpp | 4 +- rEFIt_UEFI/Platform/AcpiPatcher.cpp | 130 +- rEFIt_UEFI/Platform/DataHubCpu.cpp | 4 +- rEFIt_UEFI/Platform/FixBiosDsdt.cpp | 108 +- rEFIt_UEFI/Platform/Settings.cpp | 1453 +++++++++-------- rEFIt_UEFI/Platform/Settings.h | 162 +- rEFIt_UEFI/Platform/StateGenerator.cpp | 72 +- rEFIt_UEFI/Platform/platformdata.cpp | 28 +- rEFIt_UEFI/cpp_unit_test/all_tests.cpp | 2 +- rEFIt_UEFI/cpp_unit_test/config-test.cpp | 2 +- rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp | 200 ++- rEFIt_UEFI/entry_scan/common.cpp | 2 +- rEFIt_UEFI/entry_scan/common.h | 6 +- rEFIt_UEFI/entry_scan/secureboot.cpp | 64 +- rEFIt_UEFI/entry_scan/securehash.cpp | 2 +- rEFIt_UEFI/entry_scan/securemenu.cpp | 125 +- rEFIt_UEFI/entry_scan/securevars.cpp | 13 +- rEFIt_UEFI/refit/main.cpp | 73 +- rEFIt_UEFI/refit/menu.cpp | 102 +- 79 files changed, 1548 insertions(+), 1401 deletions(-) diff --git a/Include/Library/printf_lite.h b/Include/Library/printf_lite.h index f3e131030..91f334f72 100755 --- a/Include/Library/printf_lite.h +++ b/Include/Library/printf_lite.h @@ -269,7 +269,7 @@ typedef union { inline void printf_with_callback(const char* format, transmitBufCallBackType transmitBufCallBack, void* context, ...) { PRINTF_VA_LIST va; va_start(va, context); - vprintf_with_callback_timestamp(foPRINTF_VA_ENDva, transmitBufCallBack, context, NULL, 0); + vprintf_with_callback_timestamp(format, va, transmitBufCallBack, context, NULL, 0); PRINTF_VA_END(va); } # endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/aes.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/aes.h index 031abf01b..7d4a150e8 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/aes.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/aes.h @@ -52,7 +52,7 @@ #ifndef HEADER_AES_H #define HEADER_AES_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_AES #error AES is disabled. diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1.h index 220a0c8c6..629b7d2ba 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1.h @@ -60,18 +60,18 @@ #define HEADER_ASN1_H #include -#include +#include "e_os2.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include +#include "stack.h" +#include "safestack.h" -#include +#include "symhacks.h" -#include +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifdef OPENSSL_BUILD_SHLIBCRYPTO diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1_mac.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1_mac.h index 87bd0e9e1..e8929d045 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1_mac.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1_mac.h @@ -59,7 +59,7 @@ #ifndef HEADER_ASN1_MAC_H #define HEADER_ASN1_MAC_H -#include +#include "asn1.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1t.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1t.h index d230e4bf7..eb78f4c3c 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1t.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/asn1t.h @@ -59,8 +59,8 @@ #define HEADER_ASN1T_H #include -#include -#include +#include "e_os2.h" +#include "asn1.h" #ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/bio.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/bio.h index 997dd63d4..bc8003715 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/bio.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/bio.h @@ -59,14 +59,14 @@ #ifndef HEADER_BIO_H #define HEADER_BIO_H -#include +#include "e_os2.h" #ifndef OPENSSL_NO_FP_API # include #endif #include -#include +#include "crypto.h" #ifndef OPENSSL_NO_SCTP # ifndef OPENSSL_SYS_VMS diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/blowfish.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/blowfish.h index 4b6c8920a..698a92465 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/blowfish.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/blowfish.h @@ -59,7 +59,7 @@ #ifndef HEADER_BLOWFISH_H #define HEADER_BLOWFISH_H -#include +#include "e_os2.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/bn.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/bn.h index f34248ec4..eafd276b2 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/bn.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/bn.h @@ -125,12 +125,12 @@ #ifndef HEADER_BN_H #define HEADER_BN_H -#include +#include "e_os2.h" #ifndef OPENSSL_NO_FP_API #include /* FILE */ #endif -#include -#include +#include "ossl_typ.h" +#include "crypto.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/buffer.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/buffer.h index 178e41828..b4ab9498f 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/buffer.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/buffer.h @@ -59,7 +59,7 @@ #ifndef HEADER_BUFFER_H #define HEADER_BUFFER_H -#include +#include "ossl_typ.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/cast.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/cast.h index 203922ea2..0a2a52c18 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/cast.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/cast.h @@ -63,7 +63,7 @@ extern "C" { #endif -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_CAST #error CAST is disabled. diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/cmac.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/cmac.h index 712e92dce..9ab0d2520 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/cmac.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/cmac.h @@ -59,7 +59,7 @@ extern "C" { #endif -#include +#include "evp.h" /* Opaque */ typedef struct CMAC_CTX_st CMAC_CTX; diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/comp.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/comp.h index 4b405c7d4..306da3f74 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/comp.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/comp.h @@ -2,7 +2,7 @@ #ifndef HEADER_COMP_H #define HEADER_COMP_H -#include +#include "crypto.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf.h index c2199978a..57f513768 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf.h @@ -59,13 +59,13 @@ #ifndef HEADER_CONF_H #define HEADER_CONF_H -#include -#include -#include -#include -#include +#include "bio.h" +#include "lhash.h" +#include "stack.h" +#include "safestack.h" +#include "e_os2.h" -#include +#include "ossl_typ.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf_api.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf_api.h index 87a954aff..2efea8882 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf_api.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/conf_api.h @@ -59,8 +59,8 @@ #ifndef HEADER_CONF_API_H #define HEADER_CONF_API_H -#include -#include +#include "lhash.h" +#include "conf.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/crypto.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/crypto.h index 7e22c1cc6..e41ac2725 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/crypto.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/crypto.h @@ -119,24 +119,24 @@ #include -#include +#include "e_os2.h" #ifndef OPENSSL_NO_FP_API #include #endif -#include -#include -#include -#include +#include "stack.h" +#include "safestack.h" +#include "opensslv.h" +#include "ossl_typ.h" #ifdef CHARSET_EBCDIC -#include +#include "ebcdic.h" #endif /* Resolve problems on some operating systems with symbol names that clash one way or another */ -#include +#include "symhacks.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/des.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/des.h index 1eaedcbd2..61991ffa8 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/des.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/des.h @@ -59,7 +59,7 @@ #ifndef HEADER_NEW_DES_H #define HEADER_NEW_DES_H -#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, +#include "e_os2.h" /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG (via openssl/opensslconf.h */ #ifdef OPENSSL_NO_DES @@ -98,7 +98,7 @@ typedef struct DES_ks #endif #ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT -# include +# include "des_old.h" #endif #define DES_KEY_SZ (sizeof(DES_cblock)) diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/des_old.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/des_old.h index 2b2c37235..a82109371 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/des_old.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/des_old.h @@ -91,7 +91,7 @@ #ifndef HEADER_DES_H #define HEADER_DES_H -#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ +#include "e_os2.h" /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ #ifdef OPENSSL_NO_DES #error DES is disabled. @@ -102,10 +102,10 @@ #endif #ifdef _KERBEROS_DES_H -#error replaces . +#error "des_old.h> replaces +#include "symhacks.h" #ifdef OPENSSL_BUILD_SHLIBCRYPTO # undef OPENSSL_EXTERN @@ -441,6 +441,6 @@ void _ossl_096_des_random_seed(des_cblock *key); #endif /* for DES_read_pw_string et al */ -#include +#include "ui_compat.h" #endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dh.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dh.h index ea59e610e..1e5ab4cb6 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dh.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dh.h @@ -59,18 +59,18 @@ #ifndef HEADER_DH_H #define HEADER_DH_H -#include +#include "e_os2.h" #ifdef OPENSSL_NO_DH #error DH is disabled. #endif #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifndef OPENSSL_DH_MAX_MODULUS_BITS diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dsa.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dsa.h index a6f6d0b0b..b13569b9e 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dsa.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dsa.h @@ -65,22 +65,22 @@ #ifndef HEADER_DSA_H #define HEADER_DSA_H -#include +#include "e_os2.h" #ifdef OPENSSL_NO_DSA #error DSA is disabled. #endif #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include +#include "crypto.h" +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #ifndef OPENSSL_NO_DH -# include +# include "dh.h" #endif #endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dso.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dso.h index 839f2e061..e89c73c21 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/dso.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/dso.h @@ -59,7 +59,7 @@ #ifndef HEADER_DSO_H #define HEADER_DSO_H -#include +#include "crypto.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/e_os2.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/e_os2.h index d22c0368f..836099768 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/e_os2.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/e_os2.h @@ -53,7 +53,7 @@ * */ -#include +#include "opensslconf.h" #ifndef HEADER_E_OS2_H #define HEADER_E_OS2_H diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ec.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ec.h index dfe8710d3..bb5499c5a 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ec.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ec.h @@ -76,16 +76,16 @@ #ifndef HEADER_EC_H #define HEADER_EC_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_EC #error EC is disabled. #endif -#include -#include +#include "asn1.h" +#include "symhacks.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdh.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdh.h index 8887102c0..5a401bde7 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdh.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdh.h @@ -69,16 +69,16 @@ #ifndef HEADER_ECDH_H #define HEADER_ECDH_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_ECDH #error ECDH is disabled. #endif -#include -#include +#include "ec.h" +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdsa.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdsa.h index 7fb5254b6..2edf0f8fc 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdsa.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ecdsa.h @@ -59,16 +59,16 @@ #ifndef HEADER_ECDSA_H #define HEADER_ECDSA_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_ECDSA #error ECDSA is disabled. #endif -#include -#include +#include "ec.h" +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/engine.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/engine.h index f8be49772..70cf34316 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/engine.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/engine.h @@ -64,38 +64,38 @@ #ifndef HEADER_ENGINE_H #define HEADER_ENGINE_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_ENGINE #error ENGINE is disabled. #endif #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #ifndef OPENSSL_NO_RSA -#include +#include "rsa.h" #endif #ifndef OPENSSL_NO_DSA -#include +#include "dsa.h" #endif #ifndef OPENSSL_NO_DH -#include +#include "dh.h" #endif #ifndef OPENSSL_NO_ECDH -#include +#include "ecdh.h" #endif #ifndef OPENSSL_NO_ECDSA -#include +#include "ecdsa.h" #endif -#include -#include -#include +#include "rand.h" +#include "ui.h" +#include "err.h" #endif -#include -#include +#include "ossl_typ.h" +#include "symhacks.h" -#include +#include "x509.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h index 974cc9cc6..8fd9850b7 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h @@ -112,19 +112,19 @@ #ifndef HEADER_ERR_H #define HEADER_ERR_H -#include +#include "e_os2.h" #ifndef OPENSSL_NO_FP_API #include #include #endif -#include +#include "ossl_typ.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif #ifndef OPENSSL_NO_LHASH -#include +#include "lhash.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/evp.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/evp.h index faeb3c24e..16e90649e 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/evp.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/evp.h @@ -60,19 +60,19 @@ #define HEADER_ENVELOPE_H #ifdef OPENSSL_ALGORITHM_DEFINES -# include +# include "opensslconf.h" #else # define OPENSSL_ALGORITHM_DEFINES -# include +# include "opensslconf.h" # undef OPENSSL_ALGORITHM_DEFINES #endif -#include +#include "ossl_typ.h" -#include +#include "symhacks.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif /* @@ -91,7 +91,7 @@ /* Default PKCS#5 iteration count */ #define PKCS5_DEFAULT_ITER 2048 -#include +#include "objects.h" #define EVP_PK_RSA 0x0001 #define EVP_PK_DSA 0x0002 diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/hmac.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/hmac.h index 1be002219..fb00c7711 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/hmac.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/hmac.h @@ -58,13 +58,13 @@ #ifndef HEADER_HMAC_H #define HEADER_HMAC_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_HMAC #error HMAC is disabled. #endif -#include +#include "evp.h" #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/idea.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/idea.h index e9a1e7f1a..523bf9153 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/idea.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/idea.h @@ -59,7 +59,7 @@ #ifndef HEADER_IDEA_H #define HEADER_IDEA_H -#include /* IDEA_INT, OPENSSL_NO_IDEA */ +#include "opensslconf.h" /* IDEA_INT, OPENSSL_NO_IDEA */ #ifdef OPENSSL_NO_IDEA #error IDEA is disabled. diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/krb5_asn.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/krb5_asn.h index 41725d0dc..fada9a8f6 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/krb5_asn.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/krb5_asn.h @@ -63,7 +63,7 @@ /* #include */ -#include +#include "safestack.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/lhash.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/lhash.h index e7d876359..f9c10d527 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/lhash.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/lhash.h @@ -63,13 +63,13 @@ #ifndef HEADER_LHASH_H #define HEADER_LHASH_H -#include +#include "e_os2.h" #ifndef OPENSSL_NO_FP_API #include #endif #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md2.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md2.h index d59c9f259..61dcfd2f2 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md2.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md2.h @@ -59,7 +59,7 @@ #ifndef HEADER_MD2_H #define HEADER_MD2_H -#include /* OPENSSL_NO_MD2, MD2_INT */ +#include "opensslconf.h" /* OPENSSL_NO_MD2, MD2_INT */ #ifdef OPENSSL_NO_MD2 #error MD2 is disabled. #endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md4.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md4.h index a55368a79..d8dd5c21f 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md4.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md4.h @@ -59,7 +59,7 @@ #ifndef HEADER_MD4_H #define HEADER_MD4_H -#include +#include "e_os2.h" #include #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md5.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md5.h index 541cc925f..57ba303f1 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/md5.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/md5.h @@ -59,7 +59,7 @@ #ifndef HEADER_MD5_H #define HEADER_MD5_H -#include +#include "e_os2.h" #include #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/objects.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/objects.h index bd0ee52fe..965773827 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/objects.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/objects.h @@ -62,7 +62,7 @@ #define USE_OBJ_MAC #ifdef USE_OBJ_MAC -#include +#include "obj_mac.h" #else #define SN_undef "UNDEF" #define LN_undef "undefined" @@ -956,8 +956,8 @@ #define OBJ_OCSP_sign OBJ_id_kp,9L #endif /* USE_OBJ_MAC */ -#include -#include +#include "bio.h" +#include "asn1.h" #define OBJ_NAME_TYPE_UNDEF 0x00 #define OBJ_NAME_TYPE_MD_METH 0x01 diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ocsp.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ocsp.h index 31e45744b..bb14c215b 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ocsp.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ocsp.h @@ -64,10 +64,10 @@ #ifndef HEADER_OCSP_H #define HEADER_OCSP_H -#include -#include -#include -#include +#include "ossl_typ.h" +#include "x509.h" +#include "x509v3.h" +#include "safestack.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ossl_typ.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ossl_typ.h index ea9227f6f..5d02d1864 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ossl_typ.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ossl_typ.h @@ -55,7 +55,7 @@ #ifndef HEADER_OPENSSL_TYPES_H #define HEADER_OPENSSL_TYPES_H -#include +#include "e_os2.h" #ifdef NO_ASN1_TYPEDEFS #define ASN1_INTEGER ASN1_STRING diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h index 5bf982ce4..6a5c1c81a 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h @@ -59,16 +59,16 @@ #ifndef HEADER_PEM_H #define HEADER_PEM_H -#include +#include "e_os2.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif #ifndef OPENSSL_NO_STACK -#include +#include "stack.h" #endif -#include -#include -#include +#include "evp.h" +#include "x509.h" +#include "pem2.h" #ifdef __cplusplus extern "C" { @@ -455,7 +455,7 @@ void PEM_proc_type(char *buf, int type); void PEM_dek_info(char *buf, const char *type, int len, char *str); -#include +#include "symhacks.h" DECLARE_PEM_rw(X509, X509) diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs12.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs12.h index b17eb9f42..3442059d0 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs12.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs12.h @@ -59,8 +59,8 @@ #ifndef HEADER_PKCS12_H #define HEADER_PKCS12_H -#include -#include +#include "bio.h" +#include "x509.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs7.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs7.h index e4d443193..f4111991d 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs7.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/pkcs7.h @@ -59,12 +59,12 @@ #ifndef HEADER_PKCS7_H #define HEADER_PKCS7_H -#include -#include -#include +#include "asn1.h" +#include "bio.h" +#include "e_os2.h" -#include -#include +#include "symhacks.h" +#include "ossl_typ.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rand.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rand.h index dc8fcf94c..54f4f0e33 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rand.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rand.h @@ -60,8 +60,8 @@ #define HEADER_RAND_H #include -#include -#include +#include "ossl_typ.h" +#include "e_os2.h" #if defined(OPENSSL_SYS_WINDOWS) #include diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc2.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc2.h index e542ec94f..e8c5510b6 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc2.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc2.h @@ -59,7 +59,7 @@ #ifndef HEADER_RC2_H #define HEADER_RC2_H -#include /* OPENSSL_NO_RC2, RC2_INT */ +#include "opensslconf.h" /* OPENSSL_NO_RC2, RC2_INT */ #ifdef OPENSSL_NO_RC2 #error RC2 is disabled. #endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc4.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc4.h index 88ceb46bc..213ddc01f 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc4.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rc4.h @@ -59,7 +59,7 @@ #ifndef HEADER_RC4_H #define HEADER_RC4_H -#include /* OPENSSL_NO_RC4, RC4_INT */ +#include "opensslconf.h" /* OPENSSL_NO_RC4, RC4_INT */ #ifdef OPENSSL_NO_RC4 #error RC4 is disabled. #endif diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ripemd.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ripemd.h index 189bd8c90..98fa7063b 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ripemd.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ripemd.h @@ -59,7 +59,7 @@ #ifndef HEADER_RIPEMD_H #define HEADER_RIPEMD_H -#include +#include "e_os2.h" #include #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rsa.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rsa.h index 5f269e577..20dcb5dae 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/rsa.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/rsa.h @@ -59,15 +59,15 @@ #ifndef HEADER_RSA_H #define HEADER_RSA_H -#include +#include "asn1.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include +#include "crypto.h" +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include +#include "bn.h" #endif #ifdef OPENSSL_NO_RSA diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/safestack.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/safestack.h index ea3aa0d80..7c718090b 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/safestack.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/safestack.h @@ -55,7 +55,7 @@ #ifndef HEADER_SAFESTACK_H #define HEADER_SAFESTACK_H -#include +#include "stack.h" #ifndef CHECKED_PTR_OF #define CHECKED_PTR_OF(type, p) \ diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h index 8a6bf4bbb..3a4227e71 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h @@ -59,7 +59,7 @@ #ifndef HEADER_SHA_H #define HEADER_SHA_H -#include +#include "e_os2.h" #include #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/store.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/store.h index 0a28c7d5a..920fd2409 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/store.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/store.h @@ -59,17 +59,17 @@ #ifndef HEADER_STORE_H #define HEADER_STORE_H -#include +#include "opensslconf.h" #ifdef OPENSSL_NO_STORE #error STORE is disabled. #endif -#include +#include "ossl_typ.h" #ifndef OPENSSL_NO_DEPRECATED -#include -#include -#include +#include "evp.h" +#include "bn.h" +#include "x509.h" #endif #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/symhacks.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/symhacks.h index 07a412f84..48fbfd98d 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/symhacks.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/symhacks.h @@ -55,7 +55,7 @@ #ifndef HEADER_SYMHACKS_H #define HEADER_SYMHACKS_H -#include +#include "e_os2.h" /* Hacks to solve the problem with linkers incapable of handling very long symbol names. In the case of VMS, the limit is 31 characters on VMS for diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ts.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ts.h index c2448e3c3..884c70abd 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ts.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ts.h @@ -59,31 +59,31 @@ #ifndef HEADER_TS_H #define HEADER_TS_H -#include -#include +#include "opensslconf.h" +#include "symhacks.h" #ifndef OPENSSL_NO_BUFFER -#include +#include "buffer.h" #endif #ifndef OPENSSL_NO_EVP -#include +#include "evp.h" #endif #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include -#include +#include "stack.h" +#include "asn1.h" +#include "safestack.h" #ifndef OPENSSL_NO_RSA -#include +#include "rsa.h" #endif #ifndef OPENSSL_NO_DSA -#include +#include "dsa.h" #endif #ifndef OPENSSL_NO_DH -#include +#include "dh.h" #endif #ifdef __cplusplus @@ -95,8 +95,8 @@ extern "C" { #undef X509_NAME #endif -#include -#include +#include "x509.h" +#include "x509v3.h" /* MessageImprint ::= SEQUENCE { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/txt_db.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/txt_db.h index 6abe435bc..7fda36197 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/txt_db.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/txt_db.h @@ -59,12 +59,12 @@ #ifndef HEADER_TXT_DB_H #define HEADER_TXT_DB_H -#include +#include "opensslconf.h" #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include +#include "stack.h" +#include "lhash.h" #define DB_ERROR_OK 0 #define DB_ERROR_MALLOC 1 diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui.h index bd78aa413..20c6034ec 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui.h @@ -60,10 +60,10 @@ #define HEADER_UI_H #ifndef OPENSSL_NO_DEPRECATED -#include +#include "crypto.h" #endif -#include -#include +#include "safestack.h" +#include "ossl_typ.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui_compat.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui_compat.h index b35c9bb7f..d3ec71fe3 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui_compat.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/ui_compat.h @@ -59,8 +59,8 @@ #ifndef HEADER_UI_COMPAT_H #define HEADER_UI_COMPAT_H -#include -#include +#include "opensslconf.h" +#include "ui.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/whrlpool.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/whrlpool.h index 9e01f5b07..b63fcdace 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/whrlpool.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/whrlpool.h @@ -1,7 +1,7 @@ #ifndef HEADER_WHRLPOOL_H #define HEADER_WHRLPOOL_H -#include +#include "e_os2.h" #include #ifdef __cplusplus diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509.h index 092dd7450..840358c6f 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509.h @@ -64,49 +64,49 @@ #ifndef HEADER_X509_H #define HEADER_X509_H -#include -#include +#include "e_os2.h" +#include "symhacks.h" #ifndef OPENSSL_NO_BUFFER -#include +#include "buffer.h" #endif #ifndef OPENSSL_NO_EVP -#include +#include "evp.h" #endif #ifndef OPENSSL_NO_BIO -#include +#include "bio.h" #endif -#include -#include -#include +#include "stack.h" +#include "asn1.h" +#include "safestack.h" #ifndef OPENSSL_NO_EC -#include +#include "ec.h" #endif #ifndef OPENSSL_NO_ECDSA -#include +#include "ecdsa.h" #endif #ifndef OPENSSL_NO_ECDH -#include +#include "ecdh.h" #endif #ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_RSA -#include +#include "rsa.h" #endif #ifndef OPENSSL_NO_DSA -#include +#include "dsa.h" #endif #ifndef OPENSSL_NO_DH -#include +#include "dh.h" #endif #endif #ifndef OPENSSL_NO_SHA -#include +#include "sha.h" #endif -#include +#include "ossl_typ.h" #ifdef __cplusplus extern "C" { @@ -597,8 +597,8 @@ struct pkcs8_priv_key_info_st } #endif -#include -#include +#include "x509_vfy.h" +#include "pkcs7.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509_vfy.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509_vfy.h index fe09b30aa..d8c73e388 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509_vfy.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509_vfy.h @@ -57,7 +57,7 @@ */ #ifndef HEADER_X509_H -#include +#include "x509.h" /* openssl/x509.h ends up #include-ing this file at about the only * appropriate moment. */ #endif @@ -65,13 +65,13 @@ #ifndef HEADER_X509_VFY_H #define HEADER_X509_VFY_H -#include +#include "opensslconf.h" #ifndef OPENSSL_NO_LHASH -#include +#include "lhash.h" #endif -#include -#include -#include +#include "bio.h" +#include "crypto.h" +#include "symhacks.h" #ifdef __cplusplus extern "C" { diff --git a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509v3.h b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509v3.h index b308abe7c..865ebd9df 100644 --- a/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509v3.h +++ b/Library/OpensslLib/openssl-1.0.1e/include/openssl/x509v3.h @@ -58,9 +58,9 @@ #ifndef HEADER_X509V3_H #define HEADER_X509V3_H -#include -#include -#include +#include "bio.h" +#include "x509.h" +#include "conf.h" #ifdef __cplusplus extern "C" { diff --git a/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/include/XToolsConf.h b/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/include/XToolsConf.h index 5514e6800..0a01b6591 100755 --- a/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/include/XToolsConf.h +++ b/Xcode/CloverX64TestNewParser/CloverMock/rEFIt_UEFI/include/XToolsConf.h @@ -23,10 +23,10 @@ #define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize) -//#include #include "../Platform/Posix/posix.h" -//#include -//#include "../../../rEFIt_UEFI/Platform/Posix/abort.h" -//#include + +#define XTOOLS_VA_LIST va_list +#define XTOOLS_VA_START va_start +#define XTOOLS_VA_END va_end #endif diff --git a/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj b/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj index 84999dbc1..f628fce72 100644 --- a/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64TestNewParser/CloverX64TestNewParser.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 9A0B085E240300E000E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; }; + 9A272A7F25D5062E00F03E19 /* DataHub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A272A7D25D5062D00F03E19 /* DataHub.cpp */; }; 9A28CD1F241BB61B00F3D247 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; }; 9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; }; 9A358B2025CF115200A3850D /* Config_GUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A358AF425CF115100A3850D /* Config_GUI.cpp */; }; @@ -269,6 +270,9 @@ 9A0B084A2402FE9300E2B470 /* XArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = ""; }; 9A0B084B2402FE9300E2B470 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = ""; }; 9A0B085D240300E000E2B470 /* Platform.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = ""; }; + 9A272A7C25D5062D00F03E19 /* DataHubExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataHubExt.h; sourceTree = ""; }; + 9A272A7D25D5062D00F03E19 /* DataHub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataHub.cpp; sourceTree = ""; }; + 9A272A7E25D5062E00F03E19 /* DataHub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataHub.h; sourceTree = ""; }; 9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = ""; }; 9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = ""; }; 9A358AF425CF115100A3850D /* Config_GUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Config_GUI.cpp; sourceTree = ""; }; @@ -5252,6 +5256,9 @@ 9A28CCAC241B816400F3D247 /* Platform */ = { isa = PBXGroup; children = ( + 9A272A7D25D5062D00F03E19 /* DataHub.cpp */, + 9A272A7E25D5062E00F03E19 /* DataHub.h */, + 9A272A7C25D5062D00F03E19 /* DataHubExt.h */, 9A358AF325CF115100A3850D /* ConfigPlist */, 9AA9240D25CD5B2D00BD5E8B /* AcpiPatcher.cpp */, 9AA9240825CD5B2C00BD5E8B /* AcpiPatcher.h */, @@ -16012,6 +16019,7 @@ 9AA925CE25CD94C600BD5E8B /* BootLog.cpp in Sources */, 9A358B3025CF115200A3850D /* Config_Graphics.cpp in Sources */, 9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */, + 9A272A7F25D5062E00F03E19 /* DataHub.cpp in Sources */, 9AA918C125CD4B7900BD5E8B /* lib.cpp in Sources */, 9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */, 9AFDD08D25CE731000EEAF06 /* plist_tests.cpp in Sources */, @@ -16109,6 +16117,7 @@ "wcsncmp=wcsncmp_fixed", "wcsstr=wcsstr_fixed", "sprintf=__sprintf_is_disabled__", + "___NOT___ENABLE_SECURE_BOOT", ); GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; diff --git a/Xcode/cpp_tests/src/main.cpp b/Xcode/cpp_tests/src/main.cpp index 12383d0ce..72ea282ca 100755 --- a/Xcode/cpp_tests/src/main.cpp +++ b/Xcode/cpp_tests/src/main.cpp @@ -18,7 +18,7 @@ extern "C" int main(int argc, const char * argv[]) (void)argv; setlocale(LC_ALL, "en_US"); // to allow printf unicode char - xcode_utf_fixed_tests(); +// xcode_utf_fixed_tests(); return all_tests() ? 0 : -1 ; diff --git a/Xcode/cpp_tests/src/xcode_utf_fixed.cpp b/Xcode/cpp_tests/src/xcode_utf_fixed.cpp index 3b13fe908..ebae2ea1e 100644 --- a/Xcode/cpp_tests/src/xcode_utf_fixed.cpp +++ b/Xcode/cpp_tests/src/xcode_utf_fixed.cpp @@ -56,8 +56,8 @@ extern "C" void xcode_utf_fixed_tests() #endif uint64_t uint64 = 1; - printf("Hello world൧楔 %llu error(s)\n", uint64); - DebugLog(2, "Hello world൧楔 %llu error(s)\n", uint64); + printf("Hello world൧楔 %llu \n", uint64); + DebugLog(2, "Hello world൧楔 %llu \n", uint64); size_t len1 = wcslen(L"Hell൧楔o world൧楔"); size_t len1f = wcslen_fixed(L"Hell൧楔o world൧楔"); diff --git a/rEFIt_UEFI/Platform/AcpiPatcher.cpp b/rEFIt_UEFI/Platform/AcpiPatcher.cpp index c5095dd1f..a89eb4ab3 100644 --- a/rEFIt_UEFI/Platform/AcpiPatcher.cpp +++ b/rEFIt_UEFI/Platform/AcpiPatcher.cpp @@ -249,8 +249,8 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index) DropTable->TableId = Table->OemTableId; DropTable->Length = Table->Length; DropTable->MenuItem.BValue = FALSE; - DropTable->Next = gSettings.ACPIDropTables; - gSettings.ACPIDropTables = DropTable; + DropTable->Next = GlobalConfig.ACPIDropTables; + GlobalConfig.ACPIDropTables = DropTable; } void GetAcpiTablesList() @@ -258,7 +258,7 @@ void GetAcpiTablesList() DbgHeader("GetAcpiTablesList"); GetFadt(); //this is a first call to acpi, we need it to make a pointer to Xsdt - gSettings.ACPIDropTables = NULL; + GlobalConfig.ACPIDropTables = NULL; DBG("Get Acpi Tables List "); if (Xsdt) { @@ -398,7 +398,7 @@ BOOLEAN FixAsciiTableHeader(UINT8 *Str, UINTN Len) BOOLEAN PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header) { BOOLEAN Ret1, Ret2, Ret3; - if (!(gSettings.FixDsdt & FIX_HEADERS) && !gSettings.FixHeaders) { + if (!(gSettings.ACPI.DSDT.FixDsdt & FIX_HEADERS) && !gSettings.ACPI.FixHeaders) { return FALSE; } Ret1 = FixAsciiTableHeader((UINT8*)&Header->CreatorId, 4); @@ -437,7 +437,7 @@ void PatchAllTables() } EFI_ACPI_DESCRIPTION_HEADER* NewTable = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)BufferPtr; CopyMem(NewTable, Table, Len); - if ((gSettings.FixDsdt & FIX_HEADERS) || gSettings.FixHeaders) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_HEADERS) || gSettings.ACPI.FixHeaders) { // Merged tables already have the header patched, so no need to do it again if (!IsXsdtEntryMerged(IndexFromXsdtEntryPtr(Ptr))) { // table header NOT already patched @@ -445,31 +445,31 @@ void PatchAllTables() } } if (NewTable->Signature == EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) { - if (gSettings.DSDTPatchArray.size() > 0) { - DBG("Patching SSDTs: %zu patches each\n", gSettings.DSDTPatchArray.size()); + if (gSettings.ACPI.DSDT.DSDTPatchArray.size() > 0) { + DBG("Patching SSDTs: %zu patches each\n", gSettings.ACPI.DSDT.DSDTPatchArray.size()); // CHAR8 OTID[9]; // OTID[8] = 0; // CopyMem(OTID, &NewTable->OemTableId, 8); // DBG("Patching SSDT %s Length=%d\n", OTID, (INT32)Len); - for (UINT32 i = 0; i < gSettings.DSDTPatchArray.size(); i++) { - if ( gSettings.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { + for (UINT32 i = 0; i < gSettings.ACPI.DSDT.DSDTPatchArray.size(); i++) { + if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { continue; } // DBG("%d. [%s]:", i, gSettings.PatchDsdtLabel[i]); - if (!gSettings.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { + if (!gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { // DBG(" disabled\n"); continue; } - if ( gSettings.DSDTPatchArray[i].PatchDsdtTgt.isEmpty() ) { + if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt.isEmpty() ) { Len = FixAny((UINT8*)NewTable, Len, - gSettings.DSDTPatchArray[i].PatchDsdtFind, - gSettings.DSDTPatchArray[i].PatchDsdtReplace); + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind, + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace); //DBG(" OK\n"); }else{ //DBG("Patching: renaming in bridge\n"); - Len = FixRenameByBridge2((UINT8*)NewTable, Len, gSettings.DSDTPatchArray[i].PatchDsdtTgt, gSettings.DSDTPatchArray[i].PatchDsdtFind, gSettings.DSDTPatchArray[i].PatchDsdtReplace); + Len = FixRenameByBridge2((UINT8*)NewTable, Len, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace); } } } @@ -479,7 +479,7 @@ void PatchAllTables() GetBiosRegions((UINT8*)NewTable); //take Regions from SSDT even if they will be dropped Patched = TRUE; } - if (NewTable->Signature == MCFG_SIGN && gSettings.FixMCFG) { + if (NewTable->Signature == MCFG_SIGN && gSettings.ACPI.FixMCFG) { INTN Len1 = ((Len + 4 - 1) / 16 + 1) * 16 - 4; CopyMem(NewTable, Table, Len1); //Len increased but less than EFI_PAGE NewTable->Length = (UINT32)(UINTN)Len1; Patched = TRUE; @@ -863,7 +863,7 @@ static XStringW GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount, { XStringW FileName; CHAR8 Suffix[10]; // "-" + OemTableId + NUL - if (gSettings.NoOemTableId || 0 == OemTableId[0]) { + if (gSettings.ACPI.SSDT.NoOemTableId || 0 == OemTableId[0]) { Suffix[0] = 0; } else { Suffix[0] = '-'; @@ -894,7 +894,7 @@ void DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam UINT8 *pacBody; INTN ChildCount = 0; - if (gSettings.NoDynamicExtract) { + if (gSettings.ACPI.SSDT.NoDynamicExtract) { return; } @@ -1507,16 +1507,16 @@ void SaveOemDsdt(BOOLEAN FullPatch) UINT8 *buffer = NULL; UINTN DsdtLen = 0; XStringW OriginDsdt = SWPrintf("ACPI\\origin\\DSDT.aml"); - XStringW OriginDsdtFixed = SWPrintf("ACPI\\origin\\DSDT-%x.aml", gSettings.FixDsdt); + XStringW OriginDsdtFixed = SWPrintf("ACPI\\origin\\DSDT-%x.aml", gSettings.ACPI.DSDT.FixDsdt); // constexpr LStringW PathPatched = L"\\EFI\\CL OVER\\ACPI\\patched"; // XStringW PathDsdt; // XStringW AcpiOemPath = SWPrintf("ACPI\\patched"); -// PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName.wc_str()); +// PathDsdt.SWPrintf("\\%ls", gSettings.ACPI.DSDT.FixDsdt.wc_str()); - if (FileExists(selfOem.getConfigDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.DsdtName.wc_str()))) { - DBG("SaveOemDsdt: DSDT found in Clover volume OEM folder: \\%ls\\ACPI\\patched\\%ls\n", selfOem.getConfigDirFullPath().wc_str(), gSettings.DsdtName.wc_str()); - Status = egLoadFile(&selfOem.getConfigDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.DsdtName.wc_str()).wc_str(), &buffer, &DsdtLen); + if (FileExists(selfOem.getConfigDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.ACPI.DSDT.DsdtName.wc_str()))) { + DBG("SaveOemDsdt: DSDT found in Clover volume OEM folder: \\%ls\\ACPI\\patched\\%ls\n", selfOem.getConfigDirFullPath().wc_str(), gSettings.ACPI.DSDT.DsdtName.wc_str()); + Status = egLoadFile(&selfOem.getConfigDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.ACPI.DSDT.DsdtName.wc_str()).wc_str(), &buffer, &DsdtLen); } // Jief : Do not write outside OemPath @@ -1582,7 +1582,7 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C UINTN Index = IGNORE_INDEX; if (AUTOMERGE_PASS1 == Pass) { Index = IndexFromFileName(PartName); - // gSettings.AutoMerge always true in this case + // gSettings.ACPI.AutoMerge always true in this case // file names such as: ECDT.aml, SSDT-0.aml, SSDT-1-CpuPm.aml, attempt merge on pass1 // others: no attempt for merge // special case for SSDT.aml: no attempt to merge @@ -1603,7 +1603,7 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C } } DBG("size=%lld ", (UINT64)bufferLen); - if (!gSettings.AutoMerge) { + if (!gSettings.ACPI.AutoMerge) { // Note: with AutoMerge=false, Pass is only AUTOMERGE_PASS2 here Status = InsertTable(buffer, bufferLen); } else { @@ -1619,23 +1619,23 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass) { - if (!gSettings.AutoMerge && AUTOMERGE_PASS1 == Pass) { + if (!gSettings.ACPI.AutoMerge && AUTOMERGE_PASS1 == Pass) { // nothing to do in this case, since AutoMerge=false -> no tables ever merged return; } if (ACPIPatchedAML) { DbgHeader("ACPIPatchedAML"); - if (gSettings.AutoMerge) { + if (gSettings.ACPI.AutoMerge) { DBG("AutoMerge pass %llu\n", Pass); } //DBG("Start: Processing Patched AML(s): "); - if (gSettings.SortedACPICount) { + if (gSettings.ACPI.SortedACPI.size()) { UINTN Index; DBG("Sorted\n"); - for (Index = 0; Index < gSettings.SortedACPICount; Index++) { + for (Index = 0; Index < gSettings.ACPI.SortedACPI.size(); Index++) { ACPI_PATCHED_AML *ACPIPatchedAMLTmp; for (ACPIPatchedAMLTmp = ACPIPatchedAML; ACPIPatchedAMLTmp; ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next) { - if (0 == StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.SortedACPI[Index]) && ACPIPatchedAMLTmp->MenuItem.BValue) { + if (0 == StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.SortedACPI[Index].wc_str()) && ACPIPatchedAMLTmp->MenuItem.BValue) { if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp->MenuItem.BValue) DBG("Disabled: %ls, skip\n", ACPIPatchedAMLTmp->FileName); ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED; @@ -1643,11 +1643,11 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass) } } if (!ACPIPatchedAMLTmp) { // NULL when not disabled - DBG("Inserting table[%llu]:%ls from %ls\\%ls: ", Index, gSettings.SortedACPI[Index], selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str()); - if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, gSettings.SortedACPI[Index], Pass)) { + DBG("Inserting table[%llu]:%ls from %ls\\%ls: ", Index, gSettings.ACPI.SortedACPI[Index].wc_str(), selfOem.getConfigDirFullPath().wc_str(), acpiPathUnderOem.wc_str()); + if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, gSettings.ACPI.SortedACPI[Index].wc_str(), Pass)) { // avoid inserting table again on second pass for (ACPI_PATCHED_AML* temp2 = ACPIPatchedAML; temp2; temp2 = temp2->Next) { - if (0 == StriCmp(temp2->FileName, gSettings.SortedACPI[Index])) { + if (0 == StriCmp(temp2->FileName, gSettings.ACPI.SortedACPI[Index].wc_str())) { temp2->MenuItem.BValue = BVALUE_ATTEMPTED; break; } @@ -1862,26 +1862,26 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) //should correct headers if needed and if asked PatchTableHeader((EFI_ACPI_DESCRIPTION_HEADER*)newFadt); - if (gSettings.smartUPS==TRUE) { + if (gSettings.ACPI.smartUPS==TRUE) { newFadt->PreferredPmProfile = 3; } else { newFadt->PreferredPmProfile = gMobile?2:1; //as calculated before } - if (gSettings.EnableC6 || gSettings.EnableISS) { + if (gSettings.ACPI.SSDT.EnableC6 || gSettings.ACPI.SSDT.EnableISS) { newFadt->CstCnt = 0x85; //as in Mac } - if (gSettings.EnableC2) newFadt->PLvl2Lat = 0x65; - if (gSettings.C3Latency > 0) { - newFadt->PLvl3Lat = gSettings.C3Latency; - } else if (gSettings.EnableC4) { + if (gSettings.ACPI.SSDT.EnableC2) newFadt->PLvl2Lat = 0x65; + if (gSettings.ACPI.SSDT.C3Latency > 0) { + newFadt->PLvl3Lat = gSettings.ACPI.SSDT.C3Latency; + } else if (gSettings.ACPI.SSDT.EnableC4) { newFadt->PLvl3Lat = 0x3E9; } - if (gSettings.C3Latency == 0) { - gSettings.C3Latency = newFadt->PLvl3Lat; + if (gSettings.ACPI.SSDT.C3Latency == 0) { + gSettings.ACPI.SSDT.C3Latency = newFadt->PLvl3Lat; } newFadt->IaPcBootArch = 0x3; - if (gSettings.NoASPM) { + if (gSettings.ACPI.NoASPM) { newFadt->IaPcBootArch |= 0x10; // disable ASPM } newFadt->Flags |= 0x420; //Reset Register Supported and SleepButton active @@ -1919,14 +1919,14 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) Facs->Flags = 0; //dont' support S4BIOS, as well as 64bit wake // - if ((gSettings.ResetAddr == 0) && ((oldLength < 0x80) || (newFadt->ResetReg.Address == 0))) { + if ((gSettings.ACPI.ResetAddr == 0) && ((oldLength < 0x80) || (newFadt->ResetReg.Address == 0))) { newFadt->ResetReg.Address = 0x64; newFadt->ResetValue = 0xFE; - gSettings.ResetAddr = 0x64; - gSettings.ResetVal = 0xFE; - } else if (gSettings.ResetAddr != 0) { - newFadt->ResetReg.Address = gSettings.ResetAddr; - newFadt->ResetValue = gSettings.ResetVal; + gSettings.ACPI.ResetAddr = 0x64; + gSettings.ACPI.ResetVal = 0xFE; + } else if (gSettings.ACPI.ResetAddr != 0) { + newFadt->ResetReg.Address = gSettings.ACPI.ResetAddr; + newFadt->ResetValue = gSettings.ACPI.ResetVal; } newFadt->XPm1aEvtBlk.Address = (UINT64)(newFadt->Pm1aEvtBlk); newFadt->XPm1bEvtBlk.Address = (UINT64)(newFadt->Pm1bEvtBlk); @@ -1945,7 +1945,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) Xsdt->Entry = (UINT64)((UINT32)(UINTN)newFadt); } FixChecksum(&FadtPointer->Header); - if (gSettings.SlpSmiEnable) { + if (gSettings.ACPI.SlpSmiEnable) { UINT32 *SlpSmiEn = (UINT32*)((UINTN)(newFadt->Pm1aEvtBlk) + 0x30); UINT32 Value = *SlpSmiEn; Value &= ~ bit(4); @@ -1954,7 +1954,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) } //Get regions from BIOS DSDT - if ((gSettings.FixDsdt & FIX_REGIONS) != 0) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_REGIONS) != 0) { GetBiosRegions((UINT8*)(UINTN)(newFadt->Dsdt)); } // DBG("DSDT finding\n"); @@ -1966,7 +1966,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) Status = EFI_NOT_FOUND; - XStringW acpiPath = SWPrintf("ACPI\\patched\\%ls", gSettings.DsdtName.wc_str()); + XStringW acpiPath = SWPrintf("ACPI\\patched\\%ls", gSettings.ACPI.DSDT.DsdtName.wc_str()); if ( selfOem.oemDirExists() ) { if ( FileExists(&selfOem.getOemDir(), acpiPath) ) { @@ -1981,7 +1981,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) // second priority is DSDT from OEM folder // third priority is /EFI/CLOVER/ACPI/patched/DSDT*.aml choosen from GUI. - XStringW PathDsdt = SWPrintf("\\%ls", gSettings.DsdtName.wc_str()); + XStringW PathDsdt = SWPrintf("\\%ls", gSettings.ACPI.DSDT.DsdtName.wc_str()); if (EFI_ERROR(Status) && FileExists(Volume->RootDir, PathDsdt)) { DBG("DSDT found in booted volume\n"); Status = egLoadFile(Volume->RootDir, PathDsdt.wc_str(), &buffer, &bufferLen); @@ -2052,7 +2052,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) // dropDSM = gSettings.DropOEM_DSM; //if set by user // } - if (gSettings.DebugDSDT) { + if (gSettings.ACPI.DSDT.DebugDSDT) { TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)FadtPointer->XDsdt; bufferLen = TableHeader->Length; @@ -2060,11 +2060,11 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) Status = egSaveFile(&selfOem.getConfigDir(), L"ACPI\\origin\\DSDT-or.aml", (UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen); } //native DSDT or loaded we want to apply autoFix to this - // if (gSettings.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?) - DBG("Apply DsdtFixMask=0x%08X\n", gSettings.FixDsdt); + // if (gSettings.ACPI.DSDT.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?) + DBG("Apply DsdtFixMask=0x%08X\n", gSettings.ACPI.DSDT.FixDsdt); // DBG(" drop _DSM mask=0x%04hX\n", dropDSM); FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion); - if (gSettings.DebugDSDT) { + if (gSettings.ACPI.DSDT.DebugDSDT) { for (Index=0; Index < 60; Index++) { XStringW DsdtPatchedName = SWPrintf("ACPI\\origin\\DSDT-pa%llu.aml", Index); if(!FileExists(&selfOem.getConfigDir(), DsdtPatchedName)){ @@ -2091,10 +2091,10 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) LoadAllPatchedAML(L"ACPI\\patched"_XSW, AUTOMERGE_PASS1); // Drop tables - if (gSettings.ACPIDropTables) { + if (GlobalConfig.ACPIDropTables) { ACPI_DROP_TABLE *DropTable; DbgHeader("ACPIDropTables"); - for (DropTable = gSettings.ACPIDropTables; DropTable; DropTable = DropTable->Next) { + for (DropTable = GlobalConfig.ACPIDropTables; DropTable; DropTable = DropTable->Next) { if (DropTable->MenuItem.BValue) { //DBG("Attempting to drop \"%4.4a\" (%8.8X) \"%8.8a\" (%16.16lX) L=%d\n", &(DropTable->Signature), DropTable->Signature, &(DropTable->TableId), DropTable->TableId, DropTable->Length); DropTableFromXSDT(DropTable->Signature, DropTable->TableId, DropTable->Length); @@ -2103,7 +2103,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) } } - if (gSettings.DropSSDT) { + if (gSettings.ACPI.SSDT.DropSSDT) { DbgHeader("DropSSDT"); //special case if we set into menu drop all SSDT DropTableFromXSDT(EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0, 0); @@ -2152,7 +2152,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) DBG("ApicCPUNum=%llu\n", ApicCPUNum); //reallocate table - if (gSettings.PatchNMI) { + if (gSettings.ACPI.PatchNMI) { BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; Status=gBS->AllocatePages(AllocateMaxAddress, EfiACPIReclaimMemory, 1, &BufferPtr); if(!EFI_ERROR(Status)) { @@ -2245,7 +2245,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) ApicCPUNum = acpi_cpu_count; } - if (gSettings.GeneratePStates || gSettings.GeneratePluginType) { + if (gSettings.ACPI.SSDT.Generate.GeneratePStates || gSettings.ACPI.SSDT.Generate.GeneratePluginType) { Status = EFI_NOT_FOUND; Ssdt = generate_pss_ssdt(ApicCPUNum); if (Ssdt) { @@ -2256,7 +2256,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) } } - if (gSettings.GenerateCStates) { + if (gSettings.ACPI.SSDT.Generate.GenerateCStates) { Status = EFI_NOT_FOUND; Ssdt = generate_cst_ssdt(FadtPointer, ApicCPUNum); if (Ssdt) { @@ -2323,11 +2323,11 @@ EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched, EFI_PHYSICAL_ADDRESS Dsdt; // load if exists - Status = LoadAcpiTable(PathPatched, gSettings.DsdtName.wc_str(), &Buffer, &BufferLen); + Status = LoadAcpiTable(PathPatched, gSettings.ACPI.DSDT.DsdtName.wc_str(), &Buffer, &BufferLen); if (!EFI_ERROR(Status)) { // loaded - allocate EfiACPIReclaim - DBG("Loaded DSDT at \\%ls\\%ls\\%ls\n", self.getCloverDirFullPath().wc_str(), PathPatched, gSettings.DsdtName.wc_str()); + DBG("Loaded DSDT at \\%ls\\%ls\\%ls\n", self.getCloverDirFullPath().wc_str(), PathPatched, gSettings.ACPI.DSDT.DsdtName.wc_str()); Dsdt = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000; Status = gBS->AllocatePages ( AllocateMaxAddress, @@ -2517,10 +2517,10 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT) DropTableFromRSDT(EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0, 0); } */ - if (gSettings.ACPIDropTables) { + if (GlobalConfig.ACPIDropTables) { ACPI_DROP_TABLE *DropTable; DbgHeader("ACPIDropTables"); - for (DropTable = gSettings.ACPIDropTables; DropTable; DropTable = DropTable->Next) { + for (DropTable = GlobalConfig.ACPIDropTables; DropTable; DropTable = DropTable->Next) { // only for tables that have OtherOS true if (DropTable->OtherOS && DropTable->MenuItem.BValue) { //DBG("Attempting to drop \"%4.4a\" (%8.8X) \"%8.8a\" (%16.16lX) L=%d\n", &(DropTable->Signature), DropTable->Signature, &(DropTable->TableId), DropTable->TableId, DropTable->Length); diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index 8509f0112..7fc2b70dc 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -535,8 +535,8 @@ SetupDataForOSX(BOOLEAN Hibernate) LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Mobile, 1); // all current settings - XBuffer xb = gSettings.serialize(); - LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size()); +// XBuffer xb = gSettings.serialize(); +// LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size()); }else{ MsgLog("DataHub protocol not located. Smbios not send to datahub\n"); } diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index dfb2c02b1..e1d581a99 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -1885,7 +1885,7 @@ UINT32 FIXDarwin (UINT8* dsdt, UINT32 len) CONST UINT32 adr = 0x24; DBG("Start Darwin Fix\n"); ReplaceName(dsdt, len, "_OSI", "OOSI"); - if (gSettings.FixDsdt & FIX_DARWIN) { + if (gSettings.ACPI.DSDT.FixDsdt & FIX_DARWIN) { darwin[42] = '9'; //windows 2009 } len = move_data(adr, dsdt, len, sizeof(darwin)); @@ -1956,8 +1956,8 @@ UINT32 AddPNLF (UINT8 *dsdt, UINT32 len) } //Slice - add custom UID - if (gSettings.PNLF_UID != 0xFF) { - ((CHAR8*)pnlf)[39] = gSettings.PNLF_UID; + if (gSettings.ACPI.DSDT.PNLF_UID != 0xFF) { + ((CHAR8*)pnlf)[39] = gSettings.ACPI.DSDT.PNLF_UID; } // _UID reworked by Sherlocks. 2018.10.08 @@ -2120,7 +2120,7 @@ UINT32 FixRTC (UINT8 *dsdt, UINT32 len) for (i=adr+4; i> find this if (dsdt[i] == 0x70 && dsdt[i+1] == 0x00 && dsdt[i+2] == 0x70 && dsdt[i+3] == 0x00) { - if (dsdt[i+5] == 0x08 && gSettings.Rtc8Allowed) { + if (dsdt[i+5] == 0x08 && gSettings.ACPI.DSDT.Rtc8Allowed) { MsgLog("CMOS reset not will be, patch length is not needed\n"); } else { // First Fix RTC CMOS Reset Problem @@ -2503,7 +2503,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) BOOLEAN DISPLAYFIX = FALSE; BOOLEAN NonUsable = FALSE; BOOLEAN DsmFound = FALSE; - BOOLEAN NeedHDMI = !!(gSettings.FixDsdt & FIX_HDMI); + BOOLEAN NeedHDMI = !!(gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI); AML_CHUNK *root = NULL; AML_CHUNK *gfx0, *peg0; AML_CHUNK *met, *met2; @@ -2564,7 +2564,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) } devsize1 = get_size(dsdt, devadr1); //13 if (devsize1) { - if (gSettings.ReuseFFFF) { + if (gSettings.ACPI.DSDT.ReuseFFFF) { dsdt[j+10] = 0; dsdt[j+11] = 0; MsgLog("Found internal video device FFFF@%X, ReUse as 0\n", devadr1); @@ -4867,7 +4867,7 @@ UINT32 FIXSHUTDOWN_ASUS (UINT8 *dsdt, UINT32 len) return len; } - if (gSettings.SuspendOverride) { + if (gSettings.ACPI.DSDT.SuspendOverride) { shutdown = &shutdown1[0]; sizeoffset = sizeof(shutdown1); } else { @@ -5248,7 +5248,7 @@ void RenameDevices(UINT8* table) CHAR8 *Replace; CHAR8 *Find; - if ( gSettings.DeviceRenameCount <= 0 ) return; // to avoid message "0 replacement" + if ( gSettings.ACPI.DeviceRename.size() <= 0 ) return; // to avoid message "0 replacement" INTN i; INTN k=0; // Clang complain about possible use uninitialised. Not true, but I don't like warnings. @@ -5257,9 +5257,9 @@ void RenameDevices(UINT8* table) UINTN len = ((EFI_ACPI_DESCRIPTION_HEADER*)table)->Length; INTN adr, shift, Num = 0; BOOLEAN found; - for (index = 0; index < gSettings.DeviceRenameCount; index++) { - List = gSettings.DeviceRename[index].Next; - Replace = gSettings.DeviceRename[index].Name; + for (index = 0; index < gSettings.ACPI.DeviceRename.size(); index++) { + List = gSettings.ACPI.DeviceRename[index].Next; + Replace = gSettings.ACPI.DeviceRename[index].Name; Find = List->Name; Bridge = List->Next; MsgLog("Name: %s, Bridge: %s, Replace: %s\n", Find, Bridge->Name, Replace); @@ -5327,7 +5327,7 @@ void RenameDevices(UINT8* table) } //while find outer bridge adr += 5; } while (1); //next occurence - } //DeviceRenameCount + } //DeviceRename.size() MsgLog(" %lld replacements\n", Num); } @@ -5359,26 +5359,26 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c CheckHardware(); //arbitrary fixes - if (gSettings.DSDTPatchArray.size() > 0) { + if (gSettings.ACPI.DSDT.DSDTPatchArray.size() > 0) { MsgLog("Patching DSDT:\n"); - for (i = 0; i < gSettings.DSDTPatchArray.size(); i++) { - if ( gSettings.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { + for (i = 0; i < gSettings.ACPI.DSDT.DSDTPatchArray.size(); i++) { + if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { continue; } - MsgLog(" - [%s]:", gSettings.DSDTPatchArray[i].PatchDsdtLabel.c_str()); //yyyy - if (gSettings.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { - if (gSettings.DSDTPatchArray[i].PatchDsdtTgt.isEmpty()) { + MsgLog(" - [%s]:", gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtLabel.c_str()); //yyyy + if (gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { + if (gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt.isEmpty()) { DsdtLen = FixAny(temp, DsdtLen, - gSettings.DSDTPatchArray[i].PatchDsdtFind, - gSettings.DSDTPatchArray[i].PatchDsdtReplace); + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind, + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace); }else{ // DBG("Patching: renaming in bridge\n"); DsdtLen = FixRenameByBridge2(temp, DsdtLen, - gSettings.DSDTPatchArray[i].PatchDsdtTgt, - gSettings.DSDTPatchArray[i].PatchDsdtFind, - gSettings.DSDTPatchArray[i].PatchDsdtReplace); + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt, + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind, + gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace); } } else { @@ -5394,7 +5394,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c findCPU(temp, DsdtLen); // add Method (DTGP, 5, NotSerialized) - if ((gSettings.FixDsdt & FIX_DTGP)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_DTGP)) { if (!FindMethod(temp, DsdtLen, "DTGP")) { CopyMem((CHAR8 *)temp+DsdtLen, dtgp, sizeof(dtgp)); DsdtLen += sizeof(dtgp); @@ -5406,42 +5406,42 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c findPciRoot(temp, DsdtLen); // Fix RTC - if ((gSettings.FixDsdt & FIX_RTC)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_RTC)) { // DBG("patch RTC in DSDT \n"); DsdtLen = FixRTC(temp, DsdtLen); } // Fix TMR - if ((gSettings.FixDsdt & FIX_TMR)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_TMR)) { // DBG("patch TMR in DSDT \n"); DsdtLen = FixTMR(temp, DsdtLen); } // Fix PIC or IPIC - if ((gSettings.FixDsdt & FIX_IPIC) != 0) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_IPIC) != 0) { // DBG("patch IPIC in DSDT \n"); DsdtLen = FixPIC(temp, DsdtLen); } // Fix HPET - if ((gSettings.FixDsdt & FIX_HPET) != 0) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_HPET) != 0) { // DBG("patch HPET in DSDT \n"); DsdtLen = FixHPET(temp, DsdtLen); } // Fix LPC if don't had HPET don't need to inject LPC?? - if (LPCBFIX && (gCPUStructure.Family == 0x06) && (gSettings.FixDsdt & FIX_LPC)) { + if (LPCBFIX && (gCPUStructure.Family == 0x06) && (gSettings.ACPI.DSDT.FixDsdt & FIX_LPC)) { // DBG("patch LPC in DSDT \n"); DsdtLen = FIXLPCB(temp, DsdtLen); } // Fix Display - if ((gSettings.FixDsdt & FIX_DISPLAY) || (gSettings.FixDsdt & FIX_INTELGFX)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_DISPLAY) || (gSettings.ACPI.DSDT.FixDsdt & FIX_INTELGFX)) { INT32 j; for (j=0; j<4; ++j) { if (DisplayADR1[j]) { - if (((DisplayVendor[j] != 0x8086) && (gSettings.FixDsdt & FIX_DISPLAY)) || - ((DisplayVendor[j] == 0x8086) && (gSettings.FixDsdt & FIX_INTELGFX))) { + if (((DisplayVendor[j] != 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_DISPLAY)) || + ((DisplayVendor[j] == 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_INTELGFX))) { DsdtLen = FIXDisplay(temp, DsdtLen, j); MsgLog("patch Display #%d of Vendor=0x%4X\n", j, DisplayVendor[j]); } @@ -5450,7 +5450,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c } // Fix Network - if ((gSettings.FixDsdt & FIX_LAN)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_LAN)) { // DBG("patch LAN in DSDT \n"); UINT32 j; for (j = 0; j <= net_count; ++j) { @@ -5462,67 +5462,67 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c } // Fix Airport - if (ArptADR1 && (gSettings.FixDsdt & FIX_WIFI)) { + if (ArptADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_WIFI)) { // DBG("patch Airport in DSDT \n"); DsdtLen = FIXAirport(temp, DsdtLen); } // Fix SBUS - if (SBUSADR1 && (gSettings.FixDsdt & FIX_SBUS)) { + if (SBUSADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_SBUS)) { // DBG("patch SBUS in DSDT \n"); DsdtLen = FIXSBUS(temp, DsdtLen); } // Fix IDE inject - if (IDEFIX && (IDEVENDOR == 0x8086 || IDEVENDOR == 0x11ab) && (gSettings.FixDsdt & FIX_IDE)) { + if (IDEFIX && (IDEVENDOR == 0x8086 || IDEVENDOR == 0x11ab) && (gSettings.ACPI.DSDT.FixDsdt & FIX_IDE)) { // DBG("patch IDE in DSDT \n"); DsdtLen = FIXIDE(temp, DsdtLen); } // Fix SATA AHCI orange icon - if (SATAAHCIADR1 && (SATAAHCIVENDOR == 0x8086) && (gSettings.FixDsdt & FIX_SATA)) { + if (SATAAHCIADR1 && (SATAAHCIVENDOR == 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_SATA)) { DBG("patch AHCI in DSDT \n"); DsdtLen = FIXSATAAHCI(temp, DsdtLen); } // Fix SATA inject - if (SATAFIX && (SATAVENDOR == 0x8086) && (gSettings.FixDsdt & FIX_SATA)) { + if (SATAFIX && (SATAVENDOR == 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_SATA)) { DBG("patch SATA in DSDT \n"); DsdtLen = FIXSATA(temp, DsdtLen); } // Fix Firewire - if (FirewireADR1 && (gSettings.FixDsdt & FIX_FIREWIRE)) { + if (FirewireADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_FIREWIRE)) { DBG("patch FRWR in DSDT \n"); DsdtLen = FIXFirewire(temp, DsdtLen); } // HDA HDEF - if (HDAFIX && (gSettings.FixDsdt & FIX_HDA)) { + if (HDAFIX && (gSettings.ACPI.DSDT.FixDsdt & FIX_HDA)) { DBG("patch HDEF in DSDT \n"); DsdtLen = AddHDEF(temp, DsdtLen, OSVersion); } //Always add MCHC for PM - if ((gCPUStructure.Family == 0x06) && (gSettings.FixDsdt & FIX_MCHC)) { + if ((gCPUStructure.Family == 0x06) && (gSettings.ACPI.DSDT.FixDsdt & FIX_MCHC)) { // DBG("patch MCHC in DSDT \n"); DsdtLen = AddMCHC(temp, DsdtLen); } //add IMEI - if ((gSettings.FixDsdt & FIX_IMEI)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_IMEI)) { DsdtLen = AddIMEI(temp, DsdtLen); } //Add HDMI device - if ((gSettings.FixDsdt & FIX_HDMI)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI)) { DsdtLen = AddHDMI(temp, DsdtLen); } // Always Fix USB - if ((gSettings.FixDsdt & FIX_USB)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_USB)) { DsdtLen = FIXUSB(temp, DsdtLen); } - if ((gSettings.FixDsdt & FIX_WAK)){ + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_WAK)){ // Always Fix _WAK Return value DsdtLen = FIXWAK(temp, DsdtLen, fadt); } @@ -5535,7 +5535,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c // USB Device remove error Fix // DsdtLen = FIXGPE(temp, DsdtLen); - if ((gSettings.FixDsdt & FIX_UNUSED)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_UNUSED)) { //I want these fixes even if no Display fix. We have GraphicsInjector DsdtLen = DeleteDevice("CRT_"_XS8, temp, DsdtLen); DsdtLen = DeleteDevice("DVI_"_XS8, temp, DsdtLen); @@ -5548,7 +5548,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c DsdtLen = DeleteDevice("LPT1"_XS8, temp, DsdtLen); } - if ((gSettings.FixDsdt & FIX_ACST)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_ACST)) { ReplaceName(temp, DsdtLen, "ACST", "OCST"); ReplaceName(temp, DsdtLen, "ACSS", "OCSS"); ReplaceName(temp, DsdtLen, "APSS", "OPSS"); @@ -5556,32 +5556,32 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c ReplaceName(temp, DsdtLen, "APLF", "OPLF"); } - if ((gSettings.FixDsdt & FIX_PNLF)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_PNLF)) { DsdtLen = AddPNLF(temp, DsdtLen); } - if ((gSettings.FixDsdt & FIX_S3D)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_S3D)) { FixS3D(temp, DsdtLen); } //Fix OperationRegions - if ((gSettings.FixDsdt & FIX_REGIONS)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_REGIONS)) { FixRegions(temp, DsdtLen); } //RehabMan: Fix Mutex objects - if ((gSettings.FixDsdt & FIX_MUTEX)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_MUTEX)) { FixMutex(temp, DsdtLen); } // pwrb add _CID sleep button fix - if ((gSettings.FixDsdt & FIX_ADP1)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_ADP1)) { DsdtLen = FixADP1(temp, DsdtLen); } // other compiler warning fix _T_X, MUTE .... USB _PRW value form 0x04 => 0x01 // DsdtLen = FIXOTHER(temp, DsdtLen); - if ((gSettings.FixDsdt & FIX_WARNING) || (gSettings.FixDsdt & FIX_DARWIN)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_WARNING) || (gSettings.ACPI.DSDT.FixDsdt & FIX_DARWIN)) { if (!FindMethod(temp, DsdtLen, "GET9") && !FindMethod(temp, DsdtLen, "STR9") && !FindMethod(temp, DsdtLen, "OOSI")) { @@ -5589,7 +5589,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c } } // Fix SHUTDOWN For ASUS - if ((gSettings.FixDsdt & FIX_SHUTDOWN)) { + if ((gSettings.ACPI.DSDT.FixDsdt & FIX_SHUTDOWN)) { DsdtLen = FIXSHUTDOWN_ASUS(temp, DsdtLen); //safe to do twice } diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 621046865..191443fd9 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -2065,12 +2065,15 @@ GetEDIDSettings(const TagDict* DictPointer) } } -EFI_STATUS -GetEarlyUserSettings ( +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +EFI_STATUS GetEarlyUserSettings ( const TagDict* CfgDict, SETTINGS_DATA& settingsData ) { + #pragma GCC diagnostic pop + EFI_STATUS Status = EFI_SUCCESS; // const TagDict* Dict; // const TagDict* Dict2; @@ -2237,18 +2240,15 @@ GetEarlyUserSettings ( INTN i; INTN Count = arrayProp->arrayContent().size(); if (Count > 0) { - settingsData.Boot.SecureBootWhiteListCount = 0; - settingsData.Boot.SecureBootWhiteList = (__typeof__(settingsData.Boot.SecureBootWhiteList))AllocateZeroPool(Count * sizeof(CHAR16 *)); - if (settingsData.Boot.SecureBootWhiteList) { - for (i = 0; i < Count; i++) { - const TagStruct* prop2 = &arrayProp->arrayContent()[i]; - if ( !prop2->isString() ) { - MsgLog("MALFORMED PLIST : WhiteList must be an array of string"); - continue; - } - if ( prop2->getString()->stringValue().notEmpty() ) { - settingsData.Boot.SecureBootWhiteList[settingsData.Boot.SecureBootWhiteListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); - } + settingsData.Boot.SecureBootWhiteList.setEmpty(); + for (i = 0; i < Count; i++) { + const TagStruct* prop2 = &arrayProp->arrayContent()[i]; + if ( !prop2->isString() ) { + MsgLog("MALFORMED PLIST : WhiteList must be an array of string"); + continue; + } + if ( prop2->getString()->stringValue().notEmpty() ) { + settingsData.Boot.SecureBootWhiteList.AddNoNull(prop2->getString()->stringValue()); } } } @@ -2259,18 +2259,15 @@ GetEarlyUserSettings ( INTN i; INTN Count = arrayProp->arrayContent().size(); if (Count > 0) { - settingsData.Boot.SecureBootBlackListCount = 0; - settingsData.Boot.SecureBootBlackList = (__typeof__(settingsData.Boot.SecureBootBlackList))AllocateZeroPool(Count * sizeof(CHAR16 *)); - if (settingsData.Boot.SecureBootBlackList) { - for (i = 0; i < Count; i++) { - const TagStruct* prop2 = &arrayProp->arrayContent()[i]; - if ( !prop2->isString() ) { - MsgLog("MALFORMED PLIST : BlackList must be an array of string"); - continue; - } - if ( prop2->getString()->stringValue().notEmpty() ) { - settingsData.Boot.SecureBootBlackList[settingsData.Boot.SecureBootBlackListCount++] = SWPrintf("%s", prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); - } + settingsData.Boot.SecureBootBlackList.setEmpty(); + for (i = 0; i < Count; i++) { + const TagStruct* prop2 = &arrayProp->arrayContent()[i]; + if ( !prop2->isString() ) { + MsgLog("MALFORMED PLIST : BlackList must be an array of string"); + continue; + } + if ( prop2->getString()->stringValue().notEmpty() ) { + settingsData.Boot.SecureBootBlackList.AddNoNull(prop2->getString()->stringValue()); } } } @@ -3450,20 +3447,21 @@ static void getACPISettings(const TagDict *CfgDict) if (DropTablesArray) { INTN i; INTN Count = DropTablesArray->arrayContent().size(); - BOOLEAN Dropped; if (Count > 0) { - DBG("Dropping %lld tables:\n", Count); +// DBG("Table to drop %lld tables:\n", Count); - for (i = 0; i < Count; i++) { - UINT32 Signature = 0; - UINT32 TabLength = 0; - UINT64 TableId = 0; - BOOLEAN OtherOS = FALSE; + for (i = 0; i < Count; i++) + { + SETTINGS_DATA::ACPIClass::ACPIDropTablesClass* ACPIDropTables = new SETTINGS_DATA::ACPIClass::ACPIDropTablesClass; +// UINT32 Signature = 0; +// UINT32 TabLength = 0; +// UINT64 TableId = 0; +// BOOLEAN OtherOS = FALSE; const TagDict* Dict2 = DropTablesArray->dictElementAt(i, "ACPI/DropTables"_XS8); - DBG(" - [%02lld]: Drop table ", i); +// DBG(" - [%02lld]: Drop table ", i); // Get the table signatures to drop const TagStruct* Prop2 = Dict2->propertyForKey("Signature"); if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { @@ -3481,8 +3479,8 @@ static void getACPISettings(const TagDict *CfgDict) if (*str) { s4 = *str++; } - Signature = SIGNATURE_32(s1, s2, s3, s4); - DBG(" signature=\"%c%c%c%c\" (%8.8X)\n", s1, s2, s3, s4, Signature); + ACPIDropTables->Signature = SIGNATURE_32(s1, s2, s3, s4); +// DBG(" signature=\"%c%c%c%c\" (%8.8X)\n", s1, s2, s3, s4, ACPIDropTables->Signature); } // Get the table ids to drop Prop2 = Dict2->propertyForKey("TableId"); @@ -3500,94 +3498,94 @@ static void getACPISettings(const TagDict *CfgDict) } } - CopyMem(&TableId, (CHAR8*)&Id[0], 8); - DBG(" table-id=\"%s\" (%16.16llX)\n", Id, TableId); + CopyMem(&ACPIDropTables->TableId, (CHAR8*)&Id[0], 8); +// DBG(" table-id=\"%s\" (%16.16llX)\n", Id, ACPIDropTables->TableId); } } // Get the table len to drop Prop2 = Dict2->propertyForKey("Length"); if (Prop2 != NULL) { - TabLength = (UINT32)GetPropertyAsInteger(Prop2, 0); - DBG(" length=%d(0x%X)", TabLength, TabLength); + ACPIDropTables->TabLength = (UINT32)GetPropertyAsInteger(Prop2, 0); +// DBG(" length=%d(0x%X)", ACPIDropTables->TabLength, ACPIDropTables->TabLength); } // Check if to drop for other OS as well Prop2 = Dict2->propertyForKey("DropForAllOS"); if (Prop2 != NULL) { - OtherOS = IsPropertyNotNullAndTrue(Prop2); + ACPIDropTables->OtherOS = IsPropertyNotNullAndTrue(Prop2); } - - DBG("----\n"); + gSettings.ACPI.ACPIDropTablesArray.AddReference(ACPIDropTables, true); +// DBG("----\n"); //set to drop - if (gSettings.ACPIDropTables) { - ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables; - DBG(" - set table: %08X, %16llx to drop:", Signature, TableId); - Dropped = FALSE; - while (DropTable) { - if (((Signature == DropTable->Signature) && - (!TableId || (DropTable->TableId == TableId)) && - (!TabLength || (DropTable->Length == TabLength))) || - (!Signature && (DropTable->TableId == TableId))) { - DropTable->MenuItem.BValue = TRUE; - DropTable->OtherOS = OtherOS; - gSettings.DropSSDT = FALSE; //if one item=true then dropAll=false by default - //DBG(" true"); - Dropped = TRUE; - } - DropTable = DropTable->Next; - } - DBG(" %s\n", Dropped ? "yes" : "no"); - } +// if (GlobalConfig.ACPIDropTables) { +// ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables; +// DBG(" - set table: %08X, %16llx to drop:", Signature, TableId); +// Dropped = FALSE; +// while (DropTable) { +// if (((Signature == DropTable->Signature) && +// (!TableId || (DropTable->TableId == TableId)) && +// (!TabLength || (DropTable->Length == TabLength))) || +// (!Signature && (DropTable->TableId == TableId))) { +// DropTable->MenuItem.BValue = TRUE; +// DropTable->OtherOS = OtherOS; +// gSettings.ACPI.SSDT.DropSSDT = FALSE; //if one item=true then dropAll=false by default +// //DBG(" true"); +// Dropped = TRUE; +// } +// DropTable = DropTable->Next; +// } +// DBG(" %s\n", Dropped ? "yes" : "no"); +// } } } } const TagDict* DSDTDict = ACPIDict->dictPropertyForKey("DSDT"); if (DSDTDict) { - //gSettings.DsdtName by default is "DSDT.aml", but name "BIOS" will mean autopatch + //gSettings.ACPI.DSDT.FixDsdt by default is "DSDT.aml", but name "BIOS" will mean autopatch const TagStruct* Prop = DSDTDict->propertyForKey("Name"); if (Prop != NULL) { if ( !Prop->isString() ) { MsgLog("ATTENTION : property not string in DSDT/Name\n"); }else{ - gSettings.DsdtName = Prop->getString()->stringValue(); + gSettings.ACPI.DSDT.DsdtName = Prop->getString()->stringValue(); } } Prop = DSDTDict->propertyForKey("Debug"); - gSettings.DebugDSDT = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.DSDT.DebugDSDT = IsPropertyNotNullAndTrue(Prop); Prop = DSDTDict->propertyForKey("Rtc8Allowed"); - gSettings.Rtc8Allowed = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.DSDT.Rtc8Allowed = IsPropertyNotNullAndTrue(Prop); Prop = DSDTDict->propertyForKey("PNLF_UID"); - gSettings.PNLF_UID = (UINT8)GetPropertyAsInteger(Prop, 0x0A); + gSettings.ACPI.DSDT.PNLF_UID = (UINT8)GetPropertyAsInteger(Prop, 0x0A); Prop = DSDTDict->propertyForKey("FixMask"); - gSettings.FixDsdt = (UINT32)GetPropertyAsInteger(Prop, gSettings.FixDsdt); + gSettings.ACPI.DSDT.FixDsdt = (UINT32)GetPropertyAsInteger(Prop, gSettings.ACPI.DSDT.FixDsdt); const TagDict* FixesDict = DSDTDict->dictPropertyForKey("Fixes"); if (FixesDict != NULL) { UINTN Index; - // DBG("Fixes will override DSDT fix mask %08X!\n", gSettings.FixDsdt); - gSettings.FixDsdt = 0; + // DBG("Fixes will override DSDT fix mask %08X!\n", gSettings.ACPI.DSDT.FixDsdt); + gSettings.ACPI.DSDT.FixDsdt = 0; for (Index = 0; Index < sizeof(FixesConfig)/sizeof(FixesConfig[0]); Index++) { const TagStruct* Prop2 = FixesDict->propertyForKey(FixesConfig[Index].newName); if (!Prop2 && FixesConfig[Index].oldName) { Prop2 = FixesDict->propertyForKey(FixesConfig[Index].oldName); } if (IsPropertyNotNullAndTrue(Prop2)) { - gSettings.FixDsdt |= FixesConfig[Index].bitData; + gSettings.ACPI.DSDT.FixDsdt |= FixesConfig[Index].bitData; } } } - DBG(" - final DSDT Fix mask=%08X\n", gSettings.FixDsdt); + DBG(" - final DSDT Fix mask=%08X\n", gSettings.ACPI.DSDT.FixDsdt); const TagArray* PatchesArray = DSDTDict->arrayPropertyForKey("Patches"); // array of dict if (PatchesArray != NULL) { INTN i; INTN Count = PatchesArray->arrayContent().size(); if (Count > 0) { -// gSettings.DSDTPatchArray.size() = (UINT32)Count; +// gSettings.ACPI.DSDT.DSDTPatchArray.size() = (UINT32)Count; // gSettings.PatchDsdtFind = (__typeof__(gSettings.PatchDsdtFind))AllocateZeroPool(Count * sizeof(UINT8*)); // gSettings.PatchDsdtReplace = (__typeof__(gSettings.PatchDsdtReplace))AllocateZeroPool(Count * sizeof(UINT8*)); // gSettings.PatchDsdtTgt = (__typeof__(gSettings.PatchDsdtTgt))AllocateZeroPool(Count * sizeof(UINT8*)); @@ -3596,7 +3594,7 @@ static void getACPISettings(const TagDict *CfgDict) // gSettings.PatchDsdtLabel = (__typeof__(gSettings.PatchDsdtLabel))AllocateZeroPool(Count * sizeof(UINT8*)); // gSettings.PatchDsdtMenuItem = new INPUT_ITEM[Count]; DBG("PatchesDSDT: %lld requested\n", Count); - gSettings.DSDTPatchArray.setEmpty(); + gSettings.ACPI.DSDT.DSDTPatchArray.setEmpty(); for (i = 0; i < Count; i++) { DSDT_Patch* dsdtPatchPtr = new DSDT_Patch(); @@ -3638,19 +3636,19 @@ static void getACPISettings(const TagDict *CfgDict) if (!dsdtPatch.PatchDsdtMenuItem.BValue) { DBG(" patch disabled at config\n"); } - gSettings.DSDTPatchArray.AddReference(dsdtPatchPtr, true); + gSettings.ACPI.DSDT.DSDTPatchArray.AddReference(dsdtPatchPtr, true); } } //if count > 0 } //if prop PatchesDSDT Prop = DSDTDict->propertyForKey("ReuseFFFF"); if (IsPropertyNotNullAndTrue(Prop)) { - gSettings.ReuseFFFF = TRUE; + gSettings.ACPI.DSDT.ReuseFFFF = TRUE; } Prop = DSDTDict->propertyForKey("SuspendOverride"); if (IsPropertyNotNullAndTrue(Prop)) { - gSettings.SuspendOverride = TRUE; + gSettings.ACPI.DSDT.SuspendOverride = TRUE; } /* Prop = GetProperty(Dict2, "DropOEM_DSM"); @@ -3739,102 +3737,102 @@ static void getACPISettings(const TagDict *CfgDict) const TagStruct* Prop2 = SSDTDict->propertyForKey("Generate"); if (Prop2 != NULL) { if (IsPropertyNotNullAndTrue(Prop2)) { - gSettings.GeneratePStates = TRUE; - gSettings.GenerateCStates = TRUE; - gSettings.GenerateAPSN = TRUE; - gSettings.GenerateAPLF = TRUE; - gSettings.GeneratePluginType = TRUE; + gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE; + gSettings.ACPI.SSDT.Generate.GenerateCStates = TRUE; + gSettings.ACPI.SSDT.Generate.GenerateAPSN = TRUE; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = TRUE; + gSettings.ACPI.SSDT.Generate.GeneratePluginType = TRUE; } else if (IsPropertyNotNullAndFalse(Prop2)) { - gSettings.GeneratePStates = FALSE; - gSettings.GenerateCStates = FALSE; - gSettings.GenerateAPSN = FALSE; - gSettings.GenerateAPLF = FALSE; - gSettings.GeneratePluginType = FALSE; + gSettings.ACPI.SSDT.Generate.GeneratePStates = FALSE; + gSettings.ACPI.SSDT.Generate.GenerateCStates = FALSE; + gSettings.ACPI.SSDT.Generate.GenerateAPSN = FALSE; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = FALSE; + gSettings.ACPI.SSDT.Generate.GeneratePluginType = FALSE; } else if (Prop2->isDict()) { const TagStruct* Prop = Prop2->getDict()->propertyForKey("PStates"); - gSettings.GeneratePStates = IsPropertyNotNullAndTrue(Prop); - gSettings.GenerateAPSN = gSettings.GeneratePStates; - gSettings.GenerateAPLF = gSettings.GeneratePStates; - gSettings.GeneratePluginType = gSettings.GeneratePStates; + gSettings.ACPI.SSDT.Generate.GeneratePStates = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.Generate.GenerateAPSN = gSettings.ACPI.SSDT.Generate.GeneratePStates; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = gSettings.ACPI.SSDT.Generate.GeneratePStates; + gSettings.ACPI.SSDT.Generate.GeneratePluginType = gSettings.ACPI.SSDT.Generate.GeneratePStates; Prop = Prop2->getDict()->propertyForKey("CStates"); - gSettings.GenerateCStates = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.Generate.GenerateCStates = IsPropertyNotNullAndTrue(Prop); Prop = Prop2->getDict()->propertyForKey("APSN"); if (Prop) { - gSettings.GenerateAPSN = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.Generate.GenerateAPSN = IsPropertyNotNullAndTrue(Prop); } Prop = Prop2->getDict()->propertyForKey("APLF"); if (Prop) { - gSettings.GenerateAPLF = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.Generate.GenerateAPLF = IsPropertyNotNullAndTrue(Prop); } Prop = Prop2->getDict()->propertyForKey("PluginType"); if (Prop) { - gSettings.GeneratePluginType = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.Generate.GeneratePluginType = IsPropertyNotNullAndTrue(Prop); } } } const TagStruct* Prop = SSDTDict->propertyForKey("DropOem"); - gSettings.DropSSDT = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.DropSSDT = IsPropertyNotNullAndTrue(Prop); Prop = SSDTDict->propertyForKey("NoOemTableId"); // to disable OEM table ID on ACPI/orgin/SSDT file names - gSettings.NoOemTableId = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.NoOemTableId = IsPropertyNotNullAndTrue(Prop); Prop = SSDTDict->propertyForKey("NoDynamicExtract"); // to disable extracting child SSDTs - gSettings.NoDynamicExtract = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.NoDynamicExtract = IsPropertyNotNullAndTrue(Prop); Prop = SSDTDict->propertyForKey("UseSystemIO"); - gSettings.EnableISS = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.EnableISS = IsPropertyNotNullAndTrue(Prop); Prop = SSDTDict->propertyForKey("EnableC7"); if (Prop) { - gSettings.EnableC7 = IsPropertyNotNullAndTrue(Prop); - DBG("EnableC7: %s\n", gSettings.EnableC7 ? "yes" : "no"); + gSettings.ACPI.SSDT.EnableC7 = IsPropertyNotNullAndTrue(Prop); + DBG("EnableC7: %s\n", gSettings.ACPI.SSDT.EnableC7 ? "yes" : "no"); } Prop = SSDTDict->propertyForKey("EnableC6"); if (Prop) { - gSettings.EnableC6 = IsPropertyNotNullAndTrue(Prop); - DBG("EnableC6: %s\n", gSettings.EnableC6 ? "yes" : "no"); + gSettings.ACPI.SSDT.EnableC6 = IsPropertyNotNullAndTrue(Prop); + DBG("EnableC6: %s\n", gSettings.ACPI.SSDT.EnableC6 ? "yes" : "no"); } Prop = SSDTDict->propertyForKey("EnableC4"); if (Prop) { - gSettings.EnableC4 = IsPropertyNotNullAndTrue(Prop); - DBG("EnableC4: %s\n", gSettings.EnableC4 ? "yes" : "no"); + gSettings.ACPI.SSDT.EnableC4 = IsPropertyNotNullAndTrue(Prop); + DBG("EnableC4: %s\n", gSettings.ACPI.SSDT.EnableC4 ? "yes" : "no"); } Prop = SSDTDict->propertyForKey("EnableC2"); if (Prop) { - gSettings.EnableC2 = IsPropertyNotNullAndTrue(Prop); - DBG("EnableC2: %s\n", gSettings.EnableC2 ? "yes" : "no"); + gSettings.ACPI.SSDT.EnableC2 = IsPropertyNotNullAndTrue(Prop); + DBG("EnableC2: %s\n", gSettings.ACPI.SSDT.EnableC2 ? "yes" : "no"); } Prop = SSDTDict->propertyForKey("C3Latency"); - gSettings.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.C3Latency); - DBG("C3Latency: %d\n", gSettings.C3Latency); + gSettings.ACPI.SSDT.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.C3Latency); + DBG("C3Latency: %d\n", gSettings.ACPI.SSDT.C3Latency); Prop = SSDTDict->propertyForKey("PLimitDict"); - gSettings.PLimitDict = (UINT8)GetPropertyAsInteger(Prop, 0); + gSettings.ACPI.SSDT.PLimitDict = (UINT8)GetPropertyAsInteger(Prop, 0); Prop = SSDTDict->propertyForKey("UnderVoltStep"); - gSettings.UnderVoltStep = (UINT8)GetPropertyAsInteger(Prop, 0); + gSettings.ACPI.SSDT.UnderVoltStep = (UINT8)GetPropertyAsInteger(Prop, 0); Prop = SSDTDict->propertyForKey("DoubleFirstState"); - gSettings.DoubleFirstState = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.DoubleFirstState = IsPropertyNotNullAndTrue(Prop); Prop = SSDTDict->propertyForKey("MinMultiplier"); - gSettings.MinMultiplier = (UINT8)GetPropertyAsInteger(Prop, gSettings.MinMultiplier); - DBG("MinMultiplier: %d\n", gSettings.MinMultiplier); + gSettings.ACPI.SSDT.MinMultiplier = (UINT8)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.MinMultiplier); + DBG("MinMultiplier: %d\n", gSettings.ACPI.SSDT.MinMultiplier); Prop = SSDTDict->propertyForKey("MaxMultiplier"); - gSettings.MaxMultiplier = (UINT8)GetPropertyAsInteger(Prop, gSettings.MaxMultiplier); - DBG("MaxMultiplier: %d\n", gSettings.MaxMultiplier); + gSettings.ACPI.SSDT.MaxMultiplier = (UINT8)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.MaxMultiplier); + DBG("MaxMultiplier: %d\n", gSettings.ACPI.SSDT.MaxMultiplier); Prop = SSDTDict->propertyForKey("PluginType"); - gSettings.PluginType = (UINT8)GetPropertyAsInteger(Prop, gSettings.PluginType); - DBG("PluginType: %d\n", gSettings.PluginType); + gSettings.ACPI.SSDT.PluginType = (UINT8)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.PluginType); + DBG("PluginType: %d\n", gSettings.ACPI.SSDT.PluginType); } // Prop = GetProperty(DictPointer, "DropMCFG"); @@ -3842,45 +3840,45 @@ static void getACPISettings(const TagDict *CfgDict) const TagStruct* Prop = ACPIDict->propertyForKey("ResetAddress"); if (Prop) { - gSettings.ResetAddr = (UINT32)GetPropertyAsInteger(Prop, 0x64); - DBG("ResetAddr: 0x%llX\n", gSettings.ResetAddr); + gSettings.ACPI.ResetAddr = (UINT32)GetPropertyAsInteger(Prop, 0x64); + DBG("ResetAddr: 0x%llX\n", gSettings.ACPI.ResetAddr); - if (gSettings.ResetAddr == 0x64) { - gSettings.ResetVal = 0xFE; - } else if (gSettings.ResetAddr == 0xCF9) { - gSettings.ResetVal = 0x06; + if (gSettings.ACPI.ResetAddr == 0x64) { + gSettings.ACPI.ResetVal = 0xFE; + } else if (gSettings.ACPI.ResetAddr == 0xCF9) { + gSettings.ACPI.ResetVal = 0x06; } - DBG("Calc ResetVal: 0x%hhX\n", gSettings.ResetVal); + DBG("Calc ResetVal: 0x%hhX\n", gSettings.ACPI.ResetVal); } Prop = ACPIDict->propertyForKey("ResetValue"); - gSettings.ResetVal = (UINT8)GetPropertyAsInteger(Prop, gSettings.ResetVal); - DBG("ResetVal: 0x%hhX\n", gSettings.ResetVal); + gSettings.ACPI.ResetVal = (UINT8)GetPropertyAsInteger(Prop, gSettings.ACPI.ResetVal); + DBG("ResetVal: 0x%hhX\n", gSettings.ACPI.ResetVal); //other known pair is 0x0CF9/0x06. What about 0x92/0x01 ? Prop = ACPIDict->propertyForKey("HaltEnabler"); - gSettings.SlpSmiEnable = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SlpSmiEnable = IsPropertyNotNullAndTrue(Prop); // Prop = ACPIDict->propertyForKey("FixHeaders"); - gSettings.FixHeaders = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.FixHeaders = IsPropertyNotNullAndTrue(Prop); Prop = ACPIDict->propertyForKey("FixMCFG"); - gSettings.FixMCFG = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.FixMCFG = IsPropertyNotNullAndTrue(Prop); Prop = ACPIDict->propertyForKey("DisableASPM"); - gSettings.NoASPM = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.NoASPM = IsPropertyNotNullAndTrue(Prop); Prop = ACPIDict->propertyForKey("smartUPS"); if (Prop) { - gSettings.smartUPS = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.smartUPS = IsPropertyNotNullAndTrue(Prop); DBG("smartUPS: present\n"); } Prop = ACPIDict->propertyForKey("PatchAPIC"); - gSettings.PatchNMI = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.PatchNMI = IsPropertyNotNullAndTrue(Prop); const TagArray* SortedOrderArray = ACPIDict->arrayPropertyForKey("SortedOrder"); // array of string if (SortedOrderArray) { @@ -3888,8 +3886,7 @@ static void getACPISettings(const TagDict *CfgDict) INTN Count = SortedOrderArray->arrayContent().size(); const TagStruct* Prop2 = NULL; if (Count > 0) { - gSettings.SortedACPICount = 0; - gSettings.SortedACPI = (__typeof__(gSettings.SortedACPI))AllocateZeroPool(Count * sizeof(CHAR16 *)); + gSettings.ACPI.SortedACPI.setEmpty(); for (i = 0; i < Count; i++) { Prop2 = &SortedOrderArray->arrayContent()[i]; @@ -3897,13 +3894,13 @@ static void getACPISettings(const TagDict *CfgDict) MsgLog("MALFORMED PLIST : SortedOrder must be an array of string"); continue; } - gSettings.SortedACPI[gSettings.SortedACPICount++] = SWPrintf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.ACPI.SortedACPI.Add(Prop2->getString()->stringValue()); } } } Prop = ACPIDict->propertyForKey("AutoMerge"); - gSettings.AutoMerge = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.AutoMerge = IsPropertyNotNullAndTrue(Prop); const TagArray* DisabledAMLArray = ACPIDict->arrayPropertyForKey("DisabledAML"); // array of string if (DisabledAMLArray) { @@ -3911,18 +3908,14 @@ static void getACPISettings(const TagDict *CfgDict) INTN Count = DisabledAMLArray->arrayContent().size(); const TagStruct* Prop2 = NULL; if (Count > 0) { - gSettings.DisabledAMLCount = 0; - gSettings.DisabledAML = (__typeof__(gSettings.DisabledAML))AllocateZeroPool(Count * sizeof(CHAR16 *)); - - if (gSettings.DisabledAML) { - for (i = 0; i < Count; i++) { - Prop2 = &DisabledAMLArray->arrayContent()[i]; - if ( !Prop2->isString()) { - MsgLog("MALFORMED PLIST : DisabledAML must be an array of string"); - continue; - } - gSettings.DisabledAML[gSettings.DisabledAMLCount++] = SWPrintf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.ACPI.DisabledAML.setEmpty(); + for (i = 0; i < Count; i++) { + Prop2 = &DisabledAMLArray->arrayContent()[i]; + if ( !Prop2->isString()) { + MsgLog("MALFORMED PLIST : DisabledAML must be an array of string"); + continue; } + gSettings.ACPI.DisabledAML.Add(Prop2->getString()->stringValue()); } } } @@ -3932,22 +3925,23 @@ static void getACPISettings(const TagDict *CfgDict) INTN i; INTN Count = RenameDevicesDict->dictKeyCount(); if (Count > 0) { - gSettings.DeviceRenameCount = 0; - gSettings.DeviceRename = (__typeof__(gSettings.DeviceRename))AllocateZeroPool(Count * sizeof(ACPI_NAME_LIST)); + gSettings.ACPI.DeviceRename.setEmpty(); DBG("Devices to rename %lld\n", Count); for (i = 0; i < Count; i++) { const TagKey* key; const TagStruct* value; if ( !EFI_ERROR(RenameDevicesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { - ACPI_NAME_LIST *List = ParseACPIName(key->keyStringValue()); - gSettings.DeviceRename[gSettings.DeviceRenameCount].Next = List; + ACPI_NAME_LIST* List = ParseACPIName(key->keyStringValue()); + ACPI_NAME_LIST* List2 = List; +// gSettings.ACPI.DeviceRename[gSettings.ACPI.DeviceRename.size()].Next = List; + gSettings.ACPI.DeviceRename.AddReference(List, false); while (List) { DBG("%s:", List->Name); List = List->Next; } if (value->isString()) { - gSettings.DeviceRename[gSettings.DeviceRenameCount++].Name = S8Printf("%s", value->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); - DBG("->will be renamed to %s\n", value->getString()->stringValue().c_str()); + List2->Name = S8Printf("%s", value->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + DBG("->will be renamed to %s\n", List2->Name); } } } @@ -3956,9 +3950,16 @@ static void getACPISettings(const TagDict *CfgDict) } } -EFI_STATUS -GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) +/* + * To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global + * and is passed by non-const reference. + * This temporary during the refactoring + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings) { +#pragma GCC diagnostic pop // EFI_STATUS Status = EFI_NOT_FOUND; if (CfgDict != NULL) { @@ -3972,14 +3973,14 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if (BootDict != NULL) { const TagStruct* Prop = BootDict->propertyForKey("Arguments"); - if ( Prop != NULL && Prop->isString() && Prop->getString()->stringValue().notEmpty() && !settingsData.Boot.BootArgs.contains(Prop->getString()->stringValue()) ) { - settingsData.Boot.BootArgs = Prop->getString()->stringValue(); + if ( Prop != NULL && Prop->isString() && Prop->getString()->stringValue().notEmpty() && !gSettings.Boot.BootArgs.contains(Prop->getString()->stringValue()) ) { + gSettings.Boot.BootArgs = Prop->getString()->stringValue(); //gBootArgsChanged = TRUE; //GlobalConfig.gBootChanged = TRUE; } Prop = BootDict->propertyForKey("NeverDoRecovery"); - settingsData.NeverDoRecovery = IsPropertyNotNullAndTrue(Prop); + gSettings.NeverDoRecovery = IsPropertyNotNullAndTrue(Prop); } @@ -3991,62 +3992,62 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagStruct* Prop = GraphicsDict->propertyForKey("Inject"); if (Prop != NULL) { if (IsPropertyNotNullAndTrue(Prop)) { - settingsData.GraphicsInjector = TRUE; - settingsData.InjectIntel = TRUE; - settingsData.InjectATI = TRUE; - settingsData.InjectNVidia = TRUE; + gSettings.GraphicsInjector = TRUE; + gSettings.InjectIntel = TRUE; + gSettings.InjectATI = TRUE; + gSettings.InjectNVidia = TRUE; } else if (Prop->isDict()) { const TagDict* Dict2 = Prop->getDict(); const TagStruct* Prop2 = Dict2->propertyForKey("Intel"); if (Prop2 != NULL) { - settingsData.InjectIntel = IsPropertyNotNullAndTrue(Prop2); + gSettings.InjectIntel = IsPropertyNotNullAndTrue(Prop2); } Prop2 = Dict2->propertyForKey("ATI"); if (Prop2 != NULL) { - settingsData.InjectATI = IsPropertyNotNullAndTrue(Prop2); + gSettings.InjectATI = IsPropertyNotNullAndTrue(Prop2); } Prop2 = Dict2->propertyForKey("NVidia"); if (Prop2 != NULL) { - settingsData.InjectNVidia = IsPropertyNotNullAndTrue(Prop2); + gSettings.InjectNVidia = IsPropertyNotNullAndTrue(Prop2); } } else { - settingsData.GraphicsInjector = FALSE; - settingsData.InjectIntel = FALSE; - settingsData.InjectATI = FALSE; - settingsData.InjectNVidia = FALSE; + gSettings.GraphicsInjector = FALSE; + gSettings.InjectIntel = FALSE; + gSettings.InjectATI = FALSE; + gSettings.InjectNVidia = FALSE; } } Prop = GraphicsDict->propertyForKey("RadeonDeInit"); - settingsData.DeInit = IsPropertyNotNullAndTrue(Prop); + gSettings.DeInit = IsPropertyNotNullAndTrue(Prop); Prop = GraphicsDict->propertyForKey("VRAM"); - settingsData.VRAM = (UINTN)GetPropertyAsInteger(Prop, (INTN)settingsData.VRAM); //Mb + gSettings.VRAM = (UINTN)GetPropertyAsInteger(Prop, (INTN)gSettings.VRAM); //Mb // Prop = GraphicsDict->propertyForKey("RefCLK"); - settingsData.RefCLK = (UINT16)GetPropertyAsInteger(Prop, 0); + gSettings.RefCLK = (UINT16)GetPropertyAsInteger(Prop, 0); Prop = GraphicsDict->propertyForKey("LoadVBios"); - settingsData.LoadVBios = IsPropertyNotNullAndTrue(Prop); + gSettings.LoadVBios = IsPropertyNotNullAndTrue(Prop); for (i = 0; i < (INTN)NGFX; i++) { - gGraphics[i].LoadVBios = settingsData.LoadVBios; //default + gGraphics[i].LoadVBios = gSettings.LoadVBios; //default } Prop = GraphicsDict->propertyForKey("VideoPorts"); - settingsData.VideoPorts = (UINT16)GetPropertyAsInteger(Prop, settingsData.VideoPorts); + gSettings.VideoPorts = (UINT16)GetPropertyAsInteger(Prop, gSettings.VideoPorts); Prop = GraphicsDict->propertyForKey("BootDisplay"); - settingsData.BootDisplay = (INT8)GetPropertyAsInteger(Prop, -1); + gSettings.BootDisplay = (INT8)GetPropertyAsInteger(Prop, -1); Prop = GraphicsDict->propertyForKey("FBName"); if (Prop != NULL) { if ( !Prop->isString() ) { MsgLog("ATTENTION : property not string in FBName\n"); }else{ - settingsData.FBName = Prop->getString()->stringValue(); + gSettings.FBName = Prop->getString()->stringValue(); } } @@ -4055,11 +4056,11 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if ( !Prop->isString() ) { MsgLog("ATTENTION : property not string in NVCAP\n"); }else{ - hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&settingsData.NVCAP[0], 20); + hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&gSettings.NVCAP[0], 20); DBG("Read NVCAP:"); for (i = 0; i<20; i++) { - DBG("%02hhX", settingsData.NVCAP[i]); + DBG("%02hhX", gSettings.NVCAP[i]); } DBG("\n"); @@ -4072,12 +4073,12 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if ( !Prop->isString() ) { MsgLog("ATTENTION : property not string in display-cfg\n"); }else{ - hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&settingsData.Dcfg[0], 8); + hex2bin (Prop->getString()->stringValue().c_str(), (UINT8*)&gSettings.Dcfg[0], 8); } } Prop = GraphicsDict->propertyForKey("DualLink"); - settingsData.DualLink = (UINT32)GetPropertyAsInteger(Prop, settingsData.DualLink); + gSettings.DualLink = (UINT32)GetPropertyAsInteger(Prop, gSettings.DualLink); //InjectEDID - already done in earlysettings //No! Take again @@ -4085,19 +4086,19 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) // ErmaC: NvidiaGeneric Prop = GraphicsDict->propertyForKey("NvidiaGeneric"); - settingsData.NvidiaGeneric = IsPropertyNotNullAndTrue(Prop); + gSettings.NvidiaGeneric = IsPropertyNotNullAndTrue(Prop); Prop = GraphicsDict->propertyForKey("NvidiaNoEFI"); - settingsData.NvidiaNoEFI = IsPropertyNotNullAndTrue(Prop); + gSettings.NvidiaNoEFI = IsPropertyNotNullAndTrue(Prop); Prop = GraphicsDict->propertyForKey("NvidiaSingle"); - settingsData.NvidiaSingle = IsPropertyNotNullAndTrue(Prop); + gSettings.NvidiaSingle = IsPropertyNotNullAndTrue(Prop); Prop = GraphicsDict->propertyForKey("ig-platform-id"); - settingsData.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, settingsData.IgPlatform); + gSettings.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.IgPlatform); Prop = GraphicsDict->propertyForKey("snb-platform-id"); - settingsData.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, settingsData.IgPlatform); + gSettings.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.IgPlatform); FillCardList(GraphicsDict); //#@ Getcardslist } @@ -4105,16 +4106,16 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagDict* DevicesDict = CfgDict->dictPropertyForKey("Devices"); if (DevicesDict != NULL) { const TagStruct* Prop = DevicesDict->propertyForKey("Inject"); - settingsData.StringInjector = IsPropertyNotNullAndTrue(Prop); + gSettings.StringInjector = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("SetIntelBacklight"); - settingsData.IntelBacklight = IsPropertyNotNullAndTrue(Prop); + gSettings.IntelBacklight = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("SetIntelMaxBacklight"); - settingsData.IntelMaxBacklight = IsPropertyNotNullAndTrue(Prop); + gSettings.IntelMaxBacklight = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("IntelMaxValue"); - settingsData.IntelMaxValue = (UINT16)GetPropertyAsInteger(Prop, settingsData.IntelMaxValue); + gSettings.IntelMaxValue = (UINT16)GetPropertyAsInteger(Prop, gSettings.IntelMaxValue); /* * Properties is a single string, or a dict @@ -4147,7 +4148,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) INTN i; const TagDict* PropertiesDict = Prop->getDict(); INTN Count = PropertiesDict->dictKeyCount(); //ok - settingsData.AddProperties = new DEV_PROPERTY[Count]; + gSettings.AddProperties = new DEV_PROPERTY[Count]; DEV_PROPERTY *DevPropDevice; DEV_PROPERTY *DevProps; DEV_PROPERTY **Child; @@ -4177,14 +4178,14 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } #endif //Create Device node - DevPropDevice = settingsData.ArbProperties; - settingsData.ArbProperties = new DEV_PROPERTY; - settingsData.ArbProperties->Next = DevPropDevice; //next device - settingsData.ArbProperties->Child = NULL; - settingsData.ArbProperties->Device = 0; //to differ from arbitrary - settingsData.ArbProperties->DevicePath = DevicePath; //this is pointer - settingsData.ArbProperties->Label = S8Printf("%s", key->keyStringValue().c_str()).forgetDataWithoutFreeing(); - Child = &(settingsData.ArbProperties->Child); + DevPropDevice = gSettings.ArbProperties; + gSettings.ArbProperties = new DEV_PROPERTY; + gSettings.ArbProperties->Next = DevPropDevice; //next device + gSettings.ArbProperties->Child = NULL; + gSettings.ArbProperties->Device = 0; //to differ from arbitrary + gSettings.ArbProperties->DevicePath = DevicePath; //this is pointer + gSettings.ArbProperties->Label = S8Printf("%s", key->keyStringValue().c_str()).forgetDataWithoutFreeing(); + Child = &(gSettings.ArbProperties->Child); if ((value != NULL) && (value->isDict())) { INTN PropCount = 0; @@ -4259,13 +4260,13 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } Prop = DevicesDict->propertyForKey("LANInjection"); - settingsData.LANInjection = !IsPropertyNotNullAndFalse(Prop); //default = TRUE + gSettings.LANInjection = !IsPropertyNotNullAndFalse(Prop); //default = TRUE Prop = DevicesDict->propertyForKey("HDMIInjection"); - settingsData.HDMIInjection = IsPropertyNotNullAndTrue(Prop); + gSettings.HDMIInjection = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("NoDefaultProperties"); - settingsData.NoDefaultProperties = !IsPropertyNotNullAndFalse(Prop); + gSettings.NoDefaultProperties = !IsPropertyNotNullAndFalse(Prop); const TagArray* ArbitraryArray = DevicesDict->arrayPropertyForKey("Arbitrary"); // array of dict if (ArbitraryArray != NULL) { @@ -4323,59 +4324,59 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) for (PropIndex = 0; PropIndex < PropCount; PropIndex++) { Dict3 = CustomPropertiesArray->dictElementAt(PropIndex, "CustomProperties"_XS8); - DevProp = settingsData.ArbProperties; - settingsData.ArbProperties = new DEV_PROPERTY; - settingsData.ArbProperties->Next = DevProp; + DevProp = gSettings.ArbProperties; + gSettings.ArbProperties = new DEV_PROPERTY; + gSettings.ArbProperties->Next = DevProp; - settingsData.ArbProperties->Device = (UINT32)DeviceAddr; - settingsData.ArbProperties->Label = (__typeof__(settingsData.ArbProperties->Label))AllocateCopyPool(Label.sizeInBytesIncludingTerminator(), Label.c_str()); + gSettings.ArbProperties->Device = (UINT32)DeviceAddr; + gSettings.ArbProperties->Label = (__typeof__(gSettings.ArbProperties->Label))AllocateCopyPool(Label.sizeInBytesIncludingTerminator(), Label.c_str()); const TagStruct* DisabledProp = Dict3->propertyForKey("Disabled"); - settingsData.ArbProperties->MenuItem.BValue = !IsPropertyNotNullAndTrue(DisabledProp); + gSettings.ArbProperties->MenuItem.BValue = !IsPropertyNotNullAndTrue(DisabledProp); DisabledProp = Dict3->propertyForKey("Key"); if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) { - settingsData.ArbProperties->Key = S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.ArbProperties->Key = S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); } DisabledProp = Dict3->propertyForKey("Value"); if (DisabledProp && (DisabledProp->isString()) && DisabledProp->getString()->stringValue().notEmpty()) { //first suppose it is Ascii string - settingsData.ArbProperties->Value = (UINT8*)S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); - settingsData.ArbProperties->ValueLen = DisabledProp->getString()->stringValue().sizeInBytesIncludingTerminator(); - settingsData.ArbProperties->ValueType = kTagTypeString; + gSettings.ArbProperties->Value = (UINT8*)S8Printf("%s", DisabledProp->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.ArbProperties->ValueLen = DisabledProp->getString()->stringValue().sizeInBytesIncludingTerminator(); + gSettings.ArbProperties->ValueType = kTagTypeString; } else if (DisabledProp && (DisabledProp->isInt64())) { if ( DisabledProp->getInt64()->intValue() < MIN_INT32 || DisabledProp->getInt64()->intValue() > MAX_INT32 ) { MsgLog("Invalid int value for key 'Value'\n"); }else{ INT32 intValue = (INT32)DisabledProp->getInt64()->intValue(); - settingsData.ArbProperties->Value = (__typeof__(settingsData.ArbProperties->Value))AllocatePool(sizeof(intValue)); + gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocatePool(sizeof(intValue)); // CopyMem(settingsData.ArbProperties->Value, &Prop3->intValue, 4); - *(INT32*)(settingsData.ArbProperties->Value) = intValue; - settingsData.ArbProperties->ValueLen = sizeof(intValue); - settingsData.ArbProperties->ValueType = kTagTypeInteger; + *(INT32*)(gSettings.ArbProperties->Value) = intValue; + gSettings.ArbProperties->ValueLen = sizeof(intValue); + gSettings.ArbProperties->ValueType = kTagTypeInteger; } } else if ( DisabledProp && DisabledProp->isTrue() ) { - settingsData.ArbProperties->Value = (__typeof__(settingsData.ArbProperties->Value))AllocateZeroPool(4); - settingsData.ArbProperties->Value[0] = TRUE; - settingsData.ArbProperties->ValueLen = 1; - settingsData.ArbProperties->ValueType = kTagTypeTrue; + gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocateZeroPool(4); + gSettings.ArbProperties->Value[0] = TRUE; + gSettings.ArbProperties->ValueLen = 1; + gSettings.ArbProperties->ValueType = kTagTypeTrue; } else if ( DisabledProp && DisabledProp->isFalse() ) { - settingsData.ArbProperties->Value = (__typeof__(settingsData.ArbProperties->Value))AllocateZeroPool(4); + gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocateZeroPool(4); //settingsData.ArbProperties->Value[0] = FALSE; - settingsData.ArbProperties->ValueLen = 1; - settingsData.ArbProperties->ValueType = kTagTypeFalse; + gSettings.ArbProperties->ValueLen = 1; + gSettings.ArbProperties->ValueType = kTagTypeFalse; } else { //else data UINTN Size = 0; - settingsData.ArbProperties->Value = GetDataSetting (Dict3, "Value", &Size); - settingsData.ArbProperties->ValueLen = Size; - settingsData.ArbProperties->ValueType = kTagTypeData; + gSettings.ArbProperties->Value = GetDataSetting (Dict3, "Value", &Size); + gSettings.ArbProperties->ValueLen = Size; + gSettings.ArbProperties->ValueType = kTagTypeData; } //Special case. In future there must be more such cases - if ((AsciiStrStr(settingsData.ArbProperties->Key, "-platform-id") != NULL)) { - CopyMem((CHAR8*)&settingsData.IgPlatform, settingsData.ArbProperties->Value, 4); + if ((AsciiStrStr(gSettings.ArbProperties->Key, "-platform-id") != NULL)) { + CopyMem((CHAR8*)&gSettings.IgPlatform, gSettings.ArbProperties->Value, 4); } } //for() device properties } @@ -4392,7 +4393,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) //count = 0x1F1E1D1C1B1A1918 if (Count > 0) { DBG("Add %lld properties:\n", Count); - settingsData.AddProperties = new DEV_PROPERTY[Count]; + gSettings.AddProperties = new DEV_PROPERTY[Count]; for (i = 0; i < Count; i++) { UINTN Size = 0; @@ -4400,7 +4401,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagDict* Dict2 = AddPropertiesArray->dictElementAt(i, "AddProperties"_XS8); const TagStruct* DeviceProp = Dict2->propertyForKey("Device"); if (DeviceProp && (DeviceProp->isString()) && DeviceProp->getString()->stringValue().notEmpty()) { - DEV_PROPERTY *Property = &settingsData.AddProperties[Index]; + DEV_PROPERTY *Property = &gSettings.AddProperties[Index]; if (DeviceProp->getString()->stringValue().equalIC("ATI")) { Property->Device = (UINT32)DEV_ATI; @@ -4437,44 +4438,44 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if ( DeviceProp->isString() ) DBG(" %s ", DeviceProp->getString()->stringValue().c_str()); const TagStruct* Prop2 = Dict2->propertyForKey("Disabled"); - settingsData.AddProperties[Index].MenuItem.BValue = !IsPropertyNotNullAndTrue(Prop2); + gSettings.AddProperties[Index].MenuItem.BValue = !IsPropertyNotNullAndTrue(Prop2); Prop2 = Dict2->propertyForKey("Key"); if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { - settingsData.AddProperties[Index].Key = S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.AddProperties[Index].Key = S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); } Prop2 = Dict2->propertyForKey("Value"); if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { //first suppose it is Ascii string - settingsData.AddProperties[Index].Value = (UINT8*)S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); - settingsData.AddProperties[Index].ValueLen = Prop2->getString()->stringValue().sizeInBytesIncludingTerminator(); + gSettings.AddProperties[Index].Value = (UINT8*)S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); + gSettings.AddProperties[Index].ValueLen = Prop2->getString()->stringValue().sizeInBytesIncludingTerminator(); } else if (Prop2 && (Prop2->isInt64())) { if ( Prop2->getInt64()->intValue() < MIN_INT32 || Prop2->getInt64()->intValue() > MAX_INT32 ) { MsgLog("Invalid int value for key 'Value'\n"); }else{ INT32 intValue = (INT32)Prop2->getInt64()->intValue(); - settingsData.AddProperties[Index].Value = (__typeof__(settingsData.AddProperties[Index].Value))AllocatePool (sizeof(intValue)); + gSettings.AddProperties[Index].Value = (__typeof__(gSettings.AddProperties[Index].Value))AllocatePool (sizeof(intValue)); // CopyMem(settingsData.AddProperties[Index].Value, &Prop2->intValue, 4); - *(INT32*)(settingsData.AddProperties[Index].Value) = intValue; - settingsData.AddProperties[Index].ValueLen = sizeof(intValue); + *(INT32*)(gSettings.AddProperties[Index].Value) = intValue; + gSettings.AddProperties[Index].ValueLen = sizeof(intValue); } } else { //else data - settingsData.AddProperties[Index].Value = GetDataSetting (Dict2, "Value", &Size); - settingsData.AddProperties[Index].ValueLen = Size; + gSettings.AddProperties[Index].Value = GetDataSetting (Dict2, "Value", &Size); + gSettings.AddProperties[Index].ValueLen = Size; } - DBG("Key: %s, len: %llu\n", settingsData.AddProperties[Index].Key, settingsData.AddProperties[Index].ValueLen); + DBG("Key: %s, len: %llu\n", gSettings.AddProperties[Index].Key, gSettings.AddProperties[Index].ValueLen); - if (!settingsData.AddProperties[Index].MenuItem.BValue) { + if (!gSettings.AddProperties[Index].MenuItem.BValue) { DBG(" property disabled at config\n"); } ++Index; } - settingsData.NrAddProperties = Index; + gSettings.NrAddProperties = Index; } } //end AddProperties @@ -4483,54 +4484,54 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if (FakeIDDict != NULL) { const TagStruct* Prop2 = FakeIDDict->propertyForKey("ATI"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeATI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeATI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("NVidia"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeNVidia = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeNVidia = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("IntelGFX"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeIntel = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeIntel = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("LAN"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeLAN = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeLAN = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("WIFI"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeWIFI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeWIFI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("SATA"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeSATA = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeSATA = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("XHCI"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeXHCI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeXHCI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } Prop2 = FakeIDDict->propertyForKey("IMEI"); if (Prop2 && (Prop2->isString())) { - settingsData.FakeIMEI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); + gSettings.FakeIMEI = (UINT32)AsciiStrHexToUint64(Prop2->getString()->stringValue()); } } Prop = DevicesDict->propertyForKey("UseIntelHDMI"); - settingsData.UseIntelHDMI = IsPropertyNotNullAndTrue(Prop); + gSettings.UseIntelHDMI = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("ForceHPET"); - settingsData.ForceHPET = IsPropertyNotNullAndTrue(Prop); + gSettings.ForceHPET = IsPropertyNotNullAndTrue(Prop); Prop = DevicesDict->propertyForKey("DisableFunctions"); if (Prop && (Prop->isString())) { - settingsData.DisableFunctions = (UINT32)AsciiStrHexToUint64(Prop->getString()->stringValue()); + gSettings.DisableFunctions = (UINT32)AsciiStrHexToUint64(Prop->getString()->stringValue()); } Prop = DevicesDict->propertyForKey("AirportBridgeDeviceName"); @@ -4538,7 +4539,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) if ( Prop->getString()->stringValue().length() != 4 ) { MsgLog("ERROR IN PLIST : AirportBridgeDeviceName must 4 chars long"); }else{ - settingsData.AirportBridgeDeviceName = Prop->getString()->stringValue(); + gSettings.AirportBridgeDeviceName = Prop->getString()->stringValue(); } } @@ -4559,52 +4560,52 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) // if hex device is cannot be converted to decimal, injects legacy value 12 decimal // - all other values are equal to HDAInjection=Detect if (Prop->isInt64()) { - settingsData.HDALayoutId = (INT32)Prop->getInt64()->intValue(); //must be signed - settingsData.HDAInjection = (settingsData.HDALayoutId > 0); + gSettings.HDALayoutId = (INT32)Prop->getInt64()->intValue(); //must be signed + gSettings.HDAInjection = (gSettings.HDALayoutId > 0); } else if (Prop->isString()){ if ( Prop->getString()->stringValue().notEmpty() && (Prop->getString()->stringValue()[0] == 'n' || Prop->getString()->stringValue()[0] == 'N') ) { // if starts with n or N, then no HDA injection - settingsData.HDAInjection = FALSE; + gSettings.HDAInjection = FALSE; } else if ( Prop->getString()->stringValue().length() > 1 && Prop->getString()->stringValue()[0] == '0' && ( Prop->getString()->stringValue()[1] == 'x' || Prop->getString()->stringValue()[1] == 'X' ) ) { // assume it's a hex layout id - settingsData.HDALayoutId = (INT32)AsciiStrHexToUintn(Prop->getString()->stringValue()); - settingsData.HDAInjection = TRUE; + gSettings.HDALayoutId = (INT32)AsciiStrHexToUintn(Prop->getString()->stringValue()); + gSettings.HDAInjection = TRUE; } else { // assume it's a decimal layout id - settingsData.HDALayoutId = (INT32)AsciiStrDecimalToUintn(Prop->getString()->stringValue()); - settingsData.HDAInjection = TRUE; + gSettings.HDALayoutId = (INT32)AsciiStrDecimalToUintn(Prop->getString()->stringValue()); + gSettings.HDAInjection = TRUE; } } } Prop = AudioDict->propertyForKey("AFGLowPowerState"); - settingsData.AFGLowPowerState = IsPropertyNotNullAndTrue(Prop); + gSettings.AFGLowPowerState = IsPropertyNotNullAndTrue(Prop); } const TagDict* USBDict = DevicesDict->dictPropertyForKey("USB"); if (USBDict != NULL) { // USB Prop = USBDict->propertyForKey("Inject"); - settingsData.USBInjection = !IsPropertyNotNullAndFalse(Prop); // enabled by default + gSettings.USBInjection = !IsPropertyNotNullAndFalse(Prop); // enabled by default Prop = USBDict->propertyForKey("AddClockID"); - settingsData.InjectClockID = IsPropertyNotNullAndTrue(Prop); // disabled by default + gSettings.InjectClockID = IsPropertyNotNullAndTrue(Prop); // disabled by default // enabled by default for CloverEFI // disabled for others - settingsData.USBFixOwnership = gFirmwareClover; + gSettings.USBFixOwnership = gFirmwareClover; Prop = USBDict->propertyForKey("FixOwnership"); if (Prop != NULL) { - settingsData.USBFixOwnership = IsPropertyNotNullAndTrue(Prop); + gSettings.USBFixOwnership = IsPropertyNotNullAndTrue(Prop); } - DBG("USB FixOwnership: %s\n", settingsData.USBFixOwnership?"yes":"no"); + DBG("USB FixOwnership: %s\n", gSettings.USBFixOwnership?"yes":"no"); Prop = USBDict->propertyForKey("HighCurrent"); - settingsData.HighCurrent = IsPropertyNotNullAndTrue(Prop); + gSettings.HighCurrent = IsPropertyNotNullAndTrue(Prop); Prop = USBDict->propertyForKey("NameEH00"); - settingsData.NameEH00 = IsPropertyNotNullAndTrue(Prop); + gSettings.NameEH00 = IsPropertyNotNullAndTrue(Prop); } } @@ -4619,13 +4620,13 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagStruct* Prop = SMBIOSDict->propertyForKey("Trust"); if (Prop != NULL) { if (IsPropertyNotNullAndFalse(Prop)) { - settingsData.TrustSMBIOS = FALSE; + gSettings.TrustSMBIOS = FALSE; } else if (IsPropertyNotNullAndTrue(Prop)) { - settingsData.TrustSMBIOS = TRUE; + gSettings.TrustSMBIOS = TRUE; } } Prop = SMBIOSDict->propertyForKey("MemoryRank"); - settingsData.Attribute = (INT8)GetPropertyAsInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is + gSettings.Attribute = (INT8)GetPropertyAsInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is // Delete the user memory when a new config is selected INTN i = 0; @@ -4635,7 +4636,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } gRAM.UserInUse = 0; gRAM.UserChannels = 0; - settingsData.InjectMemoryTables = FALSE; + gSettings.InjectMemoryTables = FALSE; // Inject memory tables into SMBIOS const TagDict* MemoryDict = SMBIOSDict->dictPropertyForKey("Memory"); @@ -4719,7 +4720,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } if (gRAM.UserInUse > 0) { - settingsData.InjectMemoryTables = TRUE; + gSettings.InjectMemoryTables = TRUE; } } } @@ -4817,93 +4818,93 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } //CPU - settingsData.CpuType = GetAdvancedCpuType(); //let it be default - settingsData.SavingMode = 0xFF; //default + gSettings.CpuType = GetAdvancedCpuType(); //let it be default + gSettings.SavingMode = 0xFF; //default const TagDict* CPUDict = CfgDict->dictPropertyForKey("CPU"); if (CPUDict != NULL) { const TagStruct* Prop = CPUDict->propertyForKey("QPI"); if (Prop != NULL) { - settingsData.QPI = (UINT16)GetPropertyAsInteger(Prop, settingsData.QPI); - DBG("QPI: %dMHz\n", settingsData.QPI); + gSettings.QPI = (UINT16)GetPropertyAsInteger(Prop, gSettings.QPI); + DBG("QPI: %dMHz\n", gSettings.QPI); } Prop = CPUDict->propertyForKey("FrequencyMHz"); if (Prop != NULL) { - settingsData.CpuFreqMHz = (UINT32)GetPropertyAsInteger(Prop, settingsData.CpuFreqMHz); - DBG("CpuFreq: %dMHz\n", settingsData.CpuFreqMHz); + gSettings.CpuFreqMHz = (UINT32)GetPropertyAsInteger(Prop, gSettings.CpuFreqMHz); + DBG("CpuFreq: %dMHz\n", gSettings.CpuFreqMHz); } Prop = CPUDict->propertyForKey("Type"); if (Prop != NULL) { - settingsData.CpuType = (UINT16)GetPropertyAsInteger(Prop, settingsData.CpuType); - DBG("CpuType: %hX\n", settingsData.CpuType); + gSettings.CpuType = (UINT16)GetPropertyAsInteger(Prop, gSettings.CpuType); + DBG("CpuType: %hX\n", gSettings.CpuType); } Prop = CPUDict->propertyForKey("QEMU"); - settingsData.QEMU = IsPropertyNotNullAndTrue(Prop); - if (settingsData.QEMU) { + gSettings.QEMU = IsPropertyNotNullAndTrue(Prop); + if (gSettings.QEMU) { DBG("QEMU: true\n"); } Prop = CPUDict->propertyForKey("UseARTFrequency"); if (Prop != NULL) { - settingsData.UseARTFreq = IsPropertyNotNullAndTrue(Prop); + gSettings.UseARTFreq = IsPropertyNotNullAndTrue(Prop); } - settingsData.UserChange = FALSE; + gSettings.UserChange = FALSE; Prop = CPUDict->propertyForKey("BusSpeedkHz"); if (Prop != NULL) { - settingsData.BusSpeed = (UINT32)GetPropertyAsInteger(Prop, settingsData.BusSpeed); - DBG("BusSpeed: %dkHz\n", settingsData.BusSpeed); - settingsData.UserChange = TRUE; + gSettings.BusSpeed = (UINT32)GetPropertyAsInteger(Prop, gSettings.BusSpeed); + DBG("BusSpeed: %dkHz\n", gSettings.BusSpeed); + gSettings.UserChange = TRUE; } Prop = CPUDict->propertyForKey("C6"); if (Prop != NULL) { - settingsData.EnableC6 = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.EnableC6 = IsPropertyNotNullAndTrue(Prop); } Prop = CPUDict->propertyForKey("C4"); if (Prop != NULL) { - settingsData.EnableC4 = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.EnableC4 = IsPropertyNotNullAndTrue(Prop); } Prop = CPUDict->propertyForKey("C2"); if (Prop != NULL) { - settingsData.EnableC2 = IsPropertyNotNullAndTrue(Prop); + gSettings.ACPI.SSDT.EnableC2 = IsPropertyNotNullAndTrue(Prop); } //Usually it is 0x03e9, but if you want Turbo, you may set 0x00FA Prop = CPUDict->propertyForKey("Latency"); - settingsData.C3Latency = (UINT16)GetPropertyAsInteger(Prop, settingsData.C3Latency); + gSettings.ACPI.SSDT.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.C3Latency); Prop = CPUDict->propertyForKey("SavingMode"); - settingsData.SavingMode = (UINT8)GetPropertyAsInteger(Prop, 0xFF); //the default value means not set + gSettings.SavingMode = (UINT8)GetPropertyAsInteger(Prop, 0xFF); //the default value means not set Prop = CPUDict->propertyForKey("HWPEnable"); if (Prop && IsPropertyNotNullAndTrue(Prop) && (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U)) { - settingsData.HWP = TRUE; + gSettings.HWP = TRUE; #ifdef CLOVER_BUILD AsmWriteMsr64 (MSR_IA32_PM_ENABLE, 1); #endif } Prop = CPUDict->propertyForKey("HWPValue"); - if (Prop && settingsData.HWP) { - settingsData.HWPValue = (UINT32)GetPropertyAsInteger(Prop, 0); + if (Prop && gSettings.HWP) { + gSettings.HWPValue = (UINT32)GetPropertyAsInteger(Prop, 0); #ifdef CLOVER_BUILD - AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, settingsData.HWPValue); + AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, gSettings.HWPValue); #endif } Prop = CPUDict->propertyForKey("TDP"); - settingsData.TDP = (UINT8)GetPropertyAsInteger(Prop, 0); + gSettings.TDP = (UINT8)GetPropertyAsInteger(Prop, 0); Prop = CPUDict->propertyForKey("TurboDisable"); if (Prop && IsPropertyNotNullAndTrue(Prop)) { #ifdef CLOVER_BUILD UINT64 msr = AsmReadMsr64(MSR_IA32_MISC_ENABLE); #endif - settingsData.Turbo = 0; + gSettings.Turbo = 0; #ifdef CLOVER_BUILD msr &= ~(1ULL<<38); AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, msr); @@ -4912,20 +4913,20 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } // RtVariables - settingsData.RtROM.setEmpty(); + gSettings.RtROM.setEmpty(); const TagDict* RtVariablesDict = CfgDict->dictPropertyForKey("RtVariables"); if (RtVariablesDict != NULL) { // ROM: bin data or base 64 encoded bin data const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM"); if (Prop != NULL) { if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr0") ) { - settingsData.RtROM.ncpy(&gLanMac[0][0], 6); + gSettings.RtROM.ncpy(&gLanMac[0][0], 6); } else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr1") ) { - settingsData.RtROM.ncpy(&gLanMac[1][0], 6); + gSettings.RtROM.ncpy(&gLanMac[1][0], 6); } else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both UINTN ROMLength = 0; void* ROM = GetDataSetting(RtVariablesDict, "ROM", &ROMLength); - settingsData.RtROM.ncpy(ROM, ROMLength); + gSettings.RtROM.ncpy(ROM, ROMLength); } else { MsgLog("MALFORMED PLIST : property not string or data in RtVariables/ROM\n"); } @@ -4938,17 +4939,17 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) MsgLog("ATTENTION : property not string in RtVariables/MLB\n"); }else{ if( Prop->getString()->stringValue().notEmpty() ) { - settingsData.RtMLB = Prop->getString()->stringValue(); + gSettings.RtMLB = Prop->getString()->stringValue(); } } } // CsrActiveConfig Prop = RtVariablesDict->propertyForKey("CsrActiveConfig"); - settingsData.CsrActiveConfig = (UINT32)GetPropertyAsInteger(Prop, 0x2E7); //the value 0xFFFF means not set + gSettings.CsrActiveConfig = (UINT32)GetPropertyAsInteger(Prop, 0x2E7); //the value 0xFFFF means not set //BooterConfig Prop = RtVariablesDict->propertyForKey("BooterConfig"); - settingsData.BooterConfig = (UINT16)GetPropertyAsInteger(Prop, 0); //the value 0 means not set + gSettings.BooterConfig = (UINT16)GetPropertyAsInteger(Prop, 0); //the value 0 means not set //let it be string like "log=0" Prop = RtVariablesDict->propertyForKey("BooterCfg"); if ( Prop != NULL ) { @@ -4956,7 +4957,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) MsgLog("ATTENTION : property not string in RtVariables/BooterCfg\n"); }else{ if( Prop->getString()->stringValue().notEmpty() ) { - settingsData.BooterCfgStr = Prop->getString()->stringValue(); + gSettings.BooterCfgStr = Prop->getString()->stringValue(); } } } @@ -5015,14 +5016,14 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } } - if (settingsData.RtROM.isEmpty()) { + if (gSettings.RtROM.isEmpty()) { EFI_GUID uuid; - StrToGuidLE(settingsData.SmUUID, &uuid); - settingsData.RtROM.ncpy(&uuid.Data4[2], 6); + StrToGuidLE(gSettings.SmUUID, &uuid); + gSettings.RtROM.ncpy(&uuid.Data4[2], 6); } - if (settingsData.RtMLB.isEmpty()) { - settingsData.RtMLB = settingsData.BoardSerialNumber; + if (gSettings.RtMLB.isEmpty()) { + gSettings.RtMLB = gSettings.BoardSerialNumber; } // if CustomUUID and InjectSystemID are not specified @@ -5036,8 +5037,8 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) //BacklightLevel const TagStruct* Prop = SystemParametersDict->propertyForKey("BacklightLevel"); if (Prop != NULL) { - settingsData.BacklightLevel = (UINT16)GetPropertyAsInteger(Prop, settingsData.BacklightLevel); - settingsData.BacklightLevelConfig = TRUE; + gSettings.BacklightLevel = (UINT16)GetPropertyAsInteger(Prop, gSettings.BacklightLevel); + gSettings.BacklightLevelConfig = TRUE; } Prop = SystemParametersDict->propertyForKey("CustomUUID"); @@ -5046,31 +5047,31 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) MsgLog("ATTENTION : property not string in SystemParameters/CustomUUID\n"); }else{ if (IsValidGuidString(Prop->getString()->stringValue())) { - settingsData.CustomUuid = Prop->getString()->stringValue(); + gSettings.CustomUuid = Prop->getString()->stringValue(); // if CustomUUID specified, then default for InjectSystemID=FALSE // to stay compatibile with previous Clover behaviour DBG("The UUID is valid\n"); }else{ DBG("Error: invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str()); - settingsData.CustomUuid = {0}; + gSettings.CustomUuid = {0}; } } } //else gUuid value from SMBIOS // DBG("Finally use %s\n", strguid(&gUuid)); - settingsData.InjectSystemID_ = 2; + gSettings.InjectSystemID_ = 2; Prop = SystemParametersDict->propertyForKey("InjectSystemID"); if ( Prop ) { - if ( Prop->isBool() ) settingsData.InjectSystemID_ = Prop->getBool()->boolValue(); + if ( Prop->isBool() ) gSettings.InjectSystemID_ = Prop->getBool()->boolValue(); else if ( Prop->isString() ) { // TODO a function that takes a string and return if it's true or false - if ( Prop->getString()->stringValue().equalIC("true") ) settingsData.InjectSystemID_ = 1; - else if ( Prop->getString()->stringValue()[0] == 'y' ) settingsData.InjectSystemID_ = 1; - else if ( Prop->getString()->stringValue()[0] == 'Y' ) settingsData.InjectSystemID_ = 1; - else if ( Prop->getString()->stringValue().equalIC("false") ) settingsData.InjectSystemID_ = 0; - else if ( Prop->getString()->stringValue().equalIC("n") ) settingsData.InjectSystemID_ = 0; - else if ( Prop->getString()->stringValue().equalIC("N") ) settingsData.InjectSystemID_ = 0; + if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.InjectSystemID_ = 1; + else if ( Prop->getString()->stringValue()[0] == 'y' ) gSettings.InjectSystemID_ = 1; + else if ( Prop->getString()->stringValue()[0] == 'Y' ) gSettings.InjectSystemID_ = 1; + else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.InjectSystemID_ = 0; + else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.InjectSystemID_ = 0; + else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.InjectSystemID_ = 0; else { DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant"); } @@ -5080,7 +5081,7 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) } Prop = SystemParametersDict->propertyForKey("NvidiaWeb"); - settingsData.NvidiaWeb = IsPropertyNotNullAndTrue(Prop); + gSettings.NvidiaWeb = IsPropertyNotNullAndTrue(Prop); } @@ -5088,16 +5089,16 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagDict* BootGraphicsDict = CfgDict->dictPropertyForKey("BootGraphics"); if (BootGraphicsDict != NULL) { const TagStruct* Prop = BootGraphicsDict->propertyForKey("DefaultBackgroundColor"); - settingsData.DefaultBackgroundColor = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); //the value 0x80000000 means not set + gSettings.DefaultBackgroundColor = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); //the value 0x80000000 means not set Prop = BootGraphicsDict->propertyForKey("UIScale"); - settingsData.UIScale = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); + gSettings.UIScale = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); Prop = BootGraphicsDict->propertyForKey("EFILoginHiDPI"); - settingsData.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); + gSettings.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); Prop = BootGraphicsDict->propertyForKey("flagstate"); - *(UINT32*)&settingsData.flagstate[0] = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); + *(UINT32*)&gSettings.flagstate[0] = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); } /* @@ -5139,19 +5140,19 @@ GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& settingsData) const TagDict* KernelAndKextPatchesDict = CfgDict->dictPropertyForKey("KernelAndKextPatches"); if (KernelAndKextPatchesDict != NULL) { DBG("refill kernel patches bcoz GlobalConfig.gBootChanged\n"); - FillinKextPatches(&settingsData.KernelAndKextPatches, KernelAndKextPatchesDict); + FillinKextPatches(&gSettings.KernelAndKextPatches, KernelAndKextPatchesDict); } } else { //DBG("\n ConfigName: %ls n", settingsData.ConfigName); } if (GlobalConfig.gThemeChanged) { - settingsData.GUI.Theme.setEmpty(); + gSettings.GUI.Theme.setEmpty(); const TagDict* GUIDict = CfgDict->dictPropertyForKey("GUI"); if (GUIDict != NULL) { const TagStruct* Prop = GUIDict->propertyForKey("Theme"); if ((Prop != NULL) && (Prop->isString()) && Prop->getString()->stringValue().notEmpty()) { - settingsData.GUI.Theme.takeValueFrom(Prop->getString()->stringValue()); - DBG("Theme from new config: %ls\n", settingsData.GUI.Theme.wc_str()); + gSettings.GUI.Theme.takeValueFrom(Prop->getString()->stringValue()); + DBG("Theme from new config: %ls\n", gSettings.GUI.Theme.wc_str()); } } } @@ -6906,7 +6907,7 @@ SetDevices (LOADER_ENTRY *Entry) Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon); MsgLog ("Initial PmCon value=%hX\n", PmCon); - if (gSettings.EnableC6) { + if (gSettings.ACPI.SSDT.EnableC6) { PmCon |= 1 << 11; DBG("C6 enabled\n"); } else { @@ -6914,7 +6915,7 @@ SetDevices (LOADER_ENTRY *Entry) DBG("C6 disabled\n"); } /* - if (gSettings.EnableC2) { + if (gSettings.ACPI.SSDT.EnableC2) { PmCon |= 1 << 10; DBG("BIOS_PCIE enabled\n"); } else { @@ -6922,7 +6923,7 @@ SetDevices (LOADER_ENTRY *Entry) DBG("BIOS_PCIE disabled\n"); } */ - if (gSettings.EnableC4) { + if (gSettings.ACPI.SSDT.EnableC4) { PmCon |= 1 << 7; DBG("C4 enabled\n"); } else { @@ -6930,7 +6931,7 @@ SetDevices (LOADER_ENTRY *Entry) DBG("C4 disabled\n"); } - if (gSettings.EnableISS) { + if (gSettings.ACPI.SSDT.EnableISS) { PmCon |= 1 << 3; DBG("SpeedStep enabled\n"); } else { @@ -7328,16 +7329,16 @@ EFI_STATUS LOADER_ENTRY::SetFSInjection() return Status; } - -namespace old { -#include "../../CloverApp/Clover/CloverOldHeaders.h" -} - -static void breakpoint() -{ - DBG("Bug\n"); -} - +// +//namespace old { +//#include "../../CloverApp/Clover/CloverOldHeaders.h" +//} +// +//static void breakpoint() +//{ +// DBG("Bug\n"); +//} +// #define WriteOldFixLengthString(str, strSize) xb.ncat(str.s(), MIN(str.sizeInBytes(), strSize*sizeof(*str.s()))); xb.memsetAtPos(xb.size(), 0, strSize*sizeof(*str.s())-MIN(str.sizeInBytes(), strSize*sizeof(*str.s()))); #define checkOffset(w) \ { \ @@ -7347,381 +7348,381 @@ static void breakpoint() } \ } -XBuffer SETTINGS_DATA::serialize() const -{ - XBuffer xb; - - // SMBIOS TYPE0 - WriteOldFixLengthString(VendorName, 64); -checkOffset(RomVersion); - WriteOldFixLengthString(RomVersion, 64); - WriteOldFixLengthString(EfiVersion, 64); - WriteOldFixLengthString(ReleaseDate, 64); - // SMBIOS TYPE1 - WriteOldFixLengthString(ManufactureName, 64); - WriteOldFixLengthString(ProductName, 64); - WriteOldFixLengthString(VersionNr, 64); - WriteOldFixLengthString(SerialNr, 64); - xb.ncat(&SmUUID, sizeof(SmUUID)); - xb.cat((BOOLEAN)SmUUID.notEmpty()); - xb.ncat(&pad0, sizeof(pad0)); -//CHAR8 Uuid[64]); -//CHAR8 SKUNumber[64]); - WriteOldFixLengthString(FamilyName, 64); - WriteOldFixLengthString(OEMProduct, 64); - WriteOldFixLengthString(OEMVendor, 64); - // SMBIOS TYPE2 - WriteOldFixLengthString(BoardManufactureName, 64); - WriteOldFixLengthString(BoardSerialNumber, 64); - WriteOldFixLengthString(BoardNumber, 64); //Board-ID - WriteOldFixLengthString(LocationInChassis, 64); - WriteOldFixLengthString(BoardVersion, 64); - WriteOldFixLengthString(OEMBoard, 64); -checkOffset(BoardType); - xb.cat(BoardType); - xb.cat(pad1); - // SMBIOS TYPE3 - xb.cat(Mobile); - xb.cat(ChassisType); - WriteOldFixLengthString(ChassisManufacturer, 64); - WriteOldFixLengthString(ChassisAssetTag, 64); - // SMBIOS TYPE4 - xb.cat(CpuFreqMHz); - xb.cat(BusSpeed); //in kHz - xb.cat(Turbo); - xb.cat(EnabledCores); - xb.cat(UserChange); - xb.cat(QEMU); - // SMBIOS TYPE17 - xb.cat(SmbiosVersion); - xb.cat(Attribute); - xb.ncat(&pad17, sizeof(pad17)); - WriteOldFixLengthString(MemoryManufacturer, 64); - WriteOldFixLengthString(MemorySerialNumber, 64); - WriteOldFixLengthString(MemoryPartNumber, 64); - WriteOldFixLengthString(MemorySpeed, 64); - // SMBIOS TYPE131 -checkOffset(CpuType); - xb.cat(CpuType); - // SMBIOS TYPE132 - xb.cat(QPI); - xb.cat(SetTable132); - xb.cat(TrustSMBIOS); - xb.cat(InjectMemoryTables); - xb.cat(Boot.XMPDetection); - xb.cat(UseARTFreq); - // SMBIOS TYPE133 - xb.ncat(&pad18, sizeof(pad18)); - xb.cat(PlatformFeature); - - // PatchTableType11 - xb.cat(NoRomInfo); - - // OS parameters - WriteOldFixLengthString(Language, 16); -checkOffset(BootArgs); - WriteOldFixLengthString(Boot.BootArgs, 256); - xb.memsetAtPos(xb.size(), 0, 1); -checkOffset(CustomUuid); - WriteOldFixLengthString(XStringW(CustomUuid), 40); - xb.ncat(&pad20, sizeof(pad20)); -checkOffset(DefaultVolume); - xb.cat(uintptr_t(0)); //DefaultVolume was CHAR16* - xb.cat(uintptr_t(0)); //DefaultLoader was CHAR16* -//Boot -checkOffset(LastBootedVolume); - xb.cat(Boot.LastBootedVolume); - xb.cat(Boot.SkipHibernateTimeout); -//Monitor - xb.cat(IntelMaxBacklight); - xb.ncat(&pad21, sizeof(pad21)); - xb.cat(VendorEDID); - xb.cat(ProductEDID); - xb.cat(BacklightLevel); - xb.cat(BacklightLevelConfig); - xb.cat(IntelBacklight); -//Boot options - xb.cat(MemoryFix); - xb.cat(WithKexts); - xb.cat(WithKextsIfNoFakeSMC); - xb.cat(FakeSMCFound); - xb.cat(NoCaches); - - // GUI parameters - xb.cat(Debug); -// BOOLEAN Proportional); //never used - xb.ncat(&pad22, sizeof(pad22)); - xb.cat(DefaultBackgroundColor); - - //ACPI -checkOffset(ResetAddr); - xb.cat(ResetAddr); - xb.cat(ResetVal); - xb.cat(NoASPM); - xb.cat(DropSSDT); - xb.cat(NoOemTableId); - xb.cat(NoDynamicExtract); - xb.cat(AutoMerge); - xb.cat(GeneratePStates); - xb.cat(GenerateCStates); - xb.cat(GenerateAPSN); - xb.cat(GenerateAPLF); - xb.cat(GeneratePluginType); - xb.cat(PLimitDict); - xb.cat(UnderVoltStep); - xb.cat(DoubleFirstState); - xb.cat(SuspendOverride); - xb.cat(EnableC2); - xb.cat(EnableC4); - xb.cat(EnableC6); - xb.cat(EnableISS); - xb.cat(SlpSmiEnable); - xb.cat(FixHeaders); - xb.ncat(&pad23, sizeof(pad23)); - xb.cat(C3Latency); - xb.cat(smartUPS); - xb.cat(PatchNMI); - xb.cat(EnableC7); - xb.cat(SavingMode); - WriteOldFixLengthString(DsdtName, 28); - xb.cat(FixDsdt); - xb.cat(MinMultiplier); - xb.cat(MaxMultiplier); - xb.cat(PluginType); -// BOOLEAN DropMCFG); -checkOffset(FixMCFG); - xb.cat(FixMCFG); - xb.cat(DeviceRenameCount); - xb.cat(DeviceRename); - //Injections - xb.cat(StringInjector); - xb.cat(InjectSystemID_); - xb.cat(NoDefaultProperties); - xb.cat(ReuseFFFF); - - //PCI devices - xb.cat(FakeATI); //97 - xb.cat(FakeNVidia); - xb.cat(FakeIntel); - xb.cat(FakeLAN); //100 - xb.cat(FakeWIFI); - xb.cat(FakeSATA); - xb.cat(FakeXHCI); //103 - xb.cat(FakeIMEI); //106 - - //Graphics -// UINT16 PCIRootUID); -checkOffset(GraphicsInjector); - xb.cat(GraphicsInjector); - xb.cat(InjectIntel); - xb.cat(InjectATI); - xb.cat(InjectNVidia); - xb.cat(DeInit); - xb.cat(LoadVBios); - xb.cat(PatchVBios); - xb.ncat(&pad24, sizeof(pad24)); - xb.cat(PatchVBiosBytes); - xb.cat(PatchVBiosBytesCount); - xb.cat(InjectEDID); - xb.cat(LpcTune); - xb.cat(DropOEM_DSM); //vacant - xb.ncat(&pad25, sizeof(pad25)); - xb.cat(CustomEDID); - xb.cat(CustomEDIDsize); - xb.cat(EdidFixHorizontalSyncPulseWidth); - xb.cat(EdidFixVideoInputSignal); - xb.ncat(&pad26, sizeof(pad26)); - WriteOldFixLengthString(FBName, 16); - xb.cat(VideoPorts); - xb.cat(NvidiaGeneric); - xb.cat(NvidiaNoEFI); - xb.cat(NvidiaSingle); - xb.ncat(&pad27, sizeof(pad27)); - xb.cat(VRAM); - xb.ncat(&Dcfg, sizeof(Dcfg)); - xb.ncat(&NVCAP, sizeof(NVCAP)); - xb.cat(BootDisplay); - xb.cat(NvidiaWeb); - xb.ncat(&pad41, sizeof(pad41)); - xb.cat(DualLink); - xb.cat(IgPlatform); - - // Secure boot white/black list -checkOffset(SecureBootWhiteListCount); - xb.cat(Boot.SecureBootWhiteListCount); - xb.cat(Boot.SecureBootBlackListCount); - xb.cat(Boot.SecureBootWhiteList); - xb.cat(Boot.SecureBootBlackList); - - // Secure boot - xb.cat(Boot.SecureBoot); - xb.cat(Boot.SecureBootSetupMode); - xb.cat(Boot.SecureBootPolicy); - - // HDA - xb.cat(HDAInjection); - xb.cat(HDALayoutId); - - // USB DeviceTree injection - xb.cat(USBInjection); - xb.cat(USBFixOwnership); - xb.cat(InjectClockID); - xb.cat(HighCurrent); - xb.cat(NameEH00); - xb.cat(NameXH00); - xb.cat(LANInjection); - xb.cat(HDMIInjection); - - // UINT8 pad61[2]); - - // LegacyBoot -checkOffset(LegacyBoot); - WriteOldFixLengthString(Boot.LegacyBoot, 32); - xb.cat(Boot.LegacyBiosDefaultEntry); - - //SkyLake - xb.cat(HWP); - xb.cat(TDP); - xb.cat(HWPValue); - - //Volumes hiding - xb.cat(uintptr_t(0)); // HVHideStrings was ** - xb.cat((INTN)0); - - // KernelAndKextPatches - xb.memsetAtPos(xb.size(), 0, 112); //KernelAndKextPatches was 112 bytes - xb.cat(KextPatchesAllowed); - xb.cat(KernelPatchesAllowed); //From GUI: Only for user patches, not internal Clover - WriteOldFixLengthString(AirportBridgeDeviceName, 5); - - // Pre-language - xb.cat(KbdPrevLang); - - //Pointer - xb.cat(PointerEnabled); - xb.ncat(&pad28, sizeof(pad28)); - xb.cat(PointerSpeed); - xb.cat(DoubleClickTime); - xb.cat(PointerMirror); - -// UINT8 pad7[6]); -checkOffset(CustomBoot); - xb.cat(Boot.CustomBoot); - xb.ncat(&pad29, sizeof(pad29)); - xb.cat(Boot.CustomLogo); - xb.cat(RefCLK); - - // SysVariables - xb.ncat(&pad30, sizeof(pad30)); -checkOffset(RtMLB); - xb.cat(uintptr_t(0)); // RtMLB was CHAR8* - xb.cat(uintptr_t(0)); // RtROM was UINT8* -checkOffset(RtROMLen); - xb.cat(RtROM.size()); -checkOffset(CsrActiveConfig); - xb.cat(CsrActiveConfig); - xb.cat(BooterConfig); - WriteOldFixLengthString(BooterCfgStr, 64); - xb.cat(Boot.DisableCloverHotkeys); - xb.cat(NeverDoRecovery); - - // Multi-config - xb.ncat(&ConfigName, sizeof(ConfigName)); - xb.ncat(&pad31, sizeof(pad31)); - xb.cat(uintptr_t(0)); // MainConfigName was a CHAR16* - - //Drivers - xb.cat(DisabledDriverArray.size()); // BlackListCount - xb.cat(uintptr_t(0)); // BlackList was a pointer - - //SMC keys - xb.ncat(&RPlt, sizeof(RPlt)); - xb.ncat(&RBr, sizeof(RBr)); - xb.ncat(&EPCI, sizeof(EPCI)); - xb.ncat(&REV, sizeof(REV)); - - //other devices -checkOffset(Rtc8Allowed); - xb.cat(Rtc8Allowed); - xb.cat(ForceHPET); - xb.cat(ResetHDA); - xb.cat(PlayAsync); - xb.ncat(&pad32, sizeof(pad32)); - xb.cat(DisableFunctions); - - //Patch DSDT arbitrary - xb.cat((UINT32)DSDTPatchArray.size()); // PatchDsdtNum - xb.cat(uintptr_t(0)); // PatchDsdtFind - xb.cat(uintptr_t(0)); // LenToFind - xb.cat(uintptr_t(0)); // PatchDsdtReplace - xb.cat(uintptr_t(0)); // LenToReplace -checkOffset(DebugDSDT); - xb.cat(DebugDSDT); - xb.cat(SlpWak); - xb.cat(UseIntelHDMI); - xb.cat(AFGLowPowerState); - xb.cat(PNLF_UID); -// UINT8 pad83[4]); - - // Table dropping - xb.ncat(&pad34, sizeof(pad34)); - xb.cat(ACPIDropTables); - - // Custom entries - xb.cat(DisableEntryScan); - xb.cat(DisableToolScan); - xb.cat((BOOLEAN)0); // was ShowHiddenEntries (BOOLEAN) - xb.cat(KernelScan); - xb.cat(LinuxScan); -// UINT8 pad84[3]); - xb.ncat(&pad35, sizeof(pad35)); -checkOffset(CustomEntries); - xb.cat(CustomEntries); - xb.cat(CustomLegacy); - xb.cat(CustomTool); - - //Add custom properties - xb.cat(NrAddProperties); - xb.cat(AddProperties); - - //BlackListed kexts - xb.ncat(&BlockKexts, sizeof(BlockKexts)); - - //ACPI tables - xb.cat(SortedACPICount); - xb.cat(SortedACPI); - - // ACPI/PATCHED/AML - xb.cat(DisabledAMLCount); - xb.ncat(&pad36, sizeof(pad36)); - xb.cat(DisabledAML); - xb.cat(uintptr_t(0)); // PatchDsdtLabel - xb.cat(uintptr_t(0)); // PatchDsdtTgt - xb.cat(uintptr_t(0)); // PatchDsdtMenuItem - - //other - xb.cat(IntelMaxValue); -// UINT32 AudioVolume); - - // boot.efi -checkOffset(OptionsBits); - xb.cat(OptionsBits); - xb.cat(FlagsBits); - xb.cat(UIScale); - xb.cat(EFILoginHiDPI); - xb.ncat(&flagstate, sizeof(flagstate)); - xb.ncat(&pad37, sizeof(pad37)); - xb.cat(ArbProperties); -// xb.cat(QuirksMask); -// xb.ncat(&pad38, sizeof(pad38)); -// xb.cat(MaxSlide); - -// if ( xb.size() != sizeof(old::SETTINGS_DATA) ) { - if ( xb.size() != 3088 ) { - panic("SETTINGS_DATA::serialize wrong size\n"); - } - return xb; -} +//XBuffer SETTINGS_DATA::serialize() const +//{ +// XBuffer xb; +// +// // SMBIOS TYPE0 +// WriteOldFixLengthString(VendorName, 64); +//checkOffset(RomVersion); +// WriteOldFixLengthString(RomVersion, 64); +// WriteOldFixLengthString(EfiVersion, 64); +// WriteOldFixLengthString(ReleaseDate, 64); +// // SMBIOS TYPE1 +// WriteOldFixLengthString(ManufactureName, 64); +// WriteOldFixLengthString(ProductName, 64); +// WriteOldFixLengthString(VersionNr, 64); +// WriteOldFixLengthString(SerialNr, 64); +// xb.ncat(&SmUUID, sizeof(SmUUID)); +// xb.cat((BOOLEAN)SmUUID.notEmpty()); +// xb.ncat(&pad0, sizeof(pad0)); +////CHAR8 Uuid[64]); +////CHAR8 SKUNumber[64]); +// WriteOldFixLengthString(FamilyName, 64); +// WriteOldFixLengthString(OEMProduct, 64); +// WriteOldFixLengthString(OEMVendor, 64); +// // SMBIOS TYPE2 +// WriteOldFixLengthString(BoardManufactureName, 64); +// WriteOldFixLengthString(BoardSerialNumber, 64); +// WriteOldFixLengthString(BoardNumber, 64); //Board-ID +// WriteOldFixLengthString(LocationInChassis, 64); +// WriteOldFixLengthString(BoardVersion, 64); +// WriteOldFixLengthString(OEMBoard, 64); +//checkOffset(BoardType); +// xb.cat(BoardType); +// xb.cat(pad1); +// // SMBIOS TYPE3 +// xb.cat(Mobile); +// xb.cat(ChassisType); +// WriteOldFixLengthString(ChassisManufacturer, 64); +// WriteOldFixLengthString(ChassisAssetTag, 64); +// // SMBIOS TYPE4 +// xb.cat(CpuFreqMHz); +// xb.cat(BusSpeed); //in kHz +// xb.cat(Turbo); +// xb.cat(EnabledCores); +// xb.cat(UserChange); +// xb.cat(QEMU); +// // SMBIOS TYPE17 +// xb.cat(SmbiosVersion); +// xb.cat(Attribute); +// xb.ncat(&pad17, sizeof(pad17)); +// WriteOldFixLengthString(MemoryManufacturer, 64); +// WriteOldFixLengthString(MemorySerialNumber, 64); +// WriteOldFixLengthString(MemoryPartNumber, 64); +// WriteOldFixLengthString(MemorySpeed, 64); +// // SMBIOS TYPE131 +//checkOffset(CpuType); +// xb.cat(CpuType); +// // SMBIOS TYPE132 +// xb.cat(QPI); +// xb.cat(SetTable132); +// xb.cat(TrustSMBIOS); +// xb.cat(InjectMemoryTables); +// xb.cat(Boot.XMPDetection); +// xb.cat(UseARTFreq); +// // SMBIOS TYPE133 +// xb.ncat(&pad18, sizeof(pad18)); +// xb.cat(PlatformFeature); +// +// // PatchTableType11 +// xb.cat(NoRomInfo); +// +// // OS parameters +// WriteOldFixLengthString(Language, 16); +//checkOffset(BootArgs); +// WriteOldFixLengthString(Boot.BootArgs, 256); +// xb.memsetAtPos(xb.size(), 0, 1); +//checkOffset(CustomUuid); +// WriteOldFixLengthString(XStringW(CustomUuid), 40); +// xb.ncat(&pad20, sizeof(pad20)); +//checkOffset(DefaultVolume); +// xb.cat(uintptr_t(0)); //DefaultVolume was CHAR16* +// xb.cat(uintptr_t(0)); //DefaultLoader was CHAR16* +////Boot +//checkOffset(LastBootedVolume); +// xb.cat(Boot.LastBootedVolume); +// xb.cat(Boot.SkipHibernateTimeout); +////Monitor +// xb.cat(IntelMaxBacklight); +// xb.ncat(&pad21, sizeof(pad21)); +// xb.cat(VendorEDID); +// xb.cat(ProductEDID); +// xb.cat(BacklightLevel); +// xb.cat(BacklightLevelConfig); +// xb.cat(IntelBacklight); +////Boot options +// xb.cat(MemoryFix); +// xb.cat(WithKexts); +// xb.cat(WithKextsIfNoFakeSMC); +// xb.cat(FakeSMCFound); +// xb.cat(NoCaches); +// +// // GUI parameters +// xb.cat(Debug); +//// BOOLEAN Proportional); //never used +// xb.ncat(&pad22, sizeof(pad22)); +// xb.cat(DefaultBackgroundColor); +// +// //ACPI +//checkOffset(ResetAddr); +// xb.cat(ACPI.ResetAddr); +// xb.cat(ACPI.ResetVal); +// xb.cat(ACPI.NoASPM); +// xb.cat(ACPI.SSDT.DropSSDT); +// xb.cat(ACPI.SSDT.NoOemTableId); +// xb.cat(ACPI.SSDT.NoDynamicExtract); +// xb.cat(ACPI.AutoMerge); +// xb.cat(ACPI.SSDT.Generate.GeneratePStates); +// xb.cat(ACPI.SSDT.Generate.GenerateCStates); +// xb.cat(ACPI.SSDT.Generate.GenerateAPSN); +// xb.cat(ACPI.SSDT.Generate.GenerateAPLF); +// xb.cat(ACPI.SSDT.Generate.GeneratePluginType); +// xb.cat(ACPI.SSDT.PLimitDict); +// xb.cat(ACPI.SSDT.UnderVoltStep); +// xb.cat(ACPI.SSDT.DoubleFirstState); +// xb.cat(ACPI.DSDT.SuspendOverride); +// xb.cat(ACPI.SSDT.EnableC2); +// xb.cat(ACPI.SSDT.EnableC4); +// xb.cat(ACPI.SSDT.EnableC6); +// xb.cat(ACPI.SSDT.EnableISS); +// xb.cat(ACPI.SlpSmiEnable); +// xb.cat(ACPI.FixHeaders); +// xb.ncat(&pad23, sizeof(pad23)); +// xb.cat(ACPI.SSDT.C3Latency); +// xb.cat(ACPI.smartUPS); +// xb.cat(ACPI.PatchNMI); +// xb.cat(ACPI.SSDT.EnableC7); +// xb.cat(SavingMode); +// WriteOldFixLengthString(ACPI.DSDT.DsdtName, 28); +// xb.cat(ACPI.DSDT.FixDsdt); +// xb.cat(ACPI.SSDT.MinMultiplier); +// xb.cat(ACPI.SSDT.MaxMultiplier); +// xb.cat(ACPI.SSDT.PluginType); +//// BOOLEAN DropMCFG); +//checkOffset(FixMCFG); +// xb.cat(ACPI.FixMCFG); +// xb.cat((UINT32)ACPI.DeviceRename.size()); +// xb.cat(uintptr_t(0)); +// //Injections +// xb.cat(StringInjector); +// xb.cat(InjectSystemID_); +// xb.cat(NoDefaultProperties); +// xb.cat(ACPI.DSDT.ReuseFFFF); +// +// //PCI devices +// xb.cat(FakeATI); //97 +// xb.cat(FakeNVidia); +// xb.cat(FakeIntel); +// xb.cat(FakeLAN); //100 +// xb.cat(FakeWIFI); +// xb.cat(FakeSATA); +// xb.cat(FakeXHCI); //103 +// xb.cat(FakeIMEI); //106 +// +// //Graphics +//// UINT16 PCIRootUID); +//checkOffset(GraphicsInjector); +// xb.cat(GraphicsInjector); +// xb.cat(InjectIntel); +// xb.cat(InjectATI); +// xb.cat(InjectNVidia); +// xb.cat(DeInit); +// xb.cat(LoadVBios); +// xb.cat(PatchVBios); +// xb.ncat(&pad24, sizeof(pad24)); +// xb.cat(PatchVBiosBytes); +// xb.cat(PatchVBiosBytesCount); +// xb.cat(InjectEDID); +// xb.cat(LpcTune); +// xb.cat(DropOEM_DSM); //vacant +// xb.ncat(&pad25, sizeof(pad25)); +// xb.cat(CustomEDID); +// xb.cat(CustomEDIDsize); +// xb.cat(EdidFixHorizontalSyncPulseWidth); +// xb.cat(EdidFixVideoInputSignal); +// xb.ncat(&pad26, sizeof(pad26)); +// WriteOldFixLengthString(FBName, 16); +// xb.cat(VideoPorts); +// xb.cat(NvidiaGeneric); +// xb.cat(NvidiaNoEFI); +// xb.cat(NvidiaSingle); +// xb.ncat(&pad27, sizeof(pad27)); +// xb.cat(VRAM); +// xb.ncat(&Dcfg, sizeof(Dcfg)); +// xb.ncat(&NVCAP, sizeof(NVCAP)); +// xb.cat(BootDisplay); +// xb.cat(NvidiaWeb); +// xb.ncat(&pad41, sizeof(pad41)); +// xb.cat(DualLink); +// xb.cat(IgPlatform); +// +// // Secure boot white/black list +//checkOffset(SecureBootWhiteListCount); +// xb.cat((UINT32)Boot.SecureBootWhiteList.size()); +// xb.cat((UINT32)Boot.SecureBootBlackList.size()); +// xb.cat(uintptr_t(0)); +// xb.cat(uintptr_t(0)); +// +// // Secure boot +// xb.cat(Boot.SecureBoot); +// xb.cat(Boot.SecureBootSetupMode); +// xb.cat(Boot.SecureBootPolicy); +// +// // HDA +// xb.cat(HDAInjection); +// xb.cat(HDALayoutId); +// +// // USB DeviceTree injection +// xb.cat(USBInjection); +// xb.cat(USBFixOwnership); +// xb.cat(InjectClockID); +// xb.cat(HighCurrent); +// xb.cat(NameEH00); +// xb.cat(NameXH00); +// xb.cat(LANInjection); +// xb.cat(HDMIInjection); +// +// // UINT8 pad61[2]); +// +// // LegacyBoot +//checkOffset(LegacyBoot); +// WriteOldFixLengthString(Boot.LegacyBoot, 32); +// xb.cat(Boot.LegacyBiosDefaultEntry); +// +// //SkyLake +// xb.cat(HWP); +// xb.cat(TDP); +// xb.cat(HWPValue); +// +// //Volumes hiding +// xb.cat(uintptr_t(0)); // HVHideStrings was ** +// xb.cat((INTN)0); +// +// // KernelAndKextPatches +// xb.memsetAtPos(xb.size(), 0, 112); //KernelAndKextPatches was 112 bytes +// xb.cat(KextPatchesAllowed); +// xb.cat(KernelPatchesAllowed); //From GUI: Only for user patches, not internal Clover +// WriteOldFixLengthString(AirportBridgeDeviceName, 5); +// +// // Pre-language +// xb.cat(KbdPrevLang); +// +// //Pointer +// xb.cat(PointerEnabled); +// xb.ncat(&pad28, sizeof(pad28)); +// xb.cat(PointerSpeed); +// xb.cat(DoubleClickTime); +// xb.cat(PointerMirror); +// +//// UINT8 pad7[6]); +//checkOffset(CustomBoot); +// xb.cat(Boot.CustomBoot); +// xb.ncat(&pad29, sizeof(pad29)); +// xb.cat(Boot.CustomLogo); +// xb.cat(RefCLK); +// +// // SysVariables +// xb.ncat(&pad30, sizeof(pad30)); +//checkOffset(RtMLB); +// xb.cat(uintptr_t(0)); // RtMLB was CHAR8* +// xb.cat(uintptr_t(0)); // RtROM was UINT8* +//checkOffset(RtROMLen); +// xb.cat(RtROM.size()); +//checkOffset(CsrActiveConfig); +// xb.cat(CsrActiveConfig); +// xb.cat(BooterConfig); +// WriteOldFixLengthString(BooterCfgStr, 64); +// xb.cat(Boot.DisableCloverHotkeys); +// xb.cat(NeverDoRecovery); +// +// // Multi-config +// xb.ncat(&ConfigName, sizeof(ConfigName)); +// xb.ncat(&pad31, sizeof(pad31)); +// xb.cat(uintptr_t(0)); // MainConfigName was a CHAR16* +// +// //Drivers +// xb.cat(DisabledDriverArray.size()); // BlackListCount +// xb.cat(uintptr_t(0)); // BlackList was a pointer +// +// //SMC keys +// xb.ncat(&RPlt, sizeof(RPlt)); +// xb.ncat(&RBr, sizeof(RBr)); +// xb.ncat(&EPCI, sizeof(EPCI)); +// xb.ncat(&REV, sizeof(REV)); +// +// //other devices +//checkOffset(Rtc8Allowed); +// xb.cat(ACPI.DSDT.Rtc8Allowed); +// xb.cat(ForceHPET); +// xb.cat(ResetHDA); +// xb.cat(PlayAsync); +// xb.ncat(&pad32, sizeof(pad32)); +// xb.cat(DisableFunctions); +// +// //Patch DSDT arbitrary +// xb.cat((UINT32)ACPI.DSDT.DSDTPatchArray.size()); // PatchDsdtNum +// xb.cat(uintptr_t(0)); // PatchDsdtFind +// xb.cat(uintptr_t(0)); // LenToFind +// xb.cat(uintptr_t(0)); // PatchDsdtReplace +// xb.cat(uintptr_t(0)); // LenToReplace +//checkOffset(DebugDSDT); +// xb.cat(ACPI.DSDT.DebugDSDT); +// xb.cat(SlpWak); +// xb.cat(UseIntelHDMI); +// xb.cat(AFGLowPowerState); +// xb.cat(ACPI.DSDT.PNLF_UID); +//// UINT8 pad83[4]); +// +// // Table dropping +// xb.ncat(&pad34, sizeof(pad34)); +// xb.cat(GlobalConfig.ACPIDropTables); +// +// // Custom entries +// xb.cat(DisableEntryScan); +// xb.cat(DisableToolScan); +// xb.cat((BOOLEAN)0); // was ShowHiddenEntries (BOOLEAN) +// xb.cat(KernelScan); +// xb.cat(LinuxScan); +//// UINT8 pad84[3]); +// xb.ncat(&pad35, sizeof(pad35)); +//checkOffset(CustomEntries); +// xb.cat(CustomEntries); +// xb.cat(CustomLegacy); +// xb.cat(CustomTool); +// +// //Add custom properties +// xb.cat(NrAddProperties); +// xb.cat(AddProperties); +// +// //BlackListed kexts +// xb.ncat(&BlockKexts, sizeof(BlockKexts)); +// +// //ACPI tables +// xb.cat((UINTN)ACPI.SortedACPI.size()); +// xb.cat(uintptr_t(0)); +// +// // ACPI/PATCHED/AML +// xb.cat((UINT32)ACPI.DisabledAML.size()); +// xb.ncat(&pad36, sizeof(pad36)); +// xb.cat(uintptr_t(0)); +// xb.cat(uintptr_t(0)); // PatchDsdtLabel +// xb.cat(uintptr_t(0)); // PatchDsdtTgt +// xb.cat(uintptr_t(0)); // PatchDsdtMenuItem +// +// //other +// xb.cat(IntelMaxValue); +//// UINT32 AudioVolume); +// +// // boot.efi +//checkOffset(OptionsBits); +// xb.cat(OptionsBits); +// xb.cat(FlagsBits); +// xb.cat(UIScale); +// xb.cat(EFILoginHiDPI); +// xb.ncat(&flagstate, sizeof(flagstate)); +// xb.ncat(&pad37, sizeof(pad37)); +// xb.cat(ArbProperties); +//// xb.cat(QuirksMask); +//// xb.ncat(&pad38, sizeof(pad38)); +//// xb.cat(MaxSlide); +// +//// if ( xb.size() != sizeof(old::SETTINGS_DATA) ) { +// if ( xb.size() != 3088 ) { +// panic("SETTINGS_DATA::serialize wrong size\n"); +// } +// return xb; +//} //TagDict* regenerateConfigPlist_addDictToDict(TagDict* dict) //{ @@ -7754,7 +7755,7 @@ checkOffset(OptionsBits); // TagDict* plist = TagDict::getEmptyTag(); // regenerateConfigPlist_addKeyToDict(plist, "ACPI"_XS8); // TagDict* ACPIDict = regenerateConfigPlist_addDictToDict(plist); -// regenerateConfigPlist_addKeyAndBoolToDict(ACPIDict, "AutoMerge"_XS8, gSettings.AutoMerge); +// regenerateConfigPlist_addKeyAndBoolToDict(ACPIDict, "AutoMerge"_XS8, gSettings.ACPI.AutoMerge); // regenerateConfigPlist_addKeyToDict(ACPIDict, "DSDT"_XS8); // TagDict* DSDTDict = regenerateConfigPlist_addDictToDict(ACPIDict); // regenerateConfigPlist_addKeyToDict(DSDTDict, "Debug"_XS8); @@ -7764,7 +7765,7 @@ checkOffset(OptionsBits); // regenerateConfigPlist_addKeyToDict(DSDTDict, "Fixes"_XS8); // TagDict* FixesDict = regenerateConfigPlist_addDictToDict(DSDTDict); // for (size_t Index = 0; Index < sizeof(FixesConfig)/sizeof(FixesConfig[0]); Index++) { -// if ( gSettings.FixDsdt & FixesConfig[Index].bitData ) { +// if ( gSettings.ACPI.DSDT.FixDsdt & FixesConfig[Index].bitData ) { // regenerateConfigPlist_addKeyToDict(FixesDict, LString8(FixesConfig[Index].newName)); // regenerateConfigPlist_addBoolToDict(FixesDict, true); // } diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 2efc0192d..c8a98660b 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -239,17 +239,15 @@ public: class DSDT_Patch { public : - XBuffer PatchDsdtFind; - XBuffer PatchDsdtReplace; - XString8 PatchDsdtLabel; - XBuffer PatchDsdtTgt; + XBuffer PatchDsdtFind = XBuffer(); + XBuffer PatchDsdtReplace = XBuffer(); + XString8 PatchDsdtLabel = XString8(); + XBuffer PatchDsdtTgt = XBuffer(); INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM(); - DSDT_Patch() : PatchDsdtFind(), PatchDsdtReplace(), PatchDsdtLabel(), PatchDsdtTgt() { } - - // Not sure if default are valid. Delete them. If needed, proper ones can be created - DSDT_Patch(const DSDT_Patch&) = delete; - DSDT_Patch& operator=(const DSDT_Patch&) = delete; + DSDT_Patch() = default; // default is fine if there is only native type and objects that have copy ctor + DSDT_Patch(const DSDT_Patch& other) = default; // default is fine if there is only native type and objects that have copy ctor + DSDT_Patch& operator = ( const DSDT_Patch & ) = default; // default is fine if there is only native type and objects that have copy ctor }; class MMIOWhiteList @@ -290,19 +288,85 @@ public: UINT8 SecureBootSetupMode = 0; UINT8 SecureBootPolicy = 0; // Secure boot white/black list - UINT32 SecureBootWhiteListCount = 0; - UINT32 SecureBootBlackListCount = 0; - CHAR16 **SecureBootWhiteList = 0; - CHAR16 **SecureBootBlackList = 0; + XStringWArray SecureBootWhiteList = XStringWArray(); + XStringWArray SecureBootBlackList = XStringWArray(); INT8 XMPDetection = 0; // LegacyBoot XStringW LegacyBoot = XStringW(); UINT16 LegacyBiosDefaultEntry = 0; UINT8 CustomBoot = 0; XImage *CustomLogo = 0; - - } Boot = BootClass(); + + class ACPIClass + { + public: + class ACPIDropTablesClass + { + public: + UINT32 Signature = 0; + UINT64 TableId = 0; + UINT32 TabLength = 0; + bool OtherOS = 0; + }; + XObjArray ACPIDropTablesArray = XObjArray(); + + class DSDTClass + { + public: + XStringW DsdtName = XStringW(); + BOOLEAN DebugDSDT = 0; + BOOLEAN Rtc8Allowed = 0; + UINT8 PNLF_UID = 0; + UINT32 FixDsdt = 0; + XObjArray DSDTPatchArray = XObjArray(); + BOOLEAN ReuseFFFF = 0; + BOOLEAN SuspendOverride = 0; + } DSDT = DSDTClass(); + + class SSDTClass + { + public: + class GenerateClass + { + public: + BOOLEAN GeneratePStates = 0; + BOOLEAN GenerateCStates = 0; + BOOLEAN GenerateAPSN = 0; + BOOLEAN GenerateAPLF = 0; + BOOLEAN GeneratePluginType = 0; + } Generate = GenerateClass(); + BOOLEAN DropSSDT = 0; + BOOLEAN NoOemTableId = 0; + BOOLEAN NoDynamicExtract = 0; + BOOLEAN EnableISS = 0; + BOOLEAN EnableC7 = 0; + BOOLEAN EnableC6 = 0; + BOOLEAN EnableC4 = 0; + BOOLEAN EnableC2 = 0; + UINT16 C3Latency = 0; + UINT8 PLimitDict = 0; + UINT8 UnderVoltStep = 0; + BOOLEAN DoubleFirstState = 0; + UINT8 MinMultiplier = 0; + UINT8 MaxMultiplier = 0; + UINT8 PluginType = 0; + } SSDT = SSDTClass(); + + UINT64 ResetAddr = 0; + UINT8 ResetVal = 0; + BOOLEAN SlpSmiEnable = 0; + BOOLEAN FixHeaders = 0; + BOOLEAN FixMCFG = 0; + BOOLEAN NoASPM = 0; + BOOLEAN smartUPS = 0; + BOOLEAN PatchNMI = 0; + XStringWArray SortedACPI = XStringWArray(); + BOOLEAN AutoMerge = 0; + XStringWArray DisabledAML = XStringWArray(); + XObjArray DeviceRename = XObjArray(); + + } ACPI = ACPIClass(); class GUIClass { public: @@ -411,51 +475,16 @@ public: UINT32 DefaultBackgroundColor; //ACPI - UINT64 ResetAddr; - UINT8 ResetVal; - BOOLEAN NoASPM; - BOOLEAN DropSSDT; - BOOLEAN NoOemTableId; - BOOLEAN NoDynamicExtract; - BOOLEAN AutoMerge; - BOOLEAN GeneratePStates; - BOOLEAN GenerateCStates; - BOOLEAN GenerateAPSN; - BOOLEAN GenerateAPLF; - BOOLEAN GeneratePluginType; - UINT8 PLimitDict; - UINT8 UnderVoltStep; - BOOLEAN DoubleFirstState; - BOOLEAN SuspendOverride; - BOOLEAN EnableC2; - BOOLEAN EnableC4; - BOOLEAN EnableC6; - BOOLEAN EnableISS; - BOOLEAN SlpSmiEnable; - BOOLEAN FixHeaders; UINT8 pad23[1]; - UINT16 C3Latency; - BOOLEAN smartUPS; - BOOLEAN PatchNMI; - BOOLEAN EnableC7; UINT8 SavingMode; - XStringW DsdtName; - UINT32 FixDsdt; - UINT8 MinMultiplier; - UINT8 MaxMultiplier; - UINT8 PluginType; // BOOLEAN DropMCFG; - BOOLEAN FixMCFG; - UINT32 DeviceRenameCount; - ACPI_NAME_LIST *DeviceRename; //Injections BOOLEAN StringInjector; UINT8 InjectSystemID_; // 0=false, 1=true, other value = default. BOOLEAN NoDefaultProperties; - BOOLEAN ReuseFFFF; //PCI devices UINT32 FakeATI; //97 @@ -578,7 +607,6 @@ public: UINT8 REV[6]; //other devices - BOOLEAN Rtc8Allowed; BOOLEAN ForceHPET; BOOLEAN ResetHDA; BOOLEAN PlayAsync; @@ -586,7 +614,6 @@ public: UINT32 DisableFunctions; //Patch DSDT arbitrary - XObjArray DSDTPatchArray; // UINT32 PatchDsdtNum; // UINT8 **PatchDsdtFind; // UINT32 *LenToFind; @@ -596,17 +623,14 @@ public: // CHAR8 **PatchDsdtTgt; // INPUT_ITEM *PatchDsdtMenuItem; - BOOLEAN DebugDSDT; BOOLEAN SlpWak; BOOLEAN UseIntelHDMI; UINT8 AFGLowPowerState; - UINT8 PNLF_UID; // UINT8 pad83[4]; // Table dropping UINT8 pad34[3]; - ACPI_DROP_TABLE *ACPIDropTables; // Custom entries BOOLEAN DisableEntryScan; @@ -631,13 +655,9 @@ public: // INPUT_ITEM *InjectKextMenuItem; //ACPI tables - UINTN SortedACPICount; - CHAR16 **SortedACPI; // ACPI/PATCHED/AML - UINT32 DisabledAMLCount; UINT8 pad36[4]; - CHAR16 **DisabledAML; //other UINT32 IntelMaxValue; @@ -670,11 +690,7 @@ public: MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0), UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(), IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0), - WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), ResetAddr(0), ResetVal(0), NoASPM(0), - DropSSDT(0), NoOemTableId(0), NoDynamicExtract(0), AutoMerge(0), GeneratePStates(0), GenerateCStates(0), GenerateAPSN(0), GenerateAPLF(0), GeneratePluginType(0), - PLimitDict(0), UnderVoltStep(0), DoubleFirstState(0), SuspendOverride(0), EnableC2(0), EnableC4(0), EnableC6(0), EnableISS(0), SlpSmiEnable(0), - FixHeaders(0), C3Latency(0), smartUPS(0), PatchNMI(0), EnableC7(0), SavingMode(0), DsdtName(), FixDsdt(0), MinMultiplier(0), - MaxMultiplier(0), PluginType(1), FixMCFG(0), DeviceRenameCount(0), DeviceRename(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0), ReuseFFFF(0), + WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), SavingMode(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0), FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(0), InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0), LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0), @@ -684,17 +700,16 @@ public: HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0), KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(0), RefCLK(0), RtMLB(), RtROM(), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(), NeverDoRecovery(0), - ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ DisabledDriverArray(), RPlt{0}, RBr{0}, EPCI{0}, REV{0}, Rtc8Allowed(0), - ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), DSDTPatchArray(), DebugDSDT(0), SlpWak(0), UseIntelHDMI(0), - AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0), - CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, SortedACPICount(0), SortedACPI(0), DisabledAMLCount(0), DisabledAML(0), + ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ DisabledDriverArray(), RPlt{0}, RBr{0}, EPCI{0}, REV{0}, ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), SlpWak(0), UseIntelHDMI(0), + AFGLowPowerState(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0), + CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0}, ArbProperties(0), QuirksMask(0), MaxSlide(0), ocBooterQuirks{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, mmioWhiteListArray(), ProvideConsoleGop(0) {}; SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed - XBuffer serialize() const; +// XBuffer serialize() const; ~SETTINGS_DATA() {} @@ -779,12 +794,12 @@ class SIDELOAD_KEXT { public: XObjArray PlugInList; - XStringW FileName; - XStringW KextDirNameUnderOEMPath; - XStringW Version; + XStringW FileName = XStringW(); + XStringW KextDirNameUnderOEMPath = XStringW(); + XStringW Version = XStringW(); INPUT_ITEM MenuItem = INPUT_ITEM(); - SIDELOAD_KEXT() : PlugInList(), FileName(), KextDirNameUnderOEMPath(), Version() {}; + SIDELOAD_KEXT() : PlugInList() {}; SIDELOAD_KEXT(const SIDELOAD_KEXT& other) = delete; // Can be defined if needed const SIDELOAD_KEXT& operator = ( const SIDELOAD_KEXT & ) = delete; // Can be defined if needed ~SIDELOAD_KEXT() { } @@ -909,6 +924,7 @@ public: BOOLEAN gBootChanged = FALSE; BOOLEAN gThemeChanged = FALSE; BOOLEAN NeedPMfix = FALSE; + ACPI_DROP_TABLE *ACPIDropTables = NULL; diff --git a/rEFIt_UEFI/Platform/StateGenerator.cpp b/rEFIt_UEFI/Platform/StateGenerator.cpp index 01126a9e7..4fb031d04 100644 --- a/rEFIt_UEFI/Platform/StateGenerator.cpp +++ b/rEFIt_UEFI/Platform/StateGenerator.cpp @@ -136,7 +136,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) } } } else { - gSettings.GenerateAPLF = FALSE; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = FALSE; } if (Number > 0) { @@ -170,8 +170,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) maximum.Control.VID_FID.FID++; MsgLog("Turbo FID=0x%hhX\n", maximum.Control.VID_FID.FID); } - MsgLog("UnderVoltStep=%d\n", gSettings.UnderVoltStep); - MsgLog("PLimitDict=%d\n", gSettings.PLimitDict); + MsgLog("UnderVoltStep=%d\n", gSettings.ACPI.SSDT.UnderVoltStep); + MsgLog("PLimitDict=%d\n", gSettings.ACPI.SSDT.PLimitDict); maximum.CID = ((maximum.Control.VID_FID.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio; minimum.Control.VID_FID.FID = (RShiftU64(AsmReadMsr64(MSR_IA32_PERF_STATUS), 24) & 0x1F) | (0x80 * cpu_dynamic_fsb); @@ -219,7 +219,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) p_states[i].Control.VID_FID.VID = ((maximum.Control.VID_FID.VID << 2) - (vidstep * u)) >> 2; if (u < p_states_count - 1) { - p_states[i].Control.VID_FID.VID -= gSettings.UnderVoltStep; + p_states[i].Control.VID_FID.VID -= gSettings.ACPI.SSDT.UnderVoltStep; } // Add scope so these don't have to be moved - apianti { @@ -276,10 +276,10 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) case CPU_MODEL_TIGERLAKE_D: { maximum.Control.Control = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 8) & 0xff; - if (gSettings.MaxMultiplier) { + if (gSettings.ACPI.SSDT.MaxMultiplier) { DBG("Using custom MaxMultiplier %d instead of automatic %d\n", - gSettings.MaxMultiplier, maximum.Control.Control); - maximum.Control.Control = gSettings.MaxMultiplier; + gSettings.ACPI.SSDT.MaxMultiplier, maximum.Control.Control); + maximum.Control.Control = gSettings.ACPI.SSDT.MaxMultiplier; } realMax = maximum.Control.Control; @@ -292,8 +292,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) } Apsn = (realTurbo > realMax)?(realTurbo - realMax):0; realMin = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 40) & 0xff; - if (gSettings.MinMultiplier) { - minimum.Control.Control = gSettings.MinMultiplier; + if (gSettings.ACPI.SSDT.MinMultiplier) { + minimum.Control.Control = gSettings.ACPI.SSDT.MinMultiplier; Aplf = (realMin > minimum.Control.Control)?(realMin - minimum.Control.Control):0; } else { minimum.Control.Control = realMin; @@ -353,7 +353,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) p_states[p_states_count].Control.Control = (UINT16)j; p_states[p_states_count].CID = (UINT32)j; - if (!p_states_count && gSettings.DoubleFirstState) { + if (!p_states_count && gSettings.ACPI.SSDT.DoubleFirstState) { //double first state p_states_count++; p_states[p_states_count].Control.Control = (UINT16)j; @@ -393,7 +393,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) scop = aml_add_scope(root, name); - if (gSettings.GeneratePStates && !gSettings.HWP) { + if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) { method = aml_add_name(scop, "PSS_"); pack = aml_add_package(method); @@ -403,7 +403,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) TDPdiv = 8; } - for (decltype(p_states_count) i = gSettings.PLimitDict; i < p_states_count; i++) { + for (decltype(p_states_count) i = gSettings.ACPI.SSDT.PLimitDict; i < p_states_count; i++) { AML_CHUNK* pstt = aml_add_package(pack); aml_add_dword(pstt, p_states[i].Frequency); @@ -423,8 +423,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) //aml_add_return_name(metPSS, "PSS_"); //metPPC = aml_add_method(scop, "_PPC", 0); aml_add_name(scop, "_PPC"); - aml_add_byte(scop, (UINT8)gSettings.PLimitDict); - //aml_add_return_byte(metPPC, gSettings.PLimitDict); + aml_add_byte(scop, (UINT8)gSettings.ACPI.SSDT.PLimitDict); + //aml_add_return_byte(metPPC, gSettings.ACPI.SSDT.PLimitDict); namePCT = aml_add_name(scop, "PCT_"); packPCT = aml_add_package(namePCT); resource_template_register_fixedhw[8] = 0x00; @@ -434,17 +434,17 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) aml_add_buffer(packPCT, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); metPCT = aml_add_method(scop, "_PCT", 0); aml_add_return_name(metPCT, "PCT_"); - if (gSettings.PluginType && gSettings.GeneratePluginType) { + if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) { aml_add_buffer(scop, plugin_type, sizeof(plugin_type)); - aml_add_byte(scop, gSettings.PluginType); + aml_add_byte(scop, gSettings.ACPI.SSDT.PluginType); } if (gCPUStructure.Family >= 2) { - if (gSettings.GenerateAPSN) { + if (gSettings.ACPI.SSDT.Generate.GenerateAPSN) { //APSN: High Frequency Modes (turbo) aml_add_name(scop, "APSN"); aml_add_byte(scop, (UINT8)Apsn); } - if (gSettings.GenerateAPLF) { + if (gSettings.ACPI.SSDT.Generate.GenerateAPLF) { //APLF: Low Frequency Mode aml_add_name(scop, "APLF"); aml_add_byte(scop, (UINT8)Aplf); @@ -461,13 +461,13 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) //aml_add_return_name(metPSS, name1); metPPC = aml_add_method(scop, "_PPC", 0); aml_add_return_name(metPPC, name3); - //aml_add_return_byte(metPPC, gSettings.PLimitDict); + //aml_add_return_byte(metPPC, gSettings.ACPI.SSDT.PLimitDict); metPCT = aml_add_method(scop, "_PCT", 0); aml_add_return_name(metPCT, name2); } - } else if (gSettings.PluginType && gSettings.GeneratePluginType) { + } else if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) { aml_add_buffer(scop, plugin_type, sizeof(plugin_type)); - aml_add_byte(scop, gSettings.PluginType); + aml_add_byte(scop, gSettings.ACPI.SSDT.PluginType); } aml_calculate_size(root); @@ -481,8 +481,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) aml_destroy_node(root); - if (gSettings.GeneratePStates && !gSettings.HWP) { - if (gSettings.PluginType && gSettings.GeneratePluginType) { + if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) { + if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) { MsgLog ("SSDT with CPU P-States and plugin-type generated successfully\n"); } else { MsgLog ("SSDT with CPU P-States generated successfully\n"); @@ -502,11 +502,11 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number) { - BOOLEAN c2_enabled = gSettings.EnableC2; + BOOLEAN c2_enabled = gSettings.ACPI.SSDT.EnableC2; BOOLEAN c3_enabled; - BOOLEAN c4_enabled = gSettings.EnableC4; -// BOOLEAN c6_enabled = gSettings.EnableC6; - BOOLEAN cst_using_systemio = gSettings.EnableISS; + BOOLEAN c4_enabled = gSettings.ACPI.SSDT.EnableC4; +// BOOLEAN c6_enabled = gSettings.ACPI.SSDT.EnableC6; + BOOLEAN cst_using_systemio = gSettings.ACPI.SSDT.EnableISS; UINT8 p_blk_lo, p_blk_hi; UINT8 cstates_count; UINT32 acpi_cpu_p_blk; @@ -531,7 +531,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U c2_enabled = c2_enabled || (fadt->PLvl2Lat < 100); c3_enabled = (fadt->PLvl3Lat < 1000); cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled)? 1 : 0) - + (gSettings.EnableC6 ? 1 : 0) + (gSettings.EnableC7 ? 1 : 0); + + (gSettings.ACPI.SSDT.EnableC6 ? 1 : 0) + (gSettings.ACPI.SSDT.EnableC7 ? 1 : 0); root = aml_create_node(NULL); aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header @@ -586,10 +586,10 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U resource_template_register_systemio[12] = p_blk_hi; // C3 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, gSettings.C3Latency); // Latency + aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency aml_add_dword(tmpl, 0x000001F4); // Power } - if (gSettings.EnableC6) { // C6 + if (gSettings.ACPI.SSDT.EnableC6) { // C6 p_blk_lo = (UINT8)(acpi_cpu_p_blk + 5); p_blk_hi = (UINT8)((acpi_cpu_p_blk + 5) >> 8); @@ -598,10 +598,10 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U resource_template_register_systemio[12] = p_blk_hi; // C6 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); aml_add_byte(tmpl, 0x06); // C6 - aml_add_word(tmpl, gSettings.C3Latency + 3); // Latency + aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency aml_add_dword(tmpl, 0x0000015E); // Power } - if (gSettings.EnableC7) { //C7 + if (gSettings.ACPI.SSDT.EnableC7) { //C7 p_blk_lo = (acpi_cpu_p_blk + 6) & 0xff; p_blk_hi = (UINT8)((acpi_cpu_p_blk + 6) >> 8); @@ -652,18 +652,18 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U resource_template_register_fixedhw[11] = 0x20; // C3 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, gSettings.C3Latency); // Latency as in MacPro6,1 = 0x0043 + aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency as in MacPro6,1 = 0x0043 aml_add_dword(tmpl, 0x000001F4); // Power } - if (gSettings.EnableC6) { // C6 + if (gSettings.ACPI.SSDT.EnableC6) { // C6 tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x20; // C6 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); aml_add_byte(tmpl, 0x06); // C6 - aml_add_word(tmpl, gSettings.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046 + aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046 aml_add_dword(tmpl, 0x0000015E); // Power } - if (gSettings.EnableC7) { + if (gSettings.ACPI.SSDT.EnableC7) { tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x30; // C4 or C7 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); diff --git a/rEFIt_UEFI/Platform/platformdata.cpp b/rEFIt_UEFI/Platform/platformdata.cpp index 36e9055ed..ea192a547 100644 --- a/rEFIt_UEFI/Platform/platformdata.cpp +++ b/rEFIt_UEFI/Platform/platformdata.cpp @@ -1417,7 +1417,7 @@ void GetDefaultSettings() gSettings.HDAInjection = FALSE; //gSettings.HDALayoutId = 0; gSettings.USBInjection = TRUE; // enabled by default to have the same behavior as before - gSettings.DsdtName = L"DSDT.aml"_XSW; + gSettings.ACPI.DSDT.DsdtName = L"DSDT.aml"_XSW; gSettings.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52 gSettings.BacklightLevelConfig = FALSE; gSettings.TrustSMBIOS = TRUE; @@ -1450,23 +1450,23 @@ void GetDefaultCpuSettings() SetDMISettingsForModel(Model, TRUE); if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) { - gSettings.GeneratePStates = TRUE; - gSettings.GenerateCStates = TRUE; + gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE; + gSettings.ACPI.SSDT.Generate.GenerateCStates = TRUE; // backward compatibility, APFS, APLF, PluginType follow PStates - gSettings.GenerateAPSN = gSettings.GeneratePStates; - gSettings.GenerateAPLF = gSettings.GeneratePStates; - gSettings.GeneratePluginType = gSettings.GeneratePStates; - // gSettings.EnableISS = FALSE; - // gSettings.EnableC2 = TRUE; - gSettings.EnableC6 = TRUE; - gSettings.PluginType = 1; + gSettings.ACPI.SSDT.Generate.GenerateAPSN = gSettings.ACPI.SSDT.Generate.GeneratePStates; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = gSettings.ACPI.SSDT.Generate.GeneratePStates; + gSettings.ACPI.SSDT.Generate.GeneratePluginType = gSettings.ACPI.SSDT.Generate.GeneratePStates; + // gSettings.ACPI.SSDT.EnableISS = FALSE; + // gSettings.ACPI.SSDT.EnableC2 = TRUE; + gSettings.ACPI.SSDT.EnableC6 = TRUE; + gSettings.ACPI.SSDT.PluginType = 1; if (gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE) { - gSettings.MinMultiplier = 7; + gSettings.ACPI.SSDT.MinMultiplier = 7; } - // gSettings.DoubleFirstState = FALSE; - //gSettings.DropSSDT = TRUE; //why drop all??? - gSettings.C3Latency = 0x00FA; + // gSettings.ACPI.SSDT.DoubleFirstState = FALSE; + //gSettings.ACPI.SSDT.DropSSDT = TRUE; //why drop all??? + gSettings.ACPI.SSDT.C3Latency = 0x00FA; } gSettings.Turbo = gCPUStructure.Turbo; gSettings.SavingMode = 0xFF; //means not set diff --git a/rEFIt_UEFI/cpp_unit_test/all_tests.cpp b/rEFIt_UEFI/cpp_unit_test/all_tests.cpp index 6c383a746..b694e44af 100755 --- a/rEFIt_UEFI/cpp_unit_test/all_tests.cpp +++ b/rEFIt_UEFI/cpp_unit_test/all_tests.cpp @@ -58,7 +58,7 @@ bool all_tests() // } #endif -#if defined(JIEF_DEBUG) +#if defined(JIEF_DEBUGxxx) #if defined(JIEF_DEBUG) && defined(CLOVER_BUILD) ret = printlib_tests(); diff --git a/rEFIt_UEFI/cpp_unit_test/config-test.cpp b/rEFIt_UEFI/cpp_unit_test/config-test.cpp index 62d47f861..201789402 100755 --- a/rEFIt_UEFI/cpp_unit_test/config-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/config-test.cpp @@ -876,7 +876,7 @@ static const char* config_test = \r\n\ \r\n\ \r\n\ - ACPI\r\n\ + ACPIx\r\n\ \r\n\ AutoMerge\r\n\ 0\r\n\ diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp index 3aae761d5..011e586c0 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp @@ -39,7 +39,7 @@ int getNextTag_tests() bool b; gXmlLiteParser.init(""); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( !b ) return breakpoint(1); if ( !isOpeningTag ) return breakpoint(2); if ( isClosingTag ) return breakpoint(3); @@ -47,7 +47,7 @@ int getNextTag_tests() gXmlLiteParser.init(""); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( !b ) return breakpoint(5); if ( isOpeningTag ) return breakpoint(6); if ( !isClosingTag ) return breakpoint(7); @@ -55,11 +55,11 @@ int getNextTag_tests() gXmlLiteParser.init(""); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( !b ) return breakpoint(10); if ( !isOpeningTag ) return breakpoint(11); if ( isClosingTag ) return breakpoint(12); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( !b ) return breakpoint(13); if ( isOpeningTag ) return breakpoint(14); if ( !isClosingTag ) return breakpoint(15); @@ -69,35 +69,35 @@ int getNextTag_tests() // gXmlLiteParser.init("foo1\n foo2"); gXmlLiteParser.moveForwardUntil(0); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 7") ) return breakpoint(14); gXmlLiteParser.init("foo1\n bar1"); gXmlLiteParser.moveForwardUntil('b'); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 3") ) return breakpoint(14); gXmlLiteParser.init("foo1\n "); gXmlLiteParser.moveForwardUntil('<'); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 9") ) return breakpoint(14); gXmlLiteParser.init("foo1\n "); gXmlLiteParser.moveForwardUntil('<'); - b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); + b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 13") ) return breakpoint(14); @@ -105,7 +105,7 @@ int getNextTag_tests() gXmlLiteParser.init("foo1\n\nv"); b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); - if ( b ) return breakpoint(3); - + if ( !b ) return breakpoint(3); + if ( length != 0 ) return breakpoint(13); + gXmlLiteParser.init(" v"); b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); - if ( b ) return breakpoint(4); - + if ( !b ) return breakpoint(3); + if ( length != 0 ) return breakpoint(13); + gXmlLiteParser.init("av"); b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); if ( !b ) return breakpoint(5); @@ -368,54 +370,128 @@ int xml_integer_tests() return 0; } -class Dict1_Class : public XmlDict +int validate_dict_tests() { -public: - class Test1Bool: public XmlBool + bool b; + + class Dict1_Class : public XmlDict { - public: - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { - RETURN_IF_FALSE( XmlBool::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); - xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); - return false; // parsing can continue. - } - } test1Bool = Test1Bool(); + public: + class Test1Bool: public XmlBool + { + public: + virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + RETURN_IF_FALSE( XmlBool::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); + xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); + return false; // parsing can continue. + } + } test1Bool = Test1Bool(); - XmlDictField m_fields[1] = { - {"test1Bool", test1Bool}, + XmlDictField m_fields[1] = { + {"test1Bool", test1Bool}, + }; + virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; - virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; -}; -class MainDict_Class : public XmlDict -{ -public: - Dict1_Class dict1 = Dict1_Class(); + class Main1Dict_Class : public XmlDict + { + public: + Dict1_Class dict1 = Dict1_Class(); - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { - RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); - xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); - return false; // parsing can continue. - } + virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); + xmlLiteParser->addWarning(generateErrors, S8Printf("dict1 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); + return false; // parsing can continue. + } - XmlDictField m_fields[1] = { - {"dict1", dict1}, -}; + XmlDictField m_fields[1] = { + {"dict1", dict1}, + }; -public: - MainDict_Class() {}; - virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; -} mainDict; + Main1Dict_Class() {}; + virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; + } mainDict; -static const char* config_test = - "\r\n\ - dict1\r\n\ - \r\n\ - test1Bool\r\n\ - \r\n\ + + const char* config_test = + "\r\n\ + dict1\r\n\ + \r\n\ + test1Bool\r\n\ + \r\n\ + \r\n\ \r\n\ - \r\n\ -"; + "; + + gXmlLiteParser.init(config_test); + b = mainDict.parseFromXmlLite(&gXmlLiteParser, "/"_XS8, true); +//gXmlLiteParser.printfErrorsAndWarnings(); + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("Test1Bool tag") ) return breakpoint(14); + + if ( !b ) return breakpoint(1); + gXmlLiteParser.init(config_test); + mainDict.validate(&gXmlLiteParser, "/"_XS8, XmlParserPosition(), true); +//gXmlLiteParser.printfErrorsAndWarnings(); + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("ict1 tag") ) return breakpoint(14); + + return 0; +} + +int validate_array_tests() +{ + bool b; + + class Main2Dict_Class : public XmlDict + { + public: + XmlArray array = XmlArray(); + + virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); + xmlLiteParser->addWarning(generateErrors, S8Printf("dict2 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); + return false; // parsing can continue. + } + + XmlDictField m_fields[1] = { + {"array1", array}, + }; + + Main2Dict_Class() {}; + virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; + } mainDict; + + + const char* config_test = + "\r\n\ + array1\r\n\ + \r\n\ + \r\n\ + \r\n\ + a\r\n\ + \r\n\ + \r\n\ + "; + + gXmlLiteParser.init(config_test); + b = mainDict.parseFromXmlLite(&gXmlLiteParser, "/"_XS8, true); +//gXmlLiteParser.printfErrorsAndWarnings(); + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("Expecting ") ) return breakpoint(14); + + gXmlLiteParser.init(config_test); + mainDict.validate(&gXmlLiteParser, "/"_XS8, XmlParserPosition(), true); +//gXmlLiteParser.printfErrorsAndWarnings(); + if ( !b ) return breakpoint(1); + if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("dict2 tag") ) return breakpoint(14); + + return 0; +} int xml_lite_tests() { @@ -423,20 +499,16 @@ int xml_lite_tests() int ret; // XmlLiteParser xmlLiteParser; - bool b; - - gXmlLiteParser.init(config_test); - b = mainDict.parseFromXmlLite(&gXmlLiteParser, ""_XS8, true); - for ( size_t idx = 0 ; idx < gXmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) { - if ( !gXmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Warning: %s\n", gXmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); - if ( gXmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Error: %s\n", gXmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); - } - if ( !b ) return breakpoint(1); - - + ret = validate_array_tests(); + if ( ret ) return ret; + + + ret = validate_dict_tests(); + if ( ret ) return ret; + ret = xml_integer_tests(); if ( ret ) return ret; diff --git a/rEFIt_UEFI/entry_scan/common.cpp b/rEFIt_UEFI/entry_scan/common.cpp index abe12a610..62e3d836a 100644 --- a/rEFIt_UEFI/entry_scan/common.cpp +++ b/rEFIt_UEFI/entry_scan/common.cpp @@ -326,7 +326,7 @@ extern REFIT_MENU_ITEM_RETURN MenuEntryReturn; // it is not good to use Options menu style for messages and one line dialogs // it can be a semitransparent rectangular at the screen centre as it was in Clover v1.0 STATIC REFIT_MENU_SCREEN AlertMessageMenu(0, XStringW(), XStringW(), &MenuEntryReturn, NULL); -void AlertMessage(IN XStringW& Title, IN CONST XStringW& Message) +void AlertMessage(const XStringW& Title, const XStringW& Message) { CreateInfoLines(Message, &AlertMessageMenu.InfoLines); AlertMessageMenu.Title = Title; diff --git a/rEFIt_UEFI/entry_scan/common.h b/rEFIt_UEFI/entry_scan/common.h index c37d9cf4b..ad7b06edb 100644 --- a/rEFIt_UEFI/entry_scan/common.h +++ b/rEFIt_UEFI/entry_scan/common.h @@ -31,11 +31,7 @@ StrToLower ( IN CHAR16 *Str ); -void -AlertMessage ( - IN CONST CHAR16 *Title, - IN CONST CHAR16 *Message - ); +void AlertMessage (IN const XStringW& Title, IN const XStringW& Message); BOOLEAN YesNoMessage ( diff --git a/rEFIt_UEFI/entry_scan/secureboot.cpp b/rEFIt_UEFI/entry_scan/secureboot.cpp index 61182bdca..cbc098e12 100644 --- a/rEFIt_UEFI/entry_scan/secureboot.cpp +++ b/rEFIt_UEFI/entry_scan/secureboot.cpp @@ -37,10 +37,17 @@ #ifdef ENABLE_SECURE_BOOT +#include +#include "../Platform/Settings.h" +#include "../Platform/Self.h" #include "entry_scan.h" +#include "secureboot.h" +extern "C" { #include #include +#include +} #ifndef DEBUG_ALL #define DEBUG_SECURE_BOOT 1 @@ -63,7 +70,7 @@ void EnableSecureBoot(void) UINTN CloverSignatureSize = 0; void *CloverSignature = NULL; // Check in setup mode - if (GlobalConfig.Boot.SecureBoot || !gSettings.Boot.SecureBootSetupMode) { + if (gSettings.Boot.SecureBoot || !gSettings.Boot.SecureBootSetupMode) { return; } // Ask user if they want to use default keys @@ -73,7 +80,7 @@ void EnableSecureBoot(void) UINT32 AuthenticationStatus = 0; UINTN FileSize = 0; // Open the file buffer - void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getSelfFullPath(), &FileSize, &AuthenticationStatus); + void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getCloverDirFullPath(), &FileSize, &AuthenticationStatus); if (FileBuffer != NULL) { if (FileSize > 0) { // Retrieve the certificates @@ -92,10 +99,9 @@ void EnableSecureBoot(void) } // Check and alert about image not found if ((FileBuffer == NULL) || (FileSize == 0)) { - CHAR16 *FilePath = FileDevicePathToStr(&self.getSelfFullPath()); - if (FilePath != NULL) { - DBG("Failed to load Clover image from %ls\n", FilePath); - FreePool(FilePath); + XStringW FilePath = FileDevicePathToXStringW(&self.getCloverDirFullPath()); + if (FilePath.notEmpty()) { + DBG("Failed to load Clover image from %ls\n", FilePath.wc_str()); } else { DBG("Failed to load Clover image\n"); } @@ -121,8 +127,8 @@ void EnableSecureBoot(void) } if (EFI_ERROR(Status)) { XStringW Str = SWPrintf("Enabling secure boot failed because\n%ls", ErrorString); - AlertMessage(L"Enable Secure Boot", Str); - DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString.wc_str(), efiStrError(Status)); + AlertMessage(L"Enable Secure Boot"_XSW, Str); + DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString, efiStrError(Status)); DisableSecureBoot(); } } @@ -148,7 +154,7 @@ CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy) STATIC void PrintSecureBootInfo(void) { // Nothing to do if secure boot is disabled or in setup mode - if (!GlobalConfig.Boot.SecureBoot) { + if (!gSettings.Boot.SecureBoot) { DBG("Secure Boot: %s\n", (gSettings.Boot.SecureBootSetupMode ? "Setup" : "Disabled")); } else { // Secure boot is enabled @@ -164,12 +170,12 @@ STATIC void DisableMessage(IN EFI_STATUS Status, { XStringW Str; if (ErrorString != NULL) { - Str = SWPrintf(L"%ls\n%ls\n%ls", String, ErrorString, efiStrError(Status)); + Str = SWPrintf("%ls\n%ls\n%ls", String, ErrorString, efiStrError(Status)); } else { - Str = SWPrintf(L"%s\n%s", String, efiStrError(Status)); + Str = SWPrintf("%s\n%s", String, efiStrError(Status)); } DBG("Secure Boot: %ls", Str.wc_str()); - AlertMessage(L"Disable Secure Boot", Str); + AlertMessage(L"Disable Secure Boot"_XSW, Str); } // Disable secure boot @@ -178,7 +184,7 @@ void DisableSecureBoot(void) EFI_STATUS Status; CHAR16 *ErrorString = NULL; // Check in user mode - if (gSettings.Boot.SecureBootSetupMode || !GlobalConfig.Boot.SecureBoot) { + if (gSettings.Boot.SecureBootSetupMode || !gSettings.Boot.SecureBoot) { return; } UninstallSecureBoot(); @@ -233,9 +239,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt if (DevicePathStr == NULL) { return FALSE; } - for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) { - if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) && - (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) { + for (Index = 0; Index < gSettings.Boot.SecureBootWhiteList.size(); ++Index) { + if ((gSettings.Boot.SecureBootWhiteList[Index].notEmpty()) && + (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) { // White listed *AuthenticationStatus = EFI_SUCCESS; return TRUE; @@ -249,9 +255,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt if (DevicePathStr == NULL) { return FALSE; } - for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) { - if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) && - (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) { + for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) { + if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) && + (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) { // Black listed return TRUE; } @@ -265,17 +271,17 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt return FALSE; } // Check the black list for this image - for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) { - if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) && - (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) { + for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) { + if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) && + (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) { // Black listed return TRUE; } } // Check the white list for this image - for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) { - if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) && - (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) { + for (Index = 0; Index < gSettings.Boot.SecureBootWhiteList.size(); ++Index) { + if ((gSettings.Boot.SecureBootWhiteList[Index].notEmpty()) && + (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) { // White listed *AuthenticationStatus = EFI_SUCCESS; return TRUE; @@ -421,7 +427,7 @@ EFI_STATUS InstallSecureBoot(void) } PrintSecureBootInfo(); // Nothing to do if secure boot is disabled or in setup mode - if (!GlobalConfig.Boot.SecureBoot || gSettings.Boot.SecureBootSetupMode) { + if (!gSettings.Boot.SecureBoot || gSettings.Boot.SecureBootSetupMode) { return EFI_SUCCESS; } // Locate security protocols @@ -473,14 +479,14 @@ void InitializeSecureBoot(void) // Set secure boot variables to firmware values UINTN Size = sizeof(gSettings.Boot.SecureBootSetupMode); gRT->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBootSetupMode); - Size = sizeof(GlobalConfig.Boot.SecureBoot); - gRT->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL, &Size, &GlobalConfig.Boot.SecureBoot); + Size = sizeof(gSettings.Boot.SecureBoot); + gRT->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBoot); // Make sure that secure boot is disabled if in setup mode, this will // allow us to specify later in settings that we want to override // setup mode and pretend like we are in secure boot mode to enforce // secure boot policy even when secure boot is not present/disabled. if (gSettings.Boot.SecureBootSetupMode) { - GlobalConfig.Boot.SecureBoot = 0; + gSettings.Boot.SecureBoot = 0; } } diff --git a/rEFIt_UEFI/entry_scan/securehash.cpp b/rEFIt_UEFI/entry_scan/securehash.cpp index 61fd1c775..262b7007c 100644 --- a/rEFIt_UEFI/entry_scan/securehash.cpp +++ b/rEFIt_UEFI/entry_scan/securehash.cpp @@ -39,7 +39,7 @@ #include "entry_scan.h" -#include +#include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h" #include diff --git a/rEFIt_UEFI/entry_scan/securemenu.cpp b/rEFIt_UEFI/entry_scan/securemenu.cpp index 212ae9582..d1f5ff8de 100644 --- a/rEFIt_UEFI/entry_scan/securemenu.cpp +++ b/rEFIt_UEFI/entry_scan/securemenu.cpp @@ -37,7 +37,16 @@ #ifdef ENABLE_SECURE_BOOT +#include +#include "../Platform/Settings.h" +#include "../Platform/Nvram.h" #include "entry_scan.h" +#include "../gui/REFIT_MENU_SCREEN.h" +#include "../gui/menu_items/menu_items.h" +#include "secureboot.h" +#include "../Platform/Self.h" +#include "../refit/screen.h" +#include "../libeg/XTheme.h" #include @@ -61,21 +70,22 @@ void AddSecureBootTool(void) { LOADER_ENTRY *Entry; // If in forced mode or no secure boot then don't add tool - if (!GlobalConfig.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode) { + if (!gSettings.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode) { return; } - if (GlobalConfig.Boot.SecureBoot) { - Entry = new REFIT_MENU_ENTRY_SECURE_BOOT(); - Entry->Title.SWPrintf("Clover Secure Boot Configuration"); -// Entry->Tag = TAG_SECURE_BOOT_CONFIG; - Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT_CONFIG); - - } else { - Entry = new REFIT_MENU_ENTRY_SECURE_BOOT_CONFIG(); - Entry->Title.SWPrintf("Enable Clover Secure Boot"); -// Entry->Tag = TAG_SECURE_BOOT; - Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT); - } +panic("not done yet"); +// if (gSettings.Boot.SecureBoot) { +// Entry = new REFIT_MENU_ENTRY_SECURE_BOOT(); +// Entry->Title.SWPrintf("Clover Secure Boot Configuration"); +//// Entry->Tag = TAG_SECURE_BOOT_CONFIG; +// Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT_CONFIG); +// +// } else { +// Entry = new REFIT_MENU_ENTRY_SECURE_BOOT_CONFIG(); +// Entry->Title.SWPrintf("Enable Clover Secure Boot"); +//// Entry->Tag = TAG_SECURE_BOOT; +// Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT); +// } Entry->Row = 1; //actions Entry->AtClick = ActionSelect; @@ -85,7 +95,7 @@ void AddSecureBootTool(void) } -STATIC REFIT_MENU_ENTRY QueryEntry[] = { +STATIC REFIT_ABSTRACT_MENU_ENTRY QueryEntry[] = { { L"Deny authentication"_XSW, SECURE_BOOT_POLICY_DENY, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }, { L"Allow authentication"_XSW, SECURE_BOOT_POLICY_ALLOW, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }, { L"Insert authentication into database"_XSW, SECURE_BOOT_POLICY_INSERT, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }, @@ -102,25 +112,26 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) // Check parameters if (DevicePath != NULL) { // Get the device path string - CHAR16 *Information[] = { L"Please select the authentication action for", NULL, NULL }; - Information[1] = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); - if (Information[1] != NULL) { + QueryUserMenu.InfoLines.setEmpty() + QueryUserMenu.InfoLines.Add(L"Please select the authentication action for"_XSW); + QueryUserMenu.InfoLines.AddNoNull(FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); + if (QueryUserMenu.InfoLines.size() >= 1) { // Get the device path file path - Information[2] = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); - if (Information[2] != NULL) { + QueryUserMenu.InfoLines.AddNoNull(FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); + if (QueryUserMenu.InfoLines.size() >= 2) { // Create the entries - REFIT_MENU_ENTRY *ChosenEntry = NULL; + REFIT_SIMPLE_MENU_ENTRY_TAG *ChosenEntry = NULL; UINTN MenuExit; // Update the menu - QueryUserMenu.InfoLines = Information; QueryUserMenu.Entries.size() = gSettings.Boot.SecureBootSetupMode ? 2 : 3; // Debug message - DBG("VerifySecureBootImage: Query user for authentication action for %ls\n", Information[1]); + DBG("VerifySecureBootImage: Query user for authentication action for %ls\n", QueryUserMenu.InfoLines[1]); // Because we may if (!gGuiIsReady) { InitScreen(FALSE); if (gThemeNeedInit) { - InitTheme(TRUE); + UINTN Size = 0; + InitTheme((CHAR8*)GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size)); ThemeX.ClearScreen(); gThemeNeedInit = FALSE; } @@ -136,9 +147,7 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) MenuExit = MENU_EXIT_ESCAPE; } } while (MenuExit != MENU_EXIT_ESCAPE); - FreePool(Information[2]); } - FreePool(Information[1]); } } return Response; @@ -214,7 +223,7 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De IN UINTN FileSize) { EFI_STATUS Status = EFI_INVALID_PARAMETER; - CHAR16 *ErrorString = NULL; + XStringW ErrorString; void *Database = NULL; UINTN DatabaseSize = 0; // Check that either the device path or the file buffer is valid @@ -237,18 +246,18 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De if (Database) { // Add the image signature to database if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { - ErrorString = L"Failed to insert image authentication"; + ErrorString = L"Failed to insert image authentication"_XSW; } FreePool(Database); } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString = L"Image has no certificates or is not valid"_XSW; } } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString = L"Image has no certificates or is not valid"_XSW; } FreePool(FileBuffer); } else { - ErrorString = L"Failed to load the image"; + ErrorString = L"Failed to load the image"_XSW; } } else { // Create image signature @@ -256,28 +265,27 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De if (Database) { // Add the image signature to database if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { - ErrorString = L"Failed to insert image authentication"; + ErrorString = L"Failed to insert image authentication"_XSW; } FreePool(Database); } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString = L"Image has no certificates or is not valid"_XSW; } } - if (ErrorString != NULL) { + if (ErrorString.notEmpty()) { CHAR16 *DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); if (DevicePathStr != NULL) { - CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); - if (FileDevicePathStr != NULL) { - XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr); - AlertMessage(L"Insert Image Authentication", Str); - FreePool(FileDevicePathStr); + XStringW FileDevicePathStr = FileDevicePathFileToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); + if (FileDevicePathStr.notEmpty()) { + XStringW Str = SWPrintf("%ls\n%ls\n%ls", ErrorString.wc_str(), DevicePathStr, FileDevicePathStr.wc_str()); + AlertMessage(L"Insert Image Authentication"_XSW, Str); } else { - XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr); - AlertMessage(L"Insert Image Authentication", Str); + XStringW Str = SWPrintf("%ls\n%ls", ErrorString.wc_str(), DevicePathStr); + AlertMessage(L"Insert Image Authentication"_XSW, Str); } FreePool(DevicePathStr); } else { - AlertMessage(L"Insert Image Authentication", ErrorString); + AlertMessage(L"Insert Image Authentication"_XSW, ErrorString); } } return Status; @@ -289,7 +297,7 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL * IN UINTN FileSize) { EFI_STATUS Status = EFI_INVALID_PARAMETER; - CHAR16 *ErrorString = NULL; + XStringW ErrorString; void *Database; UINTN DatabaseSize = 0; // Check that either the device path or the file buffer is valid @@ -312,18 +320,18 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL * if (Database) { // Remove the image signature from database if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { - ErrorString = L"Failed to remove image authentication"; + ErrorString.takeValueFrom(L"Failed to remove image authentication"_XSW); } FreePool(Database); } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString.takeValueFrom(L"Image has no certificates or is not valid"_XSW); } } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString = L"Image has no certificates or is not valid"_XSW; } FreePool(FileBuffer); } else { - ErrorString = L"Failed to load the image"; + ErrorString.takeValueFrom(L"Failed to load the image"); } } else { // Create image signature @@ -331,28 +339,27 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL * if (Database) { // Remove the image signature from database if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { - ErrorString = L"Failed to remove image authentication"; + ErrorString = L"Failed to remove image authentication"_XSW; } FreePool(Database); } else { - ErrorString = L"Image has no certificates or is not valid"; + ErrorString = L"Image has no certificates or is not valid"_XSW; } } - if (ErrorString != NULL) { + if (ErrorString.notEmpty()) { CHAR16 *DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); if (DevicePathStr != NULL) { - CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); - if (FileDevicePathStr != NULL) { - XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr); - AlertMessage(L"Remove Image Authentication", Str); - FreePool(FileDevicePathStr); + XStringW FileDevicePathStr = FileDevicePathFileToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); + if (FileDevicePathStr.notEmpty()) { + XStringW Str = SWPrintf("%ls\n%ls\n%ls", ErrorString.wc_str(), DevicePathStr, FileDevicePathStr.wc_str()); + AlertMessage(L"Remove Image Authentication"_XSW, Str); } else { - XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr); - AlertMessage(L"Remove Image Authentication", Str); + XStringW Str = SWPrintf("%ls\n%ls", ErrorString.wc_str(), DevicePathStr); + AlertMessage(L"Remove Image Authentication"_XSW, Str); } FreePool(DevicePathStr); } else { - AlertMessage(L"Remove Image Authentication", ErrorString); + AlertMessage(L"Remove Image Authentication"_XSW, ErrorString); } } return Status; @@ -366,7 +373,7 @@ extern REFIT_MENU_ITEM_RETURN MenuEntryReturn; #define TAG_CLEAR 4 #define TAG_DISABLE 5 -STATIC REFIT_MENU_ENTRY SecureBootPolicyEntry = { NULL, TAG_POLICY, 0, 0, 0, NULL, NULL, NULL, { 0, 0, 0, 0 }, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }; +STATIC REFIT_MENU_ITEM_RETURN SecureBootPolicyEntry = { NULL, TAG_POLICY, 0, 0, 0, NULL, NULL, NULL, { 0, 0, 0, 0 }, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }; STATIC REFIT_MENU_ENTRY InsertImageSignatureEntry = { L"Add image authentication to database", TAG_INSERT, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }; STATIC REFIT_MENU_ENTRY RemoveImageSignatureEntry = { L"Remove image authentication from database", TAG_REMOVE, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }; STATIC REFIT_MENU_ENTRY ClearImageSignatureEntry = { L"Clear image authentication database", TAG_CLEAR, 0, 0, 0, NULL, NULL, NULL, {0, 0, 0, 0}, ActionEnter, ActionNone, ActionNone, ActionNone, NULL }; @@ -492,7 +499,7 @@ BOOLEAN ConfigureSecureBoot(void) if (YesNoMessage(L"Disable Secure Boot", L"Are you sure you want to disable secure boot?")) { DBG("User disabled secure boot\n"); DisableSecureBoot(); - if (!GlobalConfig.Boot.SecureBoot) { + if (!gSettings.Boot.SecureBoot) { return TRUE; } AlertMessage(L"Disable Secure Boot", L"Disabling secure boot failed!\nClover does not appear to own the PK"); diff --git a/rEFIt_UEFI/entry_scan/securevars.cpp b/rEFIt_UEFI/entry_scan/securevars.cpp index f7f78739a..06fbf70ec 100644 --- a/rEFIt_UEFI/entry_scan/securevars.cpp +++ b/rEFIt_UEFI/entry_scan/securevars.cpp @@ -37,15 +37,18 @@ #ifdef ENABLE_SECURE_BOOT +#include +#include "../Platform/Settings.h" #include "entry_scan.h" #include #include "securebootkeys.h" -#include -#include -#include +#include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h" +#include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h" +#include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h" +#include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/bio.h" #ifndef DEBUG_ALL #define DEBUG_SECURE_VARS 1 @@ -504,8 +507,8 @@ EFI_STATUS SetSignatureDatabase(IN CHAR16 *DatabaseName, { EFI_STATUS Status; // Check is valid to set database - if ((GlobalConfig.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) || - (!GlobalConfig.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode)) { + if ((gSettings.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) || + (!gSettings.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode)) { return EFI_NOT_FOUND; } // Erase database diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index dafc0f82e..c082f0041 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2395,7 +2395,7 @@ GetListOfDsdts() if (DirEntry->FileName[0] == L'.') { continue; } - if ( gSettings.DsdtName.equalIC(DirEntry->FileName) ) { + if ( gSettings.ACPI.DSDT.DsdtName.equalIC(DirEntry->FileName) ) { OldChosenDsdt = DsdtsNum; } NameLen = StrLen(DirEntry->FileName); //with ".aml" @@ -2412,7 +2412,6 @@ GetListOfACPI() REFIT_DIR_ITER DirIter; EFI_FILE_INFO *DirEntry = NULL; ACPI_PATCHED_AML *ACPIPatchedAMLTmp; - INTN Count = gSettings.DisabledAMLCount; // XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str()); // DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str()); while (ACPIPatchedAML != NULL) { @@ -2440,10 +2439,12 @@ GetListOfACPI() ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above ACPIPatchedAMLTmp->FileName = SWPrintf("%ls", DirEntry->FileName).forgetDataWithoutFreeing(); // if changing, notice freepool above + INTN Count = gSettings.ACPI.DisabledAML.size(); for (INTN i = 0; i < Count; i++) { - if ((gSettings.DisabledAML[i] != NULL) && - (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.DisabledAML[i]) == 0) - ) { + if ( gSettings.ACPI.DisabledAML[i].equalIC(ACPIPatchedAMLTmp->FileName) ) { +// if ((gSettings.ACPI.DisabledAML[i] != NULL) && +// (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0) +// ) { ACPIDisabled = TRUE; break; } @@ -2519,6 +2520,41 @@ RefitMain (IN EFI_HANDLE ImageHandle, } #endif +/* + * To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global + * and is passed by non-const reference. + * This temporary during the refactoring + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +void afterGetUserSettings(SETTINGS_DATA& gSettings) +{ + //set to drop + if (GlobalConfig.ACPIDropTables) { + for ( size_t idx = 0 ; idx < gSettings.ACPI.ACPIDropTablesArray.size() ; ++idx) + { + ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables; + DBG(" - [%02zd]: Drop table : %08X, %16llx : ", idx, gSettings.ACPI.ACPIDropTablesArray[idx].Signature, gSettings.ACPI.ACPIDropTablesArray[idx].TableId); + bool Dropped = FALSE; + while (DropTable) { + if (((gSettings.ACPI.ACPIDropTablesArray[idx].Signature == DropTable->Signature) && + (!gSettings.ACPI.ACPIDropTablesArray[idx].TableId || (DropTable->TableId == gSettings.ACPI.ACPIDropTablesArray[idx].TableId)) && + (!gSettings.ACPI.ACPIDropTablesArray[idx].TabLength || (DropTable->Length == gSettings.ACPI.ACPIDropTablesArray[idx].TabLength))) || + (!gSettings.ACPI.ACPIDropTablesArray[idx].Signature && (DropTable->TableId == gSettings.ACPI.ACPIDropTablesArray[idx].TableId))) { + DropTable->MenuItem.BValue = TRUE; + DropTable->OtherOS = gSettings.ACPI.ACPIDropTablesArray[idx].OtherOS; + gSettings.ACPI.SSDT.DropSSDT = FALSE; //if one item=true then dropAll=false by default + //DBG(" true"); + Dropped = TRUE; + } + DropTable = DropTable->Next; + } + DBG(" %s\n", Dropped ? "yes" : "no"); + } + } +} +#pragma GCC diagnostic pop + // // main entry point // @@ -2581,14 +2617,13 @@ RefitMain (IN EFI_HANDLE ImageHandle, Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage); // if ( !EFI_ERROR(Status) ) { -// XString8 msg = S8Printf("Clover : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger +// XString8 msg = S8Printf("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger // SerialPortWrite((UINT8*)msg.c_str(), msg.length()); // } if ( !EFI_ERROR(Status) ) DBG("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger #ifdef JIEF_DEBUG - gBS->Stall(1500000); // to give time to gdb to connect -// gBS->Stall(0500000); // to give time to gdb to connect + gBS->Stall(2500000); // to give time to gdb to connect // PauseForKey(L"press\n"); #endif } @@ -2965,6 +3000,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, for (i=0; i<2; i++) { if (gConfigDict[i]) { Status = GetUserSettings(gConfigDict[i], gSettings); + afterGetUserSettings(gSettings); if (EFI_ERROR(Status)) { DBG("Error in Second part of settings %llu: %s\n", i, efiStrError(Status)); } @@ -3356,16 +3392,17 @@ RefitMain (IN EFI_HANDLE ImageHandle, } #ifdef ENABLE_SECURE_BOOT - if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot - EnableSecureBoot(); - MainLoopRunning = FALSE; - AfterTool = TRUE; - } - - if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot - MainLoopRunning = !ConfigureSecureBoot(); - AfterTool = TRUE; - } +panic("not done yet"); +// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot +// EnableSecureBoot(); +// MainLoopRunning = FALSE; +// AfterTool = TRUE; +// } +// +// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot +// MainLoopRunning = !ConfigureSecureBoot(); +// AfterTool = TRUE; +// } #endif // ENABLE_SECURE_BOOT if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 807bd814b..53efeab1a 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -144,7 +144,7 @@ void FillInputs(BOOLEAN New) // no need for extra space here, it is added by ApplyInputs() InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.Boot.BootArgs); InputItems[InputItemsCount].ItemType = UNIString; //1 - InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.DsdtName); // 1-> 2 + InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.ACPI.DSDT.DsdtName); // 1-> 2 InputItems[InputItemsCount].ItemType = UNIString; //2 InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.BlockKexts); @@ -152,29 +152,29 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount++].IValue = 3; InputItems[InputItemsCount].ItemType = BoolValue; //4 - InputItems[InputItemsCount++].BValue = gSettings.DropSSDT; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DropSSDT; InputItems[InputItemsCount].ItemType = BoolValue; //5 - InputItems[InputItemsCount++].BValue = gSettings.GeneratePStates; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.Generate.GeneratePStates; InputItems[InputItemsCount].ItemType = BoolValue; //6 - InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SlpSmiEnable; InputItems[InputItemsCount].ItemType = Decimal; //7 - InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.PLimitDict); + InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.ACPI.SSDT.PLimitDict); InputItems[InputItemsCount].ItemType = Decimal; //8 - InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.UnderVoltStep); + InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.ACPI.SSDT.UnderVoltStep); InputItems[InputItemsCount].ItemType = BoolValue; //9 - InputItems[InputItemsCount++].BValue = gSettings.GenerateCStates; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.Generate.GenerateCStates; InputItems[InputItemsCount].ItemType = BoolValue; //10 - InputItems[InputItemsCount++].BValue = gSettings.EnableC2; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC2; InputItems[InputItemsCount].ItemType = BoolValue; //11 - InputItems[InputItemsCount++].BValue = gSettings.EnableC4; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC4; InputItems[InputItemsCount].ItemType = BoolValue; //12 - InputItems[InputItemsCount++].BValue = gSettings.EnableC6; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC6; InputItems[InputItemsCount].ItemType = BoolValue; //13 - InputItems[InputItemsCount++].BValue = gSettings.EnableISS; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableISS; InputItems[InputItemsCount].ItemType = Decimal; //14 InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.QPI); InputItems[InputItemsCount].ItemType = BoolValue; //15 - InputItems[InputItemsCount++].BValue = gSettings.PatchNMI; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.PatchNMI; InputItems[InputItemsCount].ItemType = BoolValue; //16 InputItems[InputItemsCount++].BValue = gSettings.PatchVBios; InputItems[InputItemsCount].ItemType = Decimal; //17 @@ -255,7 +255,7 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount].ItemType = BoolValue; //48 InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelPm; InputItems[InputItemsCount].ItemType = BoolValue; //49 - InputItems[InputItemsCount++].BValue = gSettings.FixMCFG; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.FixMCFG; InputItems[InputItemsCount].ItemType = Decimal; //50 InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.RefCLK); @@ -310,7 +310,7 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount].ItemType = CheckBit; //67 - InputItems[InputItemsCount++].IValue = gSettings.FixDsdt; + InputItems[InputItemsCount++].IValue = gSettings.ACPI.DSDT.FixDsdt; InputItems[InputItemsCount].ItemType = CheckBit; //68 InputItems[InputItemsCount++].IValue = gSettings.OptionsBits; InputItems[InputItemsCount].ItemType = CheckBit; //69 @@ -330,7 +330,7 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount++].BValue = gSettings.USBFixOwnership; InputItems[InputItemsCount].ItemType = Hex; //75 - InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", gSettings.C3Latency); + InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", gSettings.ACPI.SSDT.C3Latency); InputItems[InputItemsCount].ItemType = Decimal; //76 InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.EnabledCores); InputItems[InputItemsCount].ItemType = Decimal; //77 @@ -358,9 +358,9 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate.c_str()); InputItems[InputItemsCount].ItemType = BoolValue; //88 - InputItems[InputItemsCount++].BValue = gSettings.DoubleFirstState; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DoubleFirstState; InputItems[InputItemsCount].ItemType = BoolValue; //89 - InputItems[InputItemsCount++].BValue = gSettings.EnableC7; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC7; InputItems[InputItemsCount].ItemType = RadioSwitch; //90 InputItems[InputItemsCount++].IValue = 90; @@ -391,7 +391,7 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount++].IValue = gSettings.QuirksMask; // InputItems[InputItemsCount].ItemType = BoolValue; //102 - InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.DSDT.DebugDSDT; InputItems[InputItemsCount].ItemType = Hex; //103 InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.FakeIMEI); InputItems[InputItemsCount].ItemType = Hex; //104 @@ -420,7 +420,7 @@ void FillInputs(BOOLEAN New) InputItems[InputItemsCount++].SValue.SWPrintf("0x%04X", gSettings.IntelMaxValue); InputItems[InputItemsCount].ItemType = BoolValue; //113 - InputItems[InputItemsCount++].BValue = gSettings.AutoMerge; + InputItems[InputItemsCount++].BValue = gSettings.ACPI.AutoMerge; InputItems[InputItemsCount].ItemType = BoolValue; //114 InputItems[InputItemsCount++].BValue = gSettings.DeInit; InputItems[InputItemsCount].ItemType = BoolValue; //115 @@ -448,8 +448,8 @@ void FillInputs(BOOLEAN New) //menu for drop table - if (gSettings.ACPIDropTables) { - ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables; + if (GlobalConfig.ACPIDropTables) { + ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables; while (DropTable) { DropTable->MenuItem.ItemType = BoolValue; DropTable = DropTable->Next; @@ -483,7 +483,7 @@ void ApplyInputs(void) } i++; //1 if (InputItems[i].Valid) { - gSettings.DsdtName = InputItems[i].SValue; + gSettings.ACPI.DSDT.DsdtName = InputItems[i].SValue; } i++; //2 if (InputItems[i].Valid) { @@ -502,46 +502,46 @@ void ApplyInputs(void) } i++; //4 if (InputItems[i].Valid) { - gSettings.DropSSDT = InputItems[i].BValue; + gSettings.ACPI.SSDT.DropSSDT = InputItems[i].BValue; } i++; //5 if (InputItems[i].Valid) { - gSettings.GeneratePStates = InputItems[i].BValue; + gSettings.ACPI.SSDT.Generate.GeneratePStates = InputItems[i].BValue; } i++; //6 if (InputItems[i].Valid) { - gSettings.SlpSmiEnable = InputItems[i].BValue; + gSettings.ACPI.SlpSmiEnable = InputItems[i].BValue; } i++; //7 if (InputItems[i].Valid) { // DBG("InputItems[i]: %ls\n", InputItems[i].SValue); - gSettings.PLimitDict = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x7F); -// DBG("Item 7=PLimitDict %d\n", gSettings.PLimitDict); + gSettings.ACPI.SSDT.PLimitDict = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x7F); +// DBG("Item 7=PLimitDict %d\n", gSettings.ACPI.SSDT.PLimitDict); } i++; //8 if (InputItems[i].Valid) { - gSettings.UnderVoltStep = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x3F); -// DBG("Item 8=UnderVoltStep %d\n", gSettings.UnderVoltStep); + gSettings.ACPI.SSDT.UnderVoltStep = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x3F); +// DBG("Item 8=UnderVoltStep %d\n", gSettings.ACPI.SSDT.UnderVoltStep); } i++; //9 if (InputItems[i].Valid) { - gSettings.GenerateCStates = InputItems[i].BValue; + gSettings.ACPI.SSDT.Generate.GenerateCStates = InputItems[i].BValue; } i++; //10 if (InputItems[i].Valid) { - gSettings.EnableC2 = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableC2 = InputItems[i].BValue; } i++; //11 if (InputItems[i].Valid) { - gSettings.EnableC4 = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableC4 = InputItems[i].BValue; } i++; //12 if (InputItems[i].Valid) { - gSettings.EnableC6 = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableC6 = InputItems[i].BValue; } i++; //13 if (InputItems[i].Valid) { - gSettings.EnableISS = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableISS = InputItems[i].BValue; } i++; //14 if (InputItems[i].Valid) { @@ -550,7 +550,7 @@ void ApplyInputs(void) } i++; //15 if (InputItems[i].Valid) { - gSettings.PatchNMI = InputItems[i].BValue; + gSettings.ACPI.PatchNMI = InputItems[i].BValue; } i++; //16 if (InputItems[i].Valid) { @@ -659,7 +659,7 @@ void ApplyInputs(void) } i++; //49 if (InputItems[i].Valid) { - gSettings.FixMCFG = InputItems[i].BValue; + gSettings.ACPI.FixMCFG = InputItems[i].BValue; } i++; //50 @@ -744,7 +744,7 @@ void ApplyInputs(void) i++; //67 if (InputItems[i].Valid) { - gSettings.FixDsdt = InputItems[i].IValue; + gSettings.ACPI.DSDT.FixDsdt = InputItems[i].IValue; } i++; //68 if (InputItems[i].Valid) { @@ -785,7 +785,7 @@ void ApplyInputs(void) } i++; //75 if (InputItems[i].Valid) { - gSettings.C3Latency = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str()); + gSettings.ACPI.SSDT.C3Latency = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str()); } i++; //76 @@ -847,11 +847,11 @@ void ApplyInputs(void) i++; //88 if (InputItems[i].Valid) { - gSettings.DoubleFirstState = InputItems[i].BValue; + gSettings.ACPI.SSDT.DoubleFirstState = InputItems[i].BValue; } i++; //89 if (InputItems[i].Valid) { - gSettings.EnableC7 = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableC7 = InputItems[i].BValue; } i++; //90 @@ -935,7 +935,7 @@ void ApplyInputs(void) } i++; //102 if (InputItems[i].Valid) { - gSettings.DebugDSDT = InputItems[i].BValue; + gSettings.ACPI.DSDT.DebugDSDT = InputItems[i].BValue; } i++; //103 if (InputItems[i].Valid) { @@ -993,7 +993,7 @@ void ApplyInputs(void) } i++; //113 if (InputItems[i].Valid) { - gSettings.AutoMerge = InputItems[i].BValue; + gSettings.ACPI.AutoMerge = InputItems[i].BValue; } i++; //114 if (InputItems[i].Valid) { @@ -1006,9 +1006,9 @@ void ApplyInputs(void) i++; //116 if (InputItems[i].Valid) { if (OldChosenDsdt == 0xFFFF) { - gSettings.DsdtName = L"BIOS.aml"_XSW; + gSettings.ACPI.DSDT.DsdtName = L"BIOS.aml"_XSW; } else { - gSettings.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]); + gSettings.ACPI.DSDT.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]); } } i++; //117 @@ -1558,7 +1558,7 @@ REFIT_MENU_ITEM_OPTIONS* newREFIT_MENU_ITEM_OPTIONS(REFIT_MENU_SCREEN **SubScree void ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) { if (ChosenEntry->SubScreen->ID == SCREEN_DSDT) { - ChosenEntry->Title.SWPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt); + ChosenEntry->Title.SWPrintf("DSDT fix mask [0x%08x]->", gSettings.ACPI.DSDT.FixDsdt); //MsgLog("@ESC: %ls\n", (*ChosenEntry)->Title); } else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) { // CSR @@ -1961,8 +1961,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->"_XS8); - if (gSettings.ACPIDropTables) { - ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables; + if (GlobalConfig.ACPIDropTables) { + ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables; while (DropTable) { CopyMem((CHAR8*)&sign, (CHAR8*)&(DropTable->Signature), 4); CopyMem((CHAR8*)&OTID, (CHAR8*)&(DropTable->TableId), 8); @@ -2042,7 +2042,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix() // REFIT_INPUT_DIALOG *InputBootArgs; Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NullXString8); - // Entry->Title.SPrintf("DSDT fix mask [0x%08hhx]->", gSettings.FixDsdt); + // Entry->Title.SPrintf("DSDT fix mask [0x%08hhx]->", gSettings.ACPI.DSDT.FixDsdt); SubScreen->AddMenuCheck("Add DTGP", FIX_DTGP, 67); SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67); @@ -2089,17 +2089,17 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() REFIT_MENU_SCREEN *SubScreen; REFIT_INPUT_DIALOG *InputBootArgs; - size_t PatchDsdtNum = gSettings.DSDTPatchArray.size(); + size_t PatchDsdtNum = gSettings.ACPI.DSDT.DSDTPatchArray.size(); // INPUT_ITEM* DSDTPatchesMenu = gSettings.PatchDsdtMenuItem; Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->"_XS8); for (size_t Index = 0; Index < PatchDsdtNum; Index++) { InputBootArgs = new REFIT_INPUT_DIALOG; - InputBootArgs->Title.SWPrintf("%90s", gSettings.DSDTPatchArray[Index].PatchDsdtLabel.c_str()); + InputBootArgs->Title.SWPrintf("%90s", gSettings.ACPI.DSDT.DSDTPatchArray[Index].PatchDsdtLabel.c_str()); // InputBootArgs->Tag = TAG_INPUT; InputBootArgs->Row = 0xFFFF; //cursor - InputBootArgs->Item = &gSettings.DSDTPatchArray[Index].PatchDsdtMenuItem; + InputBootArgs->Item = &gSettings.ACPI.DSDT.DSDTPatchArray[Index].PatchDsdtMenuItem; InputBootArgs->AtClick = ActionEnter; InputBootArgs->AtRightClick = ActionDetails; SubScreen->AddMenuEntry(InputBootArgs, true);