MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / SetupDataForOSX

Function SetupDataForOSX

rEFIt_UEFI/Platform/DataHubCpu.cpp:431–561  ·  view source on GitHub ↗

SetupDataForOSX Sets the DataHub data used by OS X

Source from the content-addressed store, hash-verified

429// SetupDataForOSX
430/// Sets the DataHub data used by OS X
431VOID EFIAPI
432SetupDataForOSX(BOOLEAN Hibernate)
433{
434 EFI_STATUS Status;
435
436 UINT32 DevPathSupportedVal;
437 UINT64 FrontSideBus;
438 UINT64 CpuSpeed;
439 UINT64 TscFrequency;
440 UINT64 ARTFrequency;
441 UINTN Revision;
442 UINT16 Zero = 0;
443 BOOLEAN isRevLess = (gSettings.REV[0] == 0 &&
444 gSettings.REV[1] == 0 &&
445 gSettings.REV[2] == 0 &&
446 gSettings.REV[3] == 0 &&
447 gSettings.REV[4] == 0 &&
448 gSettings.REV[5] == 0);
449
450 Revision = StrDecimalToUintn(gFirmwareRevision);
451
452 // fool proof
453 FrontSideBus = gCPUStructure.FSBFrequency;
454 if ((FrontSideBus < (50 * Mega)) || (FrontSideBus > (1000 * Mega))) {
455 DBG("Wrong FrontSideBus=%llu, set to 100MHz\n", FrontSideBus);
456 FrontSideBus = 100 * Mega;
457 }
458
459 if (gSettings.QEMU) {
460 FrontSideBus = gCPUStructure.TSCFrequency;
461 switch (gCPUStructure.Model) {
462 case CPU_MODEL_DOTHAN:
463 case CPU_MODEL_YONAH:
464 case CPU_MODEL_MEROM:
465 case CPU_MODEL_PENRYN:
466 FrontSideBus = DivU64x32(FrontSideBus, 4);
467 break;
468 default:
469 break;
470 }
471 DBG("Using QEMU FrontSideBus=%llull\n", FrontSideBus);
472 }
473
474 // Save values into gSettings for the genconfig aim
475 gSettings.BusSpeed = (UINT32)DivU64x32(FrontSideBus, kilo);
476
477 CpuSpeed = gCPUStructure.CPUFrequency;
478 gSettings.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega);
479
480 // Locate DataHub Protocol
481 Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (VOID**)&gDataHub);
482 if (!EFI_ERROR(Status)) {
483 XStringW ProductName;
484 ProductName.takeValueFrom(gSettings.ProductName);
485
486 XStringW SerialNumber;
487 SerialNumber.takeValueFrom(gSettings.SerialNr);
488

Callers 1

StartLoaderMethod · 0.85

Calls 9

StrDecimalToUintnFunction · 0.85
DivU64x32Function · 0.85
LogDataHubFunction · 0.85
LogDataHubXString8Function · 0.85
LogDataHubXStringWFunction · 0.85
AddSMCkeyFunction · 0.85
serializeMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected