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

Function ScanSPD

rEFIt_UEFI/Platform/spd.cpp:862–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862VOID ScanSPD()
863{
864 EFI_STATUS Status;
865 EFI_HANDLE *HandleBuffer = NULL;
866// EFI_GUID **ProtocolGuidArray;
867 EFI_PCI_IO_PROTOCOL *PciIo = NULL;
868 UINTN HandleCount;
869// UINTN ArrayCount;
870 UINTN Index;
871// UINTN ProtocolIndex;
872 PCI_TYPE00 gPci;
873
874 DbgHeader("ScanSPD");
875
876 // Scan PCI handles
877 Status = gBS->LocateHandleBuffer (
878 ByProtocol,
879 &gEfiPciIoProtocolGuid,
880 NULL,
881 &HandleCount,
882 &HandleBuffer
883 );
884
885 if (!EFI_ERROR(Status)) {
886 for (Index = 0; Index < HandleCount; ++Index) {
887 Status = gBS->HandleProtocol(HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
888 if (!EFI_ERROR(Status)) {
889 // Read PCI BUS
890 //PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
891 Status = PciIo->Pci.Read (
892 PciIo,
893 EfiPciIoWidthUint32,
894 0,
895 sizeof (gPci) / sizeof (UINT32),
896 &gPci
897 );
898 //SmBus controller has class = 0x0c0500
899 if ((gPci.Hdr.ClassCode[2] == 0x0c) && (gPci.Hdr.ClassCode[1] == 5)
900 && (gPci.Hdr.ClassCode[0] == 0) && (gPci.Hdr.VendorId == 0x8086 || gPci.Hdr.VendorId == 0x10DE)) {
901 DBG("SMBus device : %04hX %04hX class=%02hhX%02hhX%02hhX status=%s\n",
902 gPci.Hdr.VendorId,
903 gPci.Hdr.DeviceId,
904 gPci.Hdr.ClassCode[2],
905 gPci.Hdr.ClassCode[1],
906 gPci.Hdr.ClassCode[0],
907 efiStrError(Status)
908 );
909 read_smb(PciIo, gPci.Hdr.VendorId, gPci.Hdr.DeviceId);
910 }
911 }
912 }
913 }
914
915
916 // Scan PCI BUS For SmBus controller
917/* Status = gBS->LocateHandleBuffer(AllHandles,NULL,NULL,&HandleCount,&HandleBuffer);
918 if (!EFI_ERROR(Status)) {
919 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {

Callers 1

RefitMainFunction · 0.85

Calls 4

DbgHeaderFunction · 0.85
read_smbFunction · 0.85
efiStrErrorFunction · 0.50
ReadMethod · 0.45

Tested by

no test coverage detected