41 MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
64 MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
100 Status =
gBS->OpenProtocol (
102 &gEfiSimpleNetworkProtocolGuid,
104 This->DriverBindingHandle,
106 EFI_OPEN_PROTOCOL_BY_DRIVER
108 if (EFI_ERROR (Status)) {
117 &gEfiSimpleNetworkProtocolGuid,
118 This->DriverBindingHandle,
165 if (MnpDeviceData ==
NULL) {
166 DEBUG ((DEBUG_ERROR,
"MnpDriverBindingStart(): Failed to allocate the Mnp Device Data.\n"));
168 return EFI_OUT_OF_RESOURCES;
172 if (EFI_ERROR (Status)) {
173 DEBUG ((DEBUG_ERROR,
"MnpDriverBindingStart: MnpInitializeDeviceData failed, %r.\n", Status));
182 Status =
gBS->OpenProtocol (
184 &gEfiVlanConfigProtocolGuid,
186 This->DriverBindingHandle,
188 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
190 if (!EFI_ERROR (Status)) {
195 MnpDeviceData->NumberOfVlan = 0;
198 Status = (MnpServiceData !=
NULL) ?
EFI_SUCCESS : EFI_OUT_OF_RESOURCES;
205 Status =
gBS->InstallMultipleProtocolInterfaces (
207 &gEfiVlanConfigProtocolGuid,
208 &MnpDeviceData->VlanConfig,
211 if (EFI_ERROR (Status)) {
220 if (EFI_ERROR (Status)) {
224 MnpDeviceData->NumberOfVlan = 0;
226 Status = (MnpServiceData !=
NULL) ?
EFI_SUCCESS : EFI_OUT_OF_RESOURCES;
233 MnpDeviceData->NumberOfVlan = NumberOfVlan;
234 for (Index = 0; Index < NumberOfVlan; Index++) {
237 VlanVariable[Index].Bits.Vid,
238 (UINT8)VlanVariable[Index].Bits.Priority
241 if (MnpServiceData ==
NULL) {
242 Status = EFI_OUT_OF_RESOURCES;
249 if (VlanVariable !=
NULL) {
253 if (EFI_ERROR (Status)) {
257 while (!
IsListEmpty (&MnpDeviceData->ServiceList)) {
259 MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);
266 if (MnpDeviceData->VlanConfig.Set !=
NULL) {
267 gBS->UninstallMultipleProtocolInterfaces (
268 MnpDeviceData->ControllerHandle,
269 &gEfiVlanConfigProtocolGuid,
270 &MnpDeviceData->VlanConfig,
323 Status =
gBS->OpenProtocol (
325 &gEfiManagedNetworkServiceBindingProtocolGuid,
326 (VOID **)&ServiceBinding,
327 This->DriverBindingHandle,
329 EFI_OPEN_PROTOCOL_GET_PROTOCOL
331 if (EFI_ERROR (Status)) {
335 Status =
gBS->OpenProtocol (
337 &gEfiVlanConfigProtocolGuid,
338 (VOID **)&VlanConfig,
339 This->DriverBindingHandle,
341 EFI_OPEN_PROTOCOL_GET_PROTOCOL
343 if (EFI_ERROR (Status)) {
344 DEBUG ((DEBUG_ERROR,
"MnpDriverBindingStop: try to stop unknown Controller.\n"));
345 return EFI_DEVICE_ERROR;
348 MnpDeviceData = MNP_DEVICE_DATA_FROM_THIS (VlanConfig);
350 MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (ServiceBinding);
351 MnpDeviceData = MnpServiceData->MnpDeviceData;
354 if (NumberOfChildren == 0) {
358 List = &MnpDeviceData->ServiceList;
365 if (EFI_ERROR (Status) || (ListLength != 0)) {
366 return EFI_DEVICE_ERROR;
372 if (MnpDeviceData->VlanConfig.Set !=
NULL) {
373 gBS->UninstallMultipleProtocolInterfaces (
374 MnpDeviceData->ControllerHandle,
375 &gEfiVlanConfigProtocolGuid,
376 &MnpDeviceData->VlanConfig,
387 if (gMnpControllerNameTable !=
NULL) {
389 gMnpControllerNameTable =
NULL;
398 List = &MnpDeviceData->ServiceList;
405 if (EFI_ERROR (Status)) {
406 return EFI_DEVICE_ERROR;
441 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
442 return EFI_INVALID_PARAMETER;
445 MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (This);
451 if (Instance ==
NULL) {
452 DEBUG ((DEBUG_ERROR,
"MnpServiceBindingCreateChild: Failed to allocate memory for the new instance.\n"));
454 return EFI_OUT_OF_RESOURCES;
462 Status =
gBS->InstallMultipleProtocolInterfaces (
464 &gEfiManagedNetworkProtocolGuid,
465 &Instance->ManagedNetwork,
468 if (EFI_ERROR (Status)) {
471 "MnpServiceBindingCreateChild: Failed to install the MNP protocol, %r.\n",
481 Instance->Handle = *ChildHandle;
483 Status =
gBS->OpenProtocol (
484 MnpServiceData->ServiceHandle,
485 &gEfiManagedNetworkServiceBindingProtocolGuid,
489 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
491 if (EFI_ERROR (Status)) {
498 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
500 InsertTailList (&MnpServiceData->ChildrenList, &Instance->InstEntry);
501 MnpServiceData->ChildrenNumber++;
503 gBS->RestoreTPL (OldTpl);
507 if (EFI_ERROR (Status)) {
508 if (Instance->Handle !=
NULL) {
509 gBS->UninstallMultipleProtocolInterfaces (
511 &gEfiManagedNetworkProtocolGuid,
512 &Instance->ManagedNetwork,
557 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
558 return EFI_INVALID_PARAMETER;
561 MnpServiceData = MNP_SERVICE_DATA_FROM_THIS (This);
566 Status =
gBS->OpenProtocol (
568 &gEfiManagedNetworkProtocolGuid,
569 (VOID **)&ManagedNetwork,
572 EFI_OPEN_PROTOCOL_GET_PROTOCOL
574 if (EFI_ERROR (Status)) {
575 return EFI_UNSUPPORTED;
578 Instance = MNP_INSTANCE_DATA_FROM_THIS (ManagedNetwork);
586 if (Instance->Destroyed) {
590 Instance->Destroyed =
TRUE;
596 MnpServiceData->ServiceHandle,
597 &gEfiManagedNetworkServiceBindingProtocolGuid,
598 MnpServiceData->MnpDeviceData->ImageHandle,
605 Status =
gBS->UninstallMultipleProtocolInterfaces (
607 &gEfiManagedNetworkProtocolGuid,
608 &Instance->ManagedNetwork,
611 if (EFI_ERROR (Status)) {
614 "MnpServiceBindingDestroyChild: Failed to uninstall the ManagedNetwork protocol, %r.\n",
618 Instance->Destroyed =
FALSE;
622 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
627 ManagedNetwork->Configure (ManagedNetwork,
NULL);
643 MnpServiceData->ChildrenNumber--;
645 gBS->RestoreTPL (OldTpl);
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
EFI_STATUS MnpDestroyServiceChild(IN OUT MNP_SERVICE_DATA *MnpServiceData)
EFI_STATUS MnpDestroyServiceData(IN OUT MNP_SERVICE_DATA *MnpServiceData)
VOID MnpDestroyDeviceData(IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle)
EFI_STATUS MnpInitializeDeviceData(IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
MNP_SERVICE_DATA * MnpCreateServiceData(IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId, IN UINT8 Priority OPTIONAL)
VOID MnpInitializeInstanceData(IN MNP_SERVICE_DATA *MnpServiceData, IN OUT MNP_INSTANCE_DATA *Instance)
VOID MnpFlushRcvdDataQueue(IN OUT MNP_INSTANCE_DATA *Instance)
EFI_STATUS EFIAPI MnpDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI MnpDestroyServiceChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS EFIAPI MnpDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI MnpDestroyServiceDataEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS EFIAPI MnpServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
EFI_STATUS EFIAPI MnpDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS EFIAPI MnpServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI MnpDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS MnpGetVlanVariable(IN MNP_DEVICE_DATA *MnpDeviceData, OUT UINTN *NumberOfVlan, OUT VLAN_TCI **VlanVariable)
VOID EFIAPI NetMapClean(IN OUT NET_MAP *Map)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
VOID EFIAPI Exit(IN EFI_STATUS Status)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
EFI_HANDLE DriverBindingHandle