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