diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index 63e0ccf73..2c8e7c815 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -13,6 +13,7 @@ #include "../include/Pci.h" #include "../include/Devices.h" #include "Settings.h" +#include "../Settings/Self.h" extern "C" { #include @@ -2710,11 +2711,11 @@ Skip_DSM: k = FindName(dsdt + i, Size, "_SUN"); if (k == 0) { aml_add_name(gfx0, "_SUN"); - aml_add_dword(gfx0, SlotDevices[j].SlotID); + aml_add_dword(gfx0, SlotDevices.getSlotForIndexOrNull(j).SlotID); } else { //we have name sun, set the number if (dsdt[k + 4] == 0x0A) { - dsdt[k + 5] = SlotDevices[j].SlotID; + dsdt[k + 5] = SlotDevices.getSlotForIndexOrNull(j).SlotID; } } } else { @@ -3071,11 +3072,11 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card) k = FindName(dsdt + i, Size, "_SUN"); if (k == 0) { aml_add_name(dev, "_SUN"); - aml_add_dword(dev, gSettings.Smbios.SlotDevices[5].SlotID); + aml_add_dword(dev, gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(5).SlotID); } else { //we have name sun, set the number if (dsdt[k + 4] == 0x0A) { - dsdt[k + 5] = gSettings.Smbios.SlotDevices[5].SlotID; + dsdt[k + 5] = gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(5).SlotID; } } } @@ -3153,6 +3154,12 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card) UINT32 FIXAirport (UINT8 *dsdt, UINT32 len) { +#if DEBUG_FIX > 0 +DBG("FIXAirport dsdt len=%d\n", len); +//EFI_STATUS Status = egSaveFile(&self.getCloverDir(), L"misc\\DSDT_before_AIRPORT.bin", dsdt, len); +//DBG("DSDT_before_AIRPORT.bin saved in misc. Status = %s\n", efiStrError(Status)); +#endif + UINT32 i, k; UINT32 ArptADR = 0, BridgeSize, Size, BrdADR = 0; UINT32 PCIADR, PCISIZE = 0; @@ -3262,11 +3269,11 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len) k = FindName(dsdt + i, Size, "_SUN"); if (k == 0) { aml_add_name(dev, "_SUN"); - aml_add_dword(dev, gSettings.Smbios.SlotDevices[6].SlotID); + aml_add_dword(dev, gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(6).SlotID); } else { //we have name sun, set the number if (dsdt[k + 4] == 0x0A) { - dsdt[k + 5] = gSettings.Smbios.SlotDevices[6].SlotID; + dsdt[k + 5] = gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(6).SlotID; } } } else { @@ -3700,11 +3707,11 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len) k = FindName(dsdt + i, Size, "_SUN"); if (k == 0) { aml_add_name(device, "_SUN"); - aml_add_dword(device, gSettings.Smbios.SlotDevices[12].SlotID); + aml_add_dword(device, gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(12).SlotID); } else { //we have name sun, set the number if (dsdt[k + 4] == 0x0A) { - dsdt[k + 5] = gSettings.Smbios.SlotDevices[12].SlotID; + dsdt[k + 5] = gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(12).SlotID; } } } else { diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 4fb038961..4e04d7917 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -2340,6 +2340,12 @@ printf("%s", ""); log_technical_bug("%s : no idx==%hhd", __PRETTY_FUNCTION__, idx2Look4); return SlotDeviceClass::NullSlotDevice; } + const SlotDeviceClass& getSlotForIndexOrNull(uint8_t idx2Look4) const { + for ( size_t idx = 0 ; idx < size() ; ++idx ) { + if ( ElementAt(idx).SmbiosIndex == idx2Look4 ) return ElementAt(idx); + } + return SlotDeviceClass::NullSlotDevice; + } }; class RamSlotInfo { diff --git a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp index fc9ceec11..e862c6295 100644 --- a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp +++ b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp @@ -38,17 +38,22 @@ static void panic_(const char* format, VA_LIST va) printf("Clover build id: %s\n", gBuildId.c_str()); #endif if ( format ) { - vprintf(format, va); - #ifdef DEBUG_ON_SERIAL_PORT +// vprintf(format, va); +// #ifdef DEBUG_ON_SERIAL_PORT +// char buf[500]; +// vsnprintf(buf, sizeof(buf)-1, format, va); +// SerialPortWrite((UINT8*)buf, strlen(buf)); +// #endif char buf[500]; vsnprintf(buf, sizeof(buf)-1, format, va); - SerialPortWrite((UINT8*)buf, strlen(buf)); - #endif + DebugLog(2, "%s", buf); } - printf(FATAL_ERROR_MSG); - #ifdef DEBUG_ON_SERIAL_PORT - SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG)); - #endif +// printf(FATAL_ERROR_MSG); +// #ifdef DEBUG_ON_SERIAL_PORT +// SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG)); +// #endif + DebugLog(2, "%s", FATAL_ERROR_MSG); + DebugLog(2, "\n"); while (1) { // this will avoid warning : Function declared 'noreturn' should not return CpuDeadLoop(); } diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index e122f0e94..849d557ad 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2711,6 +2711,8 @@ RefitMain (IN EFI_HANDLE ImageHandle, gRT = SystemTable->RuntimeServices; /*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS); + InitBooterLog(); + ConsoleInHandle = SystemTable->ConsoleInHandle; //#define DEBUG_ERALY_CRASH @@ -2780,14 +2782,13 @@ RefitMain (IN EFI_HANDLE ImageHandle, PauseForKey("press any key\n"_XS8); #endif - // firmware detection +// firmware detection gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0; if (!gFirmwareRevision) { // gFirmwareRevision = P__oolPrint(L"%d", gST->FirmwareRevision); } DataHubInstall (ImageHandle, SystemTable); InitializeConsoleSim(); - InitBooterLog(); DbgHeader("Starting Clover"); if (Now.TimeZone < -1440 || Now.TimeZone > 1440) { @@ -2850,6 +2851,9 @@ RefitMain (IN EFI_HANDLE ImageHandle, gConf.InitialisePlatform(); + /* + * saving debug.log works from here + */ {