Hello genode comunity, I have been testing the sdcard driver for Raspberry Pi, I compile it fine, but when I test on RPi I get this result:
\0x1b[32mGenode 15.05-18-gd94a1ad <local changes>\0x1b[0m
int main(): \0x1b[33m--- create local services ---\0x1b[0m
int main(): \0x1b[33m--- start init ---\0x1b[0m
int main(): \0x1b[33mtransferred 253 MB to init\0x1b[0m
int main(): \0x1b[33m--- init created, waiting for exit condition ---\0x1b[0m
[init] \0x1b[31mCould not open ROM session for module "ld.lib.so"\0x1b[0m
[init -> platform_drv] \0x1b[32m--- Raspberry Pi platform driver ---
[init -> sd_card_drv] --- SD card driver ---
[init -> sd_card_drv] \0x1b[33mCID: 0x001b534d 0x30303030 0x3010b1fb 0xc7bd008a\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
[init -> sd_card_drv] \0x1b[33mSD card detected\0x1b[0m
[init -> sd_card_drv] \0x1b[33mcapacity: 1107296256 MiB\0x1b[0m
[init -> test-blk-cli] \0x1b[31mCould not open ROM session for module "config"\0x1b[0m
[init -> test-blk-cli] \0x1b[31mCould not obtain config file\0x1b[0m
[init -> test-blk-cli] \0x1b[32mPaso el segundo bloque\0x1b[0m
[init -> test-blk-cli] \0x1b[32mblock device with block size 512 sector count 0 (testing 0 sectors)\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCID: 0x001b534d 0x30303030 0x3010b1fb 0xc7bd008a\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
\0x1b[32mpor aqui\0x1b[0m
\0x1b[31munavailable interrupt requested\0x1b[0m
[init -> sd_card_drv] void* abort(): \0x1b[33mabort called\0x1b[0m
I'm using a SD Card of 1GB of capacity and Genode 15.05. Someone can help me please.
Best regards, waldo
Hello Waldo,
please excuse the late response. I haven't used the Raspberry Pi lately.
Your LOG output shows actually two problems. See below.
On 11.06.2015 21:46, Waldo Paz Rodriguez wrote:
Hello genode comunity, I have been testing the sdcard driver for Raspberry Pi, I compile it fine, but when I test on RPi I get this result:
...
[init -> sd_card_drv] \0x1b[33mcapacity: 1107296256 MiB\0x1b[0m
This capacity value is obviously wrong. It is certainly a miscalculation in the '_sd_card_device_size' function:
https://github.com/genodelabs/genode/blob/master/repos/os/src/drivers/sd_car...
I definitely need to investigate the calculation with a larger test set of SD cards. That said, the wrong capacity is not the actual reason for the failing test.
unavailable interrupt requested\0x1b
[init -> sd_card_drv] void* abort(): abort called
The "blk-test-cli" program repeatedly opens and closes a session to the SD-card driver, which prompts the driver to obtain and release an IRQ session for the device's interrupt each time. Even though the driver opens the IRQ session, it does not actually uses IRQs yet. This specific behavior triggered a corner case in the base-hw version of core, which failed to mark the IRQ as free when closing the IRQ session. I fixed this problem in the following commit (on our staging branch):
https://github.com/genodelabs/genode/commit/ff874f889866a4124eced23af490b4cb...
I just tested the driver on the Raspberry Pi using the 'os/run/sd_card.run' script. To work around the capacity-detection issue, I configured the test to operate on only a part of the block device:
<start name="test-blk-cli"> <resource name="RAM" quantum="1M" /> <config test_size="32M"/> </start>
The problem did not trigger for me because I happened to use the driver with a benchmark and a real scenario, but never with the blk-test-cli program. Thanks for pointing out the problem!
Best regards Norman
Hello again,
On 23.06.2015 14:58, Norman Feske wrote:
[init -> sd_card_drv] \0x1b[33mcapacity: 1107296256 MiB\0x1b[0m
This capacity value is obviously wrong. It is certainly a miscalculation in the '_sd_card_device_size' function:
https://github.com/genodelabs/genode/blob/master/repos/os/src/drivers/sd_car...
I definitely need to investigate the calculation with a larger test set of SD cards. That said, the wrong capacity is not the actual reason for the failing test.
I found the problem. The issue lies in the strange way the SDHCI controller returns 136-bit responses (for the CSD and CID registers). The following patch applies the needed quirk to our driver:
https://github.com/genodelabs/genode/commit/15cd7064fb841536af6b651c24fa24de...
With the patch, the driver correctly detects high-capacity cards and determines their capacity. Unfortunately, I cannot test the detection of standard-capacity cards because I don't have one at hand.
Cheers Norman
Hi Norman, thanks for the replies, I apply both patches. The first if solved the problem that existed with interruptions, but the second still does not calculate the capacity correctly, I'm testing with a standard SD card of 1GB of capacity. I send the serial output using both got patches:
kernel initialized
\0x1b[32mGenode 15.05-18-gd94a1ad <local changes>\0x1b[0m
int main(): \0x1b[33m--- create local services ---\0x1b[0m
int main(): \0x1b[33m--- start init ---\0x1b[0m
int main(): \0x1b[33mtransferred 253 MB to init\0x1b[0m
int main(): \0x1b[33m--- init created, waiting for exit condition ---\0x1b[0m
[init] \0x1b[31mCould not open ROM session for module "ld.lib.so"\0x1b[0m
[init -> platform_drv] \0x1b[32m--- Raspberry Pi platform driver ---
[init -> test-blk-cli] \0x1b[32mAllocator:\0x1b[0m
[init -> sd_card_drv] --- SD card driver ---
[init -> sd_card_drv] \0x1b[33m-> index=0x00000000, arg=0x00000000, rsp_type=0\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000008, arg=0x000001aa, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000002, arg=0x00000000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCID: 0x1b534d30 0x30303030 0x10b1fbc7 0xbd008a00\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000003, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000009, arg=0x00020000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCSD: 0x007fff32 0x5f5983ce 0x76dbdfff 0x92400000\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000007, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000006, arg=0x00000002, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mSD card detected\0x1b[0m
[init -> sd_card_drv] \0x1b[33mcapacity: 510918656 MiB\0x1b[0m
[init -> test-blk-cli] \0x1b[32mblock device with block size 512 sector count 2684354560 (testing 2684354560 sectors)\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000000, arg=0x00000000, rsp_type=0\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000008, arg=0x000001aa, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000002, arg=0x00000000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCID: 0x1b534d30 0x30303030 0x10b1fbc7 0xbd008a00\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000003, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000009, arg=0x00020000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCSD: 0x007fff32 0x5f5983ce 0x76dbdfff 0x92400000\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000007, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000006, arg=0x00000002, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mSD card detected\0x1b[0m
[init -> sd_card_drv] \0x1b[33mcapacity: 510918656 MiB\0x1b[0m
[init -> test-blk-cli] \0x1b[32mreading block 0 - 2684354559, 246 per request\0x1b[0m
[init -> test-blk-cli] \0x1b[32mreading block 246 - 2684354559\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000012, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[31mcommand timed out\0x1b[0m
[init -> sd_card_drv] \0x1b[31mRead_multiple_block failed, Status: 0x01ff0207\0x1b[0m
[init -> test-blk-cli] \0x1b[31mTest failed!\0x1b[0m
[init -> test-blk-cli] \0x1b[32mcouldn't read block 0 - 246\0x1b[0m
[init] virtual void Genode::Child_policy::exit(int): \0x1b[33mchild "test-blk-cli" exited with exit value -2\0x1b[0m
greetingswaldo
Hi Waldo,
On 25.06.2015 16:15, Waldo Paz Rodriguez wrote:
Hi Norman, thanks for the replies, I apply both patches. The first if solved the problem that existed with interruptions, but the second still does not calculate the capacity correctly, I'm testing with a standard SD card of 1GB of capacity. I send the serial output using both got patches:
thanks for the feedback. Could you please give the attached patch a try?
Cheers Norman
Hi Norman, these is the serial output for last patch that you send me:
kernel initialized
\0x1b[32mGenode 15.05-18-gd94a1ad <local changes>\0x1b[0m
int main(): \0x1b[33m--- create local services ---\0x1b[0m
int main(): \0x1b[33m--- start init ---\0x1b[0m
int main(): \0x1b[33mtransferred 253 MB to init\0x1b[0m
int main(): \0x1b[33m--- init created, waiting for exit condition ---\0x1b[0m
[init] \0x1b[31mCould not open ROM session for module "ld.lib.so"\0x1b[0m
[init -> platform_drv] \0x1b[32m--- Raspberry Pi platform driver ---
[init -> sd_card_drv] --- SD card driver ---
[init -> sd_card_drv] \0x1b[33m-> index=0x00000000, arg=0x00000000, rsp_type=0\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000008, arg=0x000001aa, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000002, arg=0x00000000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCID: 0x1b534d30 0x30303030 0x10b1fbc7 0xbd008a00\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000003, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000009, arg=0x00020000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCSD: 0x007fff32 0x5f5983ce 0x76dbdfff 0x92400000\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000007, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000006, arg=0x00000002, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mSD card detected\0x1b[0m
[init -> sd_card_drv] \0x1b[33mcapacity: 997888 MiB\0x1b[0m
[init -> test-blk-cli] \0x1b[32mblock device with block size 512 sector count 2043674624 (testing 2043674624 sectors)\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000000, arg=0x00000000, rsp_type=0\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000008, arg=0x000001aa, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000029, arg=0x40018000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000002, arg=0x00000000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCID: 0x1b534d30 0x30303030 0x10b1fbc7 0xbd008a00\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000003, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mRCA: 0x0002\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000009, arg=0x00020000, rsp_type=1\0x1b[0m
[init -> sd_card_drv] \0x1b[33mCSD: 0x007fff32 0x5f5983ce 0x76dbdfff 0x92400000\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000007, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000037, arg=0x00020000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000006, arg=0x00000002, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[33mSD card detected\0x1b[0m
[init -> sd_card_drv] \0x1b[33mcapacity: 997888 MiB\0x1b[0m
[init -> test-blk-cli] \0x1b[32mreading block 0 - 2043674623, 246 per request\0x1b[0m
[init -> test-blk-cli] \0x1b[32mreading block 246 - 2043674623\0x1b[0m
[init -> sd_card_drv] \0x1b[33m-> index=0x00000012, arg=0x00000000, rsp_type=2\0x1b[0m
[init -> sd_card_drv] \0x1b[31mcommand timed out\0x1b[0m
[init -> sd_card_drv] \0x1b[31mRead_multiple_block failed, Status: 0x01ff0207\0x1b[0m
[init -> test-blk-cli] \0x1b[31mTest failed!\0x1b[0m
[init -> test-blk-cli] \0x1b[32mcouldn't read block 0 - 246\0x1b[0m
[init] virtual void Genode::Child_policy::exit(int): \0x1b[33mchild "test-blk-cli" exited with exit value -2\0x1b[0m
greetings waldo
Hi Waldo,
thanks for testing my patch.
On 25.06.2015 17:00, Waldo Paz Rodriguez wrote:
Hi Norman, these is the serial output for last patch that you send me:
...
[init -> sd_card_drv] SD card detected [init -> sd_card_drv] capacity: 997888 MiB
apparently, the value is off by the factor 1K. I just found the reason: Whereas the capacity-calculation (as given in the specification) for SD-cards of version 1.0 result in a value given in 512-byte blocks, the calculation for version 2.0 results in a value in 512-KiB blocks. I have corrected the capacity detection in this respect. Could you please give it a try? You can find the current version on my topic branch:
https://github.com/nfeske/genode/commits/rpi_sdcard
On the branch you can also find a commit with a simple benchmark that I used to measure the throughput.
Cheers Norman
Hi Norman, excuse delay in answer, I've been a little busy. I tried the example of the SD card and, indeed, it calculates the size succesfully, but the problems remain and that the example can not perform both reads and writes. I tried two examples sd_card and sd_card_bench with the changes you suggested. I attached the serial outputs of the two examples.
greetings waldo