Hello,
I'm working on an application that is using the UEFI networkstack to
communicate with a TFTP server.
That is working just fine on a mainboard with only one network interface.
But now I have a problem on a mainboard with two Intel network interfaces.
At first I'm doing something like that to decide on which interface a
network cable is attached:
// Locate all network device handles
Status = gBS->LocateHandleBuffer (ByProtocol,
&gEfiManagedNetworkServiceBindingProtocolGuid,
NULL, &HandleCount,
&Handles);
// Try to configure one of all handles
for (Index = 0; Index < HandleCount; Index++) {
// Get media status
GetNicMediaStatus (Handles[Index],
&TempNicInfo->MediaPresentSupported, &TempNicInfo->MediaPresent);
if (TempNicInfo->MediaPresent == 1) {
NicInfo->Handle = Handles[Index];
NicInfo->MediaPresentSupported =
TempNicInfo->MediaPresentSupported;
NicInfo->MediaPresent = TempNicInfo->MediaPresent;
InsertTailList (NicInfoList, &NicInfo->Link);
}
}
Depending on the MediaPresent-Flag I chose what NIC to use.
Later on in my source code I have to open the MTFTP4-protocol. I'm doing it
this way:
// Search available handles for MTFTP4 protocol
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiMtftp4ProtocolGuid,
NULL,
&HandleNum,
&HandleBuffer
);
// Chose the right protocol here
Status = gBS->OpenProtocol (
HandleBuffer[0], // Index 0
is hardcoded here. How can I chose which handle to use?
&gEfiMtftp4ProtocolGuid,
&This->Mtftp4,
This->ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
);
As you can see right now I always chose HandleBuffer[0] although HandleNum
is returning that there are 2 handles available. Depending on where a
network cable is connected I must use Index '0' or '1'. But how can I
determine which one to use automatically?
Does the index number for the MTFTP4 protocol always match the index number
of the EfiManagedNetworkServiceBindingProtocol? Or is there a better way to
do this?
Regards,
Michael
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel