]>
Commit | Line | Data |
---|---|---|
8a67d61d | 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 | stop.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 stop the interface and changes the snp state\r | |
26 | \r | |
27 | @param snp pointer to snp driver structure\r | |
28 | \r | |
29 | \r | |
30 | **/\r | |
31 | EFI_STATUS\r | |
32 | pxe_stop (\r | |
33 | SNP_DRIVER *snp\r | |
34 | )\r | |
35 | {\r | |
36 | snp->cdb.OpCode = PXE_OPCODE_STOP;\r | |
37 | snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;\r | |
38 | snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;\r | |
39 | snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;\r | |
40 | snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;\r | |
41 | snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;\r | |
42 | snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;\r | |
43 | snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;\r | |
44 | snp->cdb.IFnum = snp->if_num;\r | |
45 | snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;\r | |
46 | \r | |
47 | //\r | |
48 | // Issue UNDI command\r | |
49 | //\r | |
50 | DEBUG ((EFI_D_NET, "\nsnp->undi.stop() "));\r | |
51 | \r | |
52 | (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r | |
53 | \r | |
54 | if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r | |
55 | DEBUG (\r | |
56 | (EFI_D_WARN,\r | |
57 | "\nsnp->undi.stop() %xh:%xh\n",\r | |
58 | snp->cdb.StatCode,\r | |
59 | snp->cdb.StatFlags)\r | |
60 | );\r | |
61 | \r | |
62 | return EFI_DEVICE_ERROR;\r | |
63 | }\r | |
64 | //\r | |
65 | // Set simple network state to Started and return success.\r | |
66 | //\r | |
67 | snp->mode.State = EfiSimpleNetworkStopped;\r | |
68 | return EFI_SUCCESS;\r | |
69 | }\r | |
70 | \r | |
71 | \r | |
72 | /**\r | |
73 | This is the SNP interface routine for stopping the interface.\r | |
74 | This routine basically retrieves snp structure, checks the SNP state and\r | |
75 | calls the pxe_stop routine to actually stop the undi interface\r | |
76 | \r | |
77 | @param this context pointer\r | |
78 | \r | |
79 | \r | |
80 | **/\r | |
81 | EFI_STATUS\r | |
82 | EFIAPI\r | |
83 | snp_undi32_stop (\r | |
84 | IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r | |
85 | )\r | |
86 | {\r | |
87 | SNP_DRIVER *snp;\r | |
88 | EFI_TPL OldTpl;\r | |
89 | EFI_STATUS Status;\r | |
90 | \r | |
91 | if (this == NULL) {\r | |
92 | return EFI_INVALID_PARAMETER;\r | |
93 | }\r | |
94 | \r | |
95 | snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r | |
96 | \r | |
97 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r | |
98 | \r | |
99 | switch (snp->mode.State) {\r | |
100 | case EfiSimpleNetworkStarted:\r | |
101 | break;\r | |
102 | \r | |
103 | case EfiSimpleNetworkStopped:\r | |
104 | Status = EFI_NOT_STARTED;\r | |
105 | goto ON_EXIT;\r | |
106 | \r | |
107 | default:\r | |
108 | Status = EFI_DEVICE_ERROR;\r | |
109 | goto ON_EXIT;\r | |
110 | }\r | |
111 | \r | |
112 | Status = pxe_stop (snp);\r | |
113 | \r | |
114 | ON_EXIT:\r | |
115 | gBS->RestoreTPL (OldTpl);\r | |
116 | \r | |
117 | return Status;\r | |
118 | }\r |