Continuing to refactor SETTINGS_DATA.

This commit is contained in:
jief666 2021-02-11 14:41:59 +03:00
parent f17a05f1da
commit 8209394af9
79 changed files with 1548 additions and 1401 deletions

View File

@ -269,7 +269,7 @@ typedef union {
inline void printf_with_callback(const char* format, transmitBufCallBackType transmitBufCallBack, void* context, ...) { inline void printf_with_callback(const char* format, transmitBufCallBackType transmitBufCallBack, void* context, ...) {
PRINTF_VA_LIST va; PRINTF_VA_LIST va;
va_start(va, context); 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); PRINTF_VA_END(va);
} }
# endif # endif

View File

@ -52,7 +52,7 @@
#ifndef HEADER_AES_H #ifndef HEADER_AES_H
#define HEADER_AES_H #define HEADER_AES_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_AES #ifdef OPENSSL_NO_AES
#error AES is disabled. #error AES is disabled.

View File

@ -60,18 +60,18 @@
#define HEADER_ASN1_H #define HEADER_ASN1_H
#include <time.h> #include <time.h>
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/stack.h> #include "stack.h"
#include <openssl/safestack.h> #include "safestack.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifdef OPENSSL_BUILD_SHLIBCRYPTO #ifdef OPENSSL_BUILD_SHLIBCRYPTO

View File

@ -59,7 +59,7 @@
#ifndef HEADER_ASN1_MAC_H #ifndef HEADER_ASN1_MAC_H
#define HEADER_ASN1_MAC_H #define HEADER_ASN1_MAC_H
#include <openssl/asn1.h> #include "asn1.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,8 +59,8 @@
#define HEADER_ASN1T_H #define HEADER_ASN1T_H
#include <stddef.h> #include <stddef.h>
#include <openssl/e_os2.h> #include "e_os2.h"
#include <openssl/asn1.h> #include "asn1.h"
#ifdef OPENSSL_BUILD_SHLIBCRYPTO #ifdef OPENSSL_BUILD_SHLIBCRYPTO
# undef OPENSSL_EXTERN # undef OPENSSL_EXTERN

View File

@ -59,14 +59,14 @@
#ifndef HEADER_BIO_H #ifndef HEADER_BIO_H
#define HEADER_BIO_H #define HEADER_BIO_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
# include <stdio.h> # include <stdio.h>
#endif #endif
#include <stdarg.h> #include <stdarg.h>
#include <openssl/crypto.h> #include "crypto.h"
#ifndef OPENSSL_NO_SCTP #ifndef OPENSSL_NO_SCTP
# ifndef OPENSSL_SYS_VMS # ifndef OPENSSL_SYS_VMS

View File

