2021-04-28 20:30:34 +02:00
/*
* ConfigPlist . h
*
* Created on : Oct 9 , 2020
* Author : jief
*/
# ifndef _CONFIGPLISTCLASS_H_
# define _CONFIGPLISTCLASS_H_
# include "../../include/VolumeTypes.h"
# include "../../include/OSTypes.h"
# include "../../include/OSFlags.h"
# include "../../include/BootTypes.h"
# include "../../include/Languages.h"
# include "../../include/Devices.h"
# include "../../include/QuirksCodes.h"
# include "../../include/TagTypes.h"
# include "../../include/Pci.h"
# include "../../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants
# include <IndustryStandard/SmBios.h> // for Smbios memory type
# include "../../Platform/guid.h"
2021-05-09 16:13:37 +02:00
# include "../../entry_scan/secureboot.h"
2021-04-28 20:30:34 +02:00
extern " C " {
# include <Protocol/GraphicsOutput.h>
}
# include "../../Platform/cpu.h"
2023-06-11 21:08:12 +02:00
2023-06-22 21:50:58 +02:00
extern UINT8 default_NVCAP [ ] ; // dependency problem. TODO
2021-04-28 20:30:34 +02:00
extern const UINT8 default_dcfg_0 [ ] ;
extern const UINT8 default_dcfg_1 [ ] ;
# include "../../cpp_lib/undefinable.h"
# include "../../cpp_lib/XmlLiteSimpleTypes.h"
# include "../../cpp_lib/XmlLiteCompositeTypes.h"
# include "../../cpp_lib/XmlLiteDictTypes.h"
# include "../../cpp_lib/XmlLiteArrayTypes.h"
# include "../../cpp_lib/XmlLiteUnionTypes.h"
# include "../../cpp_lib/XmlLiteParser.h"
# include "../../cpp_foundation/XString.h"
# include "../../cpp_foundation/XStringArray.h"
# include "../../cpp_foundation/XArray.h"
# include "../../cpp_foundation/XObjArray.h"
# include "../../Platform/Utils.h"
# include "ConfigPlistAbstract.h"
# include "SMBIOSPlist.h"
2023-06-22 21:50:58 +02:00
extern SETTINGS_DATA gSettings ;
2023-05-30 23:17:19 +02:00
2021-04-28 20:30:34 +02:00
class ConfigPlistClass : public ConfigPlistAbstractClass
{
using super = ConfigPlistAbstractClass ;
public :
# include "Config_ACPI.h"
# include "Config_Boot.h"
# include "Config_BootGraphics.h"
# include "Config_CPU.h"
# include "Config_Devices.h"
# include "Config_GUI.h"
# include "Config_Graphics.h"
# include "Config_KernelAndKextPatches.h"
# include "Config_SystemParameters.h"
# include "Config_RtVariables.h"
# include "Config_Quirks.h"
ACPI_Class ACPI = ACPI_Class ( ) ;
Boot_Class Boot = Boot_Class ( ) ;
BootGraphics_Class BootGraphics = BootGraphics_Class ( ) ;
CPU_Class CPU = CPU_Class ( ) ;
DevicesClass Devices = DevicesClass ( ) ;
XmlStringWArray DisableDrivers = XmlStringWArray ( ) ;
GUI_Class GUI = GUI_Class ( ) ;
2023-06-16 23:44:39 +02:00
Graphics_Class Graphics ; // Cannot do this : = Graphics_Class(*this); because of a MSVC bug. Compilation failed at assignment of m_fields because all member become const.
2021-04-28 20:30:34 +02:00
KernelAndKextPatches_Class KernelAndKextPatches = KernelAndKextPatches_Class ( ) ;
2023-06-11 20:34:02 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS = SmbiosPlistClass : : SmbiosDictClass ( ) ; // use the same dict as for standalone smbios plist
2023-06-16 23:44:39 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_lion = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-18 20:54:30 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_cougar = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-16 23:44:39 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_mav = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-18 20:54:30 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_yos = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-16 23:44:39 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_cap = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-18 20:54:30 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_sierra = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-16 23:44:39 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_hsierra = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_moja = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_cata = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_bigsur = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_monterey = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_ventura = SmbiosPlistClass : : SmbiosDictClass ( ) ;
SmbiosPlistClass : : SmbiosDictClass SMBIOS_sonoma = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2024-05-19 19:25:30 +02:00
SmbiosPlistClass : : SmbiosDictClass SMBIOS_fifteen = SmbiosPlistClass : : SmbiosDictClass ( ) ;
2023-06-16 23:44:39 +02:00
// SmbiosPlistClass::SmbiosDictClass SMBIOS_lion = SmbiosPlistClass::SmbiosDictClass();
2021-04-28 20:30:34 +02:00
public :
SystemParameters_Class SystemParameters = SystemParameters_Class ( ) ;
RtVariables_Class RtVariables = RtVariables_Class ( ) ;
Quirks_Class Quirks = Quirks_Class ( ) ;
2024-05-19 19:25:30 +02:00
XmlDictField m_fields [ 27 ] = {
2021-04-28 20:30:34 +02:00
{ " ACPI " , ACPI } ,
{ " Boot " , Boot } ,
{ " BootGraphics " , BootGraphics } ,
{ " CPU " , CPU } ,
{ " Devices " , Devices } ,
{ " DisableDrivers " , DisableDrivers } ,
{ " GUI " , GUI } ,
{ " Graphics " , Graphics } ,
{ " KernelAndKextPatches " , KernelAndKextPatches } ,
{ " SMBIOS " , SMBIOS } ,
2023-06-16 23:44:39 +02:00
{ " SMBIOS_lion " , SMBIOS_lion } ,
2023-06-18 20:54:30 +02:00
{ " SMBIOS_cougar " , SMBIOS_cougar } ,
2023-06-16 23:44:39 +02:00
{ " SMBIOS_mav " , SMBIOS_mav } ,
2023-06-18 20:54:30 +02:00
{ " SMBIOS_yos " , SMBIOS_yos } ,
2023-06-16 23:44:39 +02:00
{ " SMBIOS_cap " , SMBIOS_cap } ,
2023-06-18 20:54:30 +02:00
{ " SMBIOS_sierra " , SMBIOS_sierra } ,
2023-06-16 23:44:39 +02:00
{ " SMBIOS_hsierra " , SMBIOS_hsierra } ,
{ " SMBIOS_moja " , SMBIOS_moja } ,
{ " SMBIOS_cata " , SMBIOS_cata } ,
{ " SMBIOS_bigsur " , SMBIOS_bigsur } ,
{ " SMBIOS_monterey " , SMBIOS_monterey } ,
{ " SMBIOS_ventura " , SMBIOS_ventura } ,
{ " SMBIOS_sonoma " , SMBIOS_sonoma } ,
2024-05-19 19:25:30 +02:00
{ " SMBIOS_fifteen " , SMBIOS_fifteen } ,
2021-04-28 20:30:34 +02:00
{ " SystemParameters " , SystemParameters } ,
{ " RtVariables " , RtVariables } ,
{ " Quirks " , Quirks } ,
} ;
public :
2021-05-08 11:34:17 +02:00
ConfigPlistClass ( ) : Graphics ( * this ) { }
2021-04-28 20:30:34 +02:00
virtual void getFields ( XmlDictField * * fields , size_t * nb ) override { * fields = m_fields ; * nb = sizeof ( m_fields ) / sizeof ( m_fields [ 0 ] ) ; } ;
2021-09-28 15:54:31 +02:00
virtual XBool validate ( XmlLiteParser * xmlLiteParser , const XString8 & xmlPath , const XmlParserPosition & keyPos , XBool generateErrors ) override {
2021-10-21 11:53:15 +02:00
bool b = super : : validate ( xmlLiteParser , xmlPath , keyPos , generateErrors ) ;
2021-05-19 14:11:21 +02:00
if ( LString8 ( ACPI . DSDT . Fixes . ACPI_DSDT_Fixe_Array [ 29 ] . getNewName ( ) ) ! = " FixHeaders_20000000 " _XS8 ) {
log_technical_bug ( " ACPI_DSDT_Fixe_Array[29].getNewName() != \" FixHeaders_20000000 \" " ) ;
}
if ( ACPI . getFixHeaders ( ) . isDefined ( ) & & ACPI . DSDT . Fixes . ACPI_DSDT_Fixe_Array [ 29 ] . isDefined ( ) ) {
if ( ACPI . getFixHeaders ( ) . value ( ) = = ACPI . DSDT . Fixes . ACPI_DSDT_Fixe_Array [ 29 ] . dgetEnabled ( ) ) {
xmlLiteParser - > addWarning ( generateErrors , S8Printf ( " FixHeaders exists in ACPI and ACPI/DSDT/Fixes. Delete FixHeaders from ACPI/DSDT/Fixes. " ) ) ;
} else {
if ( ACPI . getFixHeaders ( ) . value ( ) | | ACPI . DSDT . Fixes . ACPI_DSDT_Fixe_Array [ 29 ] . dgetEnabled ( ) ) {
if ( ACPI . getFixHeaders ( ) . value ( ) ) {
xmlLiteParser - > addWarning ( generateErrors , S8Printf ( " FixHeaders exists in ACPI and ACPI/DSDT/Fixes with a different value. Using value of ACPI/FixHeaders. Delete FixHeaders from ACPI/DSDT/Fixes. " ) ) ;
} else {
xmlLiteParser - > addWarning ( generateErrors , S8Printf ( " FixHeaders exists in ACPI and ACPI/DSDT/Fixes with a different value. Using value of ACPI/DSDT/Fixes/FixHeaders. Delete FixHeaders from ACPI/DSDT/Fixes and set ACPI/FixHeaders to true. " ) ) ;
}
}
}
}
2021-10-21 11:53:15 +02:00
return b ;
2021-05-19 14:11:21 +02:00
}
2021-04-28 20:30:34 +02:00
const decltype ( DisableDrivers ) : : ValueType & dgetDisabledDriverArray ( ) const { return DisableDrivers . isDefined ( ) ? DisableDrivers . value ( ) : DisableDrivers . nullValue ; } ;
2023-06-16 23:44:39 +02:00
const decltype ( SMBIOS ) & getSMBIOS ( ) const {
for ( size_t i = 0 ; i < sizeof ( m_fields ) / sizeof ( m_fields [ 0 ] ) ; i + + ) {
XStringW h ;
h . takeValueFrom ( m_fields [ i ] . m_name ) ;
if ( SmbiosList . size ( ) > 0 & & SmbiosList [ OldChosenSmbios ] = = h ) {
return static_cast < SmbiosPlistClass : : SmbiosDictClass & > ( m_fields [ i ] . xmlAbstractType ) ;
}
}
return SMBIOS ;
} ;
2021-04-28 20:30:34 +02:00
} ;
# endif /* _CONFIGPLISTCLASS_H_ */