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

Function GetDevices

rEFIt_UEFI/Platform/Settings.cpp:6522–6884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6520
6521
6522VOID
6523GetDevices ()
6524{
6525 EFI_STATUS Status;
6526 UINTN HandleCount = 0;
6527 EFI_HANDLE *HandleArray = NULL;
6528 EFI_PCI_IO_PROTOCOL *PciIo;
6529 PCI_TYPE00 Pci;
6530 UINTN Index;
6531 UINTN Segment = 0;
6532 UINTN Bus = 0;
6533 UINTN Device = 0;
6534 UINTN Function = 0;
6535 UINTN i;
6536 UINT32 Bar0;
6537 // UINT8 *Mmio = NULL;
6538 radeon_card_info_t *info;
6539 SLOT_DEVICE *SlotDevice;
6540
6541 NGFX = 0;
6542 NHDA = 0;
6543 AudioList.setEmpty();
6544 //Arpt.Valid = FALSE; //global variables initialized by 0 - c-language
6545 XStringW GopDevicePathStr;
6546 XStringW DevicePathStr;
6547
6548 DbgHeader("GetDevices");
6549
6550 // Get GOP handle, in order to check to which GPU the monitor is currently connected
6551 Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiGraphicsOutputProtocolGuid, NULL, &HandleCount, &HandleArray);
6552 if (!EFI_ERROR(Status)) {
6553 GopDevicePathStr = DevicePathToXStringW(DevicePathFromHandle(HandleArray[0]));
6554 DBG("GOP found at: %ls\n", GopDevicePathStr.wc_str());
6555 }
6556
6557 // Scan PCI handles
6558 Status = gBS->LocateHandleBuffer (
6559 ByProtocol,
6560 &gEfiPciIoProtocolGuid,
6561 NULL,
6562 &HandleCount,
6563 &HandleArray
6564 );
6565
6566 if (!EFI_ERROR(Status)) {
6567 for (Index = 0; Index < HandleCount; ++Index) {
6568 Status = gBS->HandleProtocol(HandleArray[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
6569 if (!EFI_ERROR(Status)) {
6570 // Read PCI BUS
6571 PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
6572 Status = PciIo->Pci.Read (
6573 PciIo,
6574 EfiPciIoWidthUint32,
6575 0,
6576 sizeof (Pci) / sizeof (UINT32),
6577 &Pci
6578 );
6579

Callers 1

RefitMainFunction · 0.85

Calls 14

DbgHeaderFunction · 0.85
DevicePathToXStringWFunction · 0.85
StrStrFunction · 0.85
snprintfFunction · 0.85
get_gma_modelFunction · 0.85
get_nvidia_modelFunction · 0.85
HdaControllerGetNameFunction · 0.85
IsHDMIAudioFunction · 0.85
CopyMemFunction · 0.50
ZeroMemFunction · 0.50
setEmptyMethod · 0.45
wc_strMethod · 0.45

Tested by

no test coverage detected