]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | Copyright (c) 2006, 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 | |
4cbd855e | 21 | #include "Snp.h"\r |
878ddf1f | 22 | \r |
23 | EFI_STATUS\r | |
24 | pxe_stop (\r | |
25 | SNP_DRIVER *snp\r | |
26 | )\r | |
27 | /*++\r | |
28 | \r | |
29 | Routine Description:\r | |
30 | this routine calls undi to stop the interface and changes the snp state\r | |
31 | \r | |
32 | Arguments:\r | |
33 | snp - pointer to snp driver structure\r | |
34 | \r | |
35 | Returns:\r | |
36 | \r | |
37 | --*/\r | |
38 | {\r | |
39 | snp->cdb.OpCode = PXE_OPCODE_STOP;\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\r | |
52 | //\r | |
53 | DEBUG ((EFI_D_NET, "\nsnp->undi.stop() "));\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->undi.stop() %xh:%xh\n",\r | |
61 | snp->cdb.StatCode,\r | |
62 | snp->cdb.StatFlags)\r | |
63 | );\r | |
64 | \r | |
65 | return EFI_DEVICE_ERROR;\r | |
66 | }\r | |
67 | //\r | |
68 | // Set simple network state to Started and return success.\r | |
69 | //\r | |
70 | snp->mode.State = EfiSimpleNetworkStopped;\r | |
71 | return EFI_SUCCESS;\r | |
72 | }\r | |
73 | \r | |
74 | EFI_STATUS\r | |
75 | EFIAPI\r | |
76 | snp_undi32_stop (\r | |
77 | IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r | |
78 | )\r | |
79 | /*++\r | |
80 | \r | |
81 | Routine Description:\r | |
82 | This is the SNP interface routine for stopping the interface.\r | |
83 | This routine basically retrieves snp structure, checks the SNP state and\r | |
84 | calls the pxe_stop routine to actually stop the undi interface\r | |
85 | \r | |
86 | Arguments:\r | |
87 | this - context pointer\r | |
88 | \r | |
89 | Returns:\r | |
90 | \r | |
91 | --*/\r | |
92 | {\r | |
93 | SNP_DRIVER *snp;\r | |
94 | \r | |
95 | if (this == NULL) {\r | |
96 | return EFI_INVALID_PARAMETER;\r | |
97 | }\r | |
98 | \r | |
99 | snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r | |
100 | \r | |
101 | if (snp == NULL) {\r | |
102 | return EFI_DEVICE_ERROR;\r | |
103 | }\r | |
104 | \r | |
105 | switch (snp->mode.State) {\r | |
106 | case EfiSimpleNetworkStarted:\r | |
107 | break;\r | |
108 | \r | |
109 | case EfiSimpleNetworkStopped:\r | |
110 | return EFI_NOT_STARTED;\r | |
111 | \r | |
112 | case EfiSimpleNetworkInitialized:\r | |
113 | return EFI_DEVICE_ERROR;\r | |
114 | \r | |
115 | default:\r | |
116 | return EFI_DEVICE_ERROR;\r | |
117 | }\r | |
118 | \r | |
119 | return pxe_stop (snp);\r | |
120 | }\r |