@ -59,7 +59,7 @@
#ifndef HEADER_BLOWFISH_H #ifndef HEADER_BLOWFISH_H
#define HEADER_BLOWFISH_H #define HEADER_BLOWFISH_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -125,12 +125,12 @@
#ifndef HEADER_BN_H #ifndef HEADER_BN_H
#define HEADER_BN_H #define HEADER_BN_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
#include <stdio.h> /* FILE */ #include <stdio.h> /* FILE */
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#include <openssl/crypto.h> #include "crypto.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,7 +59,7 @@
#ifndef HEADER_BUFFER_H #ifndef HEADER_BUFFER_H
#define HEADER_BUFFER_H #define HEADER_BUFFER_H
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -63,7 +63,7 @@
extern "C" { extern "C" {
#endif #endif
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_CAST #ifdef OPENSSL_NO_CAST
#error CAST is disabled. #error CAST is disabled.

View File

@ -59,7 +59,7 @@
extern "C" { extern "C" {
#endif #endif
#include <openssl/evp.h> #include "evp.h"
/* Opaque */ /* Opaque */
typedef struct CMAC_CTX_st CMAC_CTX; typedef struct CMAC_CTX_st CMAC_CTX;

View File

@ -2,7 +2,7 @@
#ifndef HEADER_COMP_H #ifndef HEADER_COMP_H
#define HEADER_COMP_H #define HEADER_COMP_H
#include <openssl/crypto.h> #include "crypto.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,13 +59,13 @@
#ifndef HEADER_CONF_H #ifndef HEADER_CONF_H
#define HEADER_CONF_H #define HEADER_CONF_H
#include <openssl/bio.h> #include "bio.h"
#include <openssl/lhash.h> #include "lhash.h"
#include <openssl/stack.h> #include "stack.h"
#include <openssl/safestack.h> #include "safestack.h"
#include <openssl/e_os2.h> #include "e_os2.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,8 +59,8 @@
#ifndef HEADER_CONF_API_H #ifndef HEADER_CONF_API_H
#define HEADER_CONF_API_H #define HEADER_CONF_API_H
#include <openssl/lhash.h> #include "lhash.h"
#include <openssl/conf.h> #include "conf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -119,24 +119,24 @@
#include <stdlib.h> #include <stdlib.h>
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <openssl/stack.h> #include "stack.h"
#include <openssl/safestack.h> #include "safestack.h"
#include <openssl/opensslv.h> #include "opensslv.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef CHARSET_EBCDIC #ifdef CHARSET_EBCDIC
#include <openssl/ebcdic.h> #include "ebcdic.h"
#endif #endif
/* Resolve problems on some operating systems with symbol names that clash /* Resolve problems on some operating systems with symbol names that clash
one way or another */ one way or another */
#include <openssl/symhacks.h> #include "symhacks.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,7 +59,7 @@
#ifndef HEADER_NEW_DES_H #ifndef HEADER_NEW_DES_H
#define HEADER_NEW_DES_H #define HEADER_NEW_DES_H
#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, #include "e_os2.h" /* OPENSSL_EXTERN, OPENSSL_NO_DES,
DES_LONG (via openssl/opensslconf.h */ DES_LONG (via openssl/opensslconf.h */
#ifdef OPENSSL_NO_DES #ifdef OPENSSL_NO_DES
@ -98,7 +98,7 @@ typedef struct DES_ks
#endif #endif
#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT #ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT
# include <openssl/des_old.h> # include "des_old.h"
#endif #endif
#define DES_KEY_SZ (sizeof(DES_cblock)) #define DES_KEY_SZ (sizeof(DES_cblock))

View File

@ -91,7 +91,7 @@
#ifndef HEADER_DES_H #ifndef HEADER_DES_H
#define HEADER_DES_H #define HEADER_DES_H
#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ #include "e_os2.h" /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
#ifdef OPENSSL_NO_DES #ifdef OPENSSL_NO_DES
#error DES is disabled. #error DES is disabled.
@ -102,10 +102,10 @@
#endif #endif
#ifdef _KERBEROS_DES_H #ifdef _KERBEROS_DES_H
#error <openssl/des_old.h> replaces <kerberos/des.h>. #error "des_old.h> replaces <kerberos/des.h".
#endif #endif
#include <openssl/symhacks.h> #include "symhacks.h"
#ifdef OPENSSL_BUILD_SHLIBCRYPTO #ifdef OPENSSL_BUILD_SHLIBCRYPTO
# undef OPENSSL_EXTERN # undef OPENSSL_EXTERN
@ -441,6 +441,6 @@ void _ossl_096_des_random_seed(des_cblock *key);
#endif #endif
/* for DES_read_pw_string et al */ /* for DES_read_pw_string et al */
#include <openssl/ui_compat.h> #include "ui_compat.h"
#endif #endif

View File

@ -59,18 +59,18 @@
#ifndef HEADER_DH_H #ifndef HEADER_DH_H
#define HEADER_DH_H #define HEADER_DH_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifdef OPENSSL_NO_DH #ifdef OPENSSL_NO_DH
#error DH is disabled. #error DH is disabled.
#endif #endif
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifndef OPENSSL_DH_MAX_MODULUS_BITS #ifndef OPENSSL_DH_MAX_MODULUS_BITS

View File

@ -65,22 +65,22 @@
#ifndef HEADER_DSA_H #ifndef HEADER_DSA_H
#define HEADER_DSA_H #define HEADER_DSA_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifdef OPENSSL_NO_DSA #ifdef OPENSSL_NO_DSA
#error DSA is disabled. #error DSA is disabled.
#endif #endif
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/crypto.h> #include "crypto.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
# include <openssl/dh.h> # include "dh.h"
#endif #endif
#endif #endif

View File

@ -59,7 +59,7 @@
#ifndef HEADER_DSO_H #ifndef HEADER_DSO_H
#define HEADER_DSO_H #define HEADER_DSO_H
#include <openssl/crypto.h> #include "crypto.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -53,7 +53,7 @@
* *
*/ */
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifndef HEADER_E_OS2_H #ifndef HEADER_E_OS2_H
#define HEADER_E_OS2_H #define HEADER_E_OS2_H

View File

@ -76,16 +76,16 @@
#ifndef HEADER_EC_H #ifndef HEADER_EC_H
#define HEADER_EC_H #define HEADER_EC_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_EC #ifdef OPENSSL_NO_EC
#error EC is disabled. #error EC is disabled.
#endif #endif
#include <openssl/asn1.h> #include "asn1.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -69,16 +69,16 @@
#ifndef HEADER_ECDH_H #ifndef HEADER_ECDH_H
#define HEADER_ECDH_H #define HEADER_ECDH_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_ECDH #ifdef OPENSSL_NO_ECDH
#error ECDH is disabled. #error ECDH is disabled.
#endif #endif
#include <openssl/ec.h> #include "ec.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,16 +59,16 @@
#ifndef HEADER_ECDSA_H #ifndef HEADER_ECDSA_H
#define HEADER_ECDSA_H #define HEADER_ECDSA_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_ECDSA #ifdef OPENSSL_NO_ECDSA
#error ECDSA is disabled. #error ECDSA is disabled.
#endif #endif
#include <openssl/ec.h> #include "ec.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -64,38 +64,38 @@
#ifndef HEADER_ENGINE_H #ifndef HEADER_ENGINE_H
#define HEADER_ENGINE_H #define HEADER_ENGINE_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_ENGINE #ifdef OPENSSL_NO_ENGINE
#error ENGINE is disabled. #error ENGINE is disabled.
#endif #endif
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h> #include "rsa.h"
#endif #endif
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h> #include "dsa.h"
#endif #endif
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <openssl/dh.h> #include "dh.h"
#endif #endif
#ifndef OPENSSL_NO_ECDH #ifndef OPENSSL_NO_ECDH
#include <openssl/ecdh.h> #include "ecdh.h"
#endif #endif
#ifndef OPENSSL_NO_ECDSA #ifndef OPENSSL_NO_ECDSA
#include <openssl/ecdsa.h> #include "ecdsa.h"
#endif #endif
#include <openssl/rand.h> #include "rand.h"
#include <openssl/ui.h> #include "ui.h"
#include <openssl/err.h> #include "err.h"
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#include <openssl/x509.h> #include "x509.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -112,19 +112,19 @@
#ifndef HEADER_ERR_H #ifndef HEADER_ERR_H
#define HEADER_ERR_H #define HEADER_ERR_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#ifndef OPENSSL_NO_LHASH #ifndef OPENSSL_NO_LHASH
#include <openssl/lhash.h> #include "lhash.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -60,19 +60,19 @@
#define HEADER_ENVELOPE_H #define HEADER_ENVELOPE_H
#ifdef OPENSSL_ALGORITHM_DEFINES #ifdef OPENSSL_ALGORITHM_DEFINES
# include <openssl/opensslconf.h> # include "opensslconf.h"
#else #else
# define OPENSSL_ALGORITHM_DEFINES # define OPENSSL_ALGORITHM_DEFINES
# include <openssl/opensslconf.h> # include "opensslconf.h"
# undef OPENSSL_ALGORITHM_DEFINES # undef OPENSSL_ALGORITHM_DEFINES
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
/* /*
@ -91,7 +91,7 @@
/* Default PKCS#5 iteration count */ /* Default PKCS#5 iteration count */
#define PKCS5_DEFAULT_ITER 2048 #define PKCS5_DEFAULT_ITER 2048
#include <openssl/objects.h> #include "objects.h"
#define EVP_PK_RSA 0x0001 #define EVP_PK_RSA 0x0001
#define EVP_PK_DSA 0x0002 #define EVP_PK_DSA 0x0002

View File

@ -58,13 +58,13 @@
#ifndef HEADER_HMAC_H #ifndef HEADER_HMAC_H
#define HEADER_HMAC_H #define HEADER_HMAC_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_HMAC #ifdef OPENSSL_NO_HMAC
#error HMAC is disabled. #error HMAC is disabled.
#endif #endif
#include <openssl/evp.h> #include "evp.h"
#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */

View File

@ -59,7 +59,7 @@
#ifndef HEADER_IDEA_H #ifndef HEADER_IDEA_H
#define HEADER_IDEA_H #define HEADER_IDEA_H
#include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */ #include "opensslconf.h" /* IDEA_INT, OPENSSL_NO_IDEA */
#ifdef OPENSSL_NO_IDEA #ifdef OPENSSL_NO_IDEA
#error IDEA is disabled. #error IDEA is disabled.

View File

@ -63,7 +63,7 @@
/* /*
#include <krb5.h> #include <krb5.h>
*/ */
#include <openssl/safestack.h> #include "safestack.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -63,13 +63,13 @@
#ifndef HEADER_LHASH_H #ifndef HEADER_LHASH_H
#define HEADER_LHASH_H #define HEADER_LHASH_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,7 +59,7 @@
#ifndef HEADER_MD2_H #ifndef HEADER_MD2_H
#define HEADER_MD2_H #define HEADER_MD2_H
#include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */ #include "opensslconf.h" /* OPENSSL_NO_MD2, MD2_INT */
#ifdef OPENSSL_NO_MD2 #ifdef OPENSSL_NO_MD2
#error MD2 is disabled. #error MD2 is disabled.
#endif #endif

View File

@ -59,7 +59,7 @@
#ifndef HEADER_MD4_H #ifndef HEADER_MD4_H
#define HEADER_MD4_H #define HEADER_MD4_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,7 +59,7 @@
#ifndef HEADER_MD5_H #ifndef HEADER_MD5_H
#define HEADER_MD5_H #define HEADER_MD5_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -62,7 +62,7 @@
#define USE_OBJ_MAC #define USE_OBJ_MAC
#ifdef USE_OBJ_MAC #ifdef USE_OBJ_MAC
#include <openssl/obj_mac.h> #include "obj_mac.h"
#else #else
#define SN_undef "UNDEF" #define SN_undef "UNDEF"
#define LN_undef "undefined" #define LN_undef "undefined"
@ -956,8 +956,8 @@
#define OBJ_OCSP_sign OBJ_id_kp,9L #define OBJ_OCSP_sign OBJ_id_kp,9L
#endif /* USE_OBJ_MAC */ #endif /* USE_OBJ_MAC */
#include <openssl/bio.h> #include "bio.h"
#include <openssl/asn1.h> #include "asn1.h"
#define OBJ_NAME_TYPE_UNDEF 0x00 #define OBJ_NAME_TYPE_UNDEF 0x00
#define OBJ_NAME_TYPE_MD_METH 0x01 #define OBJ_NAME_TYPE_MD_METH 0x01

View File

@ -64,10 +64,10 @@
#ifndef HEADER_OCSP_H #ifndef HEADER_OCSP_H
#define HEADER_OCSP_H #define HEADER_OCSP_H
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#include <openssl/x509.h> #include "x509.h"
#include <openssl/x509v3.h> #include "x509v3.h"
#include <openssl/safestack.h> #include "safestack.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -55,7 +55,7 @@
#ifndef HEADER_OPENSSL_TYPES_H #ifndef HEADER_OPENSSL_TYPES_H
#define HEADER_OPENSSL_TYPES_H #define HEADER_OPENSSL_TYPES_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifdef NO_ASN1_TYPEDEFS #ifdef NO_ASN1_TYPEDEFS
#define ASN1_INTEGER ASN1_STRING #define ASN1_INTEGER ASN1_STRING

View File

@ -59,16 +59,16 @@
#ifndef HEADER_PEM_H #ifndef HEADER_PEM_H
#define HEADER_PEM_H #define HEADER_PEM_H
#include <openssl/e_os2.h> #include "e_os2.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#ifndef OPENSSL_NO_STACK #ifndef OPENSSL_NO_STACK
#include <openssl/stack.h> #include "stack.h"
#endif #endif
#include <openssl/evp.h> #include "evp.h"
#include <openssl/x509.h> #include "x509.h"
#include <openssl/pem2.h> #include "pem2.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { 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); void PEM_dek_info(char *buf, const char *type, int len, char *str);
#include <openssl/symhacks.h> #include "symhacks.h"
DECLARE_PEM_rw(X509, X509) DECLARE_PEM_rw(X509, X509)

View File

@ -59,8 +59,8 @@
#ifndef HEADER_PKCS12_H #ifndef HEADER_PKCS12_H
#define HEADER_PKCS12_H #define HEADER_PKCS12_H
#include <openssl/bio.h> #include "bio.h"
#include <openssl/x509.h> #include "x509.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,12 +59,12 @@
#ifndef HEADER_PKCS7_H #ifndef HEADER_PKCS7_H
#define HEADER_PKCS7_H #define HEADER_PKCS7_H
#include <openssl/asn1.h> #include "asn1.h"
#include <openssl/bio.h> #include "bio.h"
#include <openssl/e_os2.h> #include "e_os2.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -60,8 +60,8 @@
#define HEADER_RAND_H #define HEADER_RAND_H
#include <stdlib.h> #include <stdlib.h>
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#include <openssl/e_os2.h> #include "e_os2.h"
#if defined(OPENSSL_SYS_WINDOWS) #if defined(OPENSSL_SYS_WINDOWS)
#include <windows.h> #include <windows.h>

View File

@ -59,7 +59,7 @@
#ifndef HEADER_RC2_H #ifndef HEADER_RC2_H
#define HEADER_RC2_H #define HEADER_RC2_H
#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */ #include "opensslconf.h" /* OPENSSL_NO_RC2, RC2_INT */
#ifdef OPENSSL_NO_RC2 #ifdef OPENSSL_NO_RC2
#error RC2 is disabled. #error RC2 is disabled.
#endif #endif

View File

@ -59,7 +59,7 @@
#ifndef HEADER_RC4_H #ifndef HEADER_RC4_H
#define HEADER_RC4_H #define HEADER_RC4_H
#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */ #include "opensslconf.h" /* OPENSSL_NO_RC4, RC4_INT */
#ifdef OPENSSL_NO_RC4 #ifdef OPENSSL_NO_RC4
#error RC4 is disabled. #error RC4 is disabled.
#endif #endif

View File

@ -59,7 +59,7 @@
#ifndef HEADER_RIPEMD_H #ifndef HEADER_RIPEMD_H
#define HEADER_RIPEMD_H #define HEADER_RIPEMD_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,15 +59,15 @@
#ifndef HEADER_RSA_H #ifndef HEADER_RSA_H
#define HEADER_RSA_H #define HEADER_RSA_H
#include <openssl/asn1.h> #include "asn1.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/crypto.h> #include "crypto.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/bn.h> #include "bn.h"
#endif #endif
#ifdef OPENSSL_NO_RSA #ifdef OPENSSL_NO_RSA

View File

@ -55,7 +55,7 @@
#ifndef HEADER_SAFESTACK_H #ifndef HEADER_SAFESTACK_H
#define HEADER_SAFESTACK_H #define HEADER_SAFESTACK_H
#include <openssl/stack.h> #include "stack.h"
#ifndef CHECKED_PTR_OF #ifndef CHECKED_PTR_OF
#define CHECKED_PTR_OF(type, p) \ #define CHECKED_PTR_OF(type, p) \

View File

@ -59,7 +59,7 @@
#ifndef HEADER_SHA_H #ifndef HEADER_SHA_H
#define HEADER_SHA_H #define HEADER_SHA_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,17 +59,17 @@
#ifndef HEADER_STORE_H #ifndef HEADER_STORE_H
#define HEADER_STORE_H #define HEADER_STORE_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifdef OPENSSL_NO_STORE #ifdef OPENSSL_NO_STORE
#error STORE is disabled. #error STORE is disabled.
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/evp.h> #include "evp.h"
#include <openssl/bn.h> #include "bn.h"
#include <openssl/x509.h> #include "x509.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -55,7 +55,7 @@
#ifndef HEADER_SYMHACKS_H #ifndef HEADER_SYMHACKS_H
#define HEADER_SYMHACKS_H #define HEADER_SYMHACKS_H
#include <openssl/e_os2.h> #include "e_os2.h"
/* Hacks to solve the problem with linkers incapable of handling very long /* 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 symbol names. In the case of VMS, the limit is 31 characters on VMS for

View File

@ -59,31 +59,31 @@
#ifndef HEADER_TS_H #ifndef HEADER_TS_H
#define HEADER_TS_H #define HEADER_TS_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#ifndef OPENSSL_NO_BUFFER #ifndef OPENSSL_NO_BUFFER
#include <openssl/buffer.h> #include "buffer.h"
#endif #endif
#ifndef OPENSSL_NO_EVP #ifndef OPENSSL_NO_EVP
#include <openssl/evp.h> #include "evp.h"
#endif #endif
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/stack.h> #include "stack.h"
#include <openssl/asn1.h> #include "asn1.h"
#include <openssl/safestack.h> #include "safestack.h"
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h> #include "rsa.h"
#endif #endif
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h> #include "dsa.h"
#endif #endif
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <openssl/dh.h> #include "dh.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -95,8 +95,8 @@ extern "C" {
#undef X509_NAME #undef X509_NAME
#endif #endif
#include <openssl/x509.h> #include "x509.h"
#include <openssl/x509v3.h> #include "x509v3.h"
/* /*
MessageImprint ::= SEQUENCE { MessageImprint ::= SEQUENCE {

View File

@ -59,12 +59,12 @@
#ifndef HEADER_TXT_DB_H #ifndef HEADER_TXT_DB_H
#define HEADER_TXT_DB_H #define HEADER_TXT_DB_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/stack.h> #include "stack.h"
#include <openssl/lhash.h> #include "lhash.h"
#define DB_ERROR_OK 0 #define DB_ERROR_OK 0
#define DB_ERROR_MALLOC 1 #define DB_ERROR_MALLOC 1

View File

@ -60,10 +60,10 @@
#define HEADER_UI_H #define HEADER_UI_H
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#include <openssl/crypto.h> #include "crypto.h"
#endif #endif
#include <openssl/safestack.h> #include "safestack.h"
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,8 +59,8 @@
#ifndef HEADER_UI_COMPAT_H #ifndef HEADER_UI_COMPAT_H
#define HEADER_UI_COMPAT_H #define HEADER_UI_COMPAT_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#include <openssl/ui.h> #include "ui.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,7 +1,7 @@
#ifndef HEADER_WHRLPOOL_H #ifndef HEADER_WHRLPOOL_H
#define HEADER_WHRLPOOL_H #define HEADER_WHRLPOOL_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -64,49 +64,49 @@
#ifndef HEADER_X509_H #ifndef HEADER_X509_H
#define HEADER_X509_H #define HEADER_X509_H
#include <openssl/e_os2.h> #include "e_os2.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#ifndef OPENSSL_NO_BUFFER #ifndef OPENSSL_NO_BUFFER
#include <openssl/buffer.h> #include "buffer.h"
#endif #endif
#ifndef OPENSSL_NO_EVP #ifndef OPENSSL_NO_EVP
#include <openssl/evp.h> #include "evp.h"
#endif #endif
#ifndef OPENSSL_NO_BIO #ifndef OPENSSL_NO_BIO
#include <openssl/bio.h> #include "bio.h"
#endif #endif
#include <openssl/stack.h> #include "stack.h"
#include <openssl/asn1.h> #include "asn1.h"
#include <openssl/safestack.h> #include "safestack.h"
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
#include <openssl/ec.h> #include "ec.h"
#endif #endif
#ifndef OPENSSL_NO_ECDSA #ifndef OPENSSL_NO_ECDSA
#include <openssl/ecdsa.h> #include "ecdsa.h"
#endif #endif
#ifndef OPENSSL_NO_ECDH #ifndef OPENSSL_NO_ECDH
#include <openssl/ecdh.h> #include "ecdh.h"
#endif #endif
#ifndef OPENSSL_NO_DEPRECATED #ifndef OPENSSL_NO_DEPRECATED
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h> #include "rsa.h"
#endif #endif
#ifndef OPENSSL_NO_DSA #ifndef OPENSSL_NO_DSA
#include <openssl/dsa.h> #include "dsa.h"
#endif #endif
#ifndef OPENSSL_NO_DH #ifndef OPENSSL_NO_DH
#include <openssl/dh.h> #include "dh.h"
#endif #endif
#endif #endif
#ifndef OPENSSL_NO_SHA #ifndef OPENSSL_NO_SHA
#include <openssl/sha.h> #include "sha.h"
#endif #endif
#include <openssl/ossl_typ.h> #include "ossl_typ.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -597,8 +597,8 @@ struct pkcs8_priv_key_info_st
} }
#endif #endif
#include <openssl/x509_vfy.h> #include "x509_vfy.h"
#include <openssl/pkcs7.h> #include "pkcs7.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -57,7 +57,7 @@
*/ */
#ifndef HEADER_X509_H #ifndef HEADER_X509_H
#include <openssl/x509.h> #include "x509.h"
/* openssl/x509.h ends up #include-ing this file at about the only /* openssl/x509.h ends up #include-ing this file at about the only
* appropriate moment. */ * appropriate moment. */
#endif #endif
@ -65,13 +65,13 @@
#ifndef HEADER_X509_VFY_H #ifndef HEADER_X509_VFY_H
#define HEADER_X509_VFY_H #define HEADER_X509_VFY_H
#include <openssl/opensslconf.h> #include "opensslconf.h"
#ifndef OPENSSL_NO_LHASH #ifndef OPENSSL_NO_LHASH
#include <openssl/lhash.h> #include "lhash.h"
#endif #endif
#include <openssl/bio.h> #include "bio.h"
#include <openssl/crypto.h> #include "crypto.h"
#include <openssl/symhacks.h> #include "symhacks.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -58,9 +58,9 @@
#ifndef HEADER_X509V3_H #ifndef HEADER_X509V3_H
#define HEADER_X509V3_H #define HEADER_X509V3_H
#include <openssl/bio.h> #include "bio.h"
#include <openssl/x509.h> #include "x509.h"
#include <openssl/conf.h> #include "conf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -23,10 +23,10 @@
#define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize) #define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize)
//#include <Platform.h>
#include "../Platform/Posix/posix.h" #include "../Platform/Posix/posix.h"
//#include <inttypes.h>
//#include "../../../rEFIt_UEFI/Platform/Posix/abort.h" #define XTOOLS_VA_LIST va_list
//#include <Library/Base.h> #define XTOOLS_VA_START va_start
#define XTOOLS_VA_END va_end
#endif #endif

View File

@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9A0B085E240300E000E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; }; 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 */; }; 9A28CD1F241BB61B00F3D247 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1D241BB61B00F3D247 /* abort.cpp */; };
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.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 */; }; 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 = "<group>"; }; 9A0B084A2402FE9300E2B470 /* XArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = "<group>"; };
9A0B084B2402FE9300E2B470 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; }; 9A0B084B2402FE9300E2B470 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; };
9A0B085D240300E000E2B470 /* Platform.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = "<group>"; }; 9A0B085D240300E000E2B470 /* Platform.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = "<group>"; };
9A272A7C25D5062D00F03E19 /* DataHubExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataHubExt.h; sourceTree = "<group>"; };
9A272A7D25D5062D00F03E19 /* DataHub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataHub.cpp; sourceTree = "<group>"; };
9A272A7E25D5062E00F03E19 /* DataHub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataHub.h; sourceTree = "<group>"; };
9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; }; 9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; }; 9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; };
9A358AF425CF115100A3850D /* Config_GUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Config_GUI.cpp; sourceTree = "<group>"; }; 9A358AF425CF115100A3850D /* Config_GUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Config_GUI.cpp; sourceTree = "<group>"; };
@ -5252,6 +5256,9 @@
9A28CCAC241B816400F3D247 /* Platform */ = { 9A28CCAC241B816400F3D247 /* Platform */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A272A7D25D5062D00F03E19 /* DataHub.cpp */,
9A272A7E25D5062E00F03E19 /* DataHub.h */,
9A272A7C25D5062D00F03E19 /* DataHubExt.h */,
9A358AF325CF115100A3850D /* ConfigPlist */, 9A358AF325CF115100A3850D /* ConfigPlist */,
9AA9240D25CD5B2D00BD5E8B /* AcpiPatcher.cpp */, 9AA9240D25CD5B2D00BD5E8B /* AcpiPatcher.cpp */,
9AA9240825CD5B2C00BD5E8B /* AcpiPatcher.h */, 9AA9240825CD5B2C00BD5E8B /* AcpiPatcher.h */,
@ -16012,6 +16019,7 @@
9AA925CE25CD94C600BD5E8B /* BootLog.cpp in Sources */, 9AA925CE25CD94C600BD5E8B /* BootLog.cpp in Sources */,
9A358B3025CF115200A3850D /* Config_Graphics.cpp in Sources */, 9A358B3025CF115200A3850D /* Config_Graphics.cpp in Sources */,
9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */, 9A36E51024F3B537007A1107 /* TagArray.cpp in Sources */,
9A272A7F25D5062E00F03E19 /* DataHub.cpp in Sources */,
9AA918C125CD4B7900BD5E8B /* lib.cpp in Sources */, 9AA918C125CD4B7900BD5E8B /* lib.cpp in Sources */,
9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */, 9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */,
9AFDD08D25CE731000EEAF06 /* plist_tests.cpp in Sources */, 9AFDD08D25CE731000EEAF06 /* plist_tests.cpp in Sources */,
@ -16109,6 +16117,7 @@
"wcsncmp=wcsncmp_fixed", "wcsncmp=wcsncmp_fixed",
"wcsstr=wcsstr_fixed", "wcsstr=wcsstr_fixed",
"sprintf=__sprintf_is_disabled__", "sprintf=__sprintf_is_disabled__",
"___NOT___ENABLE_SECURE_BOOT",
); );
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;

View File

@ -18,7 +18,7 @@ extern "C" int main(int argc, const char * argv[])
(void)argv; (void)argv;
setlocale(LC_ALL, "en_US"); // to allow printf unicode char setlocale(LC_ALL, "en_US"); // to allow printf unicode char
xcode_utf_fixed_tests(); // xcode_utf_fixed_tests();
return all_tests() ? 0 : -1 ; return all_tests() ? 0 : -1 ;

View File

@ -56,8 +56,8 @@ extern "C" void xcode_utf_fixed_tests()
#endif #endif
uint64_t uint64 = 1; uint64_t uint64 = 1;
printf("Hello world൧楔 %llu error(s)\n", uint64); printf("Hello world൧楔 %llu \n", uint64);
DebugLog(2, "Hello world൧楔 %llu error(s)\n", uint64); DebugLog(2, "Hello world൧楔 %llu \n", uint64);
size_t len1 = wcslen(L"Hell൧楔o world൧楔"); size_t len1 = wcslen(L"Hell൧楔o world൧楔");
size_t len1f = wcslen_fixed(L"Hell൧楔o world൧楔"); size_t len1f = wcslen_fixed(L"Hell൧楔o world൧楔");

View File

