Remove struct definitions from Plateform.h

This commit is contained in:
jief 2020-04-16 10:48:13 +03:00
parent e429268dfc
commit 89933f64ac
20 changed files with 398 additions and 412 deletions

View File

@ -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

View File

@ -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);

View File

@ -9,6 +9,7 @@
#include "Platform.h"
#include "BootOptions.h"
#include "BasicIO.h"
#include "Nvram.h"

View File

@ -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. */

View File

@ -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 {

View File

@ -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

View File

@ -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,

View File

@ -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"

View File

@ -131,7 +131,6 @@ EFI_GUID gUuid;
EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
extern MEM_STRUCTURE gRAM;
extern BOOLEAN NeedPMfix;
//extern INTN OldChosenAudio;

View File

@ -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];

View File

@ -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];

View File

@ -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 (

View File

@ -35,6 +35,7 @@
*/
#include "Platform.h"
#include "cpu.h"
#include "smbios.h"
#ifndef DEBUG_ALL

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;
//==>