reduce clover size

Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
Slice 2023-12-16 10:10:04 +03:00
parent 5817644aa0
commit 00466c6e61
5 changed files with 112 additions and 34 deletions

View File

@ -175,7 +175,12 @@ struct net_chipsets_t {
UINT32 id;
CONST CHAR8 *name;
};
#define NET_LESS 1
#if NET_LESS == 1
static struct net_chipsets_t NetChipsets[] = {
{ 0x00000000, "Unknown" },
};
#else
static struct net_chipsets_t NetChipsets[] = {
{ 0x00000000, "Unknown" },
// 8169
@ -222,7 +227,7 @@ static struct net_chipsets_t NetChipsets[] = {
// Atheros AR8151 Ethernet
{ 0x19691083, "Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet" },
};
#endif
struct ide_chipsets_t {
UINT32 id;
};

View File

@ -33,6 +33,19 @@ static value_t aty_nameparent;
card_t *card;
//static value_t aty_model;
#define ATI_LESS 1
#if ATI_LESS
const card_config_t card_configs[] = {
{NULL, 0},
{"Radeon",4},
};
const radeon_card_info_t radeon_cards[] = {
{ 0x67DF, CHIP_FAMILY_ELLESMERE, "AMD Radeon RX 480/570/580", kNull },
{ 0x0000, CHIP_FAMILY_UNKNOW, "AMD Unknown", kNull }
};
#else
const card_config_t card_configs[] = {
{NULL, 0},
/* OLDController */
@ -956,7 +969,7 @@ const radeon_card_info_t radeon_cards[] = {
{ 0x0000, CHIP_FAMILY_UNKNOW, "AMD Unknown", kNull }
};
#endif
//native ID for 10.8.3
/*
ATI7000
@ -1192,6 +1205,13 @@ Lexa-based WX 2100, WX 3100 and WX 3200 do NOT work.
*/
#if ATI_LESS
const CHAR8 *chip_family_name[] = {
"UNKNOW",
"Ellesmere",
""
};
#else
const CHAR8 *chip_family_name[] = {
"UNKNOW",
"R420",
@ -1265,6 +1285,7 @@ const CHAR8 *chip_family_name[] = {
// Navi
""
};
#endif
AtiDevProp ati_devprop_list[] = {
{FLAGTRUE, false, "@0,AAPL,boot-display", get_bootdisplay_val, NULVAL },
@ -2152,11 +2173,11 @@ static XBool init_card(pci_dt_t *pci_dev)
// if (card->cfg_name > 0) // do we want 0 ports if fb is kNull or mistyped ?
// else, match cfg_name with card_configs list and retrive default nr of ports.
for (i = 0; i < kCfgEnd; i++) {
if (AsciiStrCmp(card->cfg_name, card_configs[i].name) == 0) {
card->ports = card_configs[i].ports; // default
}
}
// for (i = 0; i < kCfgEnd; i++) {
// if (AsciiStrCmp(card->cfg_name, card_configs[i].name) == 0) {
// card->ports = card_configs[i].ports; // default
// }
// }
DBG("Nr of ports set to framebuffer's default: %d\n", card->ports);
}

View File

@ -16,6 +16,8 @@
#include "device_inject.h"
#define IGPU_LESS 1
/*
============== Information ===============
https://en.wikipedia.org/wiki/List_of_Intel_chipsets
@ -470,7 +472,14 @@ UINT8 mn_HD3000_os_info[20] = {
0xf0, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x10, 0x07, 0x00, 0x00
};
#if IGPU_LESS
static struct gma_gpu_t KnownGPUS[] = {
{ 0xFFFF, "Intel Unsupported" }, // common name for unsuported devices
{ 0x27A2, "Intel GMA 950" }, // Mobile - Intel 945GM Express Chipset Family - MacBook1,1/MacBook2,1
{ 0x2A12, "Intel GMA X3100" }, // Mobile - Intel 965 Express Chipset Family
};
#else
static struct gma_gpu_t KnownGPUS[] = {
{ 0xFFFF, "Intel Unsupported" }, // common name for unsuported devices
#if WILL_WORK
@ -944,6 +953,7 @@ static struct gma_gpu_t KnownGPUS[] = {
{ 0x4500, "Intel Jasper Lake" }, //
};
#endif
CONST CHAR8 *get_gma_model(UINT16 id)
@ -962,13 +972,13 @@ CONST CHAR8 *get_gma_model(UINT16 id)
XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildVersion, EFI_FILE* RootDir, pci_dt_t *gma_dev)
{
UINTN j;
UINTN i;
// UINTN i;
XString8 devicepath;
CONST CHAR8 *model;
DevPropDevice *device = NULL;
UINT8 BuiltIn = 0x00;
UINT32 FakeID;
UINT32 DualLink = 1;
// UINT32 DualLink = 1;
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
XBool SetUGAWidth = false;
XBool SetUGAHeight = false;
@ -994,7 +1004,7 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
MsgLog("%s [%04hX:%04hX] :: %s\n",
model, gma_dev->vendor_id, gma_dev->device_id, devicepath.c_str());
#if IGPU_LESS == 0
// Resolution
switch (UGAWidth) {
case 640:
@ -1324,7 +1334,7 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
#endif
if (!device_inject_string) {
device_inject_string = devprop_create_string();
}
@ -1338,25 +1348,25 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
return false;
}
if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
if (gSettings.Devices.AddPropertyArray[i].Device != DEV_INTEL) {
continue;
}
Injected = true;
// if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore
// for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) {
// if (gSettings.Devices.AddPropertyArray[i].Device != DEV_INTEL) {
// continue;
// }
// Injected = true;
//
// if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
// //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
// } else {
// devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
// //DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
// }
// }
// }
if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) {
//DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
} else {
devprop_add_value(device, gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].Value);
//DBG(" added property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen);
}
}
}
if (Injected) {
MsgLog(" Additional Intel GFX properties injected, continue\n");
}
// if (Injected) {
// MsgLog(" Additional Intel GFX properties injected, continue\n");
// }
if (gSettings.Devices.UseIntelHDMI) {
devprop_add_value(device, "hda-gfx", (UINT8*)"onboard-1", 10);
@ -1388,6 +1398,19 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
}
}
#if IGPU_LESS == 1
if ((gSettings.Graphics.DualLink == 0) || (gSettings.Graphics.DualLink == 1)) {
if (gSettings.Graphics.DualLink == 1) {
DBG(" DualLink: set to 1\n");
devprop_add_value(device, "AAPL01,DualLink", (UINT8*)&gSettings.Graphics.DualLink, 1);
// DBG(" AAPL01,DualLink = 1\n");
} else {
DBG(" DualLink: set to 0\n");
// DBG(" AAPL01,DualLink: not used\n");
}
}
#else
// DualLink
// Low resolution(1366x768-) - DualLink = 0, but no need it
// High resolution(1400x1050+) - DualLink = 1
@ -1462,7 +1485,7 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
}
break;
}
#endif
if (gSettings.Devices.FakeID.FakeIntel) {
FakeID = gSettings.Devices.FakeID.FakeIntel >> 16;
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
@ -1950,7 +1973,7 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
}
break;
#if IGPU_LESS == 0
//============== 7th generation ============
//----------------Ivy Bridge----------------
//GT1
@ -3341,7 +3364,7 @@ XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildV
case 0x4500: // "Intel Jasper Lake" //
break;
#endif
default:
DBG(" Intel card id=%hX unsupported, please report to the clover thread\n", gma_dev->device_id);
return false;

View File

@ -73,6 +73,7 @@
#define DBG(...) DebugLog(DEBUG_NVIDIA, __VA_ARGS__)
#endif
#define NVIDIA_LESS 1
CHAR8 generic_name[128];
const CHAR8 *nvidia_compatible_0[] = { "@0,compatible", "NVDA,NVMac" };
@ -116,6 +117,26 @@ const UINT8 pwm_info[] = {
};
#define PWM_LEN ( sizeof(pwm_info) / sizeof(UINT8) )
#if NVIDIA_LESS == 1
static const nvidia_pci_info_t nvidia_card_vendors[] = {
{ 0x106B0000, "Apple" },
};
static const nvidia_pci_info_t nvidia_card_generic[] = {
// 0000 - 0040
{ 0x10DE0000, "GeForce" },
};
static nvidia_card_info_t nvidia_card_exceptions[] = {
/* ========================================================================================
* Layout is device(VendorId + DeviceId), subdev (SubvendorId + SubdeviceId), display name.
* ========================================================================================
*/
/* ------ Specific DeviceID and SubDevID. ------ */
// 0000 - 00FF
{ 0x10DE0040, 0x10438178, "Asus V9999 Ultra V62.11", 0 },
};
#else
static const nvidia_pci_info_t nvidia_card_vendors[] = {
{ 0x10190000, "Elitegroup" },
{ 0x10250000, "Acer" },
@ -1664,6 +1685,7 @@ static nvidia_card_info_t nvidia_card_exceptions[] = {
{ 0x10DE124D, 0x146210CC, "MSi GeForce GT 635M", 0 }
};
#endif
EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, void* rom, UINT16 arch)
{

View File

@ -140,6 +140,7 @@ extern void AboutRefit(void);
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
extern EFI_DXE_SERVICES *gDS;
EFI_PHYSICAL_ADDRESS ExtraSpace = EFI_SYSTEM_TABLE_MAX_ADDRESS;
VOID
PrintMemoryMap()
@ -1727,7 +1728,7 @@ void LOADER_ENTRY::StartLoader()
if (SavePreBootLog) {
Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG);
}
gBS->FreePages (ExtraSpace, 90000);
AllocSmallBlocks(); // shrink memory map;
PrintMemoryMap();
#ifdef JIEF_DEBUG
@ -2715,6 +2716,12 @@ RefitMainMain (IN EFI_HANDLE ImageHandle,
gRT = SystemTable->RuntimeServices;
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS);
Status = gBS->AllocatePages(AllocateMaxAddress,
EfiACPIReclaimMemory,
90000,
&ExtraSpace);
InitBooterLog();
// ConsoleInHandle = SystemTable->ConsoleInHandle;