@ -249,8 +249,8 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index)
DropTable->TableId = Table->OemTableId; DropTable->TableId = Table->OemTableId;
DropTable->Length = Table->Length; DropTable->Length = Table->Length;
DropTable->MenuItem.BValue = FALSE; DropTable->MenuItem.BValue = FALSE;
DropTable->Next = gSettings.ACPIDropTables; DropTable->Next = GlobalConfig.ACPIDropTables;
gSettings.ACPIDropTables = DropTable; GlobalConfig.ACPIDropTables = DropTable;
} }
void GetAcpiTablesList() void GetAcpiTablesList()
@ -258,7 +258,7 @@ void GetAcpiTablesList()
DbgHeader("GetAcpiTablesList"); DbgHeader("GetAcpiTablesList");
GetFadt(); //this is a first call to acpi, we need it to make a pointer to Xsdt 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 "); DBG("Get Acpi Tables List ");
if (Xsdt) { if (Xsdt) {
@ -398,7 +398,7 @@ BOOLEAN FixAsciiTableHeader(UINT8 *Str, UINTN Len)
BOOLEAN PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header) BOOLEAN PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header)
{ {
BOOLEAN Ret1, Ret2, Ret3; BOOLEAN Ret1, Ret2, Ret3;
if (!(gSettings.FixDsdt & FIX_HEADERS) && !gSettings.FixHeaders) { if (!(gSettings.ACPI.DSDT.FixDsdt & FIX_HEADERS) && !gSettings.ACPI.FixHeaders) {
return FALSE; return FALSE;
} }
Ret1 = FixAsciiTableHeader((UINT8*)&Header->CreatorId, 4); Ret1 = FixAsciiTableHeader((UINT8*)&Header->CreatorId, 4);
@ -437,7 +437,7 @@ void PatchAllTables()
} }
EFI_ACPI_DESCRIPTION_HEADER* NewTable = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)BufferPtr; EFI_ACPI_DESCRIPTION_HEADER* NewTable = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)BufferPtr;
CopyMem(NewTable, Table, Len); 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 // Merged tables already have the header patched, so no need to do it again
if (!IsXsdtEntryMerged(IndexFromXsdtEntryPtr(Ptr))) { if (!IsXsdtEntryMerged(IndexFromXsdtEntryPtr(Ptr))) {
// table header NOT already patched // table header NOT already patched
@ -445,31 +445,31 @@ void PatchAllTables()
} }
} }
if (NewTable->Signature == EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) { if (NewTable->Signature == EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
if (gSettings.DSDTPatchArray.size() > 0) { if (gSettings.ACPI.DSDT.DSDTPatchArray.size() > 0) {
DBG("Patching SSDTs: %zu patches each\n", gSettings.DSDTPatchArray.size()); DBG("Patching SSDTs: %zu patches each\n", gSettings.ACPI.DSDT.DSDTPatchArray.size());
// CHAR8 OTID[9]; // CHAR8 OTID[9];
// OTID[8] = 0; // OTID[8] = 0;
// CopyMem(OTID, &NewTable->OemTableId, 8); // CopyMem(OTID, &NewTable->OemTableId, 8);
// DBG("Patching SSDT %s Length=%d\n", OTID, (INT32)Len); // DBG("Patching SSDT %s Length=%d\n", OTID, (INT32)Len);
for (UINT32 i = 0; i < gSettings.DSDTPatchArray.size(); i++) { for (UINT32 i = 0; i < gSettings.ACPI.DSDT.DSDTPatchArray.size(); i++) {
if ( gSettings.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) {
continue; continue;
} }
// DBG("%d. [%s]:", i, gSettings.PatchDsdtLabel[i]); // DBG("%d. [%s]:", i, gSettings.PatchDsdtLabel[i]);
if (!gSettings.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { if (!gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) {
// DBG(" disabled\n"); // DBG(" disabled\n");
continue; continue;
} }
if ( gSettings.DSDTPatchArray[i].PatchDsdtTgt.isEmpty() ) { if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt.isEmpty() ) {
Len = FixAny((UINT8*)NewTable, Len, Len = FixAny((UINT8*)NewTable, Len,
gSettings.DSDTPatchArray[i].PatchDsdtFind, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind,
gSettings.DSDTPatchArray[i].PatchDsdtReplace); gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace);
//DBG(" OK\n"); //DBG(" OK\n");
}else{ }else{
//DBG("Patching: renaming in bridge\n"); //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 GetBiosRegions((UINT8*)NewTable); //take Regions from SSDT even if they will be dropped
Patched = TRUE; 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; INTN Len1 = ((Len + 4 - 1) / 16 + 1) * 16 - 4;
CopyMem(NewTable, Table, Len1); //Len increased but less than EFI_PAGE CopyMem(NewTable, Table, Len1); //Len increased but less than EFI_PAGE
NewTable->Length = (UINT32)(UINTN)Len1; Patched = TRUE; NewTable->Length = (UINT32)(UINTN)Len1; Patched = TRUE;
@ -863,7 +863,7 @@ static XStringW GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount,
{ {
XStringW FileName; XStringW FileName;
CHAR8 Suffix[10]; // "-" + OemTableId + NUL CHAR8 Suffix[10]; // "-" + OemTableId + NUL
if (gSettings.NoOemTableId || 0 == OemTableId[0]) { if (gSettings.ACPI.SSDT.NoOemTableId || 0 == OemTableId[0]) {
Suffix[0] = 0; Suffix[0] = 0;
} else { } else {
Suffix[0] = '-'; Suffix[0] = '-';
@ -894,7 +894,7 @@ void DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
UINT8 *pacBody; UINT8 *pacBody;
INTN ChildCount = 0; INTN ChildCount = 0;
if (gSettings.NoDynamicExtract) { if (gSettings.ACPI.SSDT.NoDynamicExtract) {
return; return;
} }
@ -1507,16 +1507,16 @@ void SaveOemDsdt(BOOLEAN FullPatch)
UINT8 *buffer = NULL; UINT8 *buffer = NULL;
UINTN DsdtLen = 0; UINTN DsdtLen = 0;
XStringW OriginDsdt = SWPrintf("ACPI\\origin\\DSDT.aml"); 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"; // constexpr LStringW PathPatched = L"\\EFI\\CL OVER\\ACPI\\patched";
// XStringW PathDsdt; // XStringW PathDsdt;
// XStringW AcpiOemPath = SWPrintf("ACPI\\patched"); // 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()))) { 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.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.DsdtName.wc_str()).wc_str(), &buffer, &DsdtLen); Status = egLoadFile(&selfOem.getConfigDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.ACPI.DSDT.DsdtName.wc_str()).wc_str(), &buffer, &DsdtLen);
} }
// Jief : Do not write outside OemPath // 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; UINTN Index = IGNORE_INDEX;
if (AUTOMERGE_PASS1 == Pass) { if (AUTOMERGE_PASS1 == Pass) {
Index = IndexFromFileName(PartName); 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 // file names such as: ECDT.aml, SSDT-0.aml, SSDT-1-CpuPm.aml, attempt merge on pass1
// others: no attempt for merge // others: no attempt for merge
// special case for SSDT.aml: no attempt to 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); DBG("size=%lld ", (UINT64)bufferLen);
if (!gSettings.AutoMerge) { if (!gSettings.ACPI.AutoMerge) {
// Note: with AutoMerge=false, Pass is only AUTOMERGE_PASS2 here // Note: with AutoMerge=false, Pass is only AUTOMERGE_PASS2 here
Status = InsertTable(buffer, bufferLen); Status = InsertTable(buffer, bufferLen);
} else { } else {
@ -1619,23 +1619,23 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C
void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass) 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 // nothing to do in this case, since AutoMerge=false -> no tables ever merged
return; return;
} }
if (ACPIPatchedAML) { if (ACPIPatchedAML) {
DbgHeader("ACPIPatchedAML"); DbgHeader("ACPIPatchedAML");
if (gSettings.AutoMerge) { if (gSettings.ACPI.AutoMerge) {
DBG("AutoMerge pass %llu\n", Pass); DBG("AutoMerge pass %llu\n", Pass);
} }
//DBG("Start: Processing Patched AML(s): "); //DBG("Start: Processing Patched AML(s): ");
if (gSettings.SortedACPICount) { if (gSettings.ACPI.SortedACPI.size()) {
UINTN Index; UINTN Index;
DBG("Sorted\n"); DBG("Sorted\n");
for (Index = 0; Index < gSettings.SortedACPICount; Index++) { for (Index = 0; Index < gSettings.ACPI.SortedACPI.size(); Index++) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp; ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
for (ACPIPatchedAMLTmp = ACPIPatchedAML; ACPIPatchedAMLTmp; ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next) { 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) if (BVALUE_ATTEMPTED != ACPIPatchedAMLTmp->MenuItem.BValue)
DBG("Disabled: %ls, skip\n", ACPIPatchedAMLTmp->FileName); DBG("Disabled: %ls, skip\n", ACPIPatchedAMLTmp->FileName);
ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED; ACPIPatchedAMLTmp->MenuItem.BValue = BVALUE_ATTEMPTED;
@ -1643,11 +1643,11 @@ void LoadAllPatchedAML(const XStringW& acpiPathUnderOem, UINTN Pass)
} }
} }
if (!ACPIPatchedAMLTmp) { // NULL when not disabled 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()); 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.SortedACPI[Index], Pass)) { if (LoadPatchedAML(selfOem.getConfigDir(), acpiPathUnderOem, gSettings.ACPI.SortedACPI[Index].wc_str(), Pass)) {
// avoid inserting table again on second pass // avoid inserting table again on second pass
for (ACPI_PATCHED_AML* temp2 = ACPIPatchedAML; temp2; temp2 = temp2->Next) { 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; temp2->MenuItem.BValue = BVALUE_ATTEMPTED;
break; break;
} }
@ -1862,26 +1862,26 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
//should correct headers if needed and if asked //should correct headers if needed and if asked
PatchTableHeader((EFI_ACPI_DESCRIPTION_HEADER*)newFadt); PatchTableHeader((EFI_ACPI_DESCRIPTION_HEADER*)newFadt);
if (gSettings.smartUPS==TRUE) { if (gSettings.ACPI.smartUPS==TRUE) {
newFadt->PreferredPmProfile = 3; newFadt->PreferredPmProfile = 3;
} else { } else {
newFadt->PreferredPmProfile = gMobile?2:1; //as calculated before 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 newFadt->CstCnt = 0x85; //as in Mac
} }
if (gSettings.EnableC2) newFadt->PLvl2Lat = 0x65; if (gSettings.ACPI.SSDT.EnableC2) newFadt->PLvl2Lat = 0x65;
if (gSettings.C3Latency > 0) { if (gSettings.ACPI.SSDT.C3Latency > 0) {
newFadt->PLvl3Lat = gSettings.C3Latency; newFadt->PLvl3Lat = gSettings.ACPI.SSDT.C3Latency;
} else if (gSettings.EnableC4) { } else if (gSettings.ACPI.SSDT.EnableC4) {
newFadt->PLvl3Lat = 0x3E9; newFadt->PLvl3Lat = 0x3E9;
} }
if (gSettings.C3Latency == 0) { if (gSettings.ACPI.SSDT.C3Latency == 0) {
gSettings.C3Latency = newFadt->PLvl3Lat; gSettings.ACPI.SSDT.C3Latency = newFadt->PLvl3Lat;
} }
newFadt->IaPcBootArch = 0x3; newFadt->IaPcBootArch = 0x3;
if (gSettings.NoASPM) { if (gSettings.ACPI.NoASPM) {
newFadt->IaPcBootArch |= 0x10; // disable ASPM newFadt->IaPcBootArch |= 0x10; // disable ASPM
} }
newFadt->Flags |= 0x420; //Reset Register Supported and SleepButton active 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 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->ResetReg.Address = 0x64;
newFadt->ResetValue = 0xFE; newFadt->ResetValue = 0xFE;
gSettings.ResetAddr = 0x64; gSettings.ACPI.ResetAddr = 0x64;
gSettings.ResetVal = 0xFE; gSettings.ACPI.ResetVal = 0xFE;
} else if (gSettings.ResetAddr != 0) { } else if (gSettings.ACPI.ResetAddr != 0) {
newFadt->ResetReg.Address = gSettings.ResetAddr; newFadt->ResetReg.Address = gSettings.ACPI.ResetAddr;
newFadt->ResetValue = gSettings.ResetVal; newFadt->ResetValue = gSettings.ACPI.ResetVal;
} }
newFadt->XPm1aEvtBlk.Address = (UINT64)(newFadt->Pm1aEvtBlk); newFadt->XPm1aEvtBlk.Address = (UINT64)(newFadt->Pm1aEvtBlk);
newFadt->XPm1bEvtBlk.Address = (UINT64)(newFadt->Pm1bEvtBlk); 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); Xsdt->Entry = (UINT64)((UINT32)(UINTN)newFadt);
} }
FixChecksum(&FadtPointer->Header); FixChecksum(&FadtPointer->Header);
if (gSettings.SlpSmiEnable) { if (gSettings.ACPI.SlpSmiEnable) {
UINT32 *SlpSmiEn = (UINT32*)((UINTN)(newFadt->Pm1aEvtBlk) + 0x30); UINT32 *SlpSmiEn = (UINT32*)((UINTN)(newFadt->Pm1aEvtBlk) + 0x30);
UINT32 Value = *SlpSmiEn; UINT32 Value = *SlpSmiEn;
Value &= ~ bit(4); Value &= ~ bit(4);
@ -1954,7 +1954,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
} }
//Get regions from BIOS DSDT //Get regions from BIOS DSDT
if ((gSettings.FixDsdt & FIX_REGIONS) != 0) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_REGIONS) != 0) {
GetBiosRegions((UINT8*)(UINTN)(newFadt->Dsdt)); GetBiosRegions((UINT8*)(UINTN)(newFadt->Dsdt));
} }
// DBG("DSDT finding\n"); // DBG("DSDT finding\n");
@ -1966,7 +1966,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
Status = EFI_NOT_FOUND; 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 ( selfOem.oemDirExists() ) {
if ( FileExists(&selfOem.getOemDir(), acpiPath) ) { 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 // second priority is DSDT from OEM folder
// third priority is /EFI/CLOVER/ACPI/patched/DSDT*.aml choosen from GUI. // 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)) { if (EFI_ERROR(Status) && FileExists(Volume->RootDir, PathDsdt)) {
DBG("DSDT found in booted volume\n"); DBG("DSDT found in booted volume\n");
Status = egLoadFile(Volume->RootDir, PathDsdt.wc_str(), &buffer, &bufferLen); 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 // dropDSM = gSettings.DropOEM_DSM; //if set by user
// } // }
if (gSettings.DebugDSDT) { if (gSettings.ACPI.DSDT.DebugDSDT) {
TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)FadtPointer->XDsdt; TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)FadtPointer->XDsdt;
bufferLen = TableHeader->Length; 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); 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 //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(?) // 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.FixDsdt); DBG("Apply DsdtFixMask=0x%08X\n", gSettings.ACPI.DSDT.FixDsdt);
// DBG(" drop _DSM mask=0x%04hX\n", dropDSM); // DBG(" drop _DSM mask=0x%04hX\n", dropDSM);
FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion); FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion);
if (gSettings.DebugDSDT) { if (gSettings.ACPI.DSDT.DebugDSDT) {
for (Index=0; Index < 60; Index++) { for (Index=0; Index < 60; Index++) {
XStringW DsdtPatchedName = SWPrintf("ACPI\\origin\\DSDT-pa%llu.aml", Index); XStringW DsdtPatchedName = SWPrintf("ACPI\\origin\\DSDT-pa%llu.aml", Index);
if(!FileExists(&selfOem.getConfigDir(), DsdtPatchedName)){ 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); LoadAllPatchedAML(L"ACPI\\patched"_XSW, AUTOMERGE_PASS1);
// Drop tables // Drop tables
if (gSettings.ACPIDropTables) { if (GlobalConfig.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable; ACPI_DROP_TABLE *DropTable;
DbgHeader("ACPIDropTables"); DbgHeader("ACPIDropTables");
for (DropTable = gSettings.ACPIDropTables; DropTable; DropTable = DropTable->Next) { for (DropTable = GlobalConfig.ACPIDropTables; DropTable; DropTable = DropTable->Next) {
if (DropTable->MenuItem.BValue) { 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); //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); 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"); DbgHeader("DropSSDT");
//special case if we set into menu drop all SSDT //special case if we set into menu drop all SSDT
DropTableFromXSDT(EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0, 0); 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); DBG("ApicCPUNum=%llu\n", ApicCPUNum);
//reallocate table //reallocate table
if (gSettings.PatchNMI) { if (gSettings.ACPI.PatchNMI) {
BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS;
Status=gBS->AllocatePages(AllocateMaxAddress, EfiACPIReclaimMemory, 1, &BufferPtr); Status=gBS->AllocatePages(AllocateMaxAddress, EfiACPIReclaimMemory, 1, &BufferPtr);
if(!EFI_ERROR(Status)) { if(!EFI_ERROR(Status)) {
@ -2245,7 +2245,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
ApicCPUNum = acpi_cpu_count; ApicCPUNum = acpi_cpu_count;
} }
if (gSettings.GeneratePStates || gSettings.GeneratePluginType) { if (gSettings.ACPI.SSDT.Generate.GeneratePStates || gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
Ssdt = generate_pss_ssdt(ApicCPUNum); Ssdt = generate_pss_ssdt(ApicCPUNum);
if (Ssdt) { 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; Status = EFI_NOT_FOUND;
Ssdt = generate_cst_ssdt(FadtPointer, ApicCPUNum); Ssdt = generate_cst_ssdt(FadtPointer, ApicCPUNum);
if (Ssdt) { if (Ssdt) {
@ -2323,11 +2323,11 @@ EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched,
EFI_PHYSICAL_ADDRESS Dsdt; EFI_PHYSICAL_ADDRESS Dsdt;
// load if exists // 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)) { if (!EFI_ERROR(Status)) {
// loaded - allocate EfiACPIReclaim // 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; Dsdt = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
Status = gBS->AllocatePages ( Status = gBS->AllocatePages (
AllocateMaxAddress, 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); DropTableFromRSDT(EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0, 0);
} }
*/ */
if (gSettings.ACPIDropTables) { if (GlobalConfig.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable; ACPI_DROP_TABLE *DropTable;
DbgHeader("ACPIDropTables"); 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 // only for tables that have OtherOS true
if (DropTable->OtherOS && DropTable->MenuItem.BValue) { 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); //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);

View File

@ -535,8 +535,8 @@ SetupDataForOSX(BOOLEAN Hibernate)
LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Mobile, 1); LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Mobile, 1);
// all current settings // all current settings
XBuffer<UINT8> xb = gSettings.serialize(); // XBuffer<UINT8> xb = gSettings.serialize();
LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size()); // LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size());
}else{ }else{
MsgLog("DataHub protocol not located. Smbios not send to datahub\n"); MsgLog("DataHub protocol not located. Smbios not send to datahub\n");
} }

View File

@ -1885,7 +1885,7 @@ UINT32 FIXDarwin (UINT8* dsdt, UINT32 len)
CONST UINT32 adr = 0x24; CONST UINT32 adr = 0x24;
DBG("Start Darwin Fix\n"); DBG("Start Darwin Fix\n");
ReplaceName(dsdt, len, "_OSI", "OOSI"); ReplaceName(dsdt, len, "_OSI", "OOSI");
if (gSettings.FixDsdt & FIX_DARWIN) { if (gSettings.ACPI.DSDT.FixDsdt & FIX_DARWIN) {
darwin[42] = '9'; //windows 2009 darwin[42] = '9'; //windows 2009
} }
len = move_data(adr, dsdt, len, sizeof(darwin)); len = move_data(adr, dsdt, len, sizeof(darwin));
@ -1956,8 +1956,8 @@ UINT32 AddPNLF (UINT8 *dsdt, UINT32 len)
} }
//Slice - add custom UID //Slice - add custom UID
if (gSettings.PNLF_UID != 0xFF) { if (gSettings.ACPI.DSDT.PNLF_UID != 0xFF) {
((CHAR8*)pnlf)[39] = gSettings.PNLF_UID; ((CHAR8*)pnlf)[39] = gSettings.ACPI.DSDT.PNLF_UID;
} }
// _UID reworked by Sherlocks. 2018.10.08 // _UID reworked by Sherlocks. 2018.10.08
@ -2120,7 +2120,7 @@ UINT32 FixRTC (UINT8 *dsdt, UINT32 len)
for (i=adr+4; i<adr+rtcsize; i++) { for (i=adr+4; i<adr+rtcsize; i++) {
// IO (Decode16, ((0x0070, 0x0070)) =>> find this // IO (Decode16, ((0x0070, 0x0070)) =>> find this
if (dsdt[i] == 0x70 && dsdt[i+1] == 0x00 && dsdt[i+2] == 0x70 && dsdt[i+3] == 0x00) { 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"); MsgLog("CMOS reset not will be, patch length is not needed\n");
} else { } else {
// First Fix RTC CMOS Reset Problem // First Fix RTC CMOS Reset Problem
@ -2503,7 +2503,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard)
BOOLEAN DISPLAYFIX = FALSE; BOOLEAN DISPLAYFIX = FALSE;
BOOLEAN NonUsable = FALSE; BOOLEAN NonUsable = FALSE;
BOOLEAN DsmFound = FALSE; BOOLEAN DsmFound = FALSE;
BOOLEAN NeedHDMI = !!(gSettings.FixDsdt & FIX_HDMI); BOOLEAN NeedHDMI = !!(gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI);
AML_CHUNK *root = NULL; AML_CHUNK *root = NULL;
AML_CHUNK *gfx0, *peg0; AML_CHUNK *gfx0, *peg0;
AML_CHUNK *met, *met2; AML_CHUNK *met, *met2;
@ -2564,7 +2564,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard)
} }
devsize1 = get_size(dsdt, devadr1); //13 devsize1 = get_size(dsdt, devadr1); //13
if (devsize1) { if (devsize1) {
if (gSettings.ReuseFFFF) { if (gSettings.ACPI.DSDT.ReuseFFFF) {
dsdt[j+10] = 0; dsdt[j+10] = 0;
dsdt[j+11] = 0; dsdt[j+11] = 0;
MsgLog("Found internal video device FFFF@%X, ReUse as 0\n", devadr1); 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; return len;
} }
if (gSettings.SuspendOverride) { if (gSettings.ACPI.DSDT.SuspendOverride) {
shutdown = &shutdown1[0]; shutdown = &shutdown1[0];
sizeoffset = sizeof(shutdown1); sizeoffset = sizeof(shutdown1);
} else { } else {
@ -5248,7 +5248,7 @@ void RenameDevices(UINT8* table)
CHAR8 *Replace; CHAR8 *Replace;
CHAR8 *Find; 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 i;
INTN k=0; // Clang complain about possible use uninitialised. Not true, but I don't like warnings. 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; UINTN len = ((EFI_ACPI_DESCRIPTION_HEADER*)table)->Length;
INTN adr, shift, Num = 0; INTN adr, shift, Num = 0;
BOOLEAN found; BOOLEAN found;
for (index = 0; index < gSettings.DeviceRenameCount; index++) { for (index = 0; index < gSettings.ACPI.DeviceRename.size(); index++) {
List = gSettings.DeviceRename[index].Next; List = gSettings.ACPI.DeviceRename[index].Next;
Replace = gSettings.DeviceRename[index].Name; Replace = gSettings.ACPI.DeviceRename[index].Name;
Find = List->Name; Find = List->Name;
Bridge = List->Next; Bridge = List->Next;
MsgLog("Name: %s, Bridge: %s, Replace: %s\n", Find, Bridge->Name, Replace); MsgLog("Name: %s, Bridge: %s, Replace: %s\n", Find, Bridge->Name, Replace);
@ -5327,7 +5327,7 @@ void RenameDevices(UINT8* table)
} //while find outer bridge } //while find outer bridge
adr += 5; adr += 5;
} while (1); //next occurence } while (1); //next occurence
} //DeviceRenameCount } //DeviceRename.size()
MsgLog(" %lld replacements\n", Num); MsgLog(" %lld replacements\n", Num);
} }
@ -5359,26 +5359,26 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c
CheckHardware(); CheckHardware();
//arbitrary fixes //arbitrary fixes
if (gSettings.DSDTPatchArray.size() > 0) { if (gSettings.ACPI.DSDT.DSDTPatchArray.size() > 0) {
MsgLog("Patching DSDT:\n"); MsgLog("Patching DSDT:\n");
for (i = 0; i < gSettings.DSDTPatchArray.size(); i++) { for (i = 0; i < gSettings.ACPI.DSDT.DSDTPatchArray.size(); i++) {
if ( gSettings.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) { if ( gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind.isEmpty() ) {
continue; continue;
} }
MsgLog(" - [%s]:", gSettings.DSDTPatchArray[i].PatchDsdtLabel.c_str()); //yyyy MsgLog(" - [%s]:", gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtLabel.c_str()); //yyyy
if (gSettings.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) { if (gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtMenuItem.BValue) {
if (gSettings.DSDTPatchArray[i].PatchDsdtTgt.isEmpty()) { if (gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt.isEmpty()) {
DsdtLen = FixAny(temp, DsdtLen, DsdtLen = FixAny(temp, DsdtLen,
gSettings.DSDTPatchArray[i].PatchDsdtFind, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind,
gSettings.DSDTPatchArray[i].PatchDsdtReplace); gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace);
}else{ }else{
// DBG("Patching: renaming in bridge\n"); // DBG("Patching: renaming in bridge\n");
DsdtLen = FixRenameByBridge2(temp, DsdtLen, DsdtLen = FixRenameByBridge2(temp, DsdtLen,
gSettings.DSDTPatchArray[i].PatchDsdtTgt, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtTgt,
gSettings.DSDTPatchArray[i].PatchDsdtFind, gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtFind,
gSettings.DSDTPatchArray[i].PatchDsdtReplace); gSettings.ACPI.DSDT.DSDTPatchArray[i].PatchDsdtReplace);
} }
} else { } else {
@ -5394,7 +5394,7 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c
findCPU(temp, DsdtLen); findCPU(temp, DsdtLen);
// add Method (DTGP, 5, NotSerialized) // add Method (DTGP, 5, NotSerialized)
if ((gSettings.FixDsdt & FIX_DTGP)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_DTGP)) {
if (!FindMethod(temp, DsdtLen, "DTGP")) { if (!FindMethod(temp, DsdtLen, "DTGP")) {
CopyMem((CHAR8 *)temp+DsdtLen, dtgp, sizeof(dtgp)); CopyMem((CHAR8 *)temp+DsdtLen, dtgp, sizeof(dtgp));
DsdtLen += 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); findPciRoot(temp, DsdtLen);
// Fix RTC // Fix RTC
if ((gSettings.FixDsdt & FIX_RTC)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_RTC)) {
// DBG("patch RTC in DSDT \n"); // DBG("patch RTC in DSDT \n");
DsdtLen = FixRTC(temp, DsdtLen); DsdtLen = FixRTC(temp, DsdtLen);
} }
// Fix TMR // Fix TMR
if ((gSettings.FixDsdt & FIX_TMR)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_TMR)) {
// DBG("patch TMR in DSDT \n"); // DBG("patch TMR in DSDT \n");
DsdtLen = FixTMR(temp, DsdtLen); DsdtLen = FixTMR(temp, DsdtLen);
} }
// Fix PIC or IPIC // Fix PIC or IPIC
if ((gSettings.FixDsdt & FIX_IPIC) != 0) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_IPIC) != 0) {
// DBG("patch IPIC in DSDT \n"); // DBG("patch IPIC in DSDT \n");
DsdtLen = FixPIC(temp, DsdtLen); DsdtLen = FixPIC(temp, DsdtLen);
} }
// Fix HPET // Fix HPET
if ((gSettings.FixDsdt & FIX_HPET) != 0) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_HPET) != 0) {
// DBG("patch HPET in DSDT \n"); // DBG("patch HPET in DSDT \n");
DsdtLen = FixHPET(temp, DsdtLen); DsdtLen = FixHPET(temp, DsdtLen);
} }
// Fix LPC if don't had HPET don't need to inject LPC?? // 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"); // DBG("patch LPC in DSDT \n");
DsdtLen = FIXLPCB(temp, DsdtLen); DsdtLen = FIXLPCB(temp, DsdtLen);
} }
// Fix Display // 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; INT32 j;
for (j=0; j<4; ++j) { for (j=0; j<4; ++j) {
if (DisplayADR1[j]) { if (DisplayADR1[j]) {
if (((DisplayVendor[j] != 0x8086) && (gSettings.FixDsdt & FIX_DISPLAY)) || if (((DisplayVendor[j] != 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_DISPLAY)) ||
((DisplayVendor[j] == 0x8086) && (gSettings.FixDsdt & FIX_INTELGFX))) { ((DisplayVendor[j] == 0x8086) && (gSettings.ACPI.DSDT.FixDsdt & FIX_INTELGFX))) {
DsdtLen = FIXDisplay(temp, DsdtLen, j); DsdtLen = FIXDisplay(temp, DsdtLen, j);
MsgLog("patch Display #%d of Vendor=0x%4X\n", j, DisplayVendor[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 // Fix Network
if ((gSettings.FixDsdt & FIX_LAN)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_LAN)) {
// DBG("patch LAN in DSDT \n"); // DBG("patch LAN in DSDT \n");
UINT32 j; UINT32 j;
for (j = 0; j <= net_count; ++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 // Fix Airport
if (ArptADR1 && (gSettings.FixDsdt & FIX_WIFI)) { if (ArptADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_WIFI)) {
// DBG("patch Airport in DSDT \n"); // DBG("patch Airport in DSDT \n");
DsdtLen = FIXAirport(temp, DsdtLen); DsdtLen = FIXAirport(temp, DsdtLen);
} }
// Fix SBUS // Fix SBUS
if (SBUSADR1 && (gSettings.FixDsdt & FIX_SBUS)) { if (SBUSADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_SBUS)) {
// DBG("patch SBUS in DSDT \n"); // DBG("patch SBUS in DSDT \n");
DsdtLen = FIXSBUS(temp, DsdtLen); DsdtLen = FIXSBUS(temp, DsdtLen);
} }
// Fix IDE inject // 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"); // DBG("patch IDE in DSDT \n");
DsdtLen = FIXIDE(temp, DsdtLen); DsdtLen = FIXIDE(temp, DsdtLen);
} }
// Fix SATA AHCI orange icon // 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"); DBG("patch AHCI in DSDT \n");
DsdtLen = FIXSATAAHCI(temp, DsdtLen); DsdtLen = FIXSATAAHCI(temp, DsdtLen);
} }
// Fix SATA inject // 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"); DBG("patch SATA in DSDT \n");
DsdtLen = FIXSATA(temp, DsdtLen); DsdtLen = FIXSATA(temp, DsdtLen);
} }
// Fix Firewire // Fix Firewire
if (FirewireADR1 && (gSettings.FixDsdt & FIX_FIREWIRE)) { if (FirewireADR1 && (gSettings.ACPI.DSDT.FixDsdt & FIX_FIREWIRE)) {
DBG("patch FRWR in DSDT \n"); DBG("patch FRWR in DSDT \n");
DsdtLen = FIXFirewire(temp, DsdtLen); DsdtLen = FIXFirewire(temp, DsdtLen);
} }
// HDA HDEF // HDA HDEF
if (HDAFIX && (gSettings.FixDsdt & FIX_HDA)) { if (HDAFIX && (gSettings.ACPI.DSDT.FixDsdt & FIX_HDA)) {
DBG("patch HDEF in DSDT \n"); DBG("patch HDEF in DSDT \n");
DsdtLen = AddHDEF(temp, DsdtLen, OSVersion); DsdtLen = AddHDEF(temp, DsdtLen, OSVersion);
} }
//Always add MCHC for PM //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"); // DBG("patch MCHC in DSDT \n");
DsdtLen = AddMCHC(temp, DsdtLen); DsdtLen = AddMCHC(temp, DsdtLen);
} }
//add IMEI //add IMEI
if ((gSettings.FixDsdt & FIX_IMEI)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_IMEI)) {
DsdtLen = AddIMEI(temp, DsdtLen); DsdtLen = AddIMEI(temp, DsdtLen);
} }
//Add HDMI device //Add HDMI device
if ((gSettings.FixDsdt & FIX_HDMI)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI)) {
DsdtLen = AddHDMI(temp, DsdtLen); DsdtLen = AddHDMI(temp, DsdtLen);
} }
// Always Fix USB // Always Fix USB
if ((gSettings.FixDsdt & FIX_USB)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_USB)) {
DsdtLen = FIXUSB(temp, DsdtLen); DsdtLen = FIXUSB(temp, DsdtLen);
} }
if ((gSettings.FixDsdt & FIX_WAK)){ if ((gSettings.ACPI.DSDT.FixDsdt & FIX_WAK)){
// Always Fix _WAK Return value // Always Fix _WAK Return value
DsdtLen = FIXWAK(temp, DsdtLen, fadt); 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 // USB Device remove error Fix
// DsdtLen = FIXGPE(temp, DsdtLen); // 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 //I want these fixes even if no Display fix. We have GraphicsInjector
DsdtLen = DeleteDevice("CRT_"_XS8, temp, DsdtLen); DsdtLen = DeleteDevice("CRT_"_XS8, temp, DsdtLen);
DsdtLen = DeleteDevice("DVI_"_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); 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, "ACST", "OCST");
ReplaceName(temp, DsdtLen, "ACSS", "OCSS"); ReplaceName(temp, DsdtLen, "ACSS", "OCSS");
ReplaceName(temp, DsdtLen, "APSS", "OPSS"); 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"); ReplaceName(temp, DsdtLen, "APLF", "OPLF");
} }
if ((gSettings.FixDsdt & FIX_PNLF)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_PNLF)) {
DsdtLen = AddPNLF(temp, DsdtLen); DsdtLen = AddPNLF(temp, DsdtLen);
} }
if ((gSettings.FixDsdt & FIX_S3D)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_S3D)) {
FixS3D(temp, DsdtLen); FixS3D(temp, DsdtLen);
} }
//Fix OperationRegions //Fix OperationRegions
if ((gSettings.FixDsdt & FIX_REGIONS)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_REGIONS)) {
FixRegions(temp, DsdtLen); FixRegions(temp, DsdtLen);
} }
//RehabMan: Fix Mutex objects //RehabMan: Fix Mutex objects
if ((gSettings.FixDsdt & FIX_MUTEX)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_MUTEX)) {
FixMutex(temp, DsdtLen); FixMutex(temp, DsdtLen);
} }
// pwrb add _CID sleep button fix // pwrb add _CID sleep button fix
if ((gSettings.FixDsdt & FIX_ADP1)) { if ((gSettings.ACPI.DSDT.FixDsdt & FIX_ADP1)) {
DsdtLen = FixADP1(temp, DsdtLen); DsdtLen = FixADP1(temp, DsdtLen);
} }
// other compiler warning fix _T_X, MUTE .... USB _PRW value form 0x04 => 0x01 // other compiler warning fix _T_X, MUTE .... USB _PRW value form 0x04 => 0x01
// DsdtLen = FIXOTHER(temp, DsdtLen); // 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") && if (!FindMethod(temp, DsdtLen, "GET9") &&
!FindMethod(temp, DsdtLen, "STR9") && !FindMethod(temp, DsdtLen, "STR9") &&
!FindMethod(temp, DsdtLen, "OOSI")) { !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 // 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 DsdtLen = FIXSHUTDOWN_ASUS(temp, DsdtLen); //safe to do twice
} }

