+++ /dev/null
-/*++\r
-Copyright (c) 2006, 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
- \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
- reset.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
- 2000-Feb-09 M(f)J Genesis.\r
---*/\r
-\r
-\r
-#include "Snp.h"\r
-\r
-STATIC\r
-EFI_STATUS\r
-pxe_reset (\r
- SNP_DRIVER *snp\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- This routine calls undi to reset the nic.\r
-\r
-Arguments:\r
- snp - pointer to the snp driver structure\r
-\r
-Returns:\r
- EFI_SUCCESSFUL for a successful completion\r
- other for failed calls\r
-\r
---*/\r
-{\r
- snp->cdb.OpCode = PXE_OPCODE_RESET;\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
-\r
- //\r
- // Issue UNDI command and check result.\r
- //\r
- DEBUG ((EFI_D_NET, "\nsnp->undi.reset() "));\r
-\r
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);\r
-\r
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
- DEBUG (\r
- (EFI_D_WARN,\r
- "\nsnp->undi32.reset() %xh:%xh\n",\r
- snp->cdb.StatFlags,\r
- snp->cdb.StatCode)\r
- );\r
-\r
- //\r
- // UNDI could not be reset. Return UNDI error.\r
- //\r
- return EFI_DEVICE_ERROR;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-snp_undi32_reset (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- This is the SNP interface routine for resetting the NIC\r
- This routine basically retrieves snp structure, checks the SNP state and\r
- calls the pxe_reset routine to actually do the reset!\r
-\r
-Arguments:\r
- this - context pointer\r
- ExtendedVerification - not implemented\r
-\r
-Returns:\r
-\r
---*/\r
-{\r
- SNP_DRIVER *snp;\r
-\r
- if (this == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
-\r
- if (snp == NULL) {\r
- return EFI_DEVICE_ERROR;\r
- }\r
-\r
- switch (snp->mode.State) {\r
- case EfiSimpleNetworkInitialized:\r
- break;\r
-\r
- case EfiSimpleNetworkStopped:\r
- return EFI_NOT_STARTED;\r
-\r
- case EfiSimpleNetworkStarted:\r
- return EFI_DEVICE_ERROR;\r
-\r
- default:\r
- return EFI_DEVICE_ERROR;\r
- }\r
-\r
- return pxe_reset (snp);\r
-}\r