From 89933f64ac6cacff1c15c542df38ffe761757b6f Mon Sep 17 00:00:00 2001 From: jief Date: Thu, 16 Apr 2020 10:48:13 +0300 Subject: [PATCH] Remove struct definitions from Plateform.h --- rEFIt_UEFI/Platform/AcpiPatcher.h | 23 ++ rEFIt_UEFI/Platform/AmlGenerator.h | 20 ++ rEFIt_UEFI/Platform/BootOptions.cpp | 1 + rEFIt_UEFI/Platform/BootOptions.h | 42 +++ rEFIt_UEFI/Platform/DataHubCpu.cpp | 1 - rEFIt_UEFI/Platform/FixBiosDsdt.cpp | 3 + rEFIt_UEFI/Platform/FixBiosDsdt.h | 8 + rEFIt_UEFI/Platform/Platform.h | 408 ------------------------- rEFIt_UEFI/Platform/Settings.cpp | 1 - rEFIt_UEFI/Platform/Settings.h | 18 ++ rEFIt_UEFI/Platform/StateGenerator.cpp | 22 ++ rEFIt_UEFI/Platform/card_vlist.h | 14 + rEFIt_UEFI/Platform/cpu.cpp | 1 + rEFIt_UEFI/Platform/cpu.h | 57 ++++ rEFIt_UEFI/Platform/nvidia.h | 3 +- rEFIt_UEFI/Platform/platformdata.h | 130 ++++++++ rEFIt_UEFI/Platform/plist.cpp | 10 + rEFIt_UEFI/Platform/smbios.cpp | 3 + rEFIt_UEFI/Platform/smbios.h | 43 +++ rEFIt_UEFI/Platform/spd.cpp | 2 +- 20 files changed, 398 insertions(+), 412 deletions(-) diff --git a/rEFIt_UEFI/Platform/AcpiPatcher.h b/rEFIt_UEFI/Platform/AcpiPatcher.h index fee2d203a..1507d364a 100644 --- a/rEFIt_UEFI/Platform/AcpiPatcher.h +++ b/rEFIt_UEFI/Platform/AcpiPatcher.h @@ -8,6 +8,29 @@ #ifndef PLATFORM_ACPIPATCHER_H_ #define PLATFORM_ACPIPATCHER_H_ + + +#pragma pack(push) +#pragma pack(1) + +typedef struct { + + EFI_ACPI_DESCRIPTION_HEADER Header; + UINT32 Entry; + +} RSDT_TABLE; + +typedef struct { + + EFI_ACPI_DESCRIPTION_HEADER Header; + UINT64 Entry; + +} XSDT_TABLE; + +#pragma pack(pop) + + + extern UINT64 BiosDsdt; extern UINT32 BiosDsdtLen; #define acpi_cpu_max 128 diff --git a/rEFIt_UEFI/Platform/AmlGenerator.h b/rEFIt_UEFI/Platform/AmlGenerator.h index 164abc033..6c99c6e3f 100644 --- a/rEFIt_UEFI/Platform/AmlGenerator.h +++ b/rEFIt_UEFI/Platform/AmlGenerator.h @@ -18,6 +18,26 @@ static inline BOOLEAN aml_isvalidchar(char c) return IS_UPPER(c) || IS_DIGIT(c) || c == '_'; }; */ + + +struct aml_chunk +{ + UINT8 Type; + UINT8 pad; + UINT16 Length; + UINT32 pad2; + CHAR8 *Buffer; + + UINT16 Size; + UINT16 pad3[3]; + + struct aml_chunk* Next; + struct aml_chunk* First; + struct aml_chunk* Last; +}; +typedef struct aml_chunk AML_CHUNK; + + BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node); AML_CHUNK* aml_create_node(AML_CHUNK* parent); VOID aml_destroy_node(AML_CHUNK* node); diff --git a/rEFIt_UEFI/Platform/BootOptions.cpp b/rEFIt_UEFI/Platform/BootOptions.cpp index b818c89cf..465f9e3e7 100644 --- a/rEFIt_UEFI/Platform/BootOptions.cpp +++ b/rEFIt_UEFI/Platform/BootOptions.cpp @@ -9,6 +9,7 @@ #include "Platform.h" +#include "BootOptions.h" #include "BasicIO.h" #include "Nvram.h" diff --git a/rEFIt_UEFI/Platform/BootOptions.h b/rEFIt_UEFI/Platform/BootOptions.h index 2766c6d0a..6f27338d8 100644 --- a/rEFIt_UEFI/Platform/BootOptions.h +++ b/rEFIt_UEFI/Platform/BootOptions.h @@ -8,6 +8,48 @@ #ifndef PLATFORM_BOOTOPTIONS_H_ #define PLATFORM_BOOTOPTIONS_H_ +typedef struct { + /// + /// XXXX in BootXXXX. + /// + UINT16 BootNum; + /// + /// Pointer to raw EFI_LOAD_OPTION (BootXXXX) variable content. + /// + VOID *Variable; + /// + /// Variable size in bytes. + /// + UINTN VariableSize; + /// + /// BootOption Attributes (first 4 bytes from Variable). + /// + UINT32 Attributes; + /// + /// BootOption FilePathListLength (next 2 bytes from Variable). + /// + UINT16 FilePathListLength; + /// + /// Null terminated BootOption Description (pointer to 6th byte of Variable). + /// + CONST CHAR16 *Description; + /// + /// Size in bytes of BootOption Description. + /// + UINTN DescriptionSize; + /// + /// Pointer to BootOption FilePathList. + /// + EFI_DEVICE_PATH_PROTOCOL *FilePathList; + /// + /// Pointer to BootOption OptionalData. + /// + UINT8 *OptionalData; + /// + /// BootOption OptionalData size in bytes. + /// + UINTN OptionalDataSize; +} BO_BOOT_OPTION; /** Finds and returns pointer to specified DevPath node in DevicePath or NULL. */ diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index 69c083b76..e49123850 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -69,7 +69,6 @@ EFI_GUID gDataHubPlatformGuid = { extern EFI_GUID gDataHubPlatformGuid; extern APPLE_SMC_IO_PROTOCOL *gAppleSmc; extern UINTN RtVariablesNum; -extern RT_VARIABLES *RtVariables; typedef union { diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index 600e118ab..3cc37cdaa 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -6,6 +6,7 @@ // NForce additions by Oscar09, 2013 #include "Platform.h" +#include "FixBiosDsdt.h" #include "StateGenerator.h" #include "AcpiPatcher.h" #include "cpu.h" @@ -32,6 +33,8 @@ extern "C" { #define DBG(...) DebugLog(DEBUG_FIX, __VA_ARGS__) #endif + + OPER_REGION *gRegions = NULL; CHAR8* device_name[12]; // 0=>Display 1=>network 2=>firewire 3=>LPCB 4=>HDAAudio 5=>RTC 6=>TMR 7=>SBUS 8=>PIC 9=>Airport 10=>XHCI 11=>HDMI diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.h b/rEFIt_UEFI/Platform/FixBiosDsdt.h index e99ddd59f..95987ce2b 100644 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.h +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.h @@ -9,6 +9,14 @@ #define PLATFORM_FIXBIOSDSDT_H_ +struct _oper_region { + CHAR8 Name[8]; + UINT32 Address; + struct _oper_region *next; +}; +typedef struct _oper_region OPER_REGION; + + VOID FixBiosDsdt ( UINT8 *Dsdt, diff --git a/rEFIt_UEFI/Platform/Platform.h b/rEFIt_UEFI/Platform/Platform.h index a7a6b8ab6..d23cc8e61 100755 --- a/rEFIt_UEFI/Platform/Platform.h +++ b/rEFIt_UEFI/Platform/Platform.h @@ -669,416 +669,8 @@ MSR C001006B 0000-0000-0000-0000 // User policy, white and black list with query #define SECURE_BOOT_POLICY_USER (6) -// ADDRESS_OF -/// Get the address of a structure member -/// @param INSTANCETYPE The type of the instance structure -/// @param Instance An instance of a structure to get the address of a member -/// @param FIELDTYPE The type of the member field -/// @param Field The name of the field of which to get the address -/// @return The address of the offset of the member field in the instance structure -//#define ADDRESS_OF(INSTANCETYPE, Instance, FIELDTYPE, Field) (FIELDTYPE *)(((UINT8 *)(Instance)) + OFFSET_OF(INSTANCETYPE, Field)) -struct aml_chunk -{ - UINT8 Type; - UINT8 pad; - UINT16 Length; - UINT32 pad2; - CHAR8 *Buffer; - - UINT16 Size; - UINT16 pad3[3]; - - struct aml_chunk* Next; - struct aml_chunk* First; - struct aml_chunk* Last; -}; -typedef struct aml_chunk AML_CHUNK; - -struct p_state_vid_fid -{ - UINT8 VID; // Voltage ID - UINT8 FID; // Frequency ID -}; - -union p_state_control -{ - UINT16 Control; - struct p_state_vid_fid VID_FID; -}; - -struct p_state -{ - union p_state_control Control; - - UINT32 CID; // Compare ID - UINT32 Frequency; -}; -typedef struct p_state P_STATE; - -struct _oper_region { - CHAR8 Name[8]; - UINT32 Address; - struct _oper_region *next; -}; -typedef struct _oper_region OPER_REGION; - - -struct Symbol { - UINTN refCount; - struct Symbol *next; - CHAR8 string[1]; -}; - -typedef struct Symbol Symbol, *SymbolPtr; - -#pragma pack(push) -#pragma pack(1) - -typedef struct { - - EFI_ACPI_DESCRIPTION_HEADER Header; - UINT32 Entry; - -} RSDT_TABLE; - -typedef struct { - - EFI_ACPI_DESCRIPTION_HEADER Header; - UINT64 Entry; - -} XSDT_TABLE; -/* -typedef struct { - UINT32 Data1; - UINT16 Data2; - UINT16 Data3; - UINT8 Data4[8]; -} GUID; -*/ - -#pragma pack(pop) - -typedef struct RT_VARIABLES RT_VARIABLES; -struct RT_VARIABLES { -// BOOLEAN Disabled; - CHAR16 *Name; - EFI_GUID VarGuid; -}; -//no more used? - -// SysVariables -typedef struct SYSVARIABLES SYSVARIABLES; -struct SYSVARIABLES -{ - SYSVARIABLES *Next; - CHAR16 *Key; - INPUT_ITEM MenuItem; -}; - -// -// rellocate new guid for smbios table type 1 -// -#define REMAP_SMBIOS_TABLE_GUID { 0xeb9d2d35, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } - - -typedef struct { - //values from CPUID - UINT32 CPUID[CPUID_MAX][4]; - UINT32 Vendor; - UINT32 Signature; - UINT32 Family; - UINT32 Model; - UINT32 Stepping; - UINT32 Type; - UINT32 Extmodel; - UINT32 Extfamily; - UINT64 Features; - UINT64 ExtFeatures; - UINT32 CoresPerPackage; - UINT32 LogicalPerPackage; - CHAR8 BrandString[48]; - - //values from BIOS - UINT64 ExternalClock; - UINT32 MaxSpeed; //MHz - UINT32 CurrentSpeed; //MHz -// UINT32 Pad; - - //calculated from MSR - UINT64 MicroCode; - UINT64 ProcessorFlag; - UINT32 MaxRatio; - UINT32 SubDivider; - UINT32 MinRatio; - UINT32 DynFSB; - UINT64 ProcessorInterconnectSpeed; //MHz - UINT64 FSBFrequency; //Hz - UINT64 CPUFrequency; - UINT64 TSCFrequency; - UINT8 Cores; - UINT8 EnabledCores; - UINT8 Threads; - UINT8 Mobile; //not for i3-i7 - BOOLEAN Turbo; - UINT8 Pad2[3]; - - /* Core i7,5,3 */ - UINT16 Turbo1; //1 Core - UINT16 Turbo2; //2 Core - UINT16 Turbo3; //3 Core - UINT16 Turbo4; //4 Core - - UINT64 TSCCalibr; - UINT64 ARTFrequency; - -} CPU_STRUCTURE; - -typedef enum { - - MacBook11, - MacBook21, - MacBook31, - MacBook41, - MacBook51, - MacBook52, - MacBook61, - MacBook71, - MacBook81, - MacBook91, - MacBook101, - MacBookPro11, - MacBookPro12, - MacBookPro21, - MacBookPro22, - MacBookPro31, - MacBookPro41, - MacBookPro51, - MacBookPro52, - MacBookPro53, - MacBookPro54, - MacBookPro55, - MacBookPro61, - MacBookPro62, - MacBookPro71, - MacBookPro81, - MacBookPro82, - MacBookPro83, - MacBookPro91, - MacBookPro92, - MacBookPro101, - MacBookPro102, - MacBookPro111, - MacBookPro112, - MacBookPro113, - MacBookPro114, - MacBookPro115, - MacBookPro121, - MacBookPro131, - MacBookPro132, - MacBookPro133, - MacBookPro141, - MacBookPro142, - MacBookPro143, - MacBookPro151, - MacBookPro152, - MacBookPro153, - MacBookPro154, - MacBookPro161, - MacBookAir11, - MacBookAir21, - MacBookAir31, - MacBookAir32, - MacBookAir41, - MacBookAir42, - MacBookAir51, - MacBookAir52, - MacBookAir61, - MacBookAir62, - MacBookAir71, - MacBookAir72, - MacBookAir81, - MacBookAir82, - MacBookAir91, - MacMini11, - MacMini21, - MacMini31, - MacMini41, - MacMini51, - MacMini52, - MacMini53, - MacMini61, - MacMini62, - MacMini71, - MacMini81, - iMac41, - iMac42, - iMac51, - iMac52, - iMac61, - iMac71, - iMac81, - iMac91, - iMac101, - iMac111, - iMac112, - iMac113, - iMac121, - iMac122, - iMac131, - iMac132, - iMac133, - iMac141, - iMac142, - iMac143, - iMac144, - iMac151, - iMac161, - iMac162, - iMac171, - iMac181, - iMac182, - iMac183, - iMac191, - iMac192, - iMacPro11, - MacPro11, - MacPro21, - MacPro31, - MacPro41, - MacPro51, - MacPro61, - MacPro71, - Xserve11, - Xserve21, - Xserve31, - - MaxMachineType - -} MACHINE_TYPES; - -typedef struct { - BOOLEAN InUse; - UINT8 Type; - UINT16 pad0; - UINT32 pad1; - UINT32 ModuleSize; - UINT32 Frequency; - CONST CHAR8* Vendor; - CHAR8* PartNo; - CHAR8* SerialNo; -} RAM_SLOT_INFO; - -// The maximum number of RAM slots to detect -// even for 3-channels chipset X58 there are no more then 8 slots -#define MAX_RAM_SLOTS 24 -// The maximum sane frequency for a RAM module -#define MAX_RAM_FREQUENCY 5000 - -typedef struct { - - UINT32 Frequency; - UINT32 Divider; - UINT8 TRC; - UINT8 TRP; - UINT8 RAS; - UINT8 Channels; - UINT8 Slots; - UINT8 Type; - UINT8 SPDInUse; - UINT8 SMBIOSInUse; - UINT8 UserInUse; - UINT8 UserChannels; - UINT8 pad[2]; - - RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4]; - RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4]; - RAM_SLOT_INFO User[MAX_RAM_SLOTS * 4]; - -} MEM_STRUCTURE; -//unused -/* -typedef struct { - UINT8 MaxMemorySlots; // number of memory slots polulated by SMBIOS - UINT8 CntMemorySlots; // number of memory slots counted - UINT16 MemoryModules; // number of memory modules installed - UINT8 DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot -} DMI; -*/ - - -typedef struct { - UINT32 Signature; - LIST_ENTRY Link; - CHAR8 Model[64]; - UINT32 Id; - UINT32 SubId; - UINT64 VideoRam; - UINTN VideoPorts; - BOOLEAN LoadVBios; -} CARDLIST; - -typedef struct { - /// - /// XXXX in BootXXXX. - /// - UINT16 BootNum; - /// - /// Pointer to raw EFI_LOAD_OPTION (BootXXXX) variable content. - /// - VOID *Variable; - /// - /// Variable size in bytes. - /// - UINTN VariableSize; - /// - /// BootOption Attributes (first 4 bytes from Variable). - /// - UINT32 Attributes; - /// - /// BootOption FilePathListLength (next 2 bytes from Variable). - /// - UINT16 FilePathListLength; - /// - /// Null terminated BootOption Description (pointer to 6th byte of Variable). - /// - CONST CHAR16 *Description; - /// - /// Size in bytes of BootOption Description. - /// - UINTN DescriptionSize; - /// - /// Pointer to BootOption FilePathList. - /// - EFI_DEVICE_PATH_PROTOCOL *FilePathList; - /// - /// Pointer to BootOption OptionalData. - /// - UINT8 *OptionalData; - /// - /// BootOption OptionalData size in bytes. - /// - UINTN OptionalDataSize; -} BO_BOOT_OPTION; - -#define CARDLIST_SIGNATURE SIGNATURE_32('C','A','R','D') - - -//extern EFI_GUID gEfiAppleBootGuid; -//extern EFI_GUID gEfiAppleNvramGuid; -//extern EFI_GUID AppleSystemInfoProducerName; -//extern EFI_GUID gAppleDevicePropertyProtocolGuid; -//extern EFI_GUID gAppleFramebufferInfoProtocolGuid; -//extern EFI_GUID gEfiAppleVendorGuid; -//extern EFI_GUID gEfiPartTypeSystemPartGuid; -//extern EFI_GUID gMsgLogProtocolGuid; -//extern EFI_GUID gEfiLegacy8259ProtocolGuid; - - - -//----------------------------------- - #include "BootLog.h" diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 40b8a6b88..a7280109f 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -131,7 +131,6 @@ EFI_GUID gUuid; EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL; -extern MEM_STRUCTURE gRAM; extern BOOLEAN NeedPMfix; //extern INTN OldChosenAudio; diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index b20c515b3..7fe99eb7b 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -1,6 +1,16 @@ #ifndef __SETTINGS_H__ #define __SETTINGS_H__ + +//// SysVariables +//typedef struct SYSVARIABLES SYSVARIABLES; +//struct SYSVARIABLES +//{ +// SYSVARIABLES *Next; +// CHAR16 *Key; +// INPUT_ITEM MenuItem; +//}; + typedef struct { CHAR16 *Name; // CHAR8 *LineName; @@ -580,6 +590,14 @@ struct SIDELOAD_KEXT { INPUT_ITEM MenuItem; }; +typedef struct RT_VARIABLES RT_VARIABLES; +struct RT_VARIABLES { +// BOOLEAN Disabled; + CHAR16 *Name; + EFI_GUID VarGuid; +}; +extern RT_VARIABLES *RtVariables; + extern UINTN AudioNum; extern HDA_OUTPUTS AudioList[20]; diff --git a/rEFIt_UEFI/Platform/StateGenerator.cpp b/rEFIt_UEFI/Platform/StateGenerator.cpp index 0589e7eea..8aefe9587 100644 --- a/rEFIt_UEFI/Platform/StateGenerator.cpp +++ b/rEFIt_UEFI/Platform/StateGenerator.cpp @@ -50,6 +50,28 @@ UINT8 plugin_type[] = 0x65, 0x00, }; + +struct p_state_vid_fid +{ + UINT8 VID; // Voltage ID + UINT8 FID; // Frequency ID +}; + +union p_state_control +{ + UINT16 Control; + struct p_state_vid_fid VID_FID; +}; + +struct p_state +{ + union p_state_control Control; + + UINT32 CID; // Compare ID + UINT32 Frequency; +}; +typedef struct p_state P_STATE; + SSDT_TABLE *generate_pss_ssdt(UINTN Number) { CHAR8 name[31]; diff --git a/rEFIt_UEFI/Platform/card_vlist.h b/rEFIt_UEFI/Platform/card_vlist.h index 2d1eadc60..04a1330bf 100644 --- a/rEFIt_UEFI/Platform/card_vlist.h +++ b/rEFIt_UEFI/Platform/card_vlist.h @@ -9,6 +9,20 @@ #define PLATFORM_CARD_VLIST_H_ +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + CHAR8 Model[64]; + UINT32 Id; + UINT32 SubId; + UINT64 VideoRam; + UINTN VideoPorts; + BOOLEAN LoadVBios; +} CARDLIST; + + +#define CARDLIST_SIGNATURE SIGNATURE_32('C','A','R','D') + VOID FillCardList ( diff --git a/rEFIt_UEFI/Platform/cpu.cpp b/rEFIt_UEFI/Platform/cpu.cpp index 596eb6db9..e6a670271 100644 --- a/rEFIt_UEFI/Platform/cpu.cpp +++ b/rEFIt_UEFI/Platform/cpu.cpp @@ -35,6 +35,7 @@ */ #include "Platform.h" +#include "cpu.h" #include "smbios.h" #ifndef DEBUG_ALL diff --git a/rEFIt_UEFI/Platform/cpu.h b/rEFIt_UEFI/Platform/cpu.h index 5e7fb4adb..2f9404385 100644 --- a/rEFIt_UEFI/Platform/cpu.h +++ b/rEFIt_UEFI/Platform/cpu.h @@ -8,6 +8,63 @@ #ifndef PLATFORM_CPU_H_ #define PLATFORM_CPU_H_ +#include "platformdata.h" + + +typedef struct { + //values from CPUID + UINT32 CPUID[CPUID_MAX][4]; + UINT32 Vendor; + UINT32 Signature; + UINT32 Family; + UINT32 Model; + UINT32 Stepping; + UINT32 Type; + UINT32 Extmodel; + UINT32 Extfamily; + UINT64 Features; + UINT64 ExtFeatures; + UINT32 CoresPerPackage; + UINT32 LogicalPerPackage; + CHAR8 BrandString[48]; + + //values from BIOS + UINT64 ExternalClock; + UINT32 MaxSpeed; //MHz + UINT32 CurrentSpeed; //MHz +// UINT32 Pad; + + //calculated from MSR + UINT64 MicroCode; + UINT64 ProcessorFlag; + UINT32 MaxRatio; + UINT32 SubDivider; + UINT32 MinRatio; + UINT32 DynFSB; + UINT64 ProcessorInterconnectSpeed; //MHz + UINT64 FSBFrequency; //Hz + UINT64 CPUFrequency; + UINT64 TSCFrequency; + UINT8 Cores; + UINT8 EnabledCores; + UINT8 Threads; + UINT8 Mobile; //not for i3-i7 + BOOLEAN Turbo; + UINT8 Pad2[3]; + + /* Core i7,5,3 */ + UINT16 Turbo1; //1 Core + UINT16 Turbo2; //2 Core + UINT16 Turbo3; //3 Core + UINT16 Turbo4; //4 Core + + UINT64 TSCCalibr; + UINT64 ARTFrequency; + +} CPU_STRUCTURE; + + + extern UINT64 TurboMsr; extern CPU_STRUCTURE gCPUStructure; diff --git a/rEFIt_UEFI/Platform/nvidia.h b/rEFIt_UEFI/Platform/nvidia.h index d80772612..fa138f5f6 100644 --- a/rEFIt_UEFI/Platform/nvidia.h +++ b/rEFIt_UEFI/Platform/nvidia.h @@ -50,7 +50,8 @@ #ifndef __LIBSAIO_NVIDIA_H #define __LIBSAIO_NVIDIA_H -#include "device_inject.h" +//#include "device_inject.h" +#include "card_vlist.h" extern CHAR8* gDeviceProperties; diff --git a/rEFIt_UEFI/Platform/platformdata.h b/rEFIt_UEFI/Platform/platformdata.h index f702512b7..30ebb34de 100644 --- a/rEFIt_UEFI/Platform/platformdata.h +++ b/rEFIt_UEFI/Platform/platformdata.h @@ -8,6 +8,136 @@ #ifndef PLATFORM_PLATFORMDATA_H_ #define PLATFORM_PLATFORMDATA_H_ + + + +typedef enum { + + MacBook11, + MacBook21, + MacBook31, + MacBook41, + MacBook51, + MacBook52, + MacBook61, + MacBook71, + MacBook81, + MacBook91, + MacBook101, + MacBookPro11, + MacBookPro12, + MacBookPro21, + MacBookPro22, + MacBookPro31, + MacBookPro41, + MacBookPro51, + MacBookPro52, + MacBookPro53, + MacBookPro54, + MacBookPro55, + MacBookPro61, + MacBookPro62, + MacBookPro71, + MacBookPro81, + MacBookPro82, + MacBookPro83, + MacBookPro91, + MacBookPro92, + MacBookPro101, + MacBookPro102, + MacBookPro111, + MacBookPro112, + MacBookPro113, + MacBookPro114, + MacBookPro115, + MacBookPro121, + MacBookPro131, + MacBookPro132, + MacBookPro133, + MacBookPro141, + MacBookPro142, + MacBookPro143, + MacBookPro151, + MacBookPro152, + MacBookPro153, + MacBookPro154, + MacBookPro161, + MacBookAir11, + MacBookAir21, + MacBookAir31, + MacBookAir32, + MacBookAir41, + MacBookAir42, + MacBookAir51, + MacBookAir52, + MacBookAir61, + MacBookAir62, + MacBookAir71, + MacBookAir72, + MacBookAir81, + MacBookAir82, + MacBookAir91, + MacMini11, + MacMini21, + MacMini31, + MacMini41, + MacMini51, + MacMini52, + MacMini53, + MacMini61, + MacMini62, + MacMini71, + MacMini81, + iMac41, + iMac42, + iMac51, + iMac52, + iMac61, + iMac71, + iMac81, + iMac91, + iMac101, + iMac111, + iMac112, + iMac113, + iMac121, + iMac122, + iMac131, + iMac132, + iMac133, + iMac141, + iMac142, + iMac143, + iMac144, + iMac151, + iMac161, + iMac162, + iMac171, + iMac181, + iMac182, + iMac183, + iMac191, + iMac192, + iMacPro11, + MacPro11, + MacPro21, + MacPro31, + MacPro41, + MacPro51, + MacPro61, + MacPro71, + Xserve11, + Xserve21, + Xserve31, + + MaxMachineType + +} MACHINE_TYPES; + + + + + extern CONST CHAR8 *BiosVendor; extern CONST CHAR8 *AppleManufacturer; extern CONST CHAR8 *AppleBoardSN; diff --git a/rEFIt_UEFI/Platform/plist.cpp b/rEFIt_UEFI/Platform/plist.cpp index bf364d8ad..b9963e518 100755 --- a/rEFIt_UEFI/Platform/plist.cpp +++ b/rEFIt_UEFI/Platform/plist.cpp @@ -44,6 +44,16 @@ #endif +struct Symbol { + UINTN refCount; + struct Symbol *next; + CHAR8 string[1]; +}; + +typedef struct Symbol Symbol, *SymbolPtr; + + + SymbolPtr gSymbolsHead = NULL; TagPtr gTagsFree = NULL; CHAR8* buffer_start = NULL; diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 37e056174..3968b51ce 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -20,6 +20,7 @@ **/ #include "Platform.h" +#include "smbios.h" #include "../../Version.h" #include "cpu.h" #include "platformdata.h" @@ -43,6 +44,8 @@ extern "C" { #define DBG(...) DebugLog(DEBUG_SMBIOS, __VA_ARGS__) #endif +#define REMAP_SMBIOS_TABLE_GUID { 0xeb9d2d35, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + #define CPUID_EXTFEATURE_EM64T _Bit(29) #define CPUID_EXTFEATURE_XD _Bit(20) #define CPUID_FEATURE_VMX _HBit(5) diff --git a/rEFIt_UEFI/Platform/smbios.h b/rEFIt_UEFI/Platform/smbios.h index 7163f3882..9f45189f7 100644 --- a/rEFIt_UEFI/Platform/smbios.h +++ b/rEFIt_UEFI/Platform/smbios.h @@ -8,7 +8,50 @@ #ifndef PLATFORM_SMBIOS_H_ #define PLATFORM_SMBIOS_H_ +// The maximum number of RAM slots to detect +// even for 3-channels chipset X58 there are no more then 8 slots +#define MAX_RAM_SLOTS 24 +// The maximum sane frequency for a RAM module +#define MAX_RAM_FREQUENCY 5000 + +typedef struct { + BOOLEAN InUse; + UINT8 Type; + UINT16 pad0; + UINT32 pad1; + UINT32 ModuleSize; + UINT32 Frequency; + CONST CHAR8* Vendor; + CHAR8* PartNo; + CHAR8* SerialNo; +} RAM_SLOT_INFO; + +typedef struct +{ + UINT32 Frequency; + UINT32 Divider; + UINT8 TRC; + UINT8 TRP; + UINT8 RAS; + UINT8 Channels; + UINT8 Slots; + UINT8 Type; + UINT8 SPDInUse; + UINT8 SMBIOSInUse; + UINT8 UserInUse; + UINT8 UserChannels; + UINT8 pad[2]; + + RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4]; + RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4]; + RAM_SLOT_INFO User[MAX_RAM_SLOTS * 4]; + +} MEM_STRUCTURE; + + + extern APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable; +extern MEM_STRUCTURE gRAM; extern BOOLEAN gMobile; diff --git a/rEFIt_UEFI/Platform/spd.cpp b/rEFIt_UEFI/Platform/spd.cpp index 209f6be5d..14ea8b12e 100644 --- a/rEFIt_UEFI/Platform/spd.cpp +++ b/rEFIt_UEFI/Platform/spd.cpp @@ -20,6 +20,7 @@ #include "spd.h" #include "memvendors.h" #include "cpu.h" +#include "smbios.h" #ifndef DEBUG_SPD #ifndef DEBUG_ALL @@ -37,7 +38,6 @@ //extern EFI_DATA_HUB_PROTOCOL *gDataHub; -extern MEM_STRUCTURE gRAM; //extern DMI* gDMI; //==>