File diff suppressed because it is too large Load Diff

View File

@ -239,17 +239,15 @@ public:
class DSDT_Patch class DSDT_Patch
{ {
public : public :
XBuffer<UINT8> PatchDsdtFind; XBuffer<UINT8> PatchDsdtFind = XBuffer<UINT8>();
XBuffer<UINT8> PatchDsdtReplace; XBuffer<UINT8> PatchDsdtReplace = XBuffer<UINT8>();
XString8 PatchDsdtLabel; XString8 PatchDsdtLabel = XString8();
XBuffer<UINT8> PatchDsdtTgt; XBuffer<UINT8> PatchDsdtTgt = XBuffer<UINT8>();
INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM(); INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM();
DSDT_Patch() : PatchDsdtFind(), PatchDsdtReplace(), PatchDsdtLabel(), PatchDsdtTgt() { } 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
// Not sure if default are valid. Delete them. If needed, proper ones can be created DSDT_Patch& operator = ( const DSDT_Patch & ) = default; // default is fine if there is only native type and objects that have copy ctor
DSDT_Patch(const DSDT_Patch&) = delete;
DSDT_Patch& operator=(const DSDT_Patch&) = delete;
}; };
class MMIOWhiteList class MMIOWhiteList
@ -290,20 +288,86 @@ public:
UINT8 SecureBootSetupMode = 0; UINT8 SecureBootSetupMode = 0;
UINT8 SecureBootPolicy = 0; UINT8 SecureBootPolicy = 0;
// Secure boot white/black list // Secure boot white/black list
UINT32 SecureBootWhiteListCount = 0; XStringWArray SecureBootWhiteList = XStringWArray();
UINT32 SecureBootBlackListCount = 0; XStringWArray SecureBootBlackList = XStringWArray();
CHAR16 **SecureBootWhiteList = 0;
CHAR16 **SecureBootBlackList = 0;
INT8 XMPDetection = 0; INT8 XMPDetection = 0;
// LegacyBoot // LegacyBoot
XStringW LegacyBoot = XStringW(); XStringW LegacyBoot = XStringW();
UINT16 LegacyBiosDefaultEntry = 0; UINT16 LegacyBiosDefaultEntry = 0;
UINT8 CustomBoot = 0; UINT8 CustomBoot = 0;
XImage *CustomLogo = 0; XImage *CustomLogo = 0;
} Boot = BootClass(); } Boot = BootClass();
class ACPIClass
{
public:
class ACPIDropTablesClass
{
public:
UINT32 Signature = 0;
UINT64 TableId = 0;
UINT32 TabLength = 0;
bool OtherOS = 0;
};
XObjArray<ACPIDropTablesClass> ACPIDropTablesArray = XObjArray<ACPIDropTablesClass>();
class DSDTClass
{
public:
XStringW DsdtName = XStringW();
BOOLEAN DebugDSDT = 0;
BOOLEAN Rtc8Allowed = 0;
UINT8 PNLF_UID = 0;
UINT32 FixDsdt = 0;
XObjArray<DSDT_Patch> DSDTPatchArray = XObjArray<DSDT_Patch>();
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<ACPI_NAME_LIST> DeviceRename = XObjArray<ACPI_NAME_LIST>();
} ACPI = ACPIClass();
class GUIClass { class GUIClass {
public: public:
INT32 Timezone = 0xFF; INT32 Timezone = 0xFF;
@ -411,51 +475,16 @@ public:
UINT32 DefaultBackgroundColor; UINT32 DefaultBackgroundColor;
//ACPI //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]; UINT8 pad23[1];
UINT16 C3Latency;
BOOLEAN smartUPS;
BOOLEAN PatchNMI;
BOOLEAN EnableC7;
UINT8 SavingMode; UINT8 SavingMode;
XStringW DsdtName;
UINT32 FixDsdt;
UINT8 MinMultiplier;
UINT8 MaxMultiplier;
UINT8 PluginType;
// BOOLEAN DropMCFG; // BOOLEAN DropMCFG;
BOOLEAN FixMCFG;
UINT32 DeviceRenameCount;
ACPI_NAME_LIST *DeviceRename;
//Injections //Injections
BOOLEAN StringInjector; BOOLEAN StringInjector;
UINT8 InjectSystemID_; // 0=false, 1=true, other value = default. UINT8 InjectSystemID_; // 0=false, 1=true, other value = default.
BOOLEAN NoDefaultProperties; BOOLEAN NoDefaultProperties;
BOOLEAN ReuseFFFF;
//PCI devices //PCI devices
UINT32 FakeATI; //97 UINT32 FakeATI; //97
@ -578,7 +607,6 @@ public:
UINT8 REV[6]; UINT8 REV[6];
//other devices //other devices
BOOLEAN Rtc8Allowed;
BOOLEAN ForceHPET; BOOLEAN ForceHPET;
BOOLEAN ResetHDA; BOOLEAN ResetHDA;
BOOLEAN PlayAsync; BOOLEAN PlayAsync;
@ -586,7 +614,6 @@ public:
UINT32 DisableFunctions; UINT32 DisableFunctions;
//Patch DSDT arbitrary //Patch DSDT arbitrary
XObjArray<DSDT_Patch> DSDTPatchArray;
// UINT32 PatchDsdtNum; // UINT32 PatchDsdtNum;
// UINT8 **PatchDsdtFind; // UINT8 **PatchDsdtFind;
// UINT32 *LenToFind; // UINT32 *LenToFind;
@ -596,17 +623,14 @@ public:
// CHAR8 **PatchDsdtTgt; // CHAR8 **PatchDsdtTgt;
// INPUT_ITEM *PatchDsdtMenuItem; // INPUT_ITEM *PatchDsdtMenuItem;
BOOLEAN DebugDSDT;
BOOLEAN SlpWak; BOOLEAN SlpWak;
BOOLEAN UseIntelHDMI; BOOLEAN UseIntelHDMI;
UINT8 AFGLowPowerState; UINT8 AFGLowPowerState;
UINT8 PNLF_UID;
// UINT8 pad83[4]; // UINT8 pad83[4];
// Table dropping // Table dropping
UINT8 pad34[3]; UINT8 pad34[3];
ACPI_DROP_TABLE *ACPIDropTables;
// Custom entries // Custom entries
BOOLEAN DisableEntryScan; BOOLEAN DisableEntryScan;
@ -631,13 +655,9 @@ public:
// INPUT_ITEM *InjectKextMenuItem; // INPUT_ITEM *InjectKextMenuItem;
//ACPI tables //ACPI tables
UINTN SortedACPICount;
CHAR16 **SortedACPI;
// ACPI/PATCHED/AML // ACPI/PATCHED/AML
UINT32 DisabledAMLCount;
UINT8 pad36[4]; UINT8 pad36[4];
CHAR16 **DisabledAML;
//other //other
UINT32 IntelMaxValue; UINT32 IntelMaxValue;
@ -670,11 +690,7 @@ public:
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0), MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0),
UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(), UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(),
IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0), 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), WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), SavingMode(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(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),
FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(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), 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), 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), HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(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), 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), 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),
ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), DSDTPatchArray(), DebugDSDT(0), SlpWak(0), UseIntelHDMI(0), AFGLowPowerState(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(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},
CustomLegacy(0), CustomTool(0), NrAddProperties(0), AddProperties(0), BlockKexts{0}, SortedACPICount(0), SortedACPI(0), DisabledAMLCount(0), DisabledAML(0),
IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{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) 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 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 const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed
XBuffer<UINT8> serialize() const; // XBuffer<UINT8> serialize() const;
~SETTINGS_DATA() {} ~SETTINGS_DATA() {}
@ -779,12 +794,12 @@ class SIDELOAD_KEXT
{ {
public: public:
XObjArray<SIDELOAD_KEXT> PlugInList; XObjArray<SIDELOAD_KEXT> PlugInList;
XStringW FileName; XStringW FileName = XStringW();
XStringW KextDirNameUnderOEMPath; XStringW KextDirNameUnderOEMPath = XStringW();
XStringW Version; XStringW Version = XStringW();
INPUT_ITEM MenuItem = INPUT_ITEM(); 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 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 const SIDELOAD_KEXT& operator = ( const SIDELOAD_KEXT & ) = delete; // Can be defined if needed
~SIDELOAD_KEXT() { } ~SIDELOAD_KEXT() { }
@ -909,6 +924,7 @@ public:
BOOLEAN gBootChanged = FALSE; BOOLEAN gBootChanged = FALSE;
BOOLEAN gThemeChanged = FALSE; BOOLEAN gThemeChanged = FALSE;
BOOLEAN NeedPMfix = FALSE; BOOLEAN NeedPMfix = FALSE;
ACPI_DROP_TABLE *ACPIDropTables = NULL;

View File

@ -136,7 +136,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
} }
} }
} else { } else {
gSettings.GenerateAPLF = FALSE; gSettings.ACPI.SSDT.Generate.GenerateAPLF = FALSE;
} }
if (Number > 0) { if (Number > 0) {
@ -170,8 +170,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
maximum.Control.VID_FID.FID++; maximum.Control.VID_FID.FID++;
MsgLog("Turbo FID=0x%hhX\n", maximum.Control.VID_FID.FID); MsgLog("Turbo FID=0x%hhX\n", maximum.Control.VID_FID.FID);
} }
MsgLog("UnderVoltStep=%d\n", gSettings.UnderVoltStep); MsgLog("UnderVoltStep=%d\n", gSettings.ACPI.SSDT.UnderVoltStep);
MsgLog("PLimitDict=%d\n", gSettings.PLimitDict); MsgLog("PLimitDict=%d\n", gSettings.ACPI.SSDT.PLimitDict);
maximum.CID = ((maximum.Control.VID_FID.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio; 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); 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; p_states[i].Control.VID_FID.VID = ((maximum.Control.VID_FID.VID << 2) - (vidstep * u)) >> 2;
if (u < p_states_count - 1) { 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 // 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: case CPU_MODEL_TIGERLAKE_D:
{ {
maximum.Control.Control = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 8) & 0xff; 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", DBG("Using custom MaxMultiplier %d instead of automatic %d\n",
gSettings.MaxMultiplier, maximum.Control.Control); gSettings.ACPI.SSDT.MaxMultiplier, maximum.Control.Control);
maximum.Control.Control = gSettings.MaxMultiplier; maximum.Control.Control = gSettings.ACPI.SSDT.MaxMultiplier;
} }
realMax = maximum.Control.Control; realMax = maximum.Control.Control;
@ -292,8 +292,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
} }
Apsn = (realTurbo > realMax)?(realTurbo - realMax):0; Apsn = (realTurbo > realMax)?(realTurbo - realMax):0;
realMin = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 40) & 0xff; realMin = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 40) & 0xff;
if (gSettings.MinMultiplier) { if (gSettings.ACPI.SSDT.MinMultiplier) {
minimum.Control.Control = gSettings.MinMultiplier; minimum.Control.Control = gSettings.ACPI.SSDT.MinMultiplier;
Aplf = (realMin > minimum.Control.Control)?(realMin - minimum.Control.Control):0; Aplf = (realMin > minimum.Control.Control)?(realMin - minimum.Control.Control):0;
} else { } else {
minimum.Control.Control = realMin; 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].Control.Control = (UINT16)j;
p_states[p_states_count].CID = (UINT32)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 //double first state
p_states_count++; p_states_count++;
p_states[p_states_count].Control.Control = (UINT16)j; 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); 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_"); method = aml_add_name(scop, "PSS_");
pack = aml_add_package(method); pack = aml_add_package(method);
@ -403,7 +403,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
TDPdiv = 8; 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_CHUNK* pstt = aml_add_package(pack);
aml_add_dword(pstt, p_states[i].Frequency); 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_"); //aml_add_return_name(metPSS, "PSS_");
//metPPC = aml_add_method(scop, "_PPC", 0); //metPPC = aml_add_method(scop, "_PPC", 0);
aml_add_name(scop, "_PPC"); aml_add_name(scop, "_PPC");
aml_add_byte(scop, (UINT8)gSettings.PLimitDict); aml_add_byte(scop, (UINT8)gSettings.ACPI.SSDT.PLimitDict);
//aml_add_return_byte(metPPC, gSettings.PLimitDict); //aml_add_return_byte(metPPC, gSettings.ACPI.SSDT.PLimitDict);
namePCT = aml_add_name(scop, "PCT_"); namePCT = aml_add_name(scop, "PCT_");
packPCT = aml_add_package(namePCT); packPCT = aml_add_package(namePCT);
resource_template_register_fixedhw[8] = 0x00; 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)); aml_add_buffer(packPCT, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
metPCT = aml_add_method(scop, "_PCT", 0); metPCT = aml_add_method(scop, "_PCT", 0);
aml_add_return_name(metPCT, "PCT_"); 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_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 (gCPUStructure.Family >= 2) {
if (gSettings.GenerateAPSN) { if (gSettings.ACPI.SSDT.Generate.GenerateAPSN) {
//APSN: High Frequency Modes (turbo) //APSN: High Frequency Modes (turbo)
aml_add_name(scop, "APSN"); aml_add_name(scop, "APSN");
aml_add_byte(scop, (UINT8)Apsn); aml_add_byte(scop, (UINT8)Apsn);
} }
if (gSettings.GenerateAPLF) { if (gSettings.ACPI.SSDT.Generate.GenerateAPLF) {
//APLF: Low Frequency Mode //APLF: Low Frequency Mode
aml_add_name(scop, "APLF"); aml_add_name(scop, "APLF");
aml_add_byte(scop, (UINT8)Aplf); aml_add_byte(scop, (UINT8)Aplf);
@ -461,13 +461,13 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
//aml_add_return_name(metPSS, name1); //aml_add_return_name(metPSS, name1);
metPPC = aml_add_method(scop, "_PPC", 0); metPPC = aml_add_method(scop, "_PPC", 0);
aml_add_return_name(metPPC, name3); 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); metPCT = aml_add_method(scop, "_PCT", 0);
aml_add_return_name(metPCT, name2); 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_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); aml_calculate_size(root);
@ -481,8 +481,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
aml_destroy_node(root); aml_destroy_node(root);
if (gSettings.GeneratePStates && !gSettings.HWP) { if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) {
if (gSettings.PluginType && gSettings.GeneratePluginType) { if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
MsgLog ("SSDT with CPU P-States and plugin-type generated successfully\n"); MsgLog ("SSDT with CPU P-States and plugin-type generated successfully\n");
} else { } else {
MsgLog ("SSDT with CPU P-States generated successfully\n"); 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) 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 c3_enabled;
BOOLEAN c4_enabled = gSettings.EnableC4; BOOLEAN c4_enabled = gSettings.ACPI.SSDT.EnableC4;
// BOOLEAN c6_enabled = gSettings.EnableC6; // BOOLEAN c6_enabled = gSettings.ACPI.SSDT.EnableC6;
BOOLEAN cst_using_systemio = gSettings.EnableISS; BOOLEAN cst_using_systemio = gSettings.ACPI.SSDT.EnableISS;
UINT8 p_blk_lo, p_blk_hi; UINT8 p_blk_lo, p_blk_hi;
UINT8 cstates_count; UINT8 cstates_count;
UINT32 acpi_cpu_p_blk; 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); c2_enabled = c2_enabled || (fadt->PLvl2Lat < 100);
c3_enabled = (fadt->PLvl3Lat < 1000); c3_enabled = (fadt->PLvl3Lat < 1000);
cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled)? 1 : 0) 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); root = aml_create_node(NULL);
aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header 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 resource_template_register_systemio[12] = p_blk_hi; // C3
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x03); // C3 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 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_lo = (UINT8)(acpi_cpu_p_blk + 5);
p_blk_hi = (UINT8)((acpi_cpu_p_blk + 5) >> 8); 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 resource_template_register_systemio[12] = p_blk_hi; // C6
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x06); // C6 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 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_lo = (acpi_cpu_p_blk + 6) & 0xff;
p_blk_hi = (UINT8)((acpi_cpu_p_blk + 6) >> 8); 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 resource_template_register_fixedhw[11] = 0x20; // C3
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x03); // C3 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 aml_add_dword(tmpl, 0x000001F4); // Power
} }
if (gSettings.EnableC6) { // C6 if (gSettings.ACPI.SSDT.EnableC6) { // C6
tmpl = aml_add_package(pack); tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x20; // C6 resource_template_register_fixedhw[11] = 0x20; // C6
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x06); // C6 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 aml_add_dword(tmpl, 0x0000015E); // Power
} }
if (gSettings.EnableC7) { if (gSettings.ACPI.SSDT.EnableC7) {
tmpl = aml_add_package(pack); tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x30; // C4 or C7 resource_template_register_fixedhw[11] = 0x30; // C4 or C7
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));

