fix conflict

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2019-09-13 22:35:36 +03:00
commit ecab494bd2
8 changed files with 78 additions and 30 deletions

View File

@ -2010,8 +2010,10 @@ DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64
DEFINE GCC48_ALL_CC_FLAGS = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -Wno-unused-const-variable -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector -Wno-unused-but-set-variable -mabi=ms "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector -mabi=ms "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
@ -2032,8 +2034,8 @@ DEFINE GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat
DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC48_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS)
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Wno-unused-const-variable -Os -flto
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-const-variable -Os -flto
DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive

View File

@ -2008,10 +2008,10 @@ DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --re
DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii
DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
DEFINE GCC48_ALL_CC_FLAGS = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -Wno-unused-const-variable -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_ALL_CC_FLAGS = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector -Wno-unused-but-set-variable -mabi=ms "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector -mabi=ms "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -Os -flto
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
@ -2032,8 +2032,8 @@ DEFINE GCC48_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat
DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC48_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS)
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Wno-unused-const-variable -Os -flto
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-const-variable -Os -flto
DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive

View File

@ -536,8 +536,10 @@ CreateDialog (
if (Key != NULL) {
Status = WaitForKeyStroke (&KeyValue);
ASSERT_EFI_ERROR (Status);
CopyMem (Key, &KeyValue, sizeof (EFI_INPUT_KEY));
// ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR(Status)) {
CopyMem(Key, &KeyValue, sizeof(EFI_INPUT_KEY));
}
}
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
@ -721,6 +723,9 @@ ClearLines (
//
Buffer = AllocateZeroPool (0x10000);
ASSERT (Buffer != NULL);
if (!Buffer) {
return;
}
//
// Set foreground and background as defined

View File

@ -59,17 +59,23 @@ InternalPrint (
UINTN BufferSize;
ASSERT (Format != NULL);
if (!Format || !Console || !Console->OutputString) {
return 0;
}
ASSERT (((UINTN) Format & BIT0) == 0);
ASSERT (Console != NULL);
// ASSERT (Console != NULL);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
Buffer = (CHAR16 *) AllocatePool(BufferSize);
ASSERT (Buffer != NULL);
if (!Buffer) {
return 0;
}
Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
if (Console != NULL && Return > 0) {
if (/*Console != NULL && */ Return > 0) {
//
// To be extra safe make sure Console has been initialized
//
@ -196,15 +202,21 @@ AsciiInternalPrint (
ASSERT (Format != NULL);
ASSERT (Console != NULL);
if (!Format || !Console || !Console->OutputString) {
return 0;
}
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
Buffer = (CHAR16 *) AllocatePool(BufferSize);
ASSERT (Buffer != NULL);
if (!Buffer) {
return 0;
}
Return = UnicodeVSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
if (Console != NULL) {
if (Return > 0) {
//
// To be extra safe make sure Console has been initialized
//
@ -367,6 +379,9 @@ InternalPrintGraphic (
ConsoleHandle = gST->ConsoleOutHandle;
ASSERT( ConsoleHandle != NULL);
if (!ConsoleHandle) {
return 0;
}
Status = gBS->HandleProtocol (
ConsoleHandle,
@ -419,6 +434,9 @@ InternalPrintGraphic (
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
ASSERT (Blt != NULL);
if (!Blt) {
return 0;
}
Blt->Width = (UINT16) (HorizontalResolution);
Blt->Height = (UINT16) (VerticalResolution);
@ -477,6 +495,9 @@ InternalPrintGraphic (
Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
ASSERT (Blt->Image.Bitmap != NULL);
if (!Blt->Image.Bitmap) {
return 0;
}
//
// StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
@ -499,6 +520,9 @@ InternalPrintGraphic (
if (!EFI_ERROR (Status)) {
ASSERT (RowInfoArray != NULL);
if (!RowInfoArray) {
goto Error;
}
//
// Explicit Line break characters are ignored, so the updated parameter RowInfoArraySize by StringToImage will
// always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
@ -613,14 +637,21 @@ PrintXY (
UINTN ReturnNum;
ASSERT (Format != NULL);
if (!Format) {
return 0;
}
ASSERT (((UINTN) Format & BIT0) == 0);
VA_START (Marker, Format);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
Buffer = (CHAR16 *) AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
if (!Buffer) {
return 0;
}
PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
@ -692,6 +723,9 @@ AsciiPrintXY (
UINTN ReturnNum;
ASSERT (Format != NULL);
if (!Format) {
return 0;
}
VA_START (Marker, Format);
@ -699,6 +733,9 @@ AsciiPrintXY (
Buffer = (CHAR16 *) AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
if (!Buffer) {
return 0;
}
PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);

View File

@ -78,6 +78,9 @@ EfiCreateEventLegacyBootEx (
EFI_EVENT_NOTIFY WorkerNotifyFunction;
ASSERT (LegacyBootEvent != NULL);
if (!LegacyBootEvent) {
return EFI_INVALID_PARAMETER;
}
if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {
DEBUG ((EFI_D_ERROR, "EFI1.1 can't support LegacyBootEvent!"));
@ -173,6 +176,9 @@ EfiCreateEventReadyToBootEx (
EFI_EVENT_NOTIFY WorkerNotifyFunction;
ASSERT (ReadyToBootEvent != NULL);
if (!ReadyToBootEvent) {
return EFI_INVALID_PARAMETER;
}
if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {
DEBUG ((EFI_D_ERROR, "EFI1.1 can't support ReadyToBootEvent!"));
@ -282,6 +288,9 @@ EfiGetNameGuidFromFwVolDevicePathNode (
)
{
ASSERT (FvDevicePathNode != NULL);
if (!FvDevicePathNode) {
return NULL;
}
if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) {
@ -317,6 +326,9 @@ EfiInitializeFwVolDevicepathNode (
{
ASSERT (FvDevicePathNode != NULL);
ASSERT (NameGuid != NULL);
if (!FvDevicePathNode || !NameGuid) {
return;
}
//
// Use the new Device path that does not conflict with the UEFI

View File

@ -1712,7 +1712,6 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE *ProcLocalApic;
EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE *LocalApicNMI;
// UINTN ApicLen;
UINT8 CPUBase;
UINTN ApicCPUNum;
UINT8 *SubTable;
BOOLEAN DsdtLoaded = FALSE;
@ -2052,7 +2051,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
(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 CPUBase and count(?)
// if (gSettings.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?)
DBG("Apply DsdtFixMask=0x%08x\n", gSettings.FixDsdt);
DBG(" drop _DSM mask=0x%04x\n", dropDSM);
FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion);
@ -2120,13 +2119,6 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
// DBG("Fool proof: size of APIC NMI = %d\n", sizeof(EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE));
// DBG("----------- size of APIC DESC = %d\n", sizeof(EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER));
// DBG("----------- size of APIC PROC = %d\n", sizeof(EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE));
//
// 1. For CPU base number 0 or 1. codes from SunKi
CPUBase = acpi_cpu_name[0][3] - '0'; //"CPU0"
if ((UINT8)CPUBase > 11) {
DBG("Abnormal CPUBase=%x will set to 0\n", CPUBase);
CPUBase = 0;
}
ApicCPUNum = 0;
// 2. For absent NMI subtable
@ -2157,7 +2149,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
ApicCPUNum = gCPUStructure.Threads;
}
DBG("CPUBase=%d and ApicCPUBase=%d ApicCPUNum=%d\n", CPUBase, ApicCPUBase, ApicCPUNum);
DBG("ApicCPUBase=%d ApicCPUNum=%d\n", ApicCPUBase, ApicCPUNum);
//reallocate table
if (gSettings.PatchNMI) {
BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS;
@ -2253,7 +2245,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
if (gSettings.GeneratePStates || gSettings.GeneratePluginType) {
Status = EFI_NOT_FOUND;
Ssdt = generate_pss_ssdt(CPUBase, ApicCPUNum);
Ssdt = generate_pss_ssdt(ApicCPUNum);
if (Ssdt) {
Status = InsertTable(Ssdt, Ssdt->Length);
}
@ -2264,7 +2256,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
if (gSettings.GenerateCStates) {
Status = EFI_NOT_FOUND;
Ssdt = generate_cst_ssdt(FadtPointer, CPUBase, ApicCPUNum);
Ssdt = generate_cst_ssdt(FadtPointer, ApicCPUNum);
if (Ssdt) {
Status = InsertTable(Ssdt, Ssdt->Length);
}

View File

@ -50,7 +50,7 @@ CHAR8 plugin_type[] =
0x65, 0x00,
};
SSDT_TABLE *generate_pss_ssdt(UINT8 FirstID, UINTN Number)
SSDT_TABLE *generate_pss_ssdt(UINTN Number)
{
CHAR8 name[31];
CHAR8 name1[31];
@ -450,7 +450,7 @@ SSDT_TABLE *generate_pss_ssdt(UINT8 FirstID, UINTN Number)
return NULL;
}
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINT8 FirstID, UINTN Number)
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number)
{
BOOLEAN c2_enabled = gSettings.EnableC2;
BOOLEAN c3_enabled;

View File

@ -26,7 +26,7 @@
typedef EFI_ACPI_DESCRIPTION_HEADER SSDT_TABLE;
SSDT_TABLE *generate_pss_ssdt(UINT8 FirstID, UINTN Number);
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINT8 FirstID, UINTN Number);
SSDT_TABLE *generate_pss_ssdt(UINTN Number);
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number);
#endif /* !__LIBSAIO_ACPI_PATCHER_H */