Use Mde library and definition instead of some native definitions in NetLib, to simply network library.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4693 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -62,7 +62,7 @@ EfiNicIp4ConfigGetName (
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This);
|
||||
|
||||
if (Name != NULL) {
|
||||
NetCopyMem (Name, Instance->NicName, IP4_NIC_NAME_LENGTH);
|
||||
CopyMem (Name, Instance->NicName, IP4_NIC_NAME_LENGTH);
|
||||
}
|
||||
|
||||
if (NicAddr != NULL) {
|
||||
@@ -105,7 +105,7 @@ Ip4ConfigGetNicInfo (
|
||||
Config = Ip4ConfigFindNicVariable (Variable, NicAddr);
|
||||
|
||||
if (Config == NULL) {
|
||||
NetFreePool (Variable);
|
||||
gBS->FreePool (Variable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -118,14 +118,14 @@ Ip4ConfigGetNicInfo (
|
||||
Ip4ConfigWriteVariable (NewVariable);
|
||||
|
||||
if (NewVariable != NULL) {
|
||||
NetFreePool (NewVariable);
|
||||
gBS->FreePool (NewVariable);
|
||||
};
|
||||
|
||||
NetFreePool (Config);
|
||||
gBS->FreePool (Config);
|
||||
Config = NULL;
|
||||
}
|
||||
|
||||
NetFreePool (Variable);
|
||||
gBS->FreePool (Variable);
|
||||
return Config;
|
||||
}
|
||||
|
||||
@@ -179,12 +179,12 @@ EfiNicIp4ConfigGetInfo (
|
||||
Status = EFI_BUFFER_TOO_SMALL;
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
NetCopyMem (NicConfig, Config, Len);
|
||||
CopyMem (NicConfig, Config, Len);
|
||||
}
|
||||
|
||||
*ConfigLen = Len;
|
||||
|
||||
NetFreePool (Config);
|
||||
gBS->FreePool (Config);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ EfiNicIp4ConfigSetInfo (
|
||||
Status = Ip4ConfigWriteVariable (NewVariable);
|
||||
|
||||
if (NewVariable != NULL) {
|
||||
NetFreePool (NewVariable);
|
||||
gBS->FreePool (NewVariable);
|
||||
}
|
||||
|
||||
//
|
||||
// Variable is NULL when saving the first configure parameter
|
||||
//
|
||||
if (Variable != NULL) {
|
||||
NetFreePool (Variable);
|
||||
gBS->FreePool (Variable);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -313,7 +313,7 @@ EfiIp4ConfigStart (
|
||||
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This);
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (Instance->State != IP4_CONFIG_STATE_IDLE) {
|
||||
Status = EFI_ALREADY_STARTED;
|
||||
@@ -415,7 +415,7 @@ EfiIp4ConfigStart (
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
NET_TPL_LOCK,
|
||||
TPL_CALLBACK,
|
||||
Ip4ConfigOnDhcp4Complete,
|
||||
Instance,
|
||||
&Instance->Dhcp4Event
|
||||
@@ -440,7 +440,7 @@ ON_ERROR:
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ EfiIp4ConfigStop (
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (Instance->State == IP4_CONFIG_STATE_IDLE) {
|
||||
Status = EFI_NOT_STARTED;
|
||||
@@ -488,7 +488,7 @@ EfiIp4ConfigStop (
|
||||
Ip4ConfigCleanConfig (Instance);
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ EfiIp4ConfigGetData (
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (Instance->State == IP4_CONFIG_STATE_IDLE) {
|
||||
Status = EFI_NOT_STARTED;
|
||||
@@ -554,14 +554,14 @@ EfiIp4ConfigGetData (
|
||||
if ((*ConfigDataSize < Len) || (ConfigData == NULL)) {
|
||||
Status = EFI_BUFFER_TOO_SMALL;
|
||||
} else {
|
||||
NetCopyMem (ConfigData, &NicConfig->Ip4Info, Len);
|
||||
CopyMem (ConfigData, &NicConfig->Ip4Info, Len);
|
||||
}
|
||||
|
||||
*ConfigDataSize = Len;
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -619,10 +619,10 @@ Ip4ConfigOnDhcp4Complete (
|
||||
if (Instance->NicConfig != NULL) {
|
||||
ASSERT (Instance->NicConfig->Source == IP4_CONFIG_SOURCE_DHCP);
|
||||
Perment = Instance->NicConfig->Perment;
|
||||
NetFreePool (Instance->NicConfig);
|
||||
gBS->FreePool (Instance->NicConfig);
|
||||
}
|
||||
|
||||
Instance->NicConfig = NetAllocatePool (sizeof (NIC_IP4_CONFIG_INFO) + 2* sizeof (EFI_IP4_ROUTE_TABLE));
|
||||
Instance->NicConfig = AllocatePool (sizeof (NIC_IP4_CONFIG_INFO) + 2* sizeof (EFI_IP4_ROUTE_TABLE));
|
||||
|
||||
if (Instance->NicConfig == NULL) {
|
||||
Instance->Result = EFI_OUT_OF_RESOURCES;
|
||||
@@ -644,14 +644,14 @@ Ip4ConfigOnDhcp4Complete (
|
||||
//
|
||||
Ip4Config->RouteTableSize = 1;
|
||||
|
||||
NetCopyMem (&Ip1, &Dhcp4Mode.ClientAddress, sizeof (IP4_ADDR));
|
||||
NetCopyMem (&Ip2, &Dhcp4Mode.SubnetMask, sizeof (IP4_ADDR));
|
||||
CopyMem (&Ip1, &Dhcp4Mode.ClientAddress, sizeof (IP4_ADDR));
|
||||
CopyMem (&Ip2, &Dhcp4Mode.SubnetMask, sizeof (IP4_ADDR));
|
||||
|
||||
Subnet = Ip1 & Ip2;
|
||||
|
||||
NetCopyMem (&Ip4Config->RouteTable[0].SubnetAddress, &Subnet, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetCopyMem (&Ip4Config->RouteTable[0].SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetZeroMem (&Ip4Config->RouteTable[0].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Ip4Config->RouteTable[0].SubnetAddress, &Subnet, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Ip4Config->RouteTable[0].SubnetMask, &Dhcp4Mode.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&Ip4Config->RouteTable[0].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
//
|
||||
// Create a route if there is a default router.
|
||||
@@ -659,9 +659,9 @@ Ip4ConfigOnDhcp4Complete (
|
||||
if (!EFI_IP4_EQUAL (&Dhcp4Mode.RouterAddress, &mZeroIp4Addr)) {
|
||||
Ip4Config->RouteTableSize = 2;
|
||||
|
||||
NetZeroMem (&Ip4Config->RouteTable[1].SubnetAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetZeroMem (&Ip4Config->RouteTable[1].SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetCopyMem (&Ip4Config->RouteTable[1].GatewayAddress, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&Ip4Config->RouteTable[1].SubnetAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&Ip4Config->RouteTable[1].SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Ip4Config->RouteTable[1].GatewayAddress, &Dhcp4Mode.RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
}
|
||||
|
||||
Instance->Result = EFI_SUCCESS;
|
||||
@@ -738,7 +738,7 @@ Ip4ConfigCleanConfig (
|
||||
)
|
||||
{
|
||||
if (Instance->NicConfig != NULL) {
|
||||
NetFreePool (Instance->NicConfig);
|
||||
gBS->FreePool (Instance->NicConfig);
|
||||
Instance->NicConfig = NULL;
|
||||
}
|
||||
|
||||
|
@@ -214,7 +214,7 @@ Ip4ConfigDriverBindingStart (
|
||||
//
|
||||
// Allocate an instance then initialize it
|
||||
//
|
||||
Instance = NetAllocatePool (sizeof (IP4_CONFIG_INSTANCE));
|
||||
Instance = AllocatePool (sizeof (IP4_CONFIG_INSTANCE));
|
||||
|
||||
if (Instance == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -332,7 +332,7 @@ Ip4ConfigDriverBindingStart (
|
||||
NewVariable = Ip4ConfigModifyVariable (Variable, &Instance->NicAddr, NULL);
|
||||
|
||||
} else if (NicConfig->Source == IP4_CONFIG_SOURCE_DHCP) {
|
||||
NetZeroMem (&NicConfig->Ip4Info, sizeof (EFI_IP4_IPCONFIG_DATA));
|
||||
ZeroMem (&NicConfig->Ip4Info, sizeof (EFI_IP4_IPCONFIG_DATA));
|
||||
NewVariable = Ip4ConfigModifyVariable (Variable, &Instance->NicAddr, NicConfig);
|
||||
|
||||
}
|
||||
@@ -340,21 +340,21 @@ Ip4ConfigDriverBindingStart (
|
||||
Ip4ConfigWriteVariable (NewVariable);
|
||||
|
||||
if (NewVariable != NULL) {
|
||||
NetFreePool (NewVariable);
|
||||
gBS->FreePool (NewVariable);
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (Variable);
|
||||
gBS->FreePool (Variable);
|
||||
|
||||
if (NicConfig != NULL) {
|
||||
NetFreePool (NicConfig);
|
||||
gBS->FreePool (NicConfig);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
if (Instance != NULL) {
|
||||
NetFreePool (Instance);
|
||||
gBS->FreePool (Instance);
|
||||
}
|
||||
|
||||
if (Mnp != NULL) {
|
||||
@@ -511,7 +511,7 @@ Ip4ConfigDriverBindingStop (
|
||||
|
||||
Ip4ConfigCleanConfig (Instance);
|
||||
mIp4ConfigNicList[Instance->NicIndex] = NULL;
|
||||
NetFreePool (Instance);
|
||||
gBS->FreePool (Instance);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ Ip4ConfigReadVariable (
|
||||
goto REMOVE_VARIABLE;
|
||||
}
|
||||
|
||||
Variable = NetAllocatePool (Size);
|
||||
Variable = AllocatePool (Size);
|
||||
|
||||
if (Variable == NULL) {
|
||||
return NULL;
|
||||
@@ -167,7 +167,7 @@ REMOVE_VARIABLE:
|
||||
|
||||
ON_ERROR:
|
||||
if (Variable != NULL) {
|
||||
NetFreePool (Variable);
|
||||
gBS->FreePool (Variable);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -234,7 +234,7 @@ Ip4ConfigFindNicVariable (
|
||||
//
|
||||
// Copy the data to Temp to avoid the alignment problems
|
||||
//
|
||||
NetCopyMem (&Temp, Cur, sizeof (NIC_IP4_CONFIG_INFO));
|
||||
CopyMem (&Temp, Cur, sizeof (NIC_IP4_CONFIG_INFO));
|
||||
Len = SIZEOF_NIC_IP4_CONFIG_INFO (&Temp);
|
||||
|
||||
//
|
||||
@@ -242,13 +242,13 @@ Ip4ConfigFindNicVariable (
|
||||
// a block of memory then copy it out.
|
||||
//
|
||||
if (NIC_ADDR_EQUAL (&Temp.NicAddr, NicAddr)) {
|
||||
Config = NetAllocatePool (Len);
|
||||
Config = AllocatePool (Len);
|
||||
|
||||
if (Config == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NetCopyMem (Config, Cur, Len);
|
||||
CopyMem (Config, Cur, Len);
|
||||
return Config;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ Ip4ConfigModifyVariable (
|
||||
|
||||
if (Old != NULL) {
|
||||
TotalLen -= SIZEOF_NIC_IP4_CONFIG_INFO (Old);
|
||||
NetFreePool (Old);
|
||||
gBS->FreePool (Old);
|
||||
}
|
||||
|
||||
if (Config != NULL) {
|
||||
@@ -338,7 +338,7 @@ Ip4ConfigModifyVariable (
|
||||
|
||||
ASSERT (TotalLen >= sizeof (IP4_CONFIG_VARIABLE));
|
||||
|
||||
NewVar = NetAllocateZeroPool (TotalLen);
|
||||
NewVar = AllocateZeroPool (TotalLen);
|
||||
|
||||
if (NewVar == NULL) {
|
||||
return NULL;
|
||||
@@ -352,11 +352,11 @@ Ip4ConfigModifyVariable (
|
||||
Next = (UINT8 *)&NewVar->ConfigInfo;
|
||||
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
NetCopyMem (&Temp, Cur, sizeof (NIC_IP4_CONFIG_INFO));
|
||||
CopyMem (&Temp, Cur, sizeof (NIC_IP4_CONFIG_INFO));
|
||||
Len = SIZEOF_NIC_IP4_CONFIG_INFO (&Temp);
|
||||
|
||||
if (!NIC_ADDR_EQUAL (&Temp.NicAddr, NicAddr)) {
|
||||
NetCopyMem (Next, Cur, Len);
|
||||
CopyMem (Next, Cur, Len);
|
||||
Next += Len;
|
||||
NewVar->Count++;
|
||||
}
|
||||
@@ -372,7 +372,7 @@ Ip4ConfigModifyVariable (
|
||||
if (Config != NULL) {
|
||||
Len = SIZEOF_NIC_IP4_CONFIG_INFO (Config);
|
||||
|
||||
NetCopyMem (Next, Config, Len);
|
||||
CopyMem (Next, Config, Len);
|
||||
NewVar->Count++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user