Hi, This series emerged after last Coverity scan and Peter suggestion in: http://lists.nongnu.org/archive/html/qemu-devel/2018-04/msg05046.html
(3) "proper" implementation of CRC, so that an sd controller can either (a) mark the SDRequest as "no CRC" and have sd_req_crc_validate() always pass, or (b) mark the SDRequest as having a CRC and have sd_req_crc_validate() actually do the check which it currently stubs out with "return 0" - Coverity issues fixed (up to patch 6) - crc16 now works - new functions documented - qtests added Regards, Phil. Philippe Mathieu-Daudé (20): sdcard: Use the ldst API sdcard: Extract sd_calc_frame48_crc7() from sd_req_crc_validate() sdcard: Rename the SDRequest as SDFrame48 sdcard: Add sd_prepare_request[_with_crc]() sdcard: Use the sd_prepare_request*() functions sdcard: Add a "validate-crc" property sdcard: Constify sd_crc*()'s message argument sdcard: Fix sd_crc*() style sdcard: Expose sd_crc*() functions for QTest use sdcard: Expose sd_prepare_request*() functions for QTest use sdcard: Add test_sd_request_frame_crc7() qtest (request command CRC7) sdcard: Let sd_frame48_crc7_calc() work on response frames sdcard: Expose sd_prepare_frame48() for QTest use sdcard: Add test_sd_response_frame48_crc7 qtest (command response CRC7) sdcard: Add SDFrame136 struct and 136-bit SD response frames functions sdcard: Add test_sd_response_frame136_crc7() qtest sdcard: Add SDFrameData struct and data frame checksum functions sdcard: Fix sd_crc16() sdcard: Add test_sd_data_frame_crc16() qtest sdcard: Add test_sd_verify_cksum_frame48() qtest hw/sd/sdmmc-internal.h | 24 +++++++ include/hw/sd/sd.h | 136 +++++++++++++++++++++++++++++++++++++- hw/sd/bcm2835_sdhost.c | 3 +- hw/sd/milkymist-memcard.c | 9 ++- hw/sd/omap_mmc.c | 4 +- hw/sd/pxa2xx_mmci.c | 4 +- hw/sd/sd.c | 48 +++----------- hw/sd/sdhci.c | 6 +- hw/sd/sdmmc-internal.c | 114 ++++++++++++++++++++++++++++++++ hw/sd/ssi-sd.c | 6 +- tests/sdcard-test.c | 116 ++++++++++++++++++++++++++++++++ tests/Makefile.include | 2 + 12 files changed, 409 insertions(+), 63 deletions(-) create mode 100644 tests/sdcard-test.c -- 2.17.0