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

Function GetMacAddress

rEFIt_UEFI/Platform/Net.cpp:70–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 */
69
70VOID
71GetMacAddress()
72{
73 EFI_STATUS Status;
74 EFI_MAC_ADDRESS MacAddr;
75 UINT8 *HwAddress;
76 UINTN HwAddressSize;
77 UINTN Index, Index2;
78 EFI_HANDLE *HandleBuffer;
79 UINTN NumberOfHandles;
80 EFI_DEVICE_PATH_PROTOCOL *Node;
81 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
82 MAC_ADDR_DEVICE_PATH *MacAddressNode;
83 BOOLEAN Found;
84 BOOLEAN Swab;
85 UINT16 PreviousVendor = 0;
86 UINT32 Mac0, Mac4;
87 UINTN Offset;
88
89 HwAddressSize = 6;
90 //
91 // Locate Service Binding handles.
92 //
93 NumberOfHandles = 0;
94 HandleBuffer = NULL;
95 Status = gBS->LocateHandleBuffer (
96 ByProtocol,
97 &gEfiDevicePathProtocolGuid,
98 NULL,
99 &NumberOfHandles,
100 &HandleBuffer
101 );
102 if (EFI_ERROR(Status)) {
103 return;
104 }
105
106 DbgHeader("GetMacAddress");
107
108 Found = FALSE;
109 for (Index = 0; Index < NumberOfHandles; Index++) {
110 Node = NULL;
111 Status = gBS->HandleProtocol (
112 HandleBuffer[Index],
113 &gEfiDevicePathProtocolGuid,
114 (VOID **) &Node
115 );
116 if (EFI_ERROR(Status)) {
117 continue;
118 }
119 DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;
120
121 //
122 while (!IsDevicePathEnd (DevicePath)) {
123 if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
124 (DevicePathSubType (DevicePath) == MSG_MAC_ADDR_DP)) {
125 //
126 // Get MAC address.
127 //

Callers 1

RefitMainFunction · 0.85

Calls 8

DbgHeaderFunction · 0.85
IsDevicePathEndFunction · 0.50
DevicePathTypeFunction · 0.50
DevicePathSubTypeFunction · 0.50
CopyMemFunction · 0.50
NextDevicePathNodeFunction · 0.50
FreePoolFunction · 0.50
IoRead32Function · 0.50

Tested by

no test coverage detected