mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Fix wrong access to SlotDevices in FixAirport.
Send panic message to log.
This commit is contained in:
parent
d52803e7cd
commit
54bddb2fa9
@ -13,6 +13,7 @@
|
|||||||
#include "../include/Pci.h"
|
#include "../include/Pci.h"
|
||||||
#include "../include/Devices.h"
|
#include "../include/Devices.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "../Settings/Self.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <IndustryStandard/PciCommand.h>
|
#include <IndustryStandard/PciCommand.h>
|
||||||
@ -2710,11 +2711,11 @@ Skip_DSM:
|
|||||||
k = FindName(dsdt + i, Size, "_SUN");
|
k = FindName(dsdt + i, Size, "_SUN");
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
aml_add_name(gfx0, "_SUN");
|
aml_add_name(gfx0, "_SUN");
|
||||||
aml_add_dword(gfx0, SlotDevices[j].SlotID);
|
aml_add_dword(gfx0, SlotDevices.getSlotForIndexOrNull(j).SlotID);
|
||||||
} else {
|
} else {
|
||||||
//we have name sun, set the number
|
//we have name sun, set the number
|
||||||
if (dsdt[k + 4] == 0x0A) {
|
if (dsdt[k + 4] == 0x0A) {
|
||||||
dsdt[k + 5] = SlotDevices[j].SlotID;
|
dsdt[k + 5] = SlotDevices.getSlotForIndexOrNull(j).SlotID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3071,11 +3072,11 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
|
|||||||
k = FindName(dsdt + i, Size, "_SUN");
|
k = FindName(dsdt + i, Size, "_SUN");
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
aml_add_name(dev, "_SUN");
|
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 {
|
} else {
|
||||||
//we have name sun, set the number
|
//we have name sun, set the number
|
||||||
if (dsdt[k + 4] == 0x0A) {
|
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)
|
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 i, k;
|
||||||
UINT32 ArptADR = 0, BridgeSize, Size, BrdADR = 0;
|
UINT32 ArptADR = 0, BridgeSize, Size, BrdADR = 0;
|
||||||
UINT32 PCIADR, PCISIZE = 0;
|
UINT32 PCIADR, PCISIZE = 0;
|
||||||
@ -3262,11 +3269,11 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
|||||||
k = FindName(dsdt + i, Size, "_SUN");
|
k = FindName(dsdt + i, Size, "_SUN");
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
aml_add_name(dev, "_SUN");
|
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 {
|
} else {
|
||||||
//we have name sun, set the number
|
//we have name sun, set the number
|
||||||
if (dsdt[k + 4] == 0x0A) {
|
if (dsdt[k + 4] == 0x0A) {
|
||||||
dsdt[k + 5] = gSettings.Smbios.SlotDevices[6].SlotID;
|
dsdt[k + 5] = gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(6).SlotID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3700,11 +3707,11 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
|
|||||||
k = FindName(dsdt + i, Size, "_SUN");
|
k = FindName(dsdt + i, Size, "_SUN");
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
aml_add_name(device, "_SUN");
|
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 {
|
} else {
|
||||||
//we have name sun, set the number
|
//we have name sun, set the number
|
||||||
if (dsdt[k + 4] == 0x0A) {
|
if (dsdt[k + 4] == 0x0A) {
|
||||||
dsdt[k + 5] = gSettings.Smbios.SlotDevices[12].SlotID;
|
dsdt[k + 5] = gSettings.Smbios.SlotDevices.getSlotForIndexOrNull(12).SlotID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2340,6 +2340,12 @@ printf("%s", "");
|
|||||||
log_technical_bug("%s : no idx==%hhd", __PRETTY_FUNCTION__, idx2Look4);
|
log_technical_bug("%s : no idx==%hhd", __PRETTY_FUNCTION__, idx2Look4);
|
||||||
return SlotDeviceClass::NullSlotDevice;
|
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 {
|
class RamSlotInfo {
|
||||||
|
@ -38,17 +38,22 @@ static void panic_(const char* format, VA_LIST va)
|
|||||||
printf("Clover build id: %s\n", gBuildId.c_str());
|
printf("Clover build id: %s\n", gBuildId.c_str());
|
||||||
#endif
|
#endif
|
||||||
if ( format ) {
|
if ( format ) {
|
||||||
vprintf(format, va);
|
// vprintf(format, va);
|
||||||
#ifdef DEBUG_ON_SERIAL_PORT
|
// #ifdef DEBUG_ON_SERIAL_PORT
|
||||||
|
// char buf[500];
|
||||||
|
// vsnprintf(buf, sizeof(buf)-1, format, va);
|
||||||
|
// SerialPortWrite((UINT8*)buf, strlen(buf));
|
||||||
|
// #endif
|
||||||
char buf[500];
|
char buf[500];
|
||||||
vsnprintf(buf, sizeof(buf)-1, format, va);
|
vsnprintf(buf, sizeof(buf)-1, format, va);
|
||||||
SerialPortWrite((UINT8*)buf, strlen(buf));
|
DebugLog(2, "%s", buf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
printf(FATAL_ERROR_MSG);
|
// printf(FATAL_ERROR_MSG);
|
||||||
#ifdef DEBUG_ON_SERIAL_PORT
|
// #ifdef DEBUG_ON_SERIAL_PORT
|
||||||
SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG));
|
// SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG));
|
||||||
#endif
|
// #endif
|
||||||
|
DebugLog(2, "%s", FATAL_ERROR_MSG);
|
||||||
|
DebugLog(2, "\n");
|
||||||
while (1) { // this will avoid warning : Function declared 'noreturn' should not return
|
while (1) { // this will avoid warning : Function declared 'noreturn' should not return
|
||||||
CpuDeadLoop();
|
CpuDeadLoop();
|
||||||
}
|
}
|
||||||
|
@ -2711,6 +2711,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
gRT = SystemTable->RuntimeServices;
|
gRT = SystemTable->RuntimeServices;
|
||||||
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS);
|
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS);
|
||||||
|
|
||||||
|
InitBooterLog();
|
||||||
|
|
||||||
ConsoleInHandle = SystemTable->ConsoleInHandle;
|
ConsoleInHandle = SystemTable->ConsoleInHandle;
|
||||||
|
|
||||||
//#define DEBUG_ERALY_CRASH
|
//#define DEBUG_ERALY_CRASH
|
||||||
@ -2780,14 +2782,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
PauseForKey("press any key\n"_XS8);
|
PauseForKey("press any key\n"_XS8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// firmware detection
|
// firmware detection
|
||||||
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
|
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
|
||||||
if (!gFirmwareRevision) {
|
if (!gFirmwareRevision) {
|
||||||
// gFirmwareRevision = P__oolPrint(L"%d", gST->FirmwareRevision);
|
// gFirmwareRevision = P__oolPrint(L"%d", gST->FirmwareRevision);
|
||||||
}
|
}
|
||||||
DataHubInstall (ImageHandle, SystemTable);
|
DataHubInstall (ImageHandle, SystemTable);
|
||||||
InitializeConsoleSim();
|
InitializeConsoleSim();
|
||||||
InitBooterLog();
|
|
||||||
|
|
||||||
DbgHeader("Starting Clover");
|
DbgHeader("Starting Clover");
|
||||||
if (Now.TimeZone < -1440 || Now.TimeZone > 1440) {
|
if (Now.TimeZone < -1440 || Now.TimeZone > 1440) {
|
||||||
@ -2850,6 +2851,9 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
|
|
||||||
gConf.InitialisePlatform();
|
gConf.InitialisePlatform();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* saving debug.log works from here
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user