]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Network/Snp32_64/Dxe/reset.c
Fix capitalization
[mirror_edk2.git] / EdkModulePkg / Universal / Network / Snp32_64 / Dxe / reset.c
1 /*++
2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module name:
12 reset.c
13
14 Abstract:
15
16 Revision history:
17 2000-Feb-09 M(f)J Genesis.
18 --*/
19
20
21 #include "Snp.h"
22
23 EFI_STATUS
24 pxe_reset (
25 SNP_DRIVER *snp
26 )
27 /*++
28
29 Routine Description:
30 This routine calls undi to reset the nic.
31
32 Arguments:
33 snp - pointer to the snp driver structure
34
35 Returns:
36 EFI_SUCCESSFUL for a successful completion
37 other for failed calls
38
39 --*/
40 {
41 snp->cdb.OpCode = PXE_OPCODE_RESET;
42 snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
43 snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
44 snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
45 snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
46 snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
47 snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
48 snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
49 snp->cdb.IFnum = snp->if_num;
50 snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
51
52 //
53 // Issue UNDI command and check result.
54 //
55 DEBUG ((EFI_D_NET, "\nsnp->undi.reset() "));
56
57 (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
58
59 if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
60 DEBUG (
61 (EFI_D_WARN,
62 "\nsnp->undi32.reset() %xh:%xh\n",
63 snp->cdb.StatFlags,
64 snp->cdb.StatCode)
65 );
66
67 //
68 // UNDI could not be reset. Return UNDI error.
69 //
70 return EFI_DEVICE_ERROR;
71 }
72
73 return EFI_SUCCESS;
74 }
75
76 EFI_STATUS
77 EFIAPI
78 snp_undi32_reset (
79 IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
80 IN BOOLEAN ExtendedVerification
81 )
82 /*++
83
84 Routine Description:
85 This is the SNP interface routine for resetting the NIC
86 This routine basically retrieves snp structure, checks the SNP state and
87 calls the pxe_reset routine to actually do the reset!
88
89 Arguments:
90 this - context pointer
91 ExtendedVerification - not implemented
92
93 Returns:
94
95 --*/
96 {
97 SNP_DRIVER *snp;
98
99 //
100 // Resolve Warning 4 unreferenced parameter problem
101 //
102 ExtendedVerification = 0;
103
104 if (this == NULL) {
105 return EFI_INVALID_PARAMETER;
106 }
107
108 snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
109
110 if (snp == NULL) {
111 return EFI_DEVICE_ERROR;
112 }
113
114 switch (snp->mode.State) {
115 case EfiSimpleNetworkInitialized:
116 break;
117
118 case EfiSimpleNetworkStopped:
119 return EFI_NOT_STARTED;
120
121 case EfiSimpleNetworkStarted:
122 return EFI_DEVICE_ERROR;
123
124 default:
125 return EFI_DEVICE_ERROR;
126 }
127
128 return pxe_reset (snp);
129 }