]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Implementation of resetting a network adapter.\r | |
3 | \r | |
4 | Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials are licensed and made available under the \r | |
6 | terms and conditions of the BSD License which accompanies this distribution. The \r | |
7 | full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "Snp.h"\r | |
16 | \r | |
17 | \r | |
18 | /**\r | |
19 | Call UNDI to reset the NIC.\r | |
20 | \r | |
21 | @param Snp Pointer to the snp driver structure.\r | |
22 | \r | |
23 | @return EFI_SUCCESSFUL The NIC was reset.\r | |
24 | @retval EFI_DEVICE_ERROR The NIC cannot be reset.\r | |
25 | \r | |
26 | **/\r | |
27 | EFI_STATUS\r | |
28 | PxeReset (\r | |
29 | SNP_DRIVER *Snp\r | |
30 | )\r | |
31 | {\r | |
32 | Snp->Cdb.OpCode = PXE_OPCODE_RESET;\r | |
33 | Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;\r | |
34 | Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;\r | |
35 | Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;\r | |
36 | Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;\r | |
37 | Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;\r | |
38 | Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;\r | |
39 | Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;\r | |
40 | Snp->Cdb.IFnum = Snp->IfNum;\r | |
41 | Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;\r | |
42 | \r | |
43 | //\r | |
44 | // Issue UNDI command and check result.\r | |
45 | //\r | |
46 | DEBUG ((EFI_D_NET, "\nsnp->undi.reset() "));\r | |
47 | \r | |
48 | (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r | |
49 | \r | |
50 | if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r | |
51 | DEBUG (\r | |
52 | (EFI_D_WARN,\r | |
53 | "\nsnp->undi32.reset() %xh:%xh\n",\r | |
54 | Snp->Cdb.StatFlags,\r | |
55 | Snp->Cdb.StatCode)\r | |
56 | );\r | |
57 | \r | |
58 | //\r | |
59 | // UNDI could not be reset. Return UNDI error.\r | |
60 | //\r | |
61 | return EFI_DEVICE_ERROR;\r | |
62 | }\r | |
63 | \r | |
64 | return EFI_SUCCESS;\r | |
65 | }\r | |
66 | \r | |
67 | \r | |
68 | /**\r | |
69 | Resets a network adapter and reinitializes it with the parameters that were\r | |
70 | provided in the previous call to Initialize().\r | |
71 | \r | |
72 | This function resets a network adapter and reinitializes it with the parameters\r | |
73 | that were provided in the previous call to Initialize(). The transmit and \r | |
74 | receive queues are emptied and all pending interrupts are cleared.\r | |
75 | Receive filters, the station address, the statistics, and the multicast-IP-to-HW \r | |
76 | MAC addresses are not reset by this call. If the network interface was \r | |
77 | successfully reset, then EFI_SUCCESS will be returned. If the driver has not \r | |
78 | been initialized, EFI_DEVICE_ERROR will be returned.\r | |
79 | \r | |
80 | @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r | |
81 | @param ExtendedVerification Indicates that the driver may perform a more \r | |
82 | exhaustive verification operation of the device \r | |
83 | during reset.\r | |
84 | \r | |
85 | @retval EFI_SUCCESS The network interface was reset.\r | |
86 | @retval EFI_NOT_STARTED The network interface has not been started.\r | |
87 | @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r | |
88 | @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r | |
89 | @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r | |
90 | \r | |
91 | **/\r | |
92 | EFI_STATUS\r | |
93 | EFIAPI\r | |
94 | SnpUndi32Reset (\r | |
95 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r | |
96 | IN BOOLEAN ExtendedVerification\r | |
97 | )\r | |
98 | {\r | |
99 | SNP_DRIVER *Snp;\r | |
100 | EFI_TPL OldTpl;\r | |
101 | EFI_STATUS Status;\r | |
102 | \r | |
103 | //\r | |
104 | // Resolve Warning 4 unreferenced parameter problem\r | |
105 | //\r | |
106 | ExtendedVerification = 0;\r | |
107 | DEBUG ((EFI_D_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification));\r | |
108 | \r | |
109 | if (This == NULL) {\r | |
110 | return EFI_INVALID_PARAMETER;\r | |
111 | }\r | |
112 | \r | |
113 | Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r | |
114 | \r | |
115 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r | |
116 | \r | |
117 | switch (Snp->Mode.State) {\r | |
118 | case EfiSimpleNetworkInitialized:\r | |
119 | break;\r | |
120 | \r | |
121 | case EfiSimpleNetworkStopped:\r | |
122 | Status = EFI_NOT_STARTED;\r | |
123 | goto ON_EXIT;\r | |
124 | \r | |
125 | default:\r | |
126 | Status = EFI_DEVICE_ERROR;\r | |
127 | goto ON_EXIT;\r | |
128 | }\r | |
129 | \r | |
130 | Status = PxeReset (Snp);\r | |
131 | \r | |
132 | ON_EXIT:\r | |
133 | gBS->RestoreTPL (OldTpl);\r | |
134 | \r | |
135 | return Status;\r | |
136 | }\r |