HTC way of error handling.
Hallo Adrian,
Most parts of firmware reload bug are now fixed. At least for one tester... There is still one bug, which for now I was able to reproduce only on intels usb3.0 host controller.
If unload module and give enough time (2-4 seconds), adapter will be suspended. After modprobe adapter will work with some issues. For example misconfigured EP4 FIFO. If you or some one else can help me here it will be great! :)
I assume it is not last error of this kind.
Now to other problem. Since this issue is not last one, we need some way to report errors to the host. First off all, we need it make hosts live easier. If there is some firmware error, host waiting long time or keeps trying to send other request. No actual firmware errors are reported.
Probably it will be better to do it HTC way. Assume it should be HTC service which check for messages, or some thing like current rx handler.
If I understand correctly we have fallowing HTC services:WMI_CONTROL_SVCWMI_BEACON_SVCWMI_CAB_SVCWMI_UAPSD_SVCWMI_MGMT_SVCWMI_DATA_VO_SVCWMI_DATA_VI_SVCWMI_DATA_BE_SVCWMI_DATA_BK_SVC
- Only WMI_CONTROL_SVC is actual WMI service.
- All others are purely HTC services.
- By registering each service we add ath9k_htc_rxep, so we do not need to check RX packets separately and so reducing USB bandwidth.
- RX data has no HTC header, instead it has ath_htc_rx_status.
- Currently we have no way to report errors from target to host. Are this assumptions correct?
If so I think we have fallowing options:
- add HTC header before ath_htc_rx_status, so we can separate RX and ERROR btw STATUS messages.
- use WMI for periodic checks.
Other ideas?
Signature · 2 lines
Regards, Oleksij
Am 19.07.2013 22:10, schrieb Oleksij Rempel:
Quoted 38 lines
Hallo Adrian,
Most parts of firmware reload bug are now fixed. At least for one tester... There is still one bug, which for now I was able to reproduce only on intels usb3.0 host controller.
If unload module and give enough time (2-4 seconds), adapter will be suspended. After modprobe adapter will work with some issues. For example misconfigured EP4 FIFO. If you or some one else can help me here it will be great! :)
I assume it is not last error of this kind.Now to other problem. Since this issue is not last one, we need some way to report errors to the host. First off all, we need it make hosts live easier. If there is some firmware error, host waiting long time or keeps trying to send other request. No actual firmware errors are reported.
Probably it will be better to do it HTC way. Assume it should be HTC service which check for messages, or some thing like current rx handler.
If I understand correctly we have fallowing HTC services:
WMI_CONTROL_SVCWMI_BEACON_SVCWMI_CAB_SVCWMI_UAPSD_SVCWMI_MGMT_SVCWMI_DATA_VO_SVCWMI_DATA_VI_SVCWMI_DATA_BE_SVCWMI_DATA_BK_SVC- Only
WMI_CONTROL_SVCis actual WMI service.
- All others are purely HTC services.
- By registering each service we addath9k_htc_rxep, so we do not need to check RX packets separately and so reducing USB bandwidth.
- RX data has no HTC header, instead it hasath_htc_rx_status.
- Currently we have no way to report errors from target to host. Are this assumptions correct?
Quoted 7 lines
If so I think we have fallowing options:
- add HTC header beforeath_htc_rx_status, so we can separate RX and ERROR btw STATUS messages.
- use WMI for periodic checks.Other ideas?
This changes or some of them needed to properly handle EP4-Bug.
After some testing and greping source i have fallowing results:
- we have already code in firmware to report some exceptions and events directly from HIF layer.
- This ways are unorganised and _not_ used by host driver!
- firmware will send fallowing patterns to the host:
Boot loader will send a pattern on watchdog event, see:arget_firmware/magpie_fw_dev/build/magpie_1_1/sboot/hif/usb/src/usb_api.c:
zfGenWatchDogEvent0x0000C600
I tested it on ar9271 and ar7010 adapters. It is working, but ignored by host driver.
And we have two exeption events in:target_firmware/magpie_fw_dev/target/init/init.c
zfGenWrongEpidEvent0x33221299
zfGenExceptionEvent0x33221199
They are not used by host driver too.
We have also firmware reboot command with 0xffffffff pattern.
Only zfGenWatchDogEvent is in boot loader and will survive chip reset and we cant change it. This command is based on htc_frame_hdr:
struct htc_frame_hdr {
u8 endpoint_id = 0
u8 flags = C6
__be16 payload_len = 0
u8 control[4] = 0
} __packed;
The problem with this command, this flags are nonsense at least for this context. Can some one explain me, what the meaning of this bits is?
Since none of this commands is currently used by driver. We are free to make one format for all of them:
- use endpoint_id = 0 for error events.
- use some flag for errors... we already have one flag and sort of use it... see HTC_FLAGS_RECV_TRAILER in linux/drivers/net/wireless/ath/ath9k/htc_hst.c: ath9k_htc_rx_msg
- add more flags.. for example we can send back string with error message or binary header part of failed command. In this case, host can print string or hexdump.
- i would like to add 8crc check. Suddenly we can't trust USB :(... it can be optional. Add new HTC_FLAGS_HAVE_8CRC flag. and use control[4] or other field to store it. If crc is wrong send error event back to host.
This was target_to_host communication.
Now about lowlevel commands from host to target.
We have and a command to reboot target (0xffffffff). But we need more:
- cold reboot command. Only with cold reboot we can workaround of some hardware issues.
- test_EP4_bug command. After resume EP4 may stay broken. It depends on USB Host Controller. To test it, we need send some data to target. We should do this test right after firmware load and not wait until we randomly fail.
- this commands will be processed by HIF and should have other endpoint_id. 0xFF - IMO is best choice for it.
Signature · 2 lines
Regards, Oleksij