\r
#include "Mtftp4Impl.h"\r
\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4ReadFile (\r
@retval EFI_SUCCESS The operation parameter is saved in ModeData\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4GetModeData (\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
Instance = MTFTP4_PROTOCOL_FROM_THIS (This);\r
CopyMem(&ModeData->ConfigData, &Instance->Config, sizeof (Instance->Config));\r
ModeData->SupportedOptionCount = MTFTP4_SUPPORTED_OPTIONS;\r
- ModeData->SupportedOptoins = mMtftp4SupportedOptions;\r
+ ModeData->SupportedOptoins = (UINT8 **) mMtftp4SupportedOptions;\r
ModeData->UnsupportedOptionCount = 0;\r
ModeData->UnsupportedOptoins = NULL;\r
\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
\r
return EFI_SUCCESS;\r
}\r
IN EFI_STATUS Result\r
)\r
{\r
- NET_LIST_ENTRY *Entry;\r
- NET_LIST_ENTRY *Next;\r
+ LIST_ENTRY *Entry;\r
+ LIST_ENTRY *Next;\r
MTFTP4_BLOCK_RANGE *Block;\r
EFI_MTFTP4_TOKEN *Token;\r
\r
\r
NET_LIST_FOR_EACH_SAFE (Entry, Next, &Instance->Blocks) {\r
Block = NET_LIST_USER_STRUCT (Entry, MTFTP4_BLOCK_RANGE, Link);\r
- NetListRemoveEntry (Entry);\r
- NetFreePool (Block);\r
+ RemoveEntryList (Entry);\r
+ gBS->FreePool (Block);\r
}\r
\r
- NetZeroMem (&Instance->RequestOption, sizeof (MTFTP4_OPTION));\r
+ ZeroMem (&Instance->RequestOption, sizeof (MTFTP4_OPTION));\r
\r
Instance->Operation = 0;\r
\r
@retval EFI_SUCCESS The instance is configured for operation.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4Configure (\r
//\r
// Reset the operation if ConfigData is NULL\r
//\r
- OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
Mtftp4CleanOperation (Instance, EFI_ABORTED);\r
- NetZeroMem (&Instance->Config, sizeof (EFI_MTFTP4_CONFIG_DATA));\r
+ ZeroMem (&Instance->Config, sizeof (EFI_MTFTP4_CONFIG_DATA));\r
Instance->State = MTFTP4_STATE_UNCONFIGED;\r
\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
\r
} else {\r
//\r
// Configure the parameters for new operation.\r
//\r
- NetCopyMem (&Ip, &ConfigData->StationIp, sizeof (IP4_ADDR));\r
- NetCopyMem (&Netmask, &ConfigData->SubnetMask, sizeof (IP4_ADDR));\r
- NetCopyMem (&Gateway, &ConfigData->GatewayIp, sizeof (IP4_ADDR));\r
- NetCopyMem (&ServerIp, &ConfigData->ServerIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Ip, &ConfigData->StationIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Netmask, &ConfigData->SubnetMask, sizeof (IP4_ADDR));\r
+ CopyMem (&Gateway, &ConfigData->GatewayIp, sizeof (IP4_ADDR));\r
+ CopyMem (&ServerIp, &ConfigData->ServerIp, sizeof (IP4_ADDR));\r
\r
Ip = NTOHL (Ip);\r
Netmask = NTOHL (Netmask);\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
if ((Instance->State == MTFTP4_STATE_CONFIGED) && (Instance->Operation != 0)) {\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
return EFI_ACCESS_DENIED;\r
}\r
\r
CopyMem(&Instance->Config, ConfigData, sizeof (*ConfigData));;\r
Instance->State = MTFTP4_STATE_CONFIGED;\r
\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
}\r
\r
return EFI_SUCCESS;\r
@retval EFI_ABORTED Abort the ReadFile operation and return.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
Mtftp4GetInfoCheckPacket (\r
IN EFI_MTFTP4_PROTOCOL *This,\r
\r
//\r
// Allocate buffer then copy the packet over. Use gBS->AllocatePool\r
- // in case NetAllocatePool will implements something tricky.\r
+ // in case AllocatePool will implements something tricky.\r
//\r
Status = gBS->AllocatePool (EfiBootServicesData, PacketLen, (VOID **) State->Packet);\r
\r
}\r
\r
*(State->PacketLen) = PacketLen;\r
- NetCopyMem (*(State->Packet), Packet, PacketLen);\r
+ CopyMem (*(State->Packet), Packet, PacketLen);\r
\r
return EFI_ABORTED;\r
}\r
@retval Others Failed to get the information.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4GetInfo (\r
@retval EFI_SUCCESS The packet is parsed.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4ParseOptions (\r
@return TRUE if the override data is valid, otherwise FALSE.\r
\r
**/\r
-STATIC\r
BOOLEAN\r
Mtftp4OverrideValid (\r
IN MTFTP4_PROTOCOL *Instance,\r
IP4_ADDR Netmask;\r
IP4_ADDR Gateway;\r
\r
- NetCopyMem (&Ip, &Override->ServerIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Ip, &Override->ServerIp, sizeof (IP4_ADDR));\r
if (!Ip4IsUnicast (NTOHL (Ip), 0)) {\r
return FALSE;\r
}\r
\r
Config = &Instance->Config;\r
\r
- NetCopyMem (&Gateway, &Override->GatewayIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Gateway, &Override->GatewayIp, sizeof (IP4_ADDR));\r
Gateway = NTOHL (Gateway);\r
\r
if (!Config->UseDefaultSetting && (Gateway != 0)) {\r
- NetCopyMem (&Netmask, &Config->SubnetMask, sizeof (IP4_ADDR));\r
- NetCopyMem (&Ip, &Config->StationIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Netmask, &Config->SubnetMask, sizeof (IP4_ADDR));\r
+ CopyMem (&Ip, &Config->StationIp, sizeof (IP4_ADDR));\r
\r
Netmask = NTOHL (Netmask);\r
Ip = NTOHL (Ip);\r
session to unicast receive.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
Mtftp4ConfigUnicastPort (\r
IN UDP_IO_PORT *UdpIo,\r
UdpConfig.RemotePort = 0;\r
\r
Ip = HTONL (Instance->ServerIp);\r
- NetCopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+ CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
\r
Status = UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfig);\r
\r
return EFI_SUCCESS;\r
}\r
\r
+ if (!Config->UseDefaultSetting && !EFI_IP4_EQUAL (&mZeroIp4Addr, &Config->GatewayIp)) {\r
+ //\r
+ // The station IP address is manually configured and the Gateway IP is not 0.\r
+ // Add the default route for this UDP instance.\r
+ //\r
+ Status = UdpIo->Udp->Routes (UdpIo->Udp, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, &Config->GatewayIp);\r
+ if (EFI_ERROR (Status)) {\r
+ UdpIo->Udp->Configure (UdpIo->Udp, NULL);\r
+ }\r
+ }\r
return Status;\r
}\r
\r
@retval EFI_SUCCESS The operation is successfully started.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
Mtftp4Start (\r
IN EFI_MTFTP4_PROTOCOL *This,\r
Instance = MTFTP4_PROTOCOL_FROM_THIS (This);\r
\r
Status = EFI_SUCCESS;\r
- OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
if (Instance->State != MTFTP4_STATE_CONFIGED) {\r
Status = EFI_NOT_STARTED;\r
}\r
\r
if (EFI_ERROR (Status)) {\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
return Status;\r
}\r
\r
Instance->Token = Token;\r
Instance->BlkSize = MTFTP4_DEFAULT_BLKSIZE;\r
\r
- NetCopyMem (&Instance->ServerIp, &Config->ServerIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Instance->ServerIp, &Config->ServerIp, sizeof (IP4_ADDR));\r
Instance->ServerIp = NTOHL (Instance->ServerIp);\r
\r
Instance->ListeningPort = Config->InitialServerPort;\r
Instance->ConnectedPort = 0;\r
\r
- NetCopyMem (&Instance->Gateway, &Config->GatewayIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Instance->Gateway, &Config->GatewayIp, sizeof (IP4_ADDR));\r
Instance->Gateway = NTOHL (Instance->Gateway);\r
\r
Instance->MaxRetry = Config->TryCount;\r
Instance->Master = TRUE;\r
\r
if (Override != NULL) {\r
- NetCopyMem (&Instance->ServerIp, &Override->ServerIp, sizeof (IP4_ADDR));\r
- NetCopyMem (&Instance->Gateway, &Override->GatewayIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Instance->ServerIp, &Override->ServerIp, sizeof (IP4_ADDR));\r
+ CopyMem (&Instance->Gateway, &Override->GatewayIp, sizeof (IP4_ADDR));\r
\r
Instance->ServerIp = NTOHL (Instance->ServerIp);\r
Instance->Gateway = NTOHL (Instance->Gateway);\r
goto ON_ERROR;\r
}\r
\r
+ //\r
+ // Set initial status.\r
+ //\r
+ Token->Status = EFI_NOT_READY;\r
+\r
//\r
// Build and send an initial requests\r
//\r
Status = Mtftp4RrqStart (Instance, Operation);\r
}\r
\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
\r
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\r
}\r
- //\r
- // Return immediately for asynchronous operation or poll the\r
- // instance for synchronous operation.\r
- //\r
- Token->Status = EFI_NOT_READY;\r
\r
if (Token->Event != NULL) {\r
return EFI_SUCCESS;\r
}\r
\r
+ //\r
+ // Return immediately for asynchronous operation or poll the\r
+ // instance for synchronous operation.\r
+ //\r
while (Token->Status == EFI_NOT_READY) {\r
This->Poll (This);\r
}\r
\r
ON_ERROR:\r
Mtftp4CleanOperation (Instance, Status);\r
- NET_RESTORE_TPL (OldTpl);\r
+ gBS->RestoreTPL (OldTpl);\r
\r
return Status;\r
}\r
@retval Others Some error happened.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4ReadFile (\r
@retval Others Some error happened.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4WriteFile (\r
@retval Others Some error happened.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4ReadDirectory (\r
@retval EFI_DEVICE_ERROR The MTFTP session has been destoried.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EfiMtftp4Poll (\r