View File

@ -1417,7 +1417,7 @@ void GetDefaultSettings()
gSettings.HDAInjection = FALSE; gSettings.HDAInjection = FALSE;
//gSettings.HDALayoutId = 0; //gSettings.HDALayoutId = 0;
gSettings.USBInjection = TRUE; // enabled by default to have the same behavior as before 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.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52
gSettings.BacklightLevelConfig = FALSE; gSettings.BacklightLevelConfig = FALSE;
gSettings.TrustSMBIOS = TRUE; gSettings.TrustSMBIOS = TRUE;
@ -1450,23 +1450,23 @@ void GetDefaultCpuSettings()
SetDMISettingsForModel(Model, TRUE); SetDMISettingsForModel(Model, TRUE);
if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) { if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) {
gSettings.GeneratePStates = TRUE; gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE;
gSettings.GenerateCStates = TRUE; gSettings.ACPI.SSDT.Generate.GenerateCStates = TRUE;
// backward compatibility, APFS, APLF, PluginType follow PStates // backward compatibility, APFS, APLF, PluginType follow PStates
gSettings.GenerateAPSN = gSettings.GeneratePStates; gSettings.ACPI.SSDT.Generate.GenerateAPSN = gSettings.ACPI.SSDT.Generate.GeneratePStates;
gSettings.GenerateAPLF = gSettings.GeneratePStates; gSettings.ACPI.SSDT.Generate.GenerateAPLF = gSettings.ACPI.SSDT.Generate.GeneratePStates;
gSettings.GeneratePluginType = gSettings.GeneratePStates; gSettings.ACPI.SSDT.Generate.GeneratePluginType = gSettings.ACPI.SSDT.Generate.GeneratePStates;
// gSettings.EnableISS = FALSE; // gSettings.ACPI.SSDT.EnableISS = FALSE;
// gSettings.EnableC2 = TRUE; // gSettings.ACPI.SSDT.EnableC2 = TRUE;
gSettings.EnableC6 = TRUE; gSettings.ACPI.SSDT.EnableC6 = TRUE;
gSettings.PluginType = 1; gSettings.ACPI.SSDT.PluginType = 1;
if (gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE) { if (gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE) {
gSettings.MinMultiplier = 7; gSettings.ACPI.SSDT.MinMultiplier = 7;
} }
// gSettings.DoubleFirstState = FALSE; // gSettings.ACPI.SSDT.DoubleFirstState = FALSE;
//gSettings.DropSSDT = TRUE; //why drop all??? //gSettings.ACPI.SSDT.DropSSDT = TRUE; //why drop all???
gSettings.C3Latency = 0x00FA; gSettings.ACPI.SSDT.C3Latency = 0x00FA;
} }
gSettings.Turbo = gCPUStructure.Turbo; gSettings.Turbo = gCPUStructure.Turbo;
gSettings.SavingMode = 0xFF; //means not set gSettings.SavingMode = 0xFF; //means not set

