Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35119 )
Change subject: soc/sifive/fu540: Support booting from SD card ......................................................................
Patch Set 18:
(1 comment)
Patch Set 18:
Have anything update?
Waiting on the parent commit where one last change is necessary. as far as I can see, this one doesn't need any more changes.
https://review.coreboot.org/c/coreboot/+/35119/13/src/mainboard/sifive/hifiv... File src/mainboard/sifive/hifive-unleashed/media.c:
https://review.coreboot.org/c/coreboot/+/35119/13/src/mainboard/sifive/hifiv... PS13, Line 51: static ssize_t unleashed_sd_readat(const struct region_device *rdev, void *dest, : size_t offset, size_t count) : { : size_t start_block_address = offset / BLOCK_SIZE; : size_t end_block_address = (offset + count - 1) / BLOCK_SIZE; : size_t has_begin = !!(offset % BLOCK_SIZE); : size_t has_end = !!((offset + count) % BLOCK_SIZE); : : if (start_block_address == end_block_address) { : uint8_t tmp[BLOCK_SIZE]; : size_t o = offset % BLOCK_SIZE; : size_t l = count; : spi_sdcard_single_read(&card, start_block_address, tmp); : memcpy(dest, tmp + o, l); : return count; : } : : if (has_begin) { : uint8_t tmp[BLOCK_SIZE]; : size_t o = offset % BLOCK_SIZE; : size_t l = BLOCK_SIZE - o; : spi_sdcard_single_read(&card, start_block_address, tmp); : memcpy(dest, tmp + o, l); : } : : if (start_block_address + has_begin <= end_block_address - has_end) { : size_t start_lba = start_block_address + has_begin; : size_t end_lba = end_block_address - has_end; : size_t o = has_begin ? BLOCK_SIZE - offset % BLOCK_SIZE : 0; : if (start_lba < end_lba) : spi_sdcard_multiple_read(&card, : start_lba, end_lba, dest + o); : else : spi_sdcard_single_read(&card, start_lba, dest + o); : } : : if (has_end) { : uint8_t tmp[BLOCK_SIZE]; : size_t o = 0; : size_t l = (offset + count) % BLOCK_SIZE; : spi_sdcard_single_read(&card, end_block_address, tmp); : memcpy(dest + count - l, tmp + o, l); : } : : return count; : }
How change like this?
Done