]>
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 | |
27 | @param snp pointer to the snp driver structure\r | |
28 | \r | |
29 | @return EFI_SUCCESSFUL for a successful completion\r | |
30 | @return other for failed calls\r | |
31 | \r | |
32 | **/\r | |
33 | STATIC\r | |
34 | EFI_STATUS\r | |
35 | pxe_reset (\r | |
36 | SNP_DRIVER *snp\r | |
37 | )\r | |
38 | {\r | |
39 | snp->cdb.OpCode = PXE_OPCODE_RESET;\r | |
40 | snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;\r | |
41 | snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;\r | |
42 | snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;\r | |
43 | snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;\r | |
44 | snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;\r | |
45 | snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;\r | |
46 | snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;\r | |
47 | snp->cdb.IFnum = snp->if_num;\r | |
48 | snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;\r | |
49 | \r | |
50 | //\r | |
51 | // Issue UNDI command and check result.\r | |
52 | //\r | |
53 | DEBUG ((EFI_D_NET, "\nsnp->undi.reset() "));\r | |
54 | \r | |
55 | (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r | |
56 | \r | |
57 | if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r | |
58 | DEBUG (\r | |
59 | (EFI_D_WARN,\r | |
60 | "\nsnp->undi32.reset() %xh:%xh\n",\r | |
61 | snp->cdb.StatFlags,\r | |
62 | snp->cdb.StatCode)\r | |
63 | );\r | |
64 | \r | |
65 | //\r | |
66 | // UNDI could not be reset. Return UNDI error.\r | |
67 | //\r | |
68 | return EFI_DEVICE_ERROR;\r | |
69 | }\r | |
70 | \r | |
71 | return EFI_SUCCESS;\r | |
72 | }\r | |
73 | \r | |
74 | \r | |
75 | /**\r | |
76 | This is the SNP interface routine for resetting the NIC\r | |
77 | This routine basically retrieves snp structure, checks the SNP state and\r | |
78 | calls the pxe_reset routine to actually do the reset!\r | |
79 | \r | |
80 | @param this context pointer\r | |
81 | @param ExtendedVerification not implemented\r | |
82 | \r | |
83 | \r | |
84 | **/\r | |
85 | EFI_STATUS\r | |
86 | EFIAPI\r | |
87 | snp_undi32_reset (\r | |
88 | IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r | |
89 | IN BOOLEAN ExtendedVerification\r | |
90 | )\r | |
91 | {\r | |
92 | SNP_DRIVER *snp;\r | |
93 | EFI_TPL OldTpl;\r | |
94 | EFI_STATUS Status;\r | |
95 | \r | |
96 | //\r | |
97 | // Resolve Warning 4 unreferenced parameter problem\r | |
98 | //\r | |
99 | ExtendedVerification = 0;\r | |
100 | DEBUG ((EFI_D_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification));\r | |
101 | \r | |
102 | if (this == NULL) {\r | |
103 | return EFI_INVALID_PARAMETER;\r | |
104 | }\r | |
105 | \r | |
106 | snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r | |
107 | \r | |
108 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r | |
109 | \r | |
110 | switch (snp->mode.State) {\r | |
111 | case EfiSimpleNetworkInitialized:\r | |
112 | break;\r | |
113 | \r | |
114 | case EfiSimpleNetworkStopped:\r | |
115 | Status = EFI_NOT_STARTED;\r | |
116 | goto ON_EXIT;\r | |
117 | \r | |
118 | default:\r | |
119 | Status = EFI_DEVICE_ERROR;\r | |
120 | goto ON_EXIT;\r | |
121 | }\r | |
122 | \r | |
123 | Status = pxe_reset (snp);\r | |
124 | \r | |
125 | ON_EXIT:\r | |
126 | gBS->RestoreTPL (OldTpl);\r | |
127 | \r | |
128 | return Status;\r | |
129 | }\r |