View File

@ -58,7 +58,7 @@ bool all_tests()
// } // }
#endif #endif
#if defined(JIEF_DEBUG) #if defined(JIEF_DEBUGxxx)
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD) #if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
ret = printlib_tests(); ret = printlib_tests();

View File

@ -876,7 +876,7 @@ static const char* config_test =
<!DOCTYPE plist PUBLIC\"-//Apple//DTD PLIST 1.0//EN\"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\r\n\ <!DOCTYPE plist PUBLIC\"-//Apple//DTD PLIST 1.0//EN\"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\r\n\
<plist version=\"1.0\">\r\n\ <plist version=\"1.0\">\r\n\
<dict>\r\n\ <dict>\r\n\
<key>ACPI</key>\r\n\ <key>ACPIx</key>\r\n\
<dict>\r\n\ <dict>\r\n\
<key>AutoMerge</key>\r\n\ <key>AutoMerge</key>\r\n\
<integer>0</integer>\r\n\ <integer>0</integer>\r\n\

View File

@ -39,7 +39,7 @@ int getNextTag_tests()
bool b; bool b;
gXmlLiteParser.init("<key>"); gXmlLiteParser.init("<key>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(1); if ( !b ) return breakpoint(1);
if ( !isOpeningTag ) return breakpoint(2); if ( !isOpeningTag ) return breakpoint(2);
if ( isClosingTag ) return breakpoint(3); if ( isClosingTag ) return breakpoint(3);
@ -47,7 +47,7 @@ int getNextTag_tests()
gXmlLiteParser.init("</key>"); gXmlLiteParser.init("</key>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(5); if ( !b ) return breakpoint(5);
if ( isOpeningTag ) return breakpoint(6); if ( isOpeningTag ) return breakpoint(6);
if ( !isClosingTag ) return breakpoint(7); if ( !isClosingTag ) return breakpoint(7);
@ -55,11 +55,11 @@ int getNextTag_tests()
gXmlLiteParser.init("<key/>"); gXmlLiteParser.init("<key/>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(10); if ( !b ) return breakpoint(10);
if ( !isOpeningTag ) return breakpoint(11); if ( !isOpeningTag ) return breakpoint(11);
if ( isClosingTag ) return breakpoint(12); 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 ( !b ) return breakpoint(13);
if ( isOpeningTag ) return breakpoint(14); if ( isOpeningTag ) return breakpoint(14);
if ( !isClosingTag ) return breakpoint(15); if ( !isClosingTag ) return breakpoint(15);
@ -69,35 +69,35 @@ int getNextTag_tests()
// //
gXmlLiteParser.init("foo1\n foo2"); gXmlLiteParser.init("foo1\n foo2");
gXmlLiteParser.moveForwardUntil(0); gXmlLiteParser.moveForwardUntil(0);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 7") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 7") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n bar1"); gXmlLiteParser.init("foo1\n bar1");
gXmlLiteParser.moveForwardUntil('b'); gXmlLiteParser.moveForwardUntil('b');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 3") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 3") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2/>"); gXmlLiteParser.init("foo1\n </foo2/>");
gXmlLiteParser.moveForwardUntil('<'); gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 9") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 9") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2"); gXmlLiteParser.init("foo1\n </foo2");
gXmlLiteParser.moveForwardUntil('<'); gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 11") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 11") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2 >"); gXmlLiteParser.init("foo1\n </foo2 >");
gXmlLiteParser.moveForwardUntil('<'); gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 13") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 13") ) return breakpoint(14);
@ -105,7 +105,7 @@ int getNextTag_tests()
gXmlLiteParser.init("foo1\n\n<foo2/"); gXmlLiteParser.init("foo1\n\n<foo2/");
gXmlLiteParser.moveForwardUntil('/'); gXmlLiteParser.moveForwardUntil('/');
gXmlLiteParser.moveForwardUntilSignificant(); gXmlLiteParser.moveForwardUntilSignificant();
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 7") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 7") ) return breakpoint(14);
@ -113,7 +113,7 @@ int getNextTag_tests()
gXmlLiteParser.init("foo1\n\n <foo2/a"); gXmlLiteParser.init("foo1\n\n <foo2/a");
gXmlLiteParser.moveForwardUntil('/'); gXmlLiteParser.moveForwardUntil('/');
gXmlLiteParser.moveForwardUntilSignificant(); gXmlLiteParser.moveForwardUntilSignificant();
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag); b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13); if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 9") ) return breakpoint(14); if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 9") ) return breakpoint(14);
@ -209,11 +209,13 @@ int getKey_tests()
gXmlLiteParser.init("<key></key><string>v</string>"); gXmlLiteParser.init("<key></key><string>v</string>");
b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); 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("<key> </key><string>v</string>"); gXmlLiteParser.init("<key> </key><string>v</string>");
b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); 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("<key>a</key><string>v</string>"); gXmlLiteParser.init("<key>a</key><string>v</string>");
b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true); b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true);
@ -368,6 +370,10 @@ int xml_integer_tests()
return 0; return 0;
} }
int validate_dict_tests()
{
bool b;
class Dict1_Class : public XmlDict class Dict1_Class : public XmlDict
{ {
public: public:
@ -387,14 +393,14 @@ public:
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 class Main1Dict_Class : public XmlDict
{ {
public: public:
Dict1_Class dict1 = Dict1_Class(); Dict1_Class dict1 = Dict1_Class();
virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override {
RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) );
xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); xmlLiteParser->addWarning(generateErrors, S8Printf("dict1 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine()));
return false; // parsing can continue. return false; // parsing can continue.
} }
@ -402,12 +408,12 @@ public:
{"dict1", dict1}, {"dict1", dict1},
}; };
public: Main1Dict_Class() {};
MainDict_Class() {};
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]); };
} mainDict; } mainDict;
static const char* config_test =
const char* config_test =
"<dict>\r\n\ "<dict>\r\n\
<key>dict1</key>\r\n\ <key>dict1</key>\r\n\
<dict>\r\n\ <dict>\r\n\
@ -417,26 +423,92 @@ static const char* config_test =
</dict>\r\n\ </dict>\r\n\
</plist>"; </plist>";
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<XmlBool> array = XmlArray<XmlBool>();
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 =
"<dict>\r\n\
<key>array1</key>\r\n\
<array>\r\n\
<true/>\r\n\
<true/>\r\n\
<string>a</string>\r\n\
</array>\r\n\
</dict>\r\n\
</plist>";
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 <true/> <false/>") ) 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() int xml_lite_tests()
{ {
int ret; int ret;
// XmlLiteParser xmlLiteParser; // 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(); ret = xml_integer_tests();
if ( ret ) return ret; if ( ret ) return ret;

View File

@ -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 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 // 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); 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); CreateInfoLines(Message, &AlertMessageMenu.InfoLines);
AlertMessageMenu.Title = Title; AlertMessageMenu.Title = Title;

View File

@ -31,11 +31,7 @@ StrToLower (
IN CHAR16 *Str IN CHAR16 *Str
); );
void void AlertMessage (IN const XStringW& Title, IN const XStringW& Message);
AlertMessage (
IN CONST CHAR16 *Title,
IN CONST CHAR16 *Message
);
BOOLEAN BOOLEAN
YesNoMessage ( YesNoMessage (

View File

@ -37,10 +37,17 @@
#ifdef ENABLE_SECURE_BOOT #ifdef ENABLE_SECURE_BOOT
#include <Platform.h>
#include "../Platform/Settings.h"
#include "../Platform/Self.h"
#include "entry_scan.h" #include "entry_scan.h"
#include "secureboot.h"
extern "C" {
#include <Protocol/Security.h> #include <Protocol/Security.h>
#include <Protocol/Security2.h> #include <Protocol/Security2.h>
#include <Library/DxeServicesLib.h>
}
#ifndef DEBUG_ALL #ifndef DEBUG_ALL
#define DEBUG_SECURE_BOOT 1 #define DEBUG_SECURE_BOOT 1
@ -63,7 +70,7 @@ void EnableSecureBoot(void)
UINTN CloverSignatureSize = 0; UINTN CloverSignatureSize = 0;
void *CloverSignature = NULL; void *CloverSignature = NULL;
// Check in setup mode // Check in setup mode
if (GlobalConfig.Boot.SecureBoot || !gSettings.Boot.SecureBootSetupMode) { if (gSettings.Boot.SecureBoot || !gSettings.Boot.SecureBootSetupMode) {
return; return;
} }
// Ask user if they want to use default keys // Ask user if they want to use default keys
@ -73,7 +80,7 @@ void EnableSecureBoot(void)
UINT32 AuthenticationStatus = 0; UINT32 AuthenticationStatus = 0;
UINTN FileSize = 0; UINTN FileSize = 0;
// Open the file buffer // Open the file buffer
void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getSelfFullPath(), &FileSize, &AuthenticationStatus); void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getCloverDirFullPath(), &FileSize, &AuthenticationStatus);
if (FileBuffer != NULL) { if (FileBuffer != NULL) {
if (FileSize > 0) { if (FileSize > 0) {
// Retrieve the certificates // Retrieve the certificates
@ -92,10 +99,9 @@ void EnableSecureBoot(void)
} }
// Check and alert about image not found // Check and alert about image not found
if ((FileBuffer == NULL) || (FileSize == 0)) { if ((FileBuffer == NULL) || (FileSize == 0)) {
CHAR16 *FilePath = FileDevicePathToStr(&self.getSelfFullPath()); XStringW FilePath = FileDevicePathToXStringW(&self.getCloverDirFullPath());
if (FilePath != NULL) { if (FilePath.notEmpty()) {
DBG("Failed to load Clover image from %ls\n", FilePath); DBG("Failed to load Clover image from %ls\n", FilePath.wc_str());
FreePool(FilePath);
} else { } else {
DBG("Failed to load Clover image\n"); DBG("Failed to load Clover image\n");
} }
@ -121,8 +127,8 @@ void EnableSecureBoot(void)
} }
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
XStringW Str = SWPrintf("Enabling secure boot failed because\n%ls", ErrorString); XStringW Str = SWPrintf("Enabling secure boot failed because\n%ls", ErrorString);
AlertMessage(L"Enable Secure Boot", Str); AlertMessage(L"Enable Secure Boot"_XSW, Str);
DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString.wc_str(), efiStrError(Status)); DBG("Enabling secure boot failed because %ls! Status: %s\n", ErrorString, efiStrError(Status));
DisableSecureBoot(); DisableSecureBoot();
} }
} }
@ -148,7 +154,7 @@ CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy)
STATIC void PrintSecureBootInfo(void) STATIC void PrintSecureBootInfo(void)
{ {
// Nothing to do if secure boot is disabled or in setup mode // 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")); DBG("Secure Boot: %s\n", (gSettings.Boot.SecureBootSetupMode ? "Setup" : "Disabled"));
} else { } else {
// Secure boot is enabled // Secure boot is enabled
@ -164,12 +170,12 @@ STATIC void DisableMessage(IN EFI_STATUS Status,
{ {
XStringW Str; XStringW Str;
if (ErrorString != NULL) { 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 { } 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()); DBG("Secure Boot: %ls", Str.wc_str());
AlertMessage(L"Disable Secure Boot", Str); AlertMessage(L"Disable Secure Boot"_XSW, Str);
} }
// Disable secure boot // Disable secure boot
@ -178,7 +184,7 @@ void DisableSecureBoot(void)
EFI_STATUS Status; EFI_STATUS Status;
CHAR16 *ErrorString = NULL; CHAR16 *ErrorString = NULL;
// Check in user mode // Check in user mode
if (gSettings.Boot.SecureBootSetupMode || !GlobalConfig.Boot.SecureBoot) { if (gSettings.Boot.SecureBootSetupMode || !gSettings.Boot.SecureBoot) {
return; return;
} }
UninstallSecureBoot(); UninstallSecureBoot();
@ -233,9 +239,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
if (DevicePathStr == NULL) { if (DevicePathStr == NULL) {
return FALSE; return FALSE;
} }
for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) { for (Index = 0; Index < gSettings.Boot.SecureBootWhiteList.size(); ++Index) {
if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) && if ((gSettings.Boot.SecureBootWhiteList[Index].notEmpty()) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) { (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) {
// White listed // White listed
*AuthenticationStatus = EFI_SUCCESS; *AuthenticationStatus = EFI_SUCCESS;
return TRUE; return TRUE;
@ -249,9 +255,9 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
if (DevicePathStr == NULL) { if (DevicePathStr == NULL) {
return FALSE; return FALSE;
} }
for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) { for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) {
if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) && if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) { (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) {
// Black listed // Black listed
return TRUE; return TRUE;
} }
@ -265,17 +271,17 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
return FALSE; return FALSE;
} }
// Check the black list for this image // Check the black list for this image
for (Index = 0; Index < gSettings.Boot.SecureBootBlackListCount; ++Index) { for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) {
if ((gSettings.Boot.SecureBootBlackList[Index] != NULL) && if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index]) != NULL)) { (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) {
// Black listed // Black listed
return TRUE; return TRUE;
} }
} }
// Check the white list for this image // Check the white list for this image
for (Index = 0; Index < gSettings.Boot.SecureBootWhiteListCount; ++Index) { for (Index = 0; Index < gSettings.Boot.SecureBootWhiteList.size(); ++Index) {
if ((gSettings.Boot.SecureBootWhiteList[Index] != NULL) && if ((gSettings.Boot.SecureBootWhiteList[Index].notEmpty()) &&
(StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index]) != NULL)) { (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) {
// White listed // White listed
*AuthenticationStatus = EFI_SUCCESS; *AuthenticationStatus = EFI_SUCCESS;
return TRUE; return TRUE;
@ -421,7 +427,7 @@ EFI_STATUS InstallSecureBoot(void)
} }
PrintSecureBootInfo(); PrintSecureBootInfo();
// Nothing to do if secure boot is disabled or in setup mode // 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; return EFI_SUCCESS;
} }
// Locate security protocols // Locate security protocols
@ -473,14 +479,14 @@ void InitializeSecureBoot(void)
// Set secure boot variables to firmware values // Set secure boot variables to firmware values
UINTN Size = sizeof(gSettings.Boot.SecureBootSetupMode); UINTN Size = sizeof(gSettings.Boot.SecureBootSetupMode);
gRT->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBootSetupMode); gRT->GetVariable(L"SetupMode", &gEfiGlobalVariableGuid, NULL, &Size, &gSettings.Boot.SecureBootSetupMode);
Size = sizeof(GlobalConfig.Boot.SecureBoot); Size = sizeof(gSettings.Boot.SecureBoot);
gRT->GetVariable(L"SecureBoot", &gEfiGlobalVariableGuid, NULL, &Size, &GlobalConfig.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 // 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 // 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 // setup mode and pretend like we are in secure boot mode to enforce
// secure boot policy even when secure boot is not present/disabled. // secure boot policy even when secure boot is not present/disabled.
if (gSettings.Boot.SecureBootSetupMode) { if (gSettings.Boot.SecureBootSetupMode) {
GlobalConfig.Boot.SecureBoot = 0; gSettings.Boot.SecureBoot = 0;
} }
} }

