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