3 Driver Binding code and its private helpers for the virtio-net driver.
5 Copyright (C) 2013, Red Hat, Inc.
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available
9 under the terms and conditions of the BSD License which accompanies this
10 distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
14 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <IndustryStandard/Pci.h>
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/DevicePathLib.h>
21 #include <Library/MemoryAllocationLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
24 #include "VirtioNet.h"
26 #define RECEIVE_FILTERS_NO_MCAST ((UINT32) ( \
27 EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | \
28 EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST | \
29 EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS \
33 Temporarily enable then reset the virtio-net device in order to retrieve
34 configuration values needed by Simple Network Protocol and Simple Network
37 Only VirtioNetSnpPopulate() may call this function.
39 If the function fails for any reason, the virtio-net device is moved to
40 VSTAT_FAILED instead of being reset. This serves only informative purposes
43 param[in,out] Dev The VNET_DEV structure being created for
44 the virtio-net device.
45 param[out] MacAddress MAC address configured by the host.
46 param[out] MediaPresentSupported Link status is made available by the host.
47 param[out] MediaPresent If link status is made available by the
48 host, the current link status is stored in
49 *MediaPresent. Otherwise MediaPresent is
52 @retval EFI_UNSUPPORTED The host doesn't supply a MAC address.
53 @return Status codes from Dev->PciIo->Io.Read(),
54 VIRTIO_CFG_READ() and VIRTIO_CFG_WRITE().
55 @retval EFI_SUCCESS Configuration values retrieved.
60 VirtioNetGetFeatures (
62 OUT EFI_MAC_ADDRESS
*MacAddress
,
63 OUT BOOLEAN
*MediaPresentSupported
,
64 OUT BOOLEAN
*MediaPresent
73 // Interrogate the device for features (virtio-0.9.5, 2.2.1 Device
74 // Initialization Sequence), but don't complete setting it up.
76 NextDevStat
= 0; // step 1 -- reset device
77 Status
= VIRTIO_CFG_WRITE (Dev
, Generic
.VhdrDeviceStatus
, NextDevStat
);
78 if (EFI_ERROR (Status
)) {
82 NextDevStat
|= VSTAT_ACK
; // step 2 -- acknowledge device presence
83 Status
= VIRTIO_CFG_WRITE (Dev
, Generic
.VhdrDeviceStatus
, NextDevStat
);
84 if (EFI_ERROR (Status
)) {
88 NextDevStat
|= VSTAT_DRIVER
; // step 3 -- we know how to drive it
89 Status
= VIRTIO_CFG_WRITE (Dev
, Generic
.VhdrDeviceStatus
, NextDevStat
);
90 if (EFI_ERROR (Status
)) {
95 // step 4a -- retrieve and validate features
97 Status
= VIRTIO_CFG_READ (Dev
, Generic
.VhdrDeviceFeatureBits
, &Features
);
98 if (EFI_ERROR (Status
)) {
103 // get MAC address byte-wise
105 if ((Features
& VIRTIO_NET_F_MAC
) == 0) {
106 Status
= EFI_UNSUPPORTED
;
109 Status
= Dev
->PciIo
->Io
.Read (Dev
->PciIo
, // PciIo
110 EfiPciIoWidthUint8
, // Width
111 PCI_BAR_IDX0
, // BarIndex
112 OFFSET_OF_VNET (VhdrMac
), // Offset
113 SIZE_OF_VNET (VhdrMac
), // Count
117 if (EFI_ERROR (Status
)) {
122 // check if link status is reported, and if so, what the link status is
124 if ((Features
& VIRTIO_NET_F_STATUS
) == 0) {
125 *MediaPresentSupported
= FALSE
;
128 *MediaPresentSupported
= TRUE
;
129 Status
= VIRTIO_CFG_READ (Dev
, VhdrLinkStatus
, &LinkStatus
);
130 if (EFI_ERROR (Status
)) {
133 *MediaPresent
= !!(LinkStatus
& VIRTIO_NET_S_LINK_UP
);
137 VIRTIO_CFG_WRITE (Dev
, Generic
.VhdrDeviceStatus
,
138 EFI_ERROR (Status
) ? VSTAT_FAILED
: 0);
145 Set up the Simple Network Protocol fields, the Simple Network Mode fields,
146 and the Exit Boot Services Event of the virtio-net driver instance.
148 This function may only be called by VirtioNetDriverBindingStart().
150 @param[in,out] Dev The VNET_DEV driver instance being created for the
153 @return Status codes from the CreateEvent() boot service or the
154 VirtioNetGetFeatures() function.
155 @retval EFI_SUCCESS Configuration successful.
160 VirtioNetSnpPopulate (
167 // We set up a function here that is asynchronously callable by an
168 // external application to check if there are any packets available for
169 // reception. The least urgent task priority level we can specify for such a
170 // "software interrupt" is TPL_CALLBACK.
172 // TPL_CALLBACK is also the maximum TPL an SNP implementation is allowed to
173 // run at (see 6.1 Event, Timer, and Task Priority Services in the UEFI
174 // Specification 2.3.1+errC).
176 // Since we raise our TPL to TPL_CALLBACK in every single function that
177 // accesses the device, and the external application also queues its interest
178 // for received packets at the same TPL_CALLBACK, in effect the
179 // VirtioNetIsPacketAvailable() function will never interrupt any
180 // device-accessing driver function, it will be scheduled in isolation.
182 // TPL_CALLBACK (which basically this entire driver runs at) is allowed
183 // for "[l]ong term operations (such as file system operations and disk
184 // I/O)". Because none of our functions block, we'd satisfy an even stronger
187 Status
= gBS
->CreateEvent (EVT_NOTIFY_WAIT
, TPL_CALLBACK
,
188 &VirtioNetIsPacketAvailable
, Dev
, &Dev
->Snp
.WaitForPacket
);
189 if (EFI_ERROR (Status
)) {
193 Dev
->Snp
.Revision
= EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
;
194 Dev
->Snp
.Start
= &VirtioNetStart
;
195 Dev
->Snp
.Stop
= &VirtioNetStop
;
196 Dev
->Snp
.Initialize
= &VirtioNetInitialize
;
197 Dev
->Snp
.Reset
= &VirtioNetReset
;
198 Dev
->Snp
.Shutdown
= &VirtioNetShutdown
;
199 Dev
->Snp
.ReceiveFilters
= &VirtioNetReceiveFilters
;
200 Dev
->Snp
.StationAddress
= &VirtioNetStationAddress
;
201 Dev
->Snp
.Statistics
= &VirtioNetStatistics
;
202 Dev
->Snp
.MCastIpToMac
= &VirtioNetMcastIpToMac
;
203 Dev
->Snp
.NvData
= &VirtioNetNvData
;
204 Dev
->Snp
.GetStatus
= &VirtioNetGetStatus
;
205 Dev
->Snp
.Transmit
= &VirtioNetTransmit
;
206 Dev
->Snp
.Receive
= &VirtioNetReceive
;
207 Dev
->Snp
.Mode
= &Dev
->Snm
;
209 Dev
->Snm
.State
= EfiSimpleNetworkStopped
;
210 Dev
->Snm
.HwAddressSize
= SIZE_OF_VNET (VhdrMac
);
211 Dev
->Snm
.MediaHeaderSize
= SIZE_OF_VNET (VhdrMac
) + // dst MAC
212 SIZE_OF_VNET (VhdrMac
) + // src MAC
214 Dev
->Snm
.MaxPacketSize
= 1500;
215 Dev
->Snm
.NvRamSize
= 0;
216 Dev
->Snm
.NvRamAccessSize
= 0;
217 Dev
->Snm
.ReceiveFilterMask
= RECEIVE_FILTERS_NO_MCAST
;
218 Dev
->Snm
.ReceiveFilterSetting
= RECEIVE_FILTERS_NO_MCAST
;
219 Dev
->Snm
.MaxMCastFilterCount
= 0;
220 Dev
->Snm
.MCastFilterCount
= 0;
221 Dev
->Snm
.IfType
= 1; // ethernet
222 Dev
->Snm
.MacAddressChangeable
= FALSE
;
223 Dev
->Snm
.MultipleTxSupported
= TRUE
;
225 ASSERT (SIZE_OF_VNET (VhdrMac
) <= sizeof (EFI_MAC_ADDRESS
));
227 Status
= VirtioNetGetFeatures (Dev
, &Dev
->Snm
.CurrentAddress
,
228 &Dev
->Snm
.MediaPresentSupported
, &Dev
->Snm
.MediaPresent
);
229 if (EFI_ERROR (Status
)) {
230 goto CloseWaitForPacket
;
232 CopyMem (&Dev
->Snm
.PermanentAddress
, &Dev
->Snm
.CurrentAddress
,
233 SIZE_OF_VNET (VhdrMac
));
234 SetMem (&Dev
->Snm
.BroadcastAddress
, SIZE_OF_VNET (VhdrMac
), 0xFF);
237 // VirtioNetExitBoot() is queued by ExitBootServices(); its purpose is to
238 // cancel any pending virtio requests. The TPL_CALLBACK reasoning is
239 // identical to the one above. There's one difference: this kind of
240 // event is "globally visible", which means it can be signalled as soon as
241 // we create it. We haven't raised our TPL here, hence VirtioNetExitBoot()
242 // could be entered immediately. VirtioNetExitBoot() checks Dev->Snm.State,
245 Status
= gBS
->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES
, TPL_CALLBACK
,
246 &VirtioNetExitBoot
, Dev
, &Dev
->ExitBoot
);
247 if (EFI_ERROR (Status
)) {
248 goto CloseWaitForPacket
;
254 gBS
->CloseEvent (Dev
->Snp
.WaitForPacket
);
260 Release any resources allocated by VirtioNetSnpPopulate().
262 This function may only be called by VirtioNetDriverBindingStart(), when
263 rolling back a partial, failed driver instance creation, and by
264 VirtioNetDriverBindingStop(), when disconnecting a virtio-net device from the
267 @param[in,out] Dev The VNET_DEV driver instance being destroyed.
272 VirtioNetSnpEvacuate (
277 // This function runs either at TPL_CALLBACK already (from
278 // VirtioNetDriverBindingStop()), or it is part of a teardown following
279 // a partial, failed construction in VirtioNetDriverBindingStart(), when
280 // WaitForPacket was never accessible to the world.
282 gBS
->CloseEvent (Dev
->ExitBoot
);
283 gBS
->CloseEvent (Dev
->Snp
.WaitForPacket
);
288 Tests to see if this driver supports a given controller. If a child device is
289 provided, it further tests to see if this driver supports creating a handle
290 for the specified child device.
292 This function checks to see if the driver specified by This supports the
293 device specified by ControllerHandle. Drivers will typically use the device
294 path attached to ControllerHandle and/or the services from the bus I/O
295 abstraction attached to ControllerHandle to determine if the driver supports
296 ControllerHandle. This function may be called many times during platform
297 initialization. In order to reduce boot times, the tests performed by this
298 function must be very small, and take as little time as possible to execute.
299 This function must not change the state of any hardware devices, and this
300 function must be aware that the device specified by ControllerHandle may
301 already be managed by the same driver or a different driver. This function
302 must match its calls to AllocatePages() with FreePages(), AllocatePool() with
303 FreePool(), and OpenProtocol() with CloseProtocol(). Because ControllerHandle
304 may have been previously started by the same driver, if a protocol is already
305 in the opened state, then it must not be closed with CloseProtocol(). This is
306 required to guarantee the state of ControllerHandle is not modified by this
309 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL
311 @param[in] ControllerHandle The handle of the controller to test. This
312 handle must support a protocol interface
313 that supplies an I/O abstraction to the
315 @param[in] RemainingDevicePath A pointer to the remaining portion of a
316 device path. This parameter is ignored by
317 device drivers, and is optional for bus
318 drivers. For bus drivers, if this parameter
319 is not NULL, then the bus driver must
320 determine if the bus controller specified by
321 ControllerHandle and the child controller
322 specified by RemainingDevicePath are both
323 supported by this bus driver.
325 @retval EFI_SUCCESS The device specified by ControllerHandle and
326 RemainingDevicePath is supported by the
327 driver specified by This.
328 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
329 RemainingDevicePath is already being managed
330 by the driver specified by This.
331 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
332 RemainingDevicePath is already being managed
333 by a different driver or an application that
334 requires exclusive access. Currently not
336 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
337 RemainingDevicePath is not supported by the
338 driver specified by This.
344 VirtioNetDriverBindingSupported (
345 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
346 IN EFI_HANDLE DeviceHandle
,
347 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
351 EFI_PCI_IO_PROTOCOL
*PciIo
;
354 Status
= gBS
->OpenProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
355 (VOID
**)&PciIo
, This
->DriverBindingHandle
, DeviceHandle
,
356 EFI_OPEN_PROTOCOL_BY_DRIVER
);
357 if (EFI_ERROR (Status
)) {
361 Status
= PciIo
->Pci
.Read (PciIo
, EfiPciIoWidthUint32
, 0,
362 sizeof Pci
/ sizeof (UINT32
), &Pci
);
365 // virtio-0.9.5, 2.1 PCI Discovery:
366 // the network device has Subsystem Device ID 1
368 if (Status
== EFI_SUCCESS
) {
369 Status
= (Pci
.Hdr
.VendorId
== 0x1AF4 &&
370 Pci
.Hdr
.DeviceId
>= 0x1000 && Pci
.Hdr
.DeviceId
<= 0x103F &&
371 Pci
.Hdr
.RevisionID
== 0x00 &&
372 Pci
.Device
.SubsystemID
== 0x01) ? EFI_SUCCESS
: EFI_UNSUPPORTED
;
375 gBS
->CloseProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
376 This
->DriverBindingHandle
, DeviceHandle
);
382 Starts a device controller or a bus controller.
384 The Start() function is designed to be invoked from the EFI boot service
385 ConnectController(). As a result, much of the error checking on the
386 parameters to Start() has been moved into this common boot service. It is
387 legal to call Start() from other locations, but the following calling
388 restrictions must be followed, or the system behavior will not be
390 1. ControllerHandle must be a valid EFI_HANDLE.
391 2. If RemainingDevicePath is not NULL, then it must be a pointer to a
392 naturally aligned EFI_DEVICE_PATH_PROTOCOL.
393 3. Prior to calling Start(), the Supported() function for the driver
394 specified by This must have been called with the same calling parameters,
395 and Supported() must have returned EFI_SUCCESS.
397 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL
399 @param[in] ControllerHandle The handle of the controller to start. This
400 handle must support a protocol interface
401 that supplies an I/O abstraction to the
403 @param[in] RemainingDevicePath A pointer to the remaining portion of a
404 device path. This parameter is ignored by
405 device drivers, and is optional for bus
406 drivers. For a bus driver, if this parameter
407 is NULL, then handles for all the children
408 of Controller are created by this driver.
409 If this parameter is not NULL and the first
410 Device Path Node is not the End of Device
411 Path Node, then only the handle for the
412 child device specified by the first Device
413 Path Node of RemainingDevicePath is created
414 by this driver. If the first Device Path
415 Node of RemainingDevicePath is the End of
416 Device Path Node, no child handle is created
419 @retval EFI_SUCCESS The device was started.
420 @retval EFI_DEVICE_ERROR The device could not be started due to a
421 device error.Currently not implemented.
422 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
424 @retval Others The driver failded to start the device.
431 VirtioNetDriverBindingStart (
432 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
433 IN EFI_HANDLE DeviceHandle
,
434 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
439 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
440 MAC_ADDR_DEVICE_PATH MacNode
;
444 // allocate space for the driver instance
446 Dev
= (VNET_DEV
*) AllocateZeroPool (sizeof *Dev
);
448 return EFI_OUT_OF_RESOURCES
;
450 Dev
->Signature
= VNET_SIG
;
453 // get PCI access to the device and keep it open
455 Status
= gBS
->OpenProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
456 (VOID
**)&Dev
->PciIo
, This
->DriverBindingHandle
,
457 DeviceHandle
, EFI_OPEN_PROTOCOL_BY_DRIVER
);
458 if (EFI_ERROR (Status
)) {
463 // save original PCI attributes and enable IO space access
465 Status
= Dev
->PciIo
->Attributes (Dev
->PciIo
, EfiPciIoAttributeOperationGet
,
466 0, &Dev
->OrigPciAttributes
);
467 if (EFI_ERROR (Status
)) {
471 Status
= Dev
->PciIo
->Attributes (Dev
->PciIo
,
472 EfiPciIoAttributeOperationEnable
,
473 EFI_PCI_IO_ATTRIBUTE_IO
, NULL
);
474 if (EFI_ERROR (Status
)) {
479 // now we can run a basic one-shot virtio-net initialization required to
480 // retrieve the MAC address
482 Status
= VirtioNetSnpPopulate (Dev
);
483 if (EFI_ERROR (Status
)) {
484 goto RestorePciAttributes
;
488 // get the device path of the virtio-net PCI device -- one-shot open
490 Status
= gBS
->OpenProtocol (DeviceHandle
, &gEfiDevicePathProtocolGuid
,
491 (VOID
**)&DevicePath
, This
->DriverBindingHandle
,
492 DeviceHandle
, EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
493 if (EFI_ERROR (Status
)) {
498 // create another device path that has the MAC address appended
500 MacNode
.Header
.Type
= MESSAGING_DEVICE_PATH
;
501 MacNode
.Header
.SubType
= MSG_MAC_ADDR_DP
;
502 SetDevicePathNodeLength (&MacNode
, sizeof MacNode
);
503 CopyMem (&MacNode
.MacAddress
, &Dev
->Snm
.CurrentAddress
,
504 sizeof (EFI_MAC_ADDRESS
));
505 MacNode
.IfType
= Dev
->Snm
.IfType
;
507 Dev
->MacDevicePath
= AppendDevicePathNode (DevicePath
, &MacNode
.Header
);
508 if (Dev
->MacDevicePath
== NULL
) {
509 Status
= EFI_OUT_OF_RESOURCES
;
514 // create a child handle with the Simple Network Protocol and the new
515 // device path installed on it
517 Status
= gBS
->InstallMultipleProtocolInterfaces (&Dev
->MacHandle
,
518 &gEfiSimpleNetworkProtocolGuid
, &Dev
->Snp
,
519 &gEfiDevicePathProtocolGuid
, Dev
->MacDevicePath
,
521 if (EFI_ERROR (Status
)) {
522 goto FreeMacDevicePath
;
526 // make a note that we keep this device open with PciIo for the sake of this
529 Status
= gBS
->OpenProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
530 &ChildPciIo
, This
->DriverBindingHandle
,
531 Dev
->MacHandle
, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
532 if (EFI_ERROR (Status
)) {
533 goto UninstallMultiple
;
539 gBS
->UninstallMultipleProtocolInterfaces (Dev
->MacHandle
,
540 &gEfiDevicePathProtocolGuid
, Dev
->MacDevicePath
,
541 &gEfiSimpleNetworkProtocolGuid
, &Dev
->Snp
,
545 FreePool (Dev
->MacDevicePath
);
548 VirtioNetSnpEvacuate (Dev
);
550 RestorePciAttributes
:
551 Dev
->PciIo
->Attributes (Dev
->PciIo
, EfiPciIoAttributeOperationSet
,
552 Dev
->OrigPciAttributes
, NULL
);
555 gBS
->CloseProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
556 This
->DriverBindingHandle
, DeviceHandle
);
566 Stops a device controller or a bus controller.
568 The Stop() function is designed to be invoked from the EFI boot service
569 DisconnectController(). As a result, much of the error checking on the
570 parameters to Stop() has been moved into this common boot service. It is
571 legal to call Stop() from other locations, but the following calling
572 restrictions must be followed, or the system behavior will not be
574 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous
575 call to this same driver's Start() function.
576 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a
577 valid EFI_HANDLE. In addition, all of these handles must have been created
578 in this driver's Start() function, and the Start() function must have
579 called OpenProtocol() on ControllerHandle with an Attribute of
580 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
582 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL
584 @param[in] ControllerHandle A handle to the device being stopped. The
585 handle must support a bus specific I/O
586 protocol for the driver to use to stop the
588 @param[in] NumberOfChildren The number of child device handles in
590 @param[in] ChildHandleBuffer An array of child handles to be freed. May be
591 NULL if NumberOfChildren is 0.
593 @retval EFI_SUCCESS The device was stopped.
594 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device
601 VirtioNetDriverBindingStop (
602 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
603 IN EFI_HANDLE DeviceHandle
,
604 IN UINTN NumberOfChildren
,
605 IN EFI_HANDLE
*ChildHandleBuffer
608 if (NumberOfChildren
> 0) {
610 // free all resources for whose access we need the child handle, because
611 // the child handle is going away
614 EFI_SIMPLE_NETWORK_PROTOCOL
*Snp
;
618 ASSERT (NumberOfChildren
== 1);
620 Status
= gBS
->OpenProtocol (ChildHandleBuffer
[0],
621 &gEfiSimpleNetworkProtocolGuid
, (VOID
**)&Snp
,
622 This
->DriverBindingHandle
, DeviceHandle
,
623 EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
624 ASSERT_EFI_ERROR (Status
);
625 Dev
= VIRTIO_NET_FROM_SNP (Snp
);
628 // prevent any interference with WaitForPacket
630 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
632 ASSERT (Dev
->MacHandle
== ChildHandleBuffer
[0]);
633 if (Dev
->Snm
.State
!= EfiSimpleNetworkStopped
) {
635 // device in use, cannot stop driver instance
637 Status
= EFI_DEVICE_ERROR
;
640 gBS
->CloseProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
641 This
->DriverBindingHandle
, Dev
->MacHandle
);
642 gBS
->UninstallMultipleProtocolInterfaces (Dev
->MacHandle
,
643 &gEfiDevicePathProtocolGuid
, Dev
->MacDevicePath
,
644 &gEfiSimpleNetworkProtocolGuid
, &Dev
->Snp
,
646 FreePool (Dev
->MacDevicePath
);
647 VirtioNetSnpEvacuate (Dev
);
648 Dev
->PciIo
->Attributes (Dev
->PciIo
, EfiPciIoAttributeOperationSet
,
649 Dev
->OrigPciAttributes
, NULL
);
653 gBS
->RestoreTPL (OldTpl
);
658 // release remaining resources, tied directly to the parent handle
660 gBS
->CloseProtocol (DeviceHandle
, &gEfiPciIoProtocolGuid
,
661 This
->DriverBindingHandle
, DeviceHandle
);
667 EFI_DRIVER_BINDING_PROTOCOL gVirtioNetDriverBinding
= {
668 &VirtioNetDriverBindingSupported
,
669 &VirtioNetDriverBindingStart
,
670 &VirtioNetDriverBindingStop
,