View File

@ -39,7 +39,7 @@
#include "entry_scan.h" #include "entry_scan.h"
#include <openssl/sha.h> #include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/sha.h"
#include <Guid/ImageAuthentication.h> #include <Guid/ImageAuthentication.h>

View File

@ -37,7 +37,16 @@
#ifdef ENABLE_SECURE_BOOT #ifdef ENABLE_SECURE_BOOT
#include <Platform.h>
#include "../Platform/Settings.h"
#include "../Platform/Nvram.h"
#include "entry_scan.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 <Guid/ImageAuthentication.h> #include <Guid/ImageAuthentication.h>
@ -61,21 +70,22 @@ void AddSecureBootTool(void)
{ {
LOADER_ENTRY *Entry; LOADER_ENTRY *Entry;
// If in forced mode or no secure boot then don't add tool // 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; return;
} }
if (GlobalConfig.Boot.SecureBoot) { panic("not done yet");
Entry = new REFIT_MENU_ENTRY_SECURE_BOOT(); // if (gSettings.Boot.SecureBoot) {
Entry->Title.SWPrintf("Clover Secure Boot Configuration"); // Entry = new REFIT_MENU_ENTRY_SECURE_BOOT();
// Entry->Tag = TAG_SECURE_BOOT_CONFIG; // Entry->Title.SWPrintf("Clover Secure Boot Configuration");
Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT_CONFIG); //// 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(); // } else {
Entry->Title.SWPrintf("Enable Clover Secure Boot"); // Entry = new REFIT_MENU_ENTRY_SECURE_BOOT_CONFIG();
// Entry->Tag = TAG_SECURE_BOOT; // Entry->Title.SWPrintf("Enable Clover Secure Boot");
Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT); //// Entry->Tag = TAG_SECURE_BOOT;
} // Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT);
// }
Entry->Row = 1; Entry->Row = 1;
//actions //actions
Entry->AtClick = ActionSelect; 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"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"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 }, { 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 // Check parameters
if (DevicePath != NULL) { if (DevicePath != NULL) {
// Get the device path string // Get the device path string
CHAR16 *Information[] = { L"Please select the authentication action for", NULL, NULL }; QueryUserMenu.InfoLines.setEmpty()
Information[1] = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); QueryUserMenu.InfoLines.Add(L"Please select the authentication action for"_XSW);
if (Information[1] != NULL) { QueryUserMenu.InfoLines.AddNoNull(FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (QueryUserMenu.InfoLines.size() >= 1) {
// Get the device path file path // Get the device path file path
Information[2] = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); QueryUserMenu.InfoLines.AddNoNull(FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (Information[2] != NULL) { if (QueryUserMenu.InfoLines.size() >= 2) {
// Create the entries // Create the entries
REFIT_MENU_ENTRY *ChosenEntry = NULL; REFIT_SIMPLE_MENU_ENTRY_TAG *ChosenEntry = NULL;
UINTN MenuExit; UINTN MenuExit;
// Update the menu // Update the menu
QueryUserMenu.InfoLines = Information;
QueryUserMenu.Entries.size() = gSettings.Boot.SecureBootSetupMode ? 2 : 3; QueryUserMenu.Entries.size() = gSettings.Boot.SecureBootSetupMode ? 2 : 3;
// Debug message // 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 // Because we may
if (!gGuiIsReady) { if (!gGuiIsReady) {
InitScreen(FALSE); InitScreen(FALSE);
if (gThemeNeedInit) { if (gThemeNeedInit) {
InitTheme(TRUE); UINTN Size = 0;
InitTheme((CHAR8*)GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size));
ThemeX.ClearScreen(); ThemeX.ClearScreen();
gThemeNeedInit = FALSE; gThemeNeedInit = FALSE;
} }
@ -136,9 +147,7 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
MenuExit = MENU_EXIT_ESCAPE; MenuExit = MENU_EXIT_ESCAPE;
} }
} while (MenuExit != MENU_EXIT_ESCAPE); } while (MenuExit != MENU_EXIT_ESCAPE);
FreePool(Information[2]);
} }
FreePool(Information[1]);
} }
} }
return Response; return Response;
@ -214,7 +223,7 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De
IN UINTN FileSize) IN UINTN FileSize)
{ {
EFI_STATUS Status = EFI_INVALID_PARAMETER; EFI_STATUS Status = EFI_INVALID_PARAMETER;
CHAR16 *ErrorString = NULL; XStringW ErrorString;
void *Database = NULL; void *Database = NULL;
UINTN DatabaseSize = 0; UINTN DatabaseSize = 0;
// Check that either the device path or the file buffer is valid // 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) { if (Database) {
// Add the image signature to database // Add the image signature to database
if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) {
ErrorString = L"Failed to insert image authentication"; ErrorString = L"Failed to insert image authentication"_XSW;
} }
FreePool(Database); FreePool(Database);
} else { } else {
ErrorString = L"Image has no certificates or is not valid"; ErrorString = L"Image has no certificates or is not valid"_XSW;
} }
} else { } else {
ErrorString = L"Image has no certificates or is not valid"; ErrorString = L"Image has no certificates or is not valid"_XSW;
} }
FreePool(FileBuffer); FreePool(FileBuffer);
} else { } else {
ErrorString = L"Failed to load the image"; ErrorString = L"Failed to load the image"_XSW;
} }
} else { } else {
// Create image signature // Create image signature
@ -256,28 +265,27 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De
if (Database) { if (Database) {
// Add the image signature to database // Add the image signature to database
if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) {
ErrorString = L"Failed to insert image authentication"; ErrorString = L"Failed to insert image authentication"_XSW;
} }
FreePool(Database); FreePool(Database);
} else { } 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); CHAR16 *DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (DevicePathStr != NULL) { if (DevicePathStr != NULL) {
CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); XStringW FileDevicePathStr = FileDevicePathFileToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (FileDevicePathStr != NULL) { if (FileDevicePathStr.notEmpty()) {
XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr); XStringW Str = SWPrintf("%ls\n%ls\n%ls", ErrorString.wc_str(), DevicePathStr, FileDevicePathStr.wc_str());
AlertMessage(L"Insert Image Authentication", Str); AlertMessage(L"Insert Image Authentication"_XSW, Str);
FreePool(FileDevicePathStr);
} else { } else {
XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr); XStringW Str = SWPrintf("%ls\n%ls", ErrorString.wc_str(), DevicePathStr);
AlertMessage(L"Insert Image Authentication", Str); AlertMessage(L"Insert Image Authentication"_XSW, Str);
} }
FreePool(DevicePathStr); FreePool(DevicePathStr);
} else { } else {
AlertMessage(L"Insert Image Authentication", ErrorString); AlertMessage(L"Insert Image Authentication"_XSW, ErrorString);
} }
} }
return Status; return Status;
@ -289,7 +297,7 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *
IN UINTN FileSize) IN UINTN FileSize)
{ {
EFI_STATUS Status = EFI_INVALID_PARAMETER; EFI_STATUS Status = EFI_INVALID_PARAMETER;
CHAR16 *ErrorString = NULL; XStringW ErrorString;
void *Database; void *Database;
UINTN DatabaseSize = 0; UINTN DatabaseSize = 0;
// Check that either the device path or the file buffer is valid // 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) { if (Database) {
// Remove the image signature from database // Remove the image signature from database
if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { 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); FreePool(Database);
} else { } else {
ErrorString = L"Image has no certificates or is not valid"; ErrorString.takeValueFrom(L"Image has no certificates or is not valid"_XSW);
} }
} else { } else {
ErrorString = L"Image has no certificates or is not valid"; ErrorString = L"Image has no certificates or is not valid"_XSW;
} }
FreePool(FileBuffer); FreePool(FileBuffer);
} else { } else {
ErrorString = L"Failed to load the image"; ErrorString.takeValueFrom(L"Failed to load the image");
} }
} else { } else {
// Create image signature // Create image signature
@ -331,28 +339,27 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *
if (Database) { if (Database) {
// Remove the image signature from database // Remove the image signature from database
if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) {
ErrorString = L"Failed to remove image authentication"; ErrorString = L"Failed to remove image authentication"_XSW;
} }
FreePool(Database); FreePool(Database);
} else { } 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); CHAR16 *DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (DevicePathStr != NULL) { if (DevicePathStr != NULL) {
CHAR16 *FileDevicePathStr = FileDevicePathFileToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); XStringW FileDevicePathStr = FileDevicePathFileToXStringW((EFI_DEVICE_PATH_PROTOCOL *)DevicePath);
if (FileDevicePathStr != NULL) { if (FileDevicePathStr.notEmpty()) {
XStringW Str = SWPrintf(L"%ls\n%ls\n%ls", ErrorString, DevicePathStr, FileDevicePathStr); XStringW Str = SWPrintf("%ls\n%ls\n%ls", ErrorString.wc_str(), DevicePathStr, FileDevicePathStr.wc_str());
AlertMessage(L"Remove Image Authentication", Str); AlertMessage(L"Remove Image Authentication"_XSW, Str);
FreePool(FileDevicePathStr);
} else { } else {
XStringW Str = SWPrintf(L"%ls\n%ls", ErrorString, DevicePathStr); XStringW Str = SWPrintf("%ls\n%ls", ErrorString.wc_str(), DevicePathStr);
AlertMessage(L"Remove Image Authentication", Str); AlertMessage(L"Remove Image Authentication"_XSW, Str);
} }
FreePool(DevicePathStr); FreePool(DevicePathStr);
} else { } else {
AlertMessage(L"Remove Image Authentication", ErrorString); AlertMessage(L"Remove Image Authentication"_XSW, ErrorString);
} }
} }
return Status; return Status;
@ -366,7 +373,7 @@ extern REFIT_MENU_ITEM_RETURN MenuEntryReturn;
#define TAG_CLEAR 4 #define TAG_CLEAR 4
#define TAG_DISABLE 5 #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 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 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 }; 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?")) { if (YesNoMessage(L"Disable Secure Boot", L"Are you sure you want to disable secure boot?")) {
DBG("User disabled secure boot\n"); DBG("User disabled secure boot\n");
DisableSecureBoot(); DisableSecureBoot();
if (!GlobalConfig.Boot.SecureBoot) { if (!gSettings.Boot.SecureBoot) {
return TRUE; return TRUE;
} }
AlertMessage(L"Disable Secure Boot", L"Disabling secure boot failed!\nClover does not appear to own the PK"); AlertMessage(L"Disable Secure Boot", L"Disabling secure boot failed!\nClover does not appear to own the PK");

View File

