15 USB_NCM_DRIVER_VERSION,
37 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDescriptor);
38 if (EFI_ERROR (Status)) {
42 if ((InterfaceDescriptor.InterfaceClass == USB_CDC_CLASS) &&
43 (InterfaceDescriptor.InterfaceSubClass == USB_CDC_NCM_SUBCLASS) &&
44 (InterfaceDescriptor.InterfaceProtocol == USB_NO_CLASS_PROTOCOL))
76 Status =
gBS->OpenProtocol (
78 &gEfiUsbIoProtocolGuid,
80 This->DriverBindingHandle,
82 EFI_OPEN_PROTOCOL_BY_DRIVER
84 if (EFI_ERROR (Status)) {
92 &gEfiUsbIoProtocolGuid,
93 This->DriverBindingHandle,
118 return EFI_NOT_FOUND;
124 return EFI_NOT_FOUND;
135 return EFI_NOT_FOUND;
139 return EFI_NOT_FOUND;
173 Status =
gBS->LocateHandleBuffer (
175 &gEfiUsbIoProtocolGuid,
180 if (EFI_ERROR (Status)) {
184 for (Index = 0; Index < HandleCount; Index++) {
185 Status =
gBS->HandleProtocol (
187 &gEfiUsbIoProtocolGuid,
192 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
195 if ((Interface.InterfaceClass == USB_CDC_DATA_CLASS) &&
196 (Interface.InterfaceSubClass == USB_CDC_DATA_SUBCLASS) &&
197 (Interface.InterfaceProtocol == USB_NCM_NTB_PROTOCOL))
199 Status =
gBS->HandleProtocol (
201 &gEfiDevicePathProtocolGuid,
202 (VOID **)&UsbCdcDataPath
204 if (EFI_ERROR (Status)) {
209 if (!EFI_ERROR (Status)) {
243 Status =
gBS->LocateHandleBuffer (
245 &gEfiUsbIoProtocolGuid,
250 if (EFI_ERROR (Status)) {
254 for (Index = 0; Index < HandleCount; Index++) {
255 Status =
gBS->HandleProtocol (
257 &gEfiUsbIoProtocolGuid,
262 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
265 if ((Interface.InterfaceClass == USB_CDC_CLASS) &&
266 (Interface.InterfaceSubClass == USB_CDC_NCM_SUBCLASS) &&
267 (Interface.InterfaceProtocol == USB_NO_CLASS_PROTOCOL))
274 gBS->CloseEvent (Event);
308 Status =
gBS->OpenProtocol (
310 &gEfiUsbIoProtocolGuid,
312 This->DriverBindingHandle,
314 EFI_OPEN_PROTOCOL_BY_DRIVER
316 if (EFI_ERROR (Status)) {
320 Status =
gBS->OpenProtocol (
322 &gEfiDevicePathProtocolGuid,
323 (VOID **)&UsbEthPath,
324 This->DriverBindingHandle,
326 EFI_OPEN_PROTOCOL_GET_PROTOCOL
328 if (EFI_ERROR (Status)) {
331 &gEfiUsbIoProtocolGuid,
332 This->DriverBindingHandle,
339 if (EFI_ERROR (Status)) {
342 &gEfiUsbIoProtocolGuid,
343 This->DriverBindingHandle,
348 if (EFI_ERROR (Status)) {
352 Status =
gBS->RegisterProtocolNotify (&gEfiUsbIoProtocolGuid, Event, &Reg);
360 &gEfiUsbIoProtocolGuid,
361 This->DriverBindingHandle,
364 return EFI_OUT_OF_RESOURCES;
372 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
375 UsbEthDriver->Signature = USB_ETHERNET_SIGNATURE;
376 UsbEthDriver->NumOfInterface = Interface.InterfaceNumber;
377 UsbEthDriver->UsbCdcDataHandle = UsbCdcDataHandle;
378 UsbEthDriver->UsbIo = UsbIo;
395 Status =
gBS->InstallProtocolInterface (
397 &gEdkIIUsbEthProtocolGuid,
399 &(UsbEthDriver->UsbEth)
401 if (EFI_ERROR (Status)) {
404 &gEfiUsbIoProtocolGuid,
405 This->DriverBindingHandle,
441 Status =
gBS->OpenProtocol (
443 &gEdkIIUsbEthProtocolGuid,
444 (VOID **)&UsbEthProtocol,
445 This->DriverBindingHandle,
447 EFI_OPEN_PROTOCOL_GET_PROTOCOL
449 if (EFI_ERROR (Status)) {
453 UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (UsbEthProtocol);
455 Status =
gBS->UninstallProtocolInterface (
457 &gEdkIIUsbEthProtocolGuid,
460 if (EFI_ERROR (Status)) {
464 Status =
gBS->CloseProtocol (
466 &gEfiUsbIoProtocolGuid,
467 This->DriverBindingHandle,
471 FreePool (UsbEthDriver->BulkBuffer);
498 return gBS->InstallMultipleProtocolInterfaces (
500 &gEfiDriverBindingProtocolGuid,
501 &gUsbNcmDriverBinding,
502 &gEfiComponentName2ProtocolGuid,
503 &gUsbNcmComponentName2,
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
#define MESSAGING_DEVICE_PATH
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
EFI_STATUS EFIAPI GetUsbEthMacAddress(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT EFI_MAC_ADDRESS *MacAddress)
EFI_STATUS EFIAPI SetUsbEthPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN UINT16 Length, IN VOID *PatternFilter)
EFI_STATUS EFIAPI SetUsbEthPacketFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value)
VOID GetEndpoint(IN EFI_USB_IO_PROTOCOL *UsbIo, IN OUT USB_ETHERNET_DRIVER *UsbEthDriver)
EFI_STATUS EFIAPI GetUsbEthFunDescriptor(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor)
EFI_STATUS EFIAPI GetUsbEthPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, OUT BOOLEAN *PatternActive)
EFI_STATUS LoadAllDescriptor(IN EFI_USB_IO_PROTOCOL *UsbIo, OUT EFI_USB_CONFIG_DESCRIPTOR **ConfigDesc)
EFI_STATUS EFIAPI GetUsbEthStatistic(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 FeatureSelector, OUT VOID *Statistic)
EFI_STATUS EFIAPI SetUsbEthMcastFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN VOID *McastAddr)
EFI_STATUS EFIAPI GetUsbHeaderFunDescriptor(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT USB_HEADER_FUN_DESCRIPTOR *UsbHeaderFunDescriptor)
EFI_STATUS EFIAPI GetUsbUnionFunDescriptor(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT USB_UNION_FUN_DESCRIPTOR *UsbUnionFunDescriptor)
EFI_STATUS EFIAPI UsbNcmDriverStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI UsbNcmEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
BOOLEAN IsSupportedDevice(IN EFI_USB_IO_PROTOCOL *UsbIo)
EFI_STATUS IsSameDevice(IN EFI_DEVICE_PATH_PROTOCOL *UsbEthPath, IN EFI_DEVICE_PATH_PROTOCOL *UsbCdcDataPath)
EFI_STATUS EFIAPI UsbNcmDriverStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
VOID EFIAPI CallbackFunction(IN EFI_EVENT Event, IN VOID *Context)
BOOLEAN IsUsbCdcData(IN EFI_DEVICE_PATH_PROTOCOL *UsbEthPath, IN OUT EFI_HANDLE *UsbCdcDataHandle)
EFI_STATUS EFIAPI UsbNcmDriverSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI UsbEthNcmTransmit(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN VOID *Packet, IN OUT UINTN *PacketLength)
EFI_STATUS EFIAPI UsbEthNcmReceive(IN PXE_CDB *Cdb, IN EDKII_USB_ETHERNET_PROTOCOL *This, IN OUT VOID *Packet, IN OUT UINTN *PacketLength)
EFI_STATUS EFIAPI UsbEthNcmBulkSize(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT UINTN *BulkSize)
EFI_STATUS EFIAPI UsbEthNcmInterrupt(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN BOOLEAN IsNewTransfer, IN UINTN PollingInterval, IN EFI_USB_DEVICE_REQUEST *Request)
EFI_HANDLE DriverBindingHandle