+++ /dev/null
-/** @file\r
- Implementation of stopping a network interface.\r
-\r
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "Snp.h"\r
-\r
-\r
-/**\r
- Call UNDI to stop the interface and changes the snp state.\r
-\r
- @param Snp Pointer to snp driver structure\r
-\r
- @retval EFI_SUCCESS The network interface was stopped.\r
- @retval EFI_DEVICE_ERROR SNP is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-PxeStop (\r
- SNP_DRIVER *Snp\r
- )\r
-{\r
- Snp->Cdb.OpCode = PXE_OPCODE_STOP;\r
- Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;\r
- Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;\r
- Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;\r
- Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;\r
- Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;\r
- Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;\r
- Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;\r
- Snp->Cdb.IFnum = Snp->IfNum;\r
- Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;\r
-\r
- //\r
- // Issue UNDI command\r
- //\r
- DEBUG ((EFI_D_NET, "\nsnp->undi.stop() "));\r
-\r
- (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
-\r
- if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
- DEBUG (\r
- (EFI_D_WARN,\r
- "\nsnp->undi.stop() %xh:%xh\n",\r
- Snp->Cdb.StatFlags,\r
- Snp->Cdb.StatCode)\r
- );\r
-\r
- return EFI_DEVICE_ERROR;\r
- }\r
- //\r
- // Set simple network state to Started and return success.\r
- //\r
- Snp->Mode.State = EfiSimpleNetworkStopped;\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Changes the state of a network interface from "started" to "stopped."\r
-\r
- This function stops a network interface. This call is only valid if the network\r
- interface is in the started state. If the network interface was successfully\r
- stopped, then EFI_SUCCESS will be returned.\r
-\r
- @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL\r
- instance.\r
-\r
-\r
- @retval EFI_SUCCESS The network interface was stopped.\r
- @retval EFI_NOT_STARTED The network interface has not been started.\r
- @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a\r
- valid EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
- @retval EFI_DEVICE_ERROR The command could not be sent to the network\r
- interface.\r
- @retval EFI_UNSUPPORTED This function is not supported by the network\r
- interface.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SnpUndi32Stop (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
- )\r
-{\r
- SNP_DRIVER *Snp;\r
- EFI_TPL OldTpl;\r
- EFI_STATUS Status;\r
-\r
- if (This == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
-\r
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
-\r
- switch (Snp->Mode.State) {\r
- case EfiSimpleNetworkStarted:\r
- break;\r
-\r
- case EfiSimpleNetworkStopped:\r
- Status = EFI_NOT_STARTED;\r
- goto ON_EXIT;\r
-\r
- default:\r
- Status = EFI_DEVICE_ERROR;\r
- goto ON_EXIT;\r
- }\r
-\r
- Status = PxeStop (Snp);\r
-\r
-ON_EXIT:\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return Status;\r
-}\r