@ -37,15 +37,18 @@
#ifdef ENABLE_SECURE_BOOT #ifdef ENABLE_SECURE_BOOT
#include <Platform.h>
#include "../Platform/Settings.h"
#include "entry_scan.h" #include "entry_scan.h"
#include <Guid/ImageAuthentication.h> #include <Guid/ImageAuthentication.h>
#include "securebootkeys.h" #include "securebootkeys.h"
#include <openssl/err.h> #include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/err.h"
#include <openssl/pem.h> #include "../../Library/OpensslLib/openssl-1.0.1e/include/openssl/pem.h"
#include <openssl/sha.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 #ifndef DEBUG_ALL
#define DEBUG_SECURE_VARS 1 #define DEBUG_SECURE_VARS 1
@ -504,8 +507,8 @@ EFI_STATUS SetSignatureDatabase(IN CHAR16 *DatabaseName,
{ {
EFI_STATUS Status; EFI_STATUS Status;
// Check is valid to set database // Check is valid to set database
if ((GlobalConfig.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) || if ((gSettings.Boot.SecureBoot && gSettings.Boot.SecureBootSetupMode) ||
(!GlobalConfig.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode)) { (!gSettings.Boot.SecureBoot && !gSettings.Boot.SecureBootSetupMode)) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
// Erase database // Erase database

View File

@ -2395,7 +2395,7 @@ GetListOfDsdts()
if (DirEntry->FileName[0] == L'.') { if (DirEntry->FileName[0] == L'.') {
continue; continue;
} }
if ( gSettings.DsdtName.equalIC(DirEntry->FileName) ) { if ( gSettings.ACPI.DSDT.DsdtName.equalIC(DirEntry->FileName) ) {
OldChosenDsdt = DsdtsNum; OldChosenDsdt = DsdtsNum;
} }
NameLen = StrLen(DirEntry->FileName); //with ".aml" NameLen = StrLen(DirEntry->FileName); //with ".aml"
@ -2412,7 +2412,6 @@ GetListOfACPI()
REFIT_DIR_ITER DirIter; REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry = NULL; EFI_FILE_INFO *DirEntry = NULL;
ACPI_PATCHED_AML *ACPIPatchedAMLTmp; ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
INTN Count = gSettings.DisabledAMLCount;
// XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str()); // XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str()); // DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str());
while (ACPIPatchedAML != NULL) { while (ACPIPatchedAML != NULL) {
@ -2440,10 +2439,12 @@ GetListOfACPI()
ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above
ACPIPatchedAMLTmp->FileName = SWPrintf("%ls", DirEntry->FileName).forgetDataWithoutFreeing(); // 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++) { for (INTN i = 0; i < Count; i++) {
if ((gSettings.DisabledAML[i] != NULL) && if ( gSettings.ACPI.DisabledAML[i].equalIC(ACPIPatchedAMLTmp->FileName) ) {
(StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.DisabledAML[i]) == 0) // if ((gSettings.ACPI.DisabledAML[i] != NULL) &&
) { // (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0)
// ) {
ACPIDisabled = TRUE; ACPIDisabled = TRUE;
break; break;
} }
@ -2519,6 +2520,41 @@ RefitMain (IN EFI_HANDLE ImageHandle,
} }
#endif #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 // main entry point
// //
@ -2581,14 +2617,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage); Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage);
// if ( !EFI_ERROR(Status) ) { // 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()); // 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 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 #ifdef JIEF_DEBUG
gBS->Stall(1500000); // to give time to gdb to connect gBS->Stall(2500000); // to give time to gdb to connect
// gBS->Stall(0500000); // to give time to gdb to connect
// PauseForKey(L"press\n"); // PauseForKey(L"press\n");
#endif #endif
} }
@ -2965,6 +3000,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
if (gConfigDict[i]) { if (gConfigDict[i]) {
Status = GetUserSettings(gConfigDict[i], gSettings); Status = GetUserSettings(gConfigDict[i], gSettings);
afterGetUserSettings(gSettings);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
DBG("Error in Second part of settings %llu: %s\n", i, efiStrError(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 #ifdef ENABLE_SECURE_BOOT
if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot panic("not done yet");
EnableSecureBoot(); // if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
MainLoopRunning = FALSE; // EnableSecureBoot();
AfterTool = TRUE; // MainLoopRunning = FALSE;
} // AfterTool = TRUE;
// }
if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot //
MainLoopRunning = !ConfigureSecureBoot(); // if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot
AfterTool = TRUE; // MainLoopRunning = !ConfigureSecureBoot();
} // AfterTool = TRUE;
// }
#endif // ENABLE_SECURE_BOOT #endif // ENABLE_SECURE_BOOT
if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options

View File

@ -144,7 +144,7 @@ void FillInputs(BOOLEAN New)
// no need for extra space here, it is added by ApplyInputs() // no need for extra space here, it is added by ApplyInputs()
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.Boot.BootArgs); InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.Boot.BootArgs);
InputItems[InputItemsCount].ItemType = UNIString; //1 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].ItemType = UNIString; //2
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.BlockKexts); InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.BlockKexts);
@ -152,29 +152,29 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = 3; InputItems[InputItemsCount++].IValue = 3;
InputItems[InputItemsCount].ItemType = BoolValue; //4 InputItems[InputItemsCount].ItemType = BoolValue; //4
InputItems[InputItemsCount++].BValue = gSettings.DropSSDT; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DropSSDT;
InputItems[InputItemsCount].ItemType = BoolValue; //5 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].ItemType = BoolValue; //6
InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SlpSmiEnable;
InputItems[InputItemsCount].ItemType = Decimal; //7 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].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].ItemType = BoolValue; //9
InputItems[InputItemsCount++].BValue = gSettings.GenerateCStates; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.Generate.GenerateCStates;
InputItems[InputItemsCount].ItemType = BoolValue; //10 InputItems[InputItemsCount].ItemType = BoolValue; //10
InputItems[InputItemsCount++].BValue = gSettings.EnableC2; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC2;
InputItems[InputItemsCount].ItemType = BoolValue; //11 InputItems[InputItemsCount].ItemType = BoolValue; //11
InputItems[InputItemsCount++].BValue = gSettings.EnableC4; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC4;
InputItems[InputItemsCount].ItemType = BoolValue; //12 InputItems[InputItemsCount].ItemType = BoolValue; //12
InputItems[InputItemsCount++].BValue = gSettings.EnableC6; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC6;
InputItems[InputItemsCount].ItemType = BoolValue; //13 InputItems[InputItemsCount].ItemType = BoolValue; //13
InputItems[InputItemsCount++].BValue = gSettings.EnableISS; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableISS;
InputItems[InputItemsCount].ItemType = Decimal; //14 InputItems[InputItemsCount].ItemType = Decimal; //14
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.QPI); InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.QPI);
InputItems[InputItemsCount].ItemType = BoolValue; //15 InputItems[InputItemsCount].ItemType = BoolValue; //15
InputItems[InputItemsCount++].BValue = gSettings.PatchNMI; InputItems[InputItemsCount++].BValue = gSettings.ACPI.PatchNMI;
InputItems[InputItemsCount].ItemType = BoolValue; //16 InputItems[InputItemsCount].ItemType = BoolValue; //16
InputItems[InputItemsCount++].BValue = gSettings.PatchVBios; InputItems[InputItemsCount++].BValue = gSettings.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17 InputItems[InputItemsCount].ItemType = Decimal; //17
@ -255,7 +255,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //48 InputItems[InputItemsCount].ItemType = BoolValue; //48
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelPm; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelPm;
InputItems[InputItemsCount].ItemType = BoolValue; //49 InputItems[InputItemsCount].ItemType = BoolValue; //49
InputItems[InputItemsCount++].BValue = gSettings.FixMCFG; InputItems[InputItemsCount++].BValue = gSettings.ACPI.FixMCFG;
InputItems[InputItemsCount].ItemType = Decimal; //50 InputItems[InputItemsCount].ItemType = Decimal; //50
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.RefCLK); InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.RefCLK);
@ -310,7 +310,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = CheckBit; //67 InputItems[InputItemsCount].ItemType = CheckBit; //67
InputItems[InputItemsCount++].IValue = gSettings.FixDsdt; InputItems[InputItemsCount++].IValue = gSettings.ACPI.DSDT.FixDsdt;
InputItems[InputItemsCount].ItemType = CheckBit; //68 InputItems[InputItemsCount].ItemType = CheckBit; //68
InputItems[InputItemsCount++].IValue = gSettings.OptionsBits; InputItems[InputItemsCount++].IValue = gSettings.OptionsBits;
InputItems[InputItemsCount].ItemType = CheckBit; //69 InputItems[InputItemsCount].ItemType = CheckBit; //69
@ -330,7 +330,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.USBFixOwnership; InputItems[InputItemsCount++].BValue = gSettings.USBFixOwnership;
InputItems[InputItemsCount].ItemType = Hex; //75 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].ItemType = Decimal; //76
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.EnabledCores); InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.EnabledCores);
InputItems[InputItemsCount].ItemType = Decimal; //77 InputItems[InputItemsCount].ItemType = Decimal; //77
@ -358,9 +358,9 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate.c_str());
InputItems[InputItemsCount].ItemType = BoolValue; //88 InputItems[InputItemsCount].ItemType = BoolValue; //88
InputItems[InputItemsCount++].BValue = gSettings.DoubleFirstState; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DoubleFirstState;
InputItems[InputItemsCount].ItemType = BoolValue; //89 InputItems[InputItemsCount].ItemType = BoolValue; //89
InputItems[InputItemsCount++].BValue = gSettings.EnableC7; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC7;
InputItems[InputItemsCount].ItemType = RadioSwitch; //90 InputItems[InputItemsCount].ItemType = RadioSwitch; //90
InputItems[InputItemsCount++].IValue = 90; InputItems[InputItemsCount++].IValue = 90;
@ -391,7 +391,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = gSettings.QuirksMask; // InputItems[InputItemsCount++].IValue = gSettings.QuirksMask; //
InputItems[InputItemsCount].ItemType = BoolValue; //102 InputItems[InputItemsCount].ItemType = BoolValue; //102
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT; InputItems[InputItemsCount++].BValue = gSettings.ACPI.DSDT.DebugDSDT;
InputItems[InputItemsCount].ItemType = Hex; //103 InputItems[InputItemsCount].ItemType = Hex; //103
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.FakeIMEI); InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.FakeIMEI);
InputItems[InputItemsCount].ItemType = Hex; //104 InputItems[InputItemsCount].ItemType = Hex; //104
@ -420,7 +420,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].SValue.SWPrintf("0x%04X", gSettings.IntelMaxValue); InputItems[InputItemsCount++].SValue.SWPrintf("0x%04X", gSettings.IntelMaxValue);
InputItems[InputItemsCount].ItemType = BoolValue; //113 InputItems[InputItemsCount].ItemType = BoolValue; //113
InputItems[InputItemsCount++].BValue = gSettings.AutoMerge; InputItems[InputItemsCount++].BValue = gSettings.ACPI.AutoMerge;
InputItems[InputItemsCount].ItemType = BoolValue; //114 InputItems[InputItemsCount].ItemType = BoolValue; //114
InputItems[InputItemsCount++].BValue = gSettings.DeInit; InputItems[InputItemsCount++].BValue = gSettings.DeInit;
InputItems[InputItemsCount].ItemType = BoolValue; //115 InputItems[InputItemsCount].ItemType = BoolValue; //115
@ -448,8 +448,8 @@ void FillInputs(BOOLEAN New)
//menu for drop table //menu for drop table
if (gSettings.ACPIDropTables) { if (GlobalConfig.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables; ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables;
while (DropTable) { while (DropTable) {
DropTable->MenuItem.ItemType = BoolValue; DropTable->MenuItem.ItemType = BoolValue;
DropTable = DropTable->Next; DropTable = DropTable->Next;
@ -483,7 +483,7 @@ void ApplyInputs(void)
} }
i++; //1 i++; //1
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.DsdtName = InputItems[i].SValue; gSettings.ACPI.DSDT.DsdtName = InputItems[i].SValue;
} }
i++; //2 i++; //2
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -502,46 +502,46 @@ void ApplyInputs(void)
} }
i++; //4 i++; //4
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.DropSSDT = InputItems[i].BValue; gSettings.ACPI.SSDT.DropSSDT = InputItems[i].BValue;
} }
i++; //5 i++; //5
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.GeneratePStates = InputItems[i].BValue; gSettings.ACPI.SSDT.Generate.GeneratePStates = InputItems[i].BValue;
} }
i++; //6 i++; //6
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.SlpSmiEnable = InputItems[i].BValue; gSettings.ACPI.SlpSmiEnable = InputItems[i].BValue;
} }
i++; //7 i++; //7
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
// DBG("InputItems[i]: %ls\n", InputItems[i].SValue); // DBG("InputItems[i]: %ls\n", InputItems[i].SValue);
gSettings.PLimitDict = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x7F); gSettings.ACPI.SSDT.PLimitDict = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x7F);
// DBG("Item 7=PLimitDict %d\n", gSettings.PLimitDict); // DBG("Item 7=PLimitDict %d\n", gSettings.ACPI.SSDT.PLimitDict);
} }
i++; //8 i++; //8
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.UnderVoltStep = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x3F); gSettings.ACPI.SSDT.UnderVoltStep = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x3F);
// DBG("Item 8=UnderVoltStep %d\n", gSettings.UnderVoltStep); // DBG("Item 8=UnderVoltStep %d\n", gSettings.ACPI.SSDT.UnderVoltStep);
} }
i++; //9 i++; //9
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.GenerateCStates = InputItems[i].BValue; gSettings.ACPI.SSDT.Generate.GenerateCStates = InputItems[i].BValue;
} }
i++; //10 i++; //10
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnableC2 = InputItems[i].BValue; gSettings.ACPI.SSDT.EnableC2 = InputItems[i].BValue;
} }
i++; //11 i++; //11
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnableC4 = InputItems[i].BValue; gSettings.ACPI.SSDT.EnableC4 = InputItems[i].BValue;
} }
i++; //12 i++; //12
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnableC6 = InputItems[i].BValue; gSettings.ACPI.SSDT.EnableC6 = InputItems[i].BValue;
} }
i++; //13 i++; //13
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnableISS = InputItems[i].BValue; gSettings.ACPI.SSDT.EnableISS = InputItems[i].BValue;
} }
i++; //14 i++; //14
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -550,7 +550,7 @@ void ApplyInputs(void)
} }
i++; //15 i++; //15
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.PatchNMI = InputItems[i].BValue; gSettings.ACPI.PatchNMI = InputItems[i].BValue;
} }
i++; //16 i++; //16
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -659,7 +659,7 @@ void ApplyInputs(void)
} }
i++; //49 i++; //49
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.FixMCFG = InputItems[i].BValue; gSettings.ACPI.FixMCFG = InputItems[i].BValue;
} }
i++; //50 i++; //50
@ -744,7 +744,7 @@ void ApplyInputs(void)
i++; //67 i++; //67
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.FixDsdt = InputItems[i].IValue; gSettings.ACPI.DSDT.FixDsdt = InputItems[i].IValue;
} }
i++; //68 i++; //68
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -785,7 +785,7 @@ void ApplyInputs(void)
} }
i++; //75 i++; //75
if (InputItems[i].Valid) { 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 i++; //76
@ -847,11 +847,11 @@ void ApplyInputs(void)
i++; //88 i++; //88
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.DoubleFirstState = InputItems[i].BValue; gSettings.ACPI.SSDT.DoubleFirstState = InputItems[i].BValue;
} }
i++; //89 i++; //89
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnableC7 = InputItems[i].BValue; gSettings.ACPI.SSDT.EnableC7 = InputItems[i].BValue;
} }
i++; //90 i++; //90
@ -935,7 +935,7 @@ void ApplyInputs(void)
} }
i++; //102 i++; //102
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.DebugDSDT = InputItems[i].BValue; gSettings.ACPI.DSDT.DebugDSDT = InputItems[i].BValue;
} }
i++; //103 i++; //103
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -993,7 +993,7 @@ void ApplyInputs(void)
} }
i++; //113 i++; //113
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.AutoMerge = InputItems[i].BValue; gSettings.ACPI.AutoMerge = InputItems[i].BValue;
} }
i++; //114 i++; //114
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -1006,9 +1006,9 @@ void ApplyInputs(void)
i++; //116 i++; //116
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
if (OldChosenDsdt == 0xFFFF) { if (OldChosenDsdt == 0xFFFF) {
gSettings.DsdtName = L"BIOS.aml"_XSW; gSettings.ACPI.DSDT.DsdtName = L"BIOS.aml"_XSW;
} else { } else {
gSettings.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]); gSettings.ACPI.DSDT.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]);
} }
} }
i++; //117 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) void ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
{ {
if (ChosenEntry->SubScreen->ID == SCREEN_DSDT) { 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); //MsgLog("@ESC: %ls\n", (*ChosenEntry)->Title);
} else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) { } else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) {
// CSR // CSR
@ -1961,8 +1961,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->"_XS8); Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->"_XS8);
if (gSettings.ACPIDropTables) { if (GlobalConfig.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables; ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables;
while (DropTable) { while (DropTable) {
CopyMem((CHAR8*)&sign, (CHAR8*)&(DropTable->Signature), 4); CopyMem((CHAR8*)&sign, (CHAR8*)&(DropTable->Signature), 4);
CopyMem((CHAR8*)&OTID, (CHAR8*)&(DropTable->TableId), 8); CopyMem((CHAR8*)&OTID, (CHAR8*)&(DropTable->TableId), 8);
@ -2042,7 +2042,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
// REFIT_INPUT_DIALOG *InputBootArgs; // REFIT_INPUT_DIALOG *InputBootArgs;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NullXString8); 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("Add DTGP", FIX_DTGP, 67);
SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67); SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67);
@ -2089,17 +2089,17 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches()
REFIT_MENU_SCREEN *SubScreen; REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs; REFIT_INPUT_DIALOG *InputBootArgs;
size_t PatchDsdtNum = gSettings.DSDTPatchArray.size(); size_t PatchDsdtNum = gSettings.ACPI.DSDT.DSDTPatchArray.size();
// INPUT_ITEM* DSDTPatchesMenu = gSettings.PatchDsdtMenuItem; // INPUT_ITEM* DSDTPatchesMenu = gSettings.PatchDsdtMenuItem;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->"_XS8); Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->"_XS8);
for (size_t Index = 0; Index < PatchDsdtNum; Index++) { for (size_t Index = 0; Index < PatchDsdtNum; Index++) {
InputBootArgs = new REFIT_INPUT_DIALOG; 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->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &gSettings.DSDTPatchArray[Index].PatchDsdtMenuItem; InputBootArgs->Item = &gSettings.ACPI.DSDT.DSDTPatchArray[Index].PatchDsdtMenuItem;
InputBootArgs->AtClick = ActionEnter; InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails; InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true); SubScreen->AddMenuEntry(InputBootArgs, true);