/** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+ Implementation of shuting down a network adapter.\r
+ \r
+Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module name:\r
- shutdown.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
- 2000-Feb-14 M(f)J Genesis.\r
-\r
**/\r
\r
#include "Snp.h"\r
\r
\r
/**\r
- this routine calls undi to shut down the interface.\r
+ Call UNDI to shut down the interface.\r
\r
- @param snp pointer to snp driver structure\r
+ @param Snp Pointer to snp driver structure.\r
\r
+ @retval EFI_SUCCESS UNDI is shut down successfully.\r
+ @retval EFI_DEVICE_ERROR UNDI could not be shut down.\r
\r
**/\r
EFI_STATUS\r
-pxe_shutdown (\r
- IN SNP_DRIVER *snp\r
+PxeShutdown (\r
+ IN SNP_DRIVER *Snp\r
)\r
{\r
- snp->cdb.OpCode = PXE_OPCODE_SHUTDOWN;\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->if_num;\r
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+ Snp->Cdb.OpCode = PXE_OPCODE_SHUTDOWN;\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 and check result.\r
//\r
DEBUG ((EFI_D_NET, "\nsnp->undi.shutdown() "));\r
\r
- (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+ (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
\r
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+ if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
//\r
// UNDI could not be shutdown. Return UNDI error.\r
//\r
- DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));\r
+ DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown() %xh:%xh\n", Snp->Cdb.StatFlags, Snp->Cdb.StatCode));\r
\r
return EFI_DEVICE_ERROR;\r
}\r
//\r
// Free allocated memory.\r
//\r
- if (snp->tx_rx_buffer != NULL) {\r
- snp->IoFncs->FreeBuffer (\r
- snp->IoFncs,\r
- SNP_MEM_PAGES (snp->tx_rx_bufsize),\r
- (VOID *) snp->tx_rx_buffer\r
+ if (Snp->TxRxBuffer != NULL) {\r
+ Snp->PciIo->FreeBuffer (\r
+ Snp->PciIo,\r
+ SNP_MEM_PAGES (Snp->TxRxBufferSize),\r
+ (VOID *) Snp->TxRxBuffer\r
);\r
}\r
\r
- snp->tx_rx_buffer = NULL;\r
- snp->tx_rx_bufsize = 0;\r
+ Snp->TxRxBuffer = NULL;\r
+ Snp->TxRxBufferSize = 0;\r
\r
return EFI_SUCCESS;\r
}\r
\r
\r
/**\r
- This is the SNP interface routine for shutting down the interface\r
- This routine basically retrieves snp structure, checks the SNP state and\r
- calls the pxe_shutdown routine to actually do the undi shutdown\r
-\r
- @param this context pointer\r
-\r
+ Resets a network adapter and leaves it in a state that is safe for another \r
+ driver to initialize. \r
+ \r
+ This function releases the memory buffers assigned in the Initialize() call.\r
+ Pending transmits and receives are lost, and interrupts are cleared and disabled.\r
+ After this call, only the Initialize() and Stop() calls may be used. If the \r
+ network interface was successfully shutdown, then EFI_SUCCESS will be returned.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The network interface was shutdown.\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 valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
-snp_undi32_shutdown (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Shutdown (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
)\r
{\r
- SNP_DRIVER *snp;\r
+ SNP_DRIVER *Snp;\r
EFI_STATUS Status;\r
EFI_TPL OldTpl;\r
\r
//\r
+ // Get pointer to SNP driver instance for *This.\r
//\r
- //\r
- if (this == NULL) {\r
+ if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+ Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
//\r
+ // Return error if the SNP is not initialized.\r
//\r
- //\r
- switch (snp->mode.State) {\r
+ switch (Snp->Mode.State) {\r
case EfiSimpleNetworkInitialized:\r
break;\r
\r
Status = EFI_DEVICE_ERROR;\r
goto ON_EXIT;\r
}\r
- //\r
- //\r
- //\r
- Status = pxe_shutdown (snp);\r
+ \r
+ Status = PxeShutdown (Snp);\r
\r
- snp->mode.State = EfiSimpleNetworkStarted;\r
- snp->mode.ReceiveFilterSetting = 0;\r
+ Snp->Mode.State = EfiSimpleNetworkStarted;\r
+ Snp->Mode.ReceiveFilterSetting = 0;\r
\r
- snp->mode.MCastFilterCount = 0;\r
- snp->mode.ReceiveFilterSetting = 0;\r
- ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);\r
+ Snp->Mode.MCastFilterCount = 0;\r
+ Snp->Mode.ReceiveFilterSetting = 0;\r
+ ZeroMem (Snp->Mode.MCastFilter, sizeof Snp->Mode.MCastFilter);\r
CopyMem (\r
- &snp->mode.CurrentAddress,\r
- &snp->mode.PermanentAddress,\r
+ &Snp->Mode.CurrentAddress,\r
+ &Snp->Mode.PermanentAddress,\r
sizeof (EFI_MAC_ADDRESS)\r
);\r
\r
- gBS->CloseEvent (snp->snp.WaitForPacket);\r
+ gBS->CloseEvent (Snp->Snp.WaitForPacket);\r
\r
ON_EXIT:\r
gBS->RestoreTPL (OldTpl);\r