]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Universal/Network/Snp32_64/Dxe/shutdown.c
Fix capitalization
[mirror_edk2.git] / EdkModulePkg / Universal / Network / Snp32_64 / Dxe / shutdown.c
CommitLineData
878ddf1f 1/*++\r
2Copyright (c) 2006, Intel Corporation \r
3All rights reserved. This program and the accompanying materials \r
4are licensed and made available under the terms and conditions of the BSD License \r
5which accompanies this distribution. The full text of the license may be found at \r
6http://opensource.org/licenses/bsd-license.php \r
7 \r
8THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
9WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
10\r
11Module name:\r
12 shutdown.c\r
13\r
14Abstract:\r
15\r
16Revision history:\r
17 2000-Feb-14 M(f)J Genesis.\r
18--*/\r
19\r
20\r
4cbd855e 21#include "Snp.h"\r
878ddf1f 22\r
23EFI_STATUS\r
24pxe_shutdown (\r
25 IN SNP_DRIVER *snp\r
26 )\r
27/*++\r
28\r
29Routine Description:\r
30 this routine calls undi to shut down the interface.\r
31\r
32Arguments:\r
33 snp - pointer to snp driver structure\r
34\r
35Returns:\r
36\r
37--*/\r
38{\r
39 snp->cdb.OpCode = PXE_OPCODE_SHUTDOWN;\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.shutdown() "));\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 //\r
59 // UNDI could not be shutdown. Return UNDI error.\r
60 //\r
61 DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));\r
62\r
63 return EFI_DEVICE_ERROR;\r
64 }\r
65 //\r
66 // Free allocated memory.\r
67 //\r
68 if (snp->tx_rx_buffer != NULL) {\r
69 snp->IoFncs->FreeBuffer (\r
70 snp->IoFncs,\r
71 SNP_MEM_PAGES (snp->tx_rx_bufsize),\r
72 (VOID *) snp->tx_rx_buffer\r
73 );\r
74 }\r
75\r
76 snp->tx_rx_buffer = NULL;\r
77 snp->tx_rx_bufsize = 0;\r
78\r
79 return EFI_SUCCESS;\r
80}\r
81\r
82EFI_STATUS\r
83EFIAPI\r
84snp_undi32_shutdown (\r
85 IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
86 )\r
87/*++\r
88\r
89Routine Description:\r
90 This is the SNP interface routine for shutting down the interface\r
91 This routine basically retrieves snp structure, checks the SNP state and\r
92 calls the pxe_shutdown routine to actually do the undi shutdown\r
93\r
94Arguments:\r
95 this - context pointer\r
96\r
97Returns:\r
98\r
99--*/\r
100{\r
101 SNP_DRIVER *snp;\r
102 EFI_STATUS status;\r
103\r
104 //\r
105 //\r
106 //\r
107 if (this == NULL) {\r
108 return EFI_INVALID_PARAMETER;\r
109 }\r
110\r
111 snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
112\r
113 if (snp == NULL) {\r
114 return EFI_DEVICE_ERROR;\r
115 }\r
116 //\r
117 //\r
118 //\r
119 switch (snp->mode.State) {\r
120 case EfiSimpleNetworkInitialized:\r
121 break;\r
122\r
123 case EfiSimpleNetworkStopped:\r
124 return EFI_NOT_STARTED;\r
125\r
126 case EfiSimpleNetworkStarted:\r
127 return EFI_DEVICE_ERROR;\r
128\r
129 default:\r
130 return EFI_DEVICE_ERROR;\r
131 }\r
132 //\r
133 //\r
134 //\r
135 status = pxe_shutdown (snp);\r
136\r
137 snp->mode.State = EfiSimpleNetworkStarted;\r
138 snp->mode.ReceiveFilterSetting = 0;\r
139\r
140 snp->mode.MCastFilterCount = 0;\r
141 snp->mode.ReceiveFilterSetting = 0;\r
142 ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);\r
143 CopyMem (\r
144 &snp->mode.CurrentAddress,\r
145 &snp->mode.PermanentAddress,\r
146 sizeof (EFI_MAC_ADDRESS)\r
147 );\r
148\r
149 gBS->CloseEvent (snp->snp.WaitForPacket);\r
150\r
151 return status;\r
152}\r