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, ...) {
PRINTF_VA_LIST va;
va_start(va, context);
vprintf_with_callback_timestamp(foPRINTF_VA_ENDva, transmitBufCallBack, context, NULL, 0);
vprintf_with_callback_timestamp(format, va, transmitBufCallBack, context, NULL, 0);
PRINTF_VA_END(va);
}
# endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@
#ifndef 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 */
#ifdef OPENSSL_NO_DES
@ -98,7 +98,7 @@ typedef struct DES_ks
#endif
#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT
# include <openssl/des_old.h>
# include "des_old.h"
#endif
#define DES_KEY_SZ (sizeof(DES_cblock))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@
#ifndef 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
#error IDEA is disabled.

View File

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

View File

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

View File

@ -59,7 +59,7 @@
#ifndef 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
#error MD2 is disabled.
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@
#ifndef 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
#error RC2 is disabled.
#endif

View File

@ -59,7 +59,7 @@
#ifndef 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
#error RC4 is disabled.
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -136,7 +136,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
}
}
} else {
gSettings.GenerateAPLF = FALSE;
gSettings.ACPI.SSDT.Generate.GenerateAPLF = FALSE;
}
if (Number > 0) {
@ -170,8 +170,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
maximum.Control.VID_FID.FID++;
MsgLog("Turbo FID=0x%hhX\n", maximum.Control.VID_FID.FID);
}
MsgLog("UnderVoltStep=%d\n", gSettings.UnderVoltStep);
MsgLog("PLimitDict=%d\n", gSettings.PLimitDict);
MsgLog("UnderVoltStep=%d\n", gSettings.ACPI.SSDT.UnderVoltStep);
MsgLog("PLimitDict=%d\n", gSettings.ACPI.SSDT.PLimitDict);
maximum.CID = ((maximum.Control.VID_FID.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio;
minimum.Control.VID_FID.FID = (RShiftU64(AsmReadMsr64(MSR_IA32_PERF_STATUS), 24) & 0x1F) | (0x80 * cpu_dynamic_fsb);
@ -219,7 +219,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
p_states[i].Control.VID_FID.VID = ((maximum.Control.VID_FID.VID << 2) - (vidstep * u)) >> 2;
if (u < p_states_count - 1) {
p_states[i].Control.VID_FID.VID -= gSettings.UnderVoltStep;
p_states[i].Control.VID_FID.VID -= gSettings.ACPI.SSDT.UnderVoltStep;
}
// Add scope so these don't have to be moved - apianti
{
@ -276,10 +276,10 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
case CPU_MODEL_TIGERLAKE_D:
{
maximum.Control.Control = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 8) & 0xff;
if (gSettings.MaxMultiplier) {
if (gSettings.ACPI.SSDT.MaxMultiplier) {
DBG("Using custom MaxMultiplier %d instead of automatic %d\n",
gSettings.MaxMultiplier, maximum.Control.Control);
maximum.Control.Control = gSettings.MaxMultiplier;
gSettings.ACPI.SSDT.MaxMultiplier, maximum.Control.Control);
maximum.Control.Control = gSettings.ACPI.SSDT.MaxMultiplier;
}
realMax = maximum.Control.Control;
@ -292,8 +292,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
}
Apsn = (realTurbo > realMax)?(realTurbo - realMax):0;
realMin = RShiftU64(AsmReadMsr64(MSR_PLATFORM_INFO), 40) & 0xff;
if (gSettings.MinMultiplier) {
minimum.Control.Control = gSettings.MinMultiplier;
if (gSettings.ACPI.SSDT.MinMultiplier) {
minimum.Control.Control = gSettings.ACPI.SSDT.MinMultiplier;
Aplf = (realMin > minimum.Control.Control)?(realMin - minimum.Control.Control):0;
} else {
minimum.Control.Control = realMin;
@ -353,7 +353,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
p_states[p_states_count].Control.Control = (UINT16)j;
p_states[p_states_count].CID = (UINT32)j;
if (!p_states_count && gSettings.DoubleFirstState) {
if (!p_states_count && gSettings.ACPI.SSDT.DoubleFirstState) {
//double first state
p_states_count++;
p_states[p_states_count].Control.Control = (UINT16)j;
@ -393,7 +393,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
scop = aml_add_scope(root, name);
if (gSettings.GeneratePStates && !gSettings.HWP) {
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) {
method = aml_add_name(scop, "PSS_");
pack = aml_add_package(method);
@ -403,7 +403,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
TDPdiv = 8;
}
for (decltype(p_states_count) i = gSettings.PLimitDict; i < p_states_count; i++) {
for (decltype(p_states_count) i = gSettings.ACPI.SSDT.PLimitDict; i < p_states_count; i++) {
AML_CHUNK* pstt = aml_add_package(pack);
aml_add_dword(pstt, p_states[i].Frequency);
@ -423,8 +423,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
//aml_add_return_name(metPSS, "PSS_");
//metPPC = aml_add_method(scop, "_PPC", 0);
aml_add_name(scop, "_PPC");
aml_add_byte(scop, (UINT8)gSettings.PLimitDict);
//aml_add_return_byte(metPPC, gSettings.PLimitDict);
aml_add_byte(scop, (UINT8)gSettings.ACPI.SSDT.PLimitDict);
//aml_add_return_byte(metPPC, gSettings.ACPI.SSDT.PLimitDict);
namePCT = aml_add_name(scop, "PCT_");
packPCT = aml_add_package(namePCT);
resource_template_register_fixedhw[8] = 0x00;
@ -434,17 +434,17 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
aml_add_buffer(packPCT, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
metPCT = aml_add_method(scop, "_PCT", 0);
aml_add_return_name(metPCT, "PCT_");
if (gSettings.PluginType && gSettings.GeneratePluginType) {
if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
aml_add_buffer(scop, plugin_type, sizeof(plugin_type));
aml_add_byte(scop, gSettings.PluginType);
aml_add_byte(scop, gSettings.ACPI.SSDT.PluginType);
}
if (gCPUStructure.Family >= 2) {
if (gSettings.GenerateAPSN) {
if (gSettings.ACPI.SSDT.Generate.GenerateAPSN) {
//APSN: High Frequency Modes (turbo)
aml_add_name(scop, "APSN");
aml_add_byte(scop, (UINT8)Apsn);
}
if (gSettings.GenerateAPLF) {
if (gSettings.ACPI.SSDT.Generate.GenerateAPLF) {
//APLF: Low Frequency Mode
aml_add_name(scop, "APLF");
aml_add_byte(scop, (UINT8)Aplf);
@ -461,13 +461,13 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
//aml_add_return_name(metPSS, name1);
metPPC = aml_add_method(scop, "_PPC", 0);
aml_add_return_name(metPPC, name3);
//aml_add_return_byte(metPPC, gSettings.PLimitDict);
//aml_add_return_byte(metPPC, gSettings.ACPI.SSDT.PLimitDict);
metPCT = aml_add_method(scop, "_PCT", 0);
aml_add_return_name(metPCT, name2);
}
} else if (gSettings.PluginType && gSettings.GeneratePluginType) {
} else if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
aml_add_buffer(scop, plugin_type, sizeof(plugin_type));
aml_add_byte(scop, gSettings.PluginType);
aml_add_byte(scop, gSettings.ACPI.SSDT.PluginType);
}
aml_calculate_size(root);
@ -481,8 +481,8 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
aml_destroy_node(root);
if (gSettings.GeneratePStates && !gSettings.HWP) {
if (gSettings.PluginType && gSettings.GeneratePluginType) {
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) {
if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
MsgLog ("SSDT with CPU P-States and plugin-type generated successfully\n");
} else {
MsgLog ("SSDT with CPU P-States generated successfully\n");
@ -502,11 +502,11 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number)
{
BOOLEAN c2_enabled = gSettings.EnableC2;
BOOLEAN c2_enabled = gSettings.ACPI.SSDT.EnableC2;
BOOLEAN c3_enabled;
BOOLEAN c4_enabled = gSettings.EnableC4;
// BOOLEAN c6_enabled = gSettings.EnableC6;
BOOLEAN cst_using_systemio = gSettings.EnableISS;
BOOLEAN c4_enabled = gSettings.ACPI.SSDT.EnableC4;
// BOOLEAN c6_enabled = gSettings.ACPI.SSDT.EnableC6;
BOOLEAN cst_using_systemio = gSettings.ACPI.SSDT.EnableISS;
UINT8 p_blk_lo, p_blk_hi;
UINT8 cstates_count;
UINT32 acpi_cpu_p_blk;
@ -531,7 +531,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
c2_enabled = c2_enabled || (fadt->PLvl2Lat < 100);
c3_enabled = (fadt->PLvl3Lat < 1000);
cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled)? 1 : 0)
+ (gSettings.EnableC6 ? 1 : 0) + (gSettings.EnableC7 ? 1 : 0);
+ (gSettings.ACPI.SSDT.EnableC6 ? 1 : 0) + (gSettings.ACPI.SSDT.EnableC7 ? 1 : 0);
root = aml_create_node(NULL);
aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header
@ -586,10 +586,10 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
resource_template_register_systemio[12] = p_blk_hi; // C3
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x03); // C3
aml_add_word(tmpl, gSettings.C3Latency); // Latency
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency
aml_add_dword(tmpl, 0x000001F4); // Power
}
if (gSettings.EnableC6) { // C6
if (gSettings.ACPI.SSDT.EnableC6) { // C6
p_blk_lo = (UINT8)(acpi_cpu_p_blk + 5);
p_blk_hi = (UINT8)((acpi_cpu_p_blk + 5) >> 8);
@ -598,10 +598,10 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
resource_template_register_systemio[12] = p_blk_hi; // C6
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x06); // C6
aml_add_word(tmpl, gSettings.C3Latency + 3); // Latency
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency
aml_add_dword(tmpl, 0x0000015E); // Power
}
if (gSettings.EnableC7) { //C7
if (gSettings.ACPI.SSDT.EnableC7) { //C7
p_blk_lo = (acpi_cpu_p_blk + 6) & 0xff;
p_blk_hi = (UINT8)((acpi_cpu_p_blk + 6) >> 8);
@ -652,18 +652,18 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
resource_template_register_fixedhw[11] = 0x20; // C3
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x03); // C3
aml_add_word(tmpl, gSettings.C3Latency); // Latency as in MacPro6,1 = 0x0043
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency as in MacPro6,1 = 0x0043
aml_add_dword(tmpl, 0x000001F4); // Power
}
if (gSettings.EnableC6) { // C6
if (gSettings.ACPI.SSDT.EnableC6) { // C6
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x20; // C6
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x06); // C6
aml_add_word(tmpl, gSettings.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046
aml_add_dword(tmpl, 0x0000015E); // Power
}
if (gSettings.EnableC7) {
if (gSettings.ACPI.SSDT.EnableC7) {
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x30; // C4 or C7
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));

View File

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

View File

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

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\
<plist version=\"1.0\">\r\n\
<dict>\r\n\
<key>ACPI</key>\r\n\
<key>ACPIx</key>\r\n\
<dict>\r\n\
<key>AutoMerge</key>\r\n\
<integer>0</integer>\r\n\

View File

@ -39,7 +39,7 @@ int getNextTag_tests()
bool b;
gXmlLiteParser.init("<key>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(1);
if ( !isOpeningTag ) return breakpoint(2);
if ( isClosingTag ) return breakpoint(3);
@ -47,7 +47,7 @@ int getNextTag_tests()
gXmlLiteParser.init("</key>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(5);
if ( isOpeningTag ) return breakpoint(6);
if ( !isClosingTag ) return breakpoint(7);
@ -55,11 +55,11 @@ int getNextTag_tests()
gXmlLiteParser.init("<key/>");
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(10);
if ( !isOpeningTag ) return breakpoint(11);
if ( isClosingTag ) return breakpoint(12);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( !b ) return breakpoint(13);
if ( isOpeningTag ) return breakpoint(14);
if ( !isClosingTag ) return breakpoint(15);
@ -69,35 +69,35 @@ int getNextTag_tests()
//
gXmlLiteParser.init("foo1\n foo2");
gXmlLiteParser.moveForwardUntil(0);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 7") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n bar1");
gXmlLiteParser.moveForwardUntil('b');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 3") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2/>");
gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 9") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2");
gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 11") ) return breakpoint(14);
gXmlLiteParser.init("foo1\n </foo2 >");
gXmlLiteParser.moveForwardUntil('<');
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 2 col 13") ) return breakpoint(14);
@ -105,7 +105,7 @@ int getNextTag_tests()
gXmlLiteParser.init("foo1\n\n<foo2/");
gXmlLiteParser.moveForwardUntil('/');
gXmlLiteParser.moveForwardUntilSignificant();
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 7") ) return breakpoint(14);
@ -113,7 +113,7 @@ int getNextTag_tests()
gXmlLiteParser.init("foo1\n\n <foo2/a");
gXmlLiteParser.moveForwardUntil('/');
gXmlLiteParser.moveForwardUntilSignificant();
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag);
b = gXmlLiteParser.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true);
if ( b ) return breakpoint(13);
if ( gXmlLiteParser.getErrorsAndWarnings().size() != 1 ) return breakpoint(13);
if ( !gXmlLiteParser.getErrorsAndWarnings()[0].msg.contains("line 3 col 9") ) return breakpoint(14);
@ -209,11 +209,13 @@ int getKey_tests()
gXmlLiteParser.init("<key></key><string>v</string>");
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>");
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>");
b = gXmlLiteParser.getKeyTagValue(&tag, &length, &xmlParserPosition, true);
@ -368,54 +370,128 @@ int xml_integer_tests()
return 0;
}
class Dict1_Class : public XmlDict
int validate_dict_tests()
{
public:
class Test1Bool: public XmlBool
bool b;
class Dict1_Class : public XmlDict
{
public:
virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override {
RETURN_IF_FALSE( XmlBool::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) );
xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine()));
return false; // parsing can continue.
}
} test1Bool = Test1Bool();
public:
class Test1Bool: public XmlBool
{
public:
virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override {
RETURN_IF_FALSE( XmlBool::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) );
xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine()));
return false; // parsing can continue.
}
} test1Bool = Test1Bool();
XmlDictField m_fields[1] = {
{"test1Bool", test1Bool},
XmlDictField m_fields[1] = {
{"test1Bool", test1Bool},
};
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
};
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
};
class MainDict_Class : public XmlDict
{
public:
Dict1_Class dict1 = Dict1_Class();
class Main1Dict_Class : public XmlDict
{
public:
Dict1_Class dict1 = Dict1_Class();
virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override {
RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) );
xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine()));
return false; // parsing can continue.
}
virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override {
RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) );
xmlLiteParser->addWarning(generateErrors, S8Printf("dict1 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine()));
return false; // parsing can continue.
}
XmlDictField m_fields[1] = {
{"dict1", dict1},
};
XmlDictField m_fields[1] = {
{"dict1", dict1},
};
public:
MainDict_Class() {};
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
} mainDict;
Main1Dict_Class() {};
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
} mainDict;
static const char* config_test =
"<dict>\r\n\
<key>dict1</key>\r\n\
<dict>\r\n\
<key>test1Bool</key>\r\n\
<true/>\r\n\
const char* config_test =
"<dict>\r\n\
<key>dict1</key>\r\n\
<dict>\r\n\
<key>test1Bool</key>\r\n\
<true/>\r\n\
</dict>\r\n\
</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()
{
@ -423,20 +499,16 @@ int xml_lite_tests()
int ret;
// XmlLiteParser xmlLiteParser;
bool b;
gXmlLiteParser.init(config_test);
b = mainDict.parseFromXmlLite(&gXmlLiteParser, ""_XS8, true);
for ( size_t idx = 0 ; idx < gXmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) {
if ( !gXmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Warning: %s\n", gXmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str());
if ( gXmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Error: %s\n", gXmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str());
}
if ( !b ) return breakpoint(1);
ret = validate_array_tests();
if ( ret ) return ret;
ret = validate_dict_tests();
if ( ret ) return ret;
ret = xml_integer_tests();
if ( ret ) return ret;

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 can be a semitransparent rectangular at the screen centre as it was in Clover v1.0
STATIC REFIT_MENU_SCREEN AlertMessageMenu(0, XStringW(), XStringW(), &MenuEntryReturn, NULL);
void AlertMessage(IN XStringW& Title, IN CONST XStringW& Message)
void AlertMessage(const XStringW& Title, const XStringW& Message)
{
CreateInfoLines(Message, &AlertMessageMenu.InfoLines);
AlertMessageMenu.Title = Title;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2395,7 +2395,7 @@ GetListOfDsdts()
if (DirEntry->FileName[0] == L'.') {
continue;
}
if ( gSettings.DsdtName.equalIC(DirEntry->FileName) ) {
if ( gSettings.ACPI.DSDT.DsdtName.equalIC(DirEntry->FileName) ) {
OldChosenDsdt = DsdtsNum;
}
NameLen = StrLen(DirEntry->FileName); //with ".aml"
@ -2412,7 +2412,6 @@ GetListOfACPI()
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry = NULL;
ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
INTN Count = gSettings.DisabledAMLCount;
// XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str());
while (ACPIPatchedAML != NULL) {
@ -2440,10 +2439,12 @@ GetListOfACPI()
ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above
ACPIPatchedAMLTmp->FileName = SWPrintf("%ls", DirEntry->FileName).forgetDataWithoutFreeing(); // if changing, notice freepool above
INTN Count = gSettings.ACPI.DisabledAML.size();
for (INTN i = 0; i < Count; i++) {
if ((gSettings.DisabledAML[i] != NULL) &&
(StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.DisabledAML[i]) == 0)
) {
if ( gSettings.ACPI.DisabledAML[i].equalIC(ACPIPatchedAMLTmp->FileName) ) {
// if ((gSettings.ACPI.DisabledAML[i] != NULL) &&
// (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0)
// ) {
ACPIDisabled = TRUE;
break;
}
@ -2519,6 +2520,41 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
#endif
/*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
void afterGetUserSettings(SETTINGS_DATA& gSettings)
{
//set to drop
if (GlobalConfig.ACPIDropTables) {
for ( size_t idx = 0 ; idx < gSettings.ACPI.ACPIDropTablesArray.size() ; ++idx)
{
ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables;
DBG(" - [%02zd]: Drop table : %08X, %16llx : ", idx, gSettings.ACPI.ACPIDropTablesArray[idx].Signature, gSettings.ACPI.ACPIDropTablesArray[idx].TableId);
bool Dropped = FALSE;
while (DropTable) {
if (((gSettings.ACPI.ACPIDropTablesArray[idx].Signature == DropTable->Signature) &&
(!gSettings.ACPI.ACPIDropTablesArray[idx].TableId || (DropTable->TableId == gSettings.ACPI.ACPIDropTablesArray[idx].TableId)) &&
(!gSettings.ACPI.ACPIDropTablesArray[idx].TabLength || (DropTable->Length == gSettings.ACPI.ACPIDropTablesArray[idx].TabLength))) ||
(!gSettings.ACPI.ACPIDropTablesArray[idx].Signature && (DropTable->TableId == gSettings.ACPI.ACPIDropTablesArray[idx].TableId))) {
DropTable->MenuItem.BValue = TRUE;
DropTable->OtherOS = gSettings.ACPI.ACPIDropTablesArray[idx].OtherOS;
gSettings.ACPI.SSDT.DropSSDT = FALSE; //if one item=true then dropAll=false by default
//DBG(" true");
Dropped = TRUE;
}
DropTable = DropTable->Next;
}
DBG(" %s\n", Dropped ? "yes" : "no");
}
}
}
#pragma GCC diagnostic pop
//
// main entry point
//
@ -2581,14 +2617,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage);
// if ( !EFI_ERROR(Status) ) {
// XString8 msg = S8Printf("Clover : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
// XString8 msg = S8Printf("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
// SerialPortWrite((UINT8*)msg.c_str(), msg.length());
// }
if ( !EFI_ERROR(Status) ) DBG("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
#ifdef JIEF_DEBUG
gBS->Stall(1500000); // to give time to gdb to connect
// gBS->Stall(0500000); // to give time to gdb to connect
gBS->Stall(2500000); // to give time to gdb to connect
// PauseForKey(L"press\n");
#endif
}
@ -2965,6 +3000,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
for (i=0; i<2; i++) {
if (gConfigDict[i]) {
Status = GetUserSettings(gConfigDict[i], gSettings);
afterGetUserSettings(gSettings);
if (EFI_ERROR(Status)) {
DBG("Error in Second part of settings %llu: %s\n", i, efiStrError(Status));
}
@ -3356,16 +3392,17 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
#ifdef ENABLE_SECURE_BOOT
if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
EnableSecureBoot();
MainLoopRunning = FALSE;
AfterTool = TRUE;
}
if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot
MainLoopRunning = !ConfigureSecureBoot();
AfterTool = TRUE;
}
panic("not done yet");
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
// EnableSecureBoot();
// MainLoopRunning = FALSE;
// AfterTool = TRUE;
// }
//
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot
// MainLoopRunning = !ConfigureSecureBoot();
// AfterTool = TRUE;
// }
#endif // ENABLE_SECURE_BOOT
if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options

View File

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