The USB command CMD_RXQTC ("RX Queue Cascade Threshold Control") tries
to access the register and is always failing when using the Apple
Ethernet adapter.Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Shivamurthy Shastri <[email protected]> --- .../Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c | 15 +++++---- .../Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h | 2 ++ .../Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c | 39 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c index 45ba3e5..b3fefb1 100644 --- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c +++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.c @@ -625,15 +625,18 @@ Ax88772Reset ( if (EFI_ERROR(Status)) goto err; - SetupMsg.RequestType = USB_REQ_TYPE_VENDOR + if (pNicDevice->Flags != FLAG_TYPE_AX88772) { + SetupMsg.RequestType = USB_REQ_TYPE_VENDOR | USB_TARGET_DEVICE; - SetupMsg.Request = CMD_RXQTC; - SetupMsg.Value = 0x8000; - SetupMsg.Index = 0x8001; - SetupMsg.Length = 0; - Status = Ax88772UsbCommand ( pNicDevice, + SetupMsg.Request = CMD_RXQTC; + SetupMsg.Value = 0x8000; + SetupMsg.Index = 0x8001; + SetupMsg.Length = 0; + Status = Ax88772UsbCommand ( pNicDevice, &SetupMsg, NULL ); + } + err: return Status; } diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h index 816f2b2..a85c998 100644 --- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h +++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h @@ -407,6 +407,8 @@ typedef struct { RX_PKT * pFirstFill; UINTN PktCntInQueue; UINT8 * pBulkInBuff; + + INT32 Flags; } NIC_DEVICE; diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c index 6a10cbf..46a2ef9 100644 --- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c +++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c @@ -124,6 +124,8 @@ DriverStart ( UINTN LengthInBytes; EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath = NULL; MAC_ADDR_DEVICE_PATH MacDeviceNode; + EFI_USB_DEVICE_DESCRIPTOR Device; + UINT32 i; // // Allocate the device structure @@ -178,6 +180,43 @@ DriverStart ( goto EXIT; } + Status = pNicDevice->pUsbIo->UsbGetDeviceDescriptor ( pNicDevice->pUsbIo, &Device ); + if (EFI_ERROR ( Status )) { + gBS->CloseProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + pThis->DriverBindingHandle, + Controller + ); + gBS->FreePool ( pNicDevice ); + goto EXIT; + } + else { + // + // Validate the adapter + // + for (i = 0; ASIX_DONGLES[i].VendorId != 0; i++) { + if (ASIX_DONGLES[i].VendorId == Device.IdVendor && + ASIX_DONGLES[i].ProductId == Device.IdProduct) { + break; + } + } + + if (ASIX_DONGLES[i].VendorId == 0) { + gBS->CloseProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + pThis->DriverBindingHandle, + Controller + ); + gBS->FreePool ( pNicDevice ); + goto EXIT; + } + + pNicDevice->Flags = ASIX_DONGLES[i].Flags; + } + + // // Set Device Path // -- 1.9.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

