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

Function LoadDrivers

rEFIt_UEFI/refit/main.cpp:1471–1548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1469
1470
1471static VOID LoadDrivers(VOID)
1472{
1473 EFI_STATUS Status;
1474 EFI_HANDLE *DriversToConnect = NULL;
1475 UINTN DriversToConnectNum = 0;
1476 UINT8 *Edid;
1477 UINTN VarSize = 0;
1478 BOOLEAN VBiosPatchNeeded;
1479
1480 DbgHeader("LoadDrivers");
1481
1482 // load drivers from /efi/drivers
1483#if defined(MDE_CPU_X64)
1484 if (gFirmwareClover) {
1485 if (FileExists(SelfRootDir, L"\\EFI\\CLOVER\\drivers\\BIOS")) {
1486 ScanDriverDir(L"\\EFI\\CLOVER\\drivers\\BIOS", &DriversToConnect, &DriversToConnectNum);
1487 } else {
1488 ScanDriverDir(L"\\EFI\\CLOVER\\drivers64", &DriversToConnect, &DriversToConnectNum);
1489 }
1490 } else
1491 if (FileExists(SelfRootDir, L"\\EFI\\CLOVER\\drivers\\UEFI")) {
1492 ScanDriverDir(L"\\EFI\\CLOVER\\drivers\\UEFI", &DriversToConnect, &DriversToConnectNum);
1493 } else {
1494 ScanDriverDir(L"\\EFI\\CLOVER\\drivers64UEFI", &DriversToConnect, &DriversToConnectNum);
1495 }
1496#else
1497 ScanDriverDir(L"\\EFI\\CLOVER\\drivers32", &DriversToConnect, &DriversToConnectNum);
1498#endif
1499
1500 VBiosPatchNeeded = gSettings.PatchVBios || (gSettings.PatchVBiosBytesCount > 0 && gSettings.PatchVBiosBytes != NULL);
1501 if (VBiosPatchNeeded) {
1502 // check if it is already done in CloverEFI BiosVideo
1503 Status = gRT->GetVariable (
1504 L"CloverVBiosPatchDone",
1505 &gEfiGlobalVariableGuid,
1506 NULL,
1507 &VarSize,
1508 NULL
1509 );
1510 if (Status == EFI_BUFFER_TOO_SMALL) {
1511 // var exists - it's done - let's not do it again
1512 VBiosPatchNeeded = FALSE;
1513 }
1514 }
1515
1516 if (((gSettings.CustomEDID != NULL) && gFirmwareClover) || (VBiosPatchNeeded && !gDriversFlags.VideoLoaded)) {
1517 // we have video bios patch - force video driver reconnect
1518 DBG("Video bios patch requested or CustomEDID - forcing video reconnect\n");
1519 gDriversFlags.VideoLoaded = TRUE;
1520 DriversToConnectNum++;
1521 }
1522
1523 if (DriversToConnectNum > 0) {
1524 DBG("%llu drivers needs connecting ...\n", DriversToConnectNum);
1525 // note: our platform driver protocol
1526 // will use DriversToConnect - do not release it
1527 RegisterDriversToHighestPriority(DriversToConnect);
1528 if (VBiosPatchNeeded) {

Callers 1

RefitMainFunction · 0.85

Calls 9

DbgHeaderFunction · 0.85
FileExistsFunction · 0.85
ScanDriverDirFunction · 0.85
getCurrentEdidFunction · 0.85
DisconnectSomeDevicesFunction · 0.85
PatchVideoBiosFunction · 0.85
FreePoolFunction · 0.50

Tested by

no test coverage detected