X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMnpDxe%2FMnpConfig.c;h=381f8b87b8bc68ba3cf48bfc27e8288041763a46;hp=c2bb839e6b0600699bd1536c0a3adbf4f0cb8a3f;hb=87f89c0840a042a683b966d2be8ecb015886cb39;hpb=36ee91ca3661d3d020a7841aacbf858d885c4728 diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c index c2bb839e6b..381f8b87b8 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c @@ -1,23 +1,15 @@ /** @file + Implementation of Managed Network Protocol private services. -Copyright (c) 2005 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php +Copyright (c) 2005 - 2009, Intel Corporation.
+All rights reserved. This program and the accompanying materials are licensed +and made available under the terms and conditions of the BSD License which +accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - MnpConfig.c - -Abstract: - - Implementation of Managed Network Protocol private services. - - **/ @@ -40,8 +32,8 @@ EFI_MANAGED_NETWORK_PROTOCOL mMnpProtocolTemplate = { }; EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = { - 10000, - 10000, + 10000000, + 10000000, 0, FALSE, FALSE, @@ -52,80 +44,23 @@ EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = { FALSE }; -STATIC -EFI_STATUS -MnpAddFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN UINTN Count - ); - -STATIC -EFI_STATUS -MnpStartSnp ( - IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp - ); - -STATIC -EFI_STATUS -MnpStopSnp ( - IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp - ); - -STATIC -EFI_STATUS -MnpStart ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN BOOLEAN IsConfigUpdate, - IN BOOLEAN EnableSystemPoll - ); - -STATIC -EFI_STATUS -MnpStop ( - IN MNP_SERVICE_DATA *MnpServiceData - ); - -STATIC -EFI_STATUS -MnpConfigReceiveFilters ( - IN MNP_SERVICE_DATA *MnpServiceData - ); - -STATIC -EFI_STATUS -MnpGroupOpAddCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk, - IN MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, - IN EFI_MAC_ADDRESS *MacAddress, - IN UINT32 HwAddressSize - ); - -STATIC -BOOLEAN -MnpGroupOpDelCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk - ); - /** - Add some NET_BUF into MnpServiceData->FreeNbufQue. The buffer length of - the NET_BUF is specified by MnpServiceData->BufferLength. + Add Count of net buffers to MnpServiceData->FreeNbufQue. The length of the net + buffer is specified by MnpServiceData->BufferLength. - @param MnpServiceData Pointer to the MNP_SERVICE_DATA. - @param Count Number of NET_BUFFERs to add. + @param[in, out] MnpServiceData Pointer to the MNP_SERVICE_DATA. + @param[in] Count Number of NET_BUFFERs to add. - @retval EFI_SUCCESS The specified amount of NET_BUFs are allocated and - added into MnpServiceData->FreeNbufQue. + @retval EFI_SUCCESS The specified amount of NET_BUFs are allocated + and added to MnpServiceData->FreeNbufQue. @retval EFI_OUT_OF_RESOURCES Failed to allocate a NET_BUF structure. **/ -STATIC EFI_STATUS MnpAddFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN UINTN Count + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN UINTN Count ) { EFI_STATUS Status; @@ -142,7 +77,7 @@ MnpAddFreeNbuf ( Nbuf = NetbufAlloc (MnpServiceData->BufferLength + MnpServiceData->PaddingSize); if (Nbuf == NULL) { - MNP_DEBUG_ERROR (("MnpAddFreeNbuf: NetBufAlloc failed.\n")); + DEBUG ((EFI_D_ERROR, "MnpAddFreeNbuf: NetBufAlloc failed.\n")); Status = EFI_OUT_OF_RESOURCES; break; } @@ -169,14 +104,15 @@ MnpAddFreeNbuf ( in the queue, first try to allocate some and add them into the queue, then fetch the NET_BUF from the updated FreeNbufQue. - @param MnpServiceData Pointer to the MNP_SERVICE_DATA. + @param[in, out] MnpServiceData Pointer to the MNP_SERVICE_DATA. - @return Pointer to the allocated free NET_BUF structure, if NULL the operation is failed. + @return Pointer to the allocated free NET_BUF structure, if NULL the + operation is failed. **/ NET_BUF * MnpAllocNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData ) { EFI_STATUS Status; @@ -188,7 +124,7 @@ MnpAllocNbuf ( FreeNbufQue = &MnpServiceData->FreeNbufQue; - OldTpl = NET_RAISE_TPL (NET_TPL_RECYCLE); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); // // Check whether there are available buffers, or else try to add some. @@ -197,8 +133,9 @@ MnpAllocNbuf ( if ((MnpServiceData->NbufCnt + MNP_NET_BUFFER_INCREASEMENT) > MNP_MAX_NET_BUFFER_NUM) { - MNP_DEBUG_ERROR ( - ("MnpAllocNbuf: The maximum NET_BUF size is reached for MNP driver instance %p.\n", + DEBUG ( + (EFI_D_ERROR, + "MnpAllocNbuf: The maximum NET_BUF size is reached for MNP driver instance %p.\n", MnpServiceData) ); @@ -209,8 +146,9 @@ MnpAllocNbuf ( Status = MnpAddFreeNbuf (MnpServiceData, MNP_NET_BUFFER_INCREASEMENT); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR ( - ("MnpAllocNbuf: Failed to add NET_BUFs into the FreeNbufQue, %r.\n", + DEBUG ( + (EFI_D_ERROR, + "MnpAllocNbuf: Failed to add NET_BUFs into the FreeNbufQue, %r.\n", Status) ); // @@ -230,7 +168,7 @@ MnpAllocNbuf ( } ON_EXIT: - NET_RESTORE_TPL (OldTpl); + gBS->RestoreTPL (OldTpl); return Nbuf; } @@ -239,16 +177,14 @@ ON_EXIT: /** Try to reclaim the Nbuf into the buffer pool. - @param MnpServiceData Pointer to the mnp service context data. - @param Nbuf Pointer to the NET_BUF to free. - - @return None. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in, out] Nbuf Pointer to the NET_BUF to free. **/ VOID MnpFreeNbuf ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN NET_BUF *Nbuf + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN OUT NET_BUF *Nbuf ) { EFI_TPL OldTpl; @@ -256,7 +192,7 @@ MnpFreeNbuf ( NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); ASSERT (Nbuf->RefCnt > 1); - OldTpl = NET_RAISE_TPL (NET_TPL_RECYCLE); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); NET_PUT_REF (Nbuf); @@ -268,25 +204,27 @@ MnpFreeNbuf ( NetbufQueAppend (&MnpServiceData->FreeNbufQue, Nbuf); } - NET_RESTORE_TPL (OldTpl); + gBS->RestoreTPL (OldTpl); } /** Initialize the mnp service context data. - @param MnpServiceData Pointer to the mnp service context data. - @param Snp Pointer to the simple network protocol. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] ImageHandle The driver image handle. + @param[in] ControllerHandle Handle of device to bind driver to. @retval EFI_SUCCESS The mnp service context is initialized. - @retval Other Some error occurs. + @retval EFI_UNSUPPORTED ControllerHandle does not support Simple Network Protocol. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpInitializeServiceData ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN EFI_HANDLE ImageHandle, - IN EFI_HANDLE ControllerHandle + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE ControllerHandle ) { EFI_STATUS Status; @@ -327,8 +265,8 @@ MnpInitializeServiceData ( // // Initialize the lists. // - NetListInit (&MnpServiceData->GroupAddressList); - NetListInit (&MnpServiceData->ChildrenList); + InitializeListHead (&MnpServiceData->GroupAddressList); + InitializeListHead (&MnpServiceData->ChildrenList); // // Get the buffer length used to allocate NET_BUF to hold data received @@ -337,7 +275,7 @@ MnpInitializeServiceData ( MnpServiceData->BufferLength = MnpServiceData->Mtu + SnpMode->MediaHeaderSize + NET_ETHER_FCS_SIZE; // - // Make sure the protocol headers immediately following the media header + // Make sure the protocol headers immediately following the media header // 4-byte aligned // MnpServiceData->PaddingSize = (4 - SnpMode->MediaHeaderSize) & 0x3; @@ -349,7 +287,7 @@ MnpInitializeServiceData ( Status = MnpAddFreeNbuf (MnpServiceData, MNP_INIT_NET_BUFFER_NUM); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpInitializeServiceData: MnpAddFreeNbuf failed, %r.\n", Status)); + DEBUG ((EFI_D_ERROR, "MnpInitializeServiceData: MnpAddFreeNbuf failed, %r.\n", Status)); goto ERROR; } // @@ -365,10 +303,10 @@ MnpInitializeServiceData ( // // Allocate buffer pool for tx. // - MnpServiceData->TxBuf = NetAllocatePool (MnpServiceData->Mtu + SnpMode->MediaHeaderSize); + MnpServiceData->TxBuf = AllocatePool (MnpServiceData->Mtu + SnpMode->MediaHeaderSize); if (MnpServiceData->TxBuf == NULL) { - MNP_DEBUG_ERROR (("MnpInitializeServiceData: NetAllocatePool failed.\n")); + DEBUG ((EFI_D_ERROR, "MnpInitializeServiceData: AllocatePool failed.\n")); Status = EFI_OUT_OF_RESOURCES; goto ERROR; @@ -379,14 +317,14 @@ MnpInitializeServiceData ( // Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL | EVT_TIMER, - NET_TPL_LOCK, + TPL_CALLBACK, MnpSystemPoll, MnpServiceData, &MnpServiceData->PollTimer ); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpInitializeServiceData: CreateEvent for poll timer failed.\n")); + DEBUG ((EFI_D_ERROR, "MnpInitializeServiceData: CreateEvent for poll timer failed.\n")); goto ERROR; } @@ -395,14 +333,14 @@ MnpInitializeServiceData ( // Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL | EVT_TIMER, - NET_TPL_TIMER, + TPL_CALLBACK, MnpCheckPacketTimeout, MnpServiceData, &MnpServiceData->TimeoutCheckTimer ); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpInitializeServiceData: CreateEvent for packet timeout check failed.\n")); + DEBUG ((EFI_D_ERROR, "MnpInitializeServiceData: CreateEvent for packet timeout check failed.\n")); goto ERROR; } @@ -411,14 +349,14 @@ MnpInitializeServiceData ( // Status = gBS->CreateEvent ( EVT_TIMER, - NET_TPL_TIMER, + TPL_CALLBACK, NULL, NULL, &MnpServiceData->TxTimeoutEvent ); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpInitializeServiceData: CreateEvent for tx timeout event failed.\n")); + DEBUG ((EFI_D_ERROR, "MnpInitializeServiceData: CreateEvent for tx timeout event failed.\n")); } ERROR: @@ -439,7 +377,7 @@ ERROR: if (MnpServiceData->TxBuf != NULL) { - NetFreePool (MnpServiceData->TxBuf); + gBS->FreePool (MnpServiceData->TxBuf); } if (MnpServiceData->RxNbufCache != NULL) { @@ -460,14 +398,14 @@ ERROR: /** Flush the mnp service context data. - @param MnpServiceData Pointer to the mnp service context data. - - @return None. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] ImageHandle The driver image handle. **/ VOID MnpFlushServiceData ( - MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN EFI_HANDLE ImageHandle ) { NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); @@ -475,7 +413,7 @@ MnpFlushServiceData ( // // The GroupAddressList must be empty. // - ASSERT (NetListIsEmpty (&MnpServiceData->GroupAddressList)); + ASSERT (IsListEmpty (&MnpServiceData->GroupAddressList)); // // Close the event. @@ -487,7 +425,7 @@ MnpFlushServiceData ( // // Free the tx buffer. // - NetFreePool (MnpServiceData->TxBuf); + gBS->FreePool (MnpServiceData->TxBuf); // // Free the RxNbufCache. @@ -502,28 +440,36 @@ MnpFlushServiceData ( DEBUG_CODE ( - if (MnpServiceData->NbufCnt != 0) { + if (MnpServiceData->NbufCnt != 0) { - MNP_DEBUG_WARN (("MnpFlushServiceData: Memory leak, MnpServiceData->NbufCnt != 0.\n")); + DEBUG ((EFI_D_WARN, "MnpFlushServiceData: Memory leak, MnpServiceData->NbufCnt != 0.\n")); } ); + + // + // Close the Simple Network Protocol. + // + gBS->CloseProtocol ( + MnpServiceData->ControllerHandle, + &gEfiSimpleNetworkProtocolGuid, + ImageHandle, + MnpServiceData->ControllerHandle + ); } /** Initialize the mnp instance context data. - @param MnpServiceData Pointer to the mnp service context data. - @param Instance Pointer to the mnp instance context data to - initialize. - - @return None. + @param[in] MnpServiceData Pointer to the mnp service context data. + @param[in, out] Instance Pointer to the mnp instance context data + to initialize. **/ VOID MnpInitializeInstanceData ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN MNP_INSTANCE_DATA *Instance + IN MNP_SERVICE_DATA *MnpServiceData, + IN OUT MNP_INSTANCE_DATA *Instance ) { NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); @@ -547,9 +493,9 @@ MnpInitializeInstanceData ( // // Initialize the lists. // - NetListInit (&Instance->GroupCtrlBlkList); - NetListInit (&Instance->RcvdPacketQueue); - NetListInit (&Instance->RxDeliveredPacketQueue); + InitializeListHead (&Instance->GroupCtrlBlkList); + InitializeListHead (&Instance->RcvdPacketQueue); + InitializeListHead (&Instance->RxDeliveredPacketQueue); // // Initialize the RxToken Map. @@ -564,11 +510,11 @@ MnpInitializeInstanceData ( /** - Check whether the token specified by Arg maches the token in Item. + Check whether the token specified by Arg matches the token in Item. - @param Map Pointer to the NET_MAP. - @param Item Pointer to the NET_MAP_ITEM - @param Arg Pointer to the Arg, it's a pointer to the token to + @param[in] Map Pointer to the NET_MAP. + @param[in] Item Pointer to the NET_MAP_ITEM. + @param[in] Arg Pointer to the Arg, it's a pointer to the token to check. @retval EFI_SUCCESS The token specified by Arg is different from the @@ -601,27 +547,26 @@ MnpTokenExist ( return EFI_SUCCESS; } - /** Cancel the token specified by Arg if it matches the token in Item. - @param Map Pointer to the NET_MAP. - @param Item Pointer to the NET_MAP_ITEM - @param Arg Pointer to the Arg, it's a pointer to the token to - cancel. + @param[in, out] Map Pointer to the NET_MAP. + @param[in, out] Item Pointer to the NET_MAP_ITEM. + @param[in] Arg Pointer to the Arg, it's a pointer to the + token to cancel. - @retval EFI_SUCCESS The Arg is NULL, and the token in Item is - cancelled, or the Arg isn't NULL, and the token in - Item is different from the Arg. - @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the - Arg, and the token is cancelled. + @retval EFI_SUCCESS The Arg is NULL, and the token in Item is cancelled, + or the Arg isn't NULL, and the token in Item is + different from the Arg. + @retval EFI_ABORTED The Arg isn't NULL, the token in Item mathces the + Arg, and the token is cancelled. **/ EFI_STATUS MnpCancelTokens ( - IN NET_MAP *Map, - IN NET_MAP_ITEM *Item, - IN VOID *Arg + IN OUT NET_MAP *Map, + IN OUT NET_MAP_ITEM *Item, + IN VOID *Arg ) { EFI_MANAGED_NETWORK_COMPLETION_TOKEN *TokenToCancel; @@ -660,13 +605,12 @@ MnpCancelTokens ( /** Start and initialize the simple network. - @param Snp Pointer to the simple network protocol. + @param[in] Snp Pointer to the simple network protocol. @retval EFI_SUCCESS The simple network protocol is started. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ -STATIC EFI_STATUS MnpStartSnp ( IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp @@ -695,13 +639,12 @@ MnpStartSnp ( /** Stop the simple network. - @param Snp Pointer to the simple network protocol. + @param[in] Snp Pointer to the simple network protocol. @retval EFI_SUCCESS The simple network is stopped. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ -STATIC EFI_STATUS MnpStopSnp ( IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp @@ -731,22 +674,21 @@ MnpStopSnp ( Start the managed network, this function is called when one instance is configured or reconfigured. - @param MnpServiceData Pointer to the mnp service context data. - @param IsConfigUpdate The instance is reconfigured or it's the first time - the instanced is configured. - @param EnableSystemPoll Enable the system polling or not. + @param[in, out] MnpServiceData Pointer to the mnp service context data. + @param[in] IsConfigUpdate The instance is reconfigured or it's the first + time the instanced is configured. + @param[in] EnableSystemPoll Enable the system polling or not. - @retval EFI_SUCCESS The managed network is started and some - configuration is updated. - @retval Other Some error occurs. + @retval EFI_SUCCESS The managed network is started and some + configuration is updated. + @retval Others Other errors as indicated. **/ -STATIC EFI_STATUS MnpStart ( - IN MNP_SERVICE_DATA *MnpServiceData, - IN BOOLEAN IsConfigUpdate, - IN BOOLEAN EnableSystemPoll + IN OUT MNP_SERVICE_DATA *MnpServiceData, + IN BOOLEAN IsConfigUpdate, + IN BOOLEAN EnableSystemPoll ) { EFI_STATUS Status; @@ -769,7 +711,7 @@ MnpStart ( Status = MnpStartSnp (MnpServiceData->Snp); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpStart: MnpStartSnp failed, %r.\n", Status)); + DEBUG ((EFI_D_ERROR, "MnpStart: MnpStartSnp failed, %r.\n", Status)); goto ErrorExit; } @@ -783,8 +725,9 @@ MnpStart ( ); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR ( - ("MnpStart, gBS->SetTimer for TimeoutCheckTimer %r.\n", + DEBUG ( + (EFI_D_ERROR, + "MnpStart, gBS->SetTimer for TimeoutCheckTimer %r.\n", Status) ); goto ErrorExit; @@ -802,7 +745,7 @@ MnpStart ( Status = gBS->SetTimer (MnpServiceData->PollTimer, TimerOpType, MNP_SYS_POLL_INTERVAL); if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR (("MnpStart: gBS->SetTimer for PollTimer failed, %r.\n", Status)); + DEBUG ((EFI_D_ERROR, "MnpStart: gBS->SetTimer for PollTimer failed, %r.\n", Status)); goto ErrorExit; } @@ -823,16 +766,15 @@ ErrorExit: /** Stop the managed network. - @param MnpServiceData Pointer to the mnp service context data. + @param[in, out] MnpServiceData Pointer to the mnp service context data. - @retval EFI_SUCCESS The managed network is stopped. - @retval Other Some error occurs. + @retval EFI_SUCCESS The managed network is stopped. + @retval Others Other errors as indicated. **/ -STATIC EFI_STATUS MnpStop ( - IN MNP_SERVICE_DATA *MnpServiceData + IN OUT MNP_SERVICE_DATA *MnpServiceData ) { EFI_STATUS Status; @@ -887,14 +829,12 @@ MnpStop ( /** Flush the instance's received data. - @param Instance Pointer to the mnp instance context data. - - @return None. + @param[in, out] Instance Pointer to the mnp instance context data. **/ VOID MnpFlushRcvdDataQueue ( - IN MNP_INSTANCE_DATA *Instance + IN OUT MNP_INSTANCE_DATA *Instance ) { EFI_TPL OldTpl; @@ -902,9 +842,9 @@ MnpFlushRcvdDataQueue ( NET_CHECK_SIGNATURE (Instance, MNP_INSTANCE_DATA_SIGNATURE); - OldTpl = NET_RAISE_TPL (NET_TPL_RECYCLE); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - while (!NetListIsEmpty (&Instance->RcvdPacketQueue)) { + while (!IsListEmpty (&Instance->RcvdPacketQueue)) { // // Remove all the Wraps. // @@ -919,27 +859,27 @@ MnpFlushRcvdDataQueue ( ASSERT (Instance->RcvdPacketQueueSize == 0); - NET_RESTORE_TPL (OldTpl); + gBS->RestoreTPL (OldTpl); } /** Configure the Instance using ConfigData. - @param Instance Pointer to the mnp instance context data. - @param ConfigData Pointer to the configuration data used to configure + @param[in, out] Instance Pointer to the mnp instance context data. + @param[in] ConfigData Pointer to the configuration data used to configure the isntance. @retval EFI_SUCCESS The Instance is configured. @retval EFI_UNSUPPORTED EnableReceiveTimestamps is on and the implementation doesn't support it. - @retval Other Some error occurs. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpConfigureInstance ( - IN MNP_INSTANCE_DATA *Instance, - IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL + IN OUT MNP_INSTANCE_DATA *Instance, + IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL ) { EFI_STATUS Status; @@ -1061,19 +1001,17 @@ MnpConfigureInstance ( return Status; } - /** Configure the Snp receive filters according to the instances' receive filter settings. - @param MnpServiceData Pointer to the mnp service context data. + @param[in] MnpServiceData Pointer to the mnp service context data. - @retval EFI_SUCCESS The receive filters is configured. - @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due to lack - of memory resource. + @retval EFI_SUCCESS The receive filters is configured. + @retval EFI_OUT_OF_RESOURCES The receive filters can't be configured due + to lack of memory resource. **/ -STATIC EFI_STATUS MnpConfigReceiveFilters ( IN MNP_SERVICE_DATA *MnpServiceData @@ -1086,7 +1024,7 @@ MnpConfigReceiveFilters ( UINT32 EnableFilterBits; UINT32 DisableFilterBits; BOOLEAN ResetMCastFilters; - NET_LIST_ENTRY *Entry; + LIST_ENTRY *Entry; UINT32 Index; MNP_GROUP_ADDRESS *GroupAddress; @@ -1138,10 +1076,10 @@ MnpConfigReceiveFilters ( // Allocate pool for the mulicast addresses. // MCastFilterCnt = MnpServiceData->GroupAddressCount; - MCastFilter = NetAllocatePool (sizeof (EFI_MAC_ADDRESS) * MCastFilterCnt); + MCastFilter = AllocatePool (sizeof (EFI_MAC_ADDRESS) * MCastFilterCnt); if (MCastFilter == NULL) { - MNP_DEBUG_ERROR (("MnpConfigReceiveFilters: Failed to allocate memory resource for MCastFilter.\n")); + DEBUG ((EFI_D_ERROR, "MnpConfigReceiveFilters: Failed to allocate memory resource for MCastFilter.\n")); return EFI_OUT_OF_RESOURCES; } @@ -1163,7 +1101,7 @@ MnpConfigReceiveFilters ( // multicast. // - if (Snp->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) { + if ((Snp->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) { EnableFilterBits |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; } else { // @@ -1202,8 +1140,9 @@ MnpConfigReceiveFilters ( DEBUG_CODE ( if (EFI_ERROR (Status)) { - MNP_DEBUG_ERROR ( - ("MnpConfigReceiveFilters: Snp->ReceiveFilters failed, %r.\n", + DEBUG ( + (EFI_D_ERROR, + "MnpConfigReceiveFilters: Snp->ReceiveFilters failed, %r.\n", Status) ); } @@ -1213,7 +1152,7 @@ MnpConfigReceiveFilters ( // // Free the buffer used to hold the group addresses. // - NetFreePool (MCastFilter); + gBS->FreePool (MCastFilter); } return Status; @@ -1224,24 +1163,23 @@ MnpConfigReceiveFilters ( Add a group address control block which controls the MacAddress for this instance. - @param Instance Pointer to the mnp instance context data. - @param CtrlBlk Pointer to the group address control block. - @param GroupAddress Pointer to the group adress. - @param MacAddress Pointer to the mac address. - @param HwAddressSize The hardware address size. + @param[in, out] Instance Pointer to the mnp instance context data. + @param[in, out] CtrlBlk Pointer to the group address control block. + @param[in, out] GroupAddress Pointer to the group adress. + @param[in] MacAddress Pointer to the mac address. + @param[in] HwAddressSize The hardware address size. - @retval EFI_SUCCESS The group address control block is added. - @retval EFI_OUT_OF_RESOURCE Failed due to lack of memory resources. + @retval EFI_SUCCESS The group address control block is added. + @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources. **/ -STATIC EFI_STATUS MnpGroupOpAddCtrlBlk ( - IN MNP_INSTANCE_DATA *Instance, - IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk, - IN MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, - IN EFI_MAC_ADDRESS *MacAddress, - IN UINT32 HwAddressSize + IN OUT MNP_INSTANCE_DATA *Instance, + IN OUT MNP_GROUP_CONTROL_BLOCK *CtrlBlk, + IN OUT MNP_GROUP_ADDRESS *GroupAddress OPTIONAL, + IN EFI_MAC_ADDRESS *MacAddress, + IN UINT32 HwAddressSize ) { MNP_SERVICE_DATA *MnpServiceData; @@ -1258,17 +1196,17 @@ MnpGroupOpAddCtrlBlk ( // // Allocate a new GroupAddress to be added into MNP's GroupAddressList. // - GroupAddress = NetAllocatePool (sizeof (MNP_GROUP_ADDRESS)); + GroupAddress = AllocatePool (sizeof (MNP_GROUP_ADDRESS)); if (GroupAddress == NULL) { - MNP_DEBUG_ERROR (("MnpGroupOpFormCtrlBlk: Failed to allocate memory resource.\n")); + DEBUG ((EFI_D_ERROR, "MnpGroupOpFormCtrlBlk: Failed to allocate memory resource.\n")); return EFI_OUT_OF_RESOURCES; } CopyMem (&GroupAddress->Address, MacAddress, sizeof (GroupAddress->Address)); GroupAddress->RefCnt = 0; - NetListInsertTail ( + InsertTailList ( &MnpServiceData->GroupAddressList, &GroupAddress->AddrEntry ); @@ -1284,7 +1222,7 @@ MnpGroupOpAddCtrlBlk ( // Add the CtrlBlk into the instance's GroupCtrlBlkList. // CtrlBlk->GroupAddress = GroupAddress; - NetListInsertTail (&Instance->GroupCtrlBlkList, &CtrlBlk->CtrlBlkEntry); + InsertTailList (&Instance->GroupCtrlBlkList, &CtrlBlk->CtrlBlkEntry); return EFI_SUCCESS; } @@ -1294,13 +1232,12 @@ MnpGroupOpAddCtrlBlk ( Delete a group control block from the instance. If the controlled group address's reference count reaches zero, the group address is removed too. - @param Instance Pointer to the instance context data. - @param CtrlBlk Pointer to the group control block to delete. + @param[in] Instance Pointer to the instance context data. + @param[in] CtrlBlk Pointer to the group control block to delete. @return The group address controlled by the control block is no longer used or not. **/ -STATIC BOOLEAN MnpGroupOpDelCtrlBlk ( IN MNP_INSTANCE_DATA *Instance, @@ -1319,8 +1256,8 @@ MnpGroupOpDelCtrlBlk ( // Remove and free the CtrlBlk. // GroupAddress = CtrlBlk->GroupAddress; - NetListRemoveEntry (&CtrlBlk->CtrlBlkEntry); - NetFreePool (CtrlBlk); + RemoveEntryList (&CtrlBlk->CtrlBlkEntry); + gBS->FreePool (CtrlBlk); ASSERT (GroupAddress->RefCnt > 0); @@ -1334,8 +1271,8 @@ MnpGroupOpDelCtrlBlk ( // Free this GroupAddress entry if no instance uses it. // MnpServiceData->GroupAddressCount--; - NetListRemoveEntry (&GroupAddress->AddrEntry); - NetFreePool (GroupAddress); + RemoveEntryList (&GroupAddress->AddrEntry); + gBS->FreePool (GroupAddress); return TRUE; } @@ -1347,28 +1284,29 @@ MnpGroupOpDelCtrlBlk ( /** Do the group operations for this instance. - @param Instance Pointer to the instance context data. - @param JoinFlag Set to TRUE to join a group. Set to TRUE to leave a - group/groups. - @param MacAddress Pointer to the group address to join or leave. - @param CtrlBlk Pointer to the group control block if JoinFlag if - FALSE. + @param[in, out] Instance Pointer to the instance context data. + @param[in] JoinFlag Set to TRUE to join a group. Set to TRUE to + leave a group/groups. + @param[in] MacAddress Pointer to the group address to join or leave. + @param[in] CtrlBlk Pointer to the group control block if JoinFlag + is FALSE. - @retval EFI_SUCCESS The group operation finished. - @retval Other Some error occurs. + @retval EFI_SUCCESS The group operation finished. + @retval EFI_OUT_OF_RESOURCES Failed due to lack of memory resources. + @retval Others Other errors as indicated. **/ EFI_STATUS MnpGroupOp ( - IN MNP_INSTANCE_DATA *Instance, + IN OUT MNP_INSTANCE_DATA *Instance, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL ) { MNP_SERVICE_DATA *MnpServiceData; - NET_LIST_ENTRY *Entry; - NET_LIST_ENTRY *NextEntry; + LIST_ENTRY *Entry; + LIST_ENTRY *NextEntry; MNP_GROUP_ADDRESS *GroupAddress; EFI_SIMPLE_NETWORK_MODE *SnpMode; MNP_GROUP_CONTROL_BLOCK *NewCtrlBlk; @@ -1392,10 +1330,10 @@ MnpGroupOp ( // // Allocate memory for the control block. // - NewCtrlBlk = NetAllocatePool (sizeof (MNP_GROUP_CONTROL_BLOCK)); + NewCtrlBlk = AllocatePool (sizeof (MNP_GROUP_CONTROL_BLOCK)); if (NewCtrlBlk == NULL) { - MNP_DEBUG_ERROR (("MnpGroupOp: Failed to allocate memory resource.\n")); + DEBUG ((EFI_D_ERROR, "MnpGroupOp: Failed to allocate memory resource.\n")); return EFI_OUT_OF_RESOURCES; } @@ -1404,7 +1342,7 @@ MnpGroupOp ( // Check whether the MacAddress is already joined by other instances. // GroupAddress = NET_LIST_USER_STRUCT (Entry, MNP_GROUP_ADDRESS, AddrEntry); - if (0 == NetCompareMem ( + if (0 == CompareMem ( MacAddress, &GroupAddress->Address, SnpMode->HwAddressSize