]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c
Use Mde library and definition instead of some native definitions in NetLib, to simpl...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpDriver.c
index 946ace1f66a25178cdccb0913adf31d8007970fc..fe6b63beaccdcdaddaf23429930c878223b07027 100644 (file)
@@ -19,7 +19,6 @@ Abstract:
 **/\r
 \r
 #include "MnpDriver.h"\r
-#include "MnpDebug.h"\r
 #include "MnpImpl.h"\r
 \r
 \r
@@ -116,10 +115,9 @@ MnpDriverBindingStart (
 \r
   MnpInitialized  = FALSE;\r
 \r
-  MnpServiceData  = NetAllocateZeroPool (sizeof (MNP_SERVICE_DATA));\r
+  MnpServiceData  = AllocateZeroPool (sizeof (MNP_SERVICE_DATA));\r
   if (MnpServiceData == NULL) {\r
-    MNP_DEBUG_ERROR (("MnpDriverBindingStart(): Failed to allocate the "\r
-      L"Mnp Service Data.\n"));\r
+    DEBUG ((EFI_D_ERROR, "MnpDriverBindingStart(): Failed to allocate the Mnp Service Data.\n"));\r
 \r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -130,8 +128,7 @@ MnpDriverBindingStart (
   Status = MnpInitializeServiceData (MnpServiceData, This->DriverBindingHandle, ControllerHandle);\r
   if (EFI_ERROR (Status)) {\r
 \r
-    MNP_DEBUG_ERROR (("MnpDriverBindingStart: MnpInitializeServiceData "\r
-      L"failed, %r.\n",Status));\r
+    DEBUG ((EFI_D_ERROR, "MnpDriverBindingStart: MnpInitializeServiceData failed, %r.\n",Status));\r
     goto ErrorExit;\r
   }\r
 \r
@@ -168,7 +165,7 @@ ErrorExit:
           ControllerHandle\r
           );\r
 \r
-    NetFreePool (MnpServiceData);\r
+    gBS->FreePool (MnpServiceData);\r
   }\r
 \r
   return Status;\r
@@ -215,8 +212,9 @@ MnpDriverBindingStop (
                   );\r
   if (EFI_ERROR (Status)) {\r
 \r
-    MNP_DEBUG_ERROR (\r
-      ("MnpDriverBindingStop: Locate MNP Service Binding Protocol failed, %r.\n",\r
+    DEBUG (\r
+      (EFI_D_ERROR,\r
+      "MnpDriverBindingStop: Locate MNP Service Binding Protocol failed, %r.\n",\r
       Status)\r
       );\r
     return EFI_DEVICE_ERROR;\r
@@ -250,9 +248,9 @@ MnpDriverBindingStop (
     //\r
     MnpFlushServiceData (MnpServiceData);\r
 \r
-    NetFreePool (MnpServiceData);\r
+    gBS->FreePool (MnpServiceData);\r
   } else {\r
-    while (!NetListIsEmpty (&MnpServiceData->ChildrenList)) {\r
+    while (!IsListEmpty (&MnpServiceData->ChildrenList)) {\r
       //\r
       // Don't use NetListRemoveHead here, the remove opreration will be done\r
       // in ServiceBindingDestroyChild.\r
@@ -310,10 +308,10 @@ MnpServiceBindingCreateChild (
   //\r
   // Allocate buffer for the new instance.\r
   //\r
-  Instance = NetAllocateZeroPool (sizeof (MNP_INSTANCE_DATA));\r
+  Instance = AllocateZeroPool (sizeof (MNP_INSTANCE_DATA));\r
   if (Instance == NULL) {\r
 \r
-    MNP_DEBUG_ERROR (("MnpServiceBindingCreateChild: Faild to allocate memory for the new instance.\n"));\r
+    DEBUG ((EFI_D_ERROR, "MnpServiceBindingCreateChild: Faild to allocate memory for the new instance.\n"));\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -330,8 +328,9 @@ MnpServiceBindingCreateChild (
                   );\r
   if (EFI_ERROR (Status)) {\r
 \r
-    MNP_DEBUG_ERROR (\r
-      ("MnpServiceBindingCreateChild: Failed to install the MNP protocol, %r.\n",\r
+    DEBUG (\r
+      (EFI_D_ERROR,\r
+      "MnpServiceBindingCreateChild: Failed to install the MNP protocol, %r.\n",\r
       Status)\r
       );\r
     goto ErrorExit;\r
@@ -357,12 +356,12 @@ MnpServiceBindingCreateChild (
   //\r
   // Add the child instance into ChildrenList.\r
   //\r
-  OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  NetListInsertTail (&MnpServiceData->ChildrenList, &Instance->InstEntry);\r
+  InsertTailList (&MnpServiceData->ChildrenList, &Instance->InstEntry);\r
   MnpServiceData->ChildrenNumber++;\r
 \r
-  NET_RESTORE_TPL (OldTpl);\r
+  gBS->RestoreTPL (OldTpl);\r
 \r
 ErrorExit:\r
 \r
@@ -377,7 +376,7 @@ ErrorExit:
             );\r
     }\r
 \r
-    NetFreePool (Instance);\r
+    gBS->FreePool (Instance);\r
   }\r
 \r
   return Status;\r
@@ -472,8 +471,9 @@ MnpServiceBindingDestroyChild (
                   );\r
   if (EFI_ERROR (Status)) {\r
 \r
-    MNP_DEBUG_ERROR (\r
-      ("MnpServiceBindingDestroyChild: Failed to uninstall the ManagedNetwork protocol, %r.\n",\r
+    DEBUG (\r
+      (EFI_D_ERROR,\r
+      "MnpServiceBindingDestroyChild: Failed to uninstall the ManagedNetwork protocol, %r.\n",\r
       Status)\r
       );\r
 \r
@@ -481,7 +481,7 @@ MnpServiceBindingDestroyChild (
     return Status;\r
   }\r
 \r
-  OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);\r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Reset the configuration.\r
@@ -501,12 +501,12 @@ MnpServiceBindingDestroyChild (
   //\r
   // Remove this instance from the ChildrenList.\r
   //\r
-  NetListRemoveEntry (&Instance->InstEntry);\r
+  RemoveEntryList (&Instance->InstEntry);\r
   MnpServiceData->ChildrenNumber--;\r
 \r
-  NET_RESTORE_TPL (OldTpl);\r
+  gBS->RestoreTPL (OldTpl);\r
 \r
-  NetFreePool (Instance);\r
+  gBS->FreePool (Instance);\r
 \r
   return Status;\r
 }\r