VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpShutdown.c

Last change on this file was 89503, checked in by vboxsync, 3 years ago

EFI/E1kNetDxe: Updates, the basic receive and transmit operations are functional and PXE booting seems to work with the limited testing done, include the driver in our image

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/** @file
2
3 Implementation of the SNP.Shutdown() function and its private helpers if any.
4
5 Copyright (c) 2021, Oracle and/or its affiliates.
6 Copyright (c) 2017, AMD Inc, All rights reserved.
7 Copyright (C) 2013, Red Hat, Inc.
8 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11
12**/
13
14#include <Library/UefiBootServicesTableLib.h>
15
16#include "E1kNet.h"
17
18/**
19 Resets a network adapter and leaves it in a state that is safe for another
20 driver to initialize.
21
22 @param This Protocol instance pointer.
23
24 @retval EFI_SUCCESS The network interface was shutdown.
25 @retval EFI_NOT_STARTED The network interface has not been started.
26 @retval EFI_INVALID_PARAMETER One or more of the parameters has an
27 unsupported value.
28 @retval EFI_DEVICE_ERROR The command could not be sent to the network
29 interface.
30 @retval EFI_UNSUPPORTED This function is not supported by the network
31 interface.
32
33**/
34
35EFI_STATUS
36EFIAPI
37E1kNetShutdown (
38 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
39 )
40{
41 E1K_NET_DEV *Dev;
42 EFI_TPL OldTpl;
43 EFI_STATUS Status;
44
45 DEBUG((DEBUG_INFO, "E1kNetShutdown:\n"));
46
47 if (This == NULL) {
48 return EFI_INVALID_PARAMETER;
49 }
50
51 Dev = E1K_NET_FROM_SNP (This);
52 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
53 switch (Dev->Snm.State) {
54 case EfiSimpleNetworkStopped:
55 Status = EFI_NOT_STARTED;
56 goto Exit;
57 case EfiSimpleNetworkStarted:
58 Status = EFI_DEVICE_ERROR;
59 goto Exit;
60 default:
61 break;
62 }
63
64 E1kNetDevReset(Dev);
65 E1kNetShutdownRx (Dev);
66 E1kNetShutdownTx (Dev);
67
68 Dev->Snm.State = EfiSimpleNetworkStarted;
69 Status = EFI_SUCCESS;
70
71Exit:
72 gBS->RestoreTPL (OldTpl);
73 return Status;
74}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use