Rtems_fsmount dosfs hanging
Andre Marques
andre.lousa.marques at gmail.com
Tue May 13 19:00:24 UTC 2014
On 05/13/14 12:15, Andrey Mozzhuhin wrote:
> Do you not forget to call rtems_blkdev_request_done in read routine of
> block device driver?
> Also try to increase CONFIGURE_MAXIMUM_TASKS - bdbuf need some worker
> tasks.
I call rtems_blkdev_request_done after each read request, and changing
CONFIGURE_MAXIMUM_TASKS to 20 (instead of 2) did not had any impact.
>
> >> https://github.com/jncronin/rpi-boot/blob/master/emmc.c
>
> Hmm. Implementation specific to Raspberry Pi is not good idea. It is
> better to separate MMC/SD protocol implementation and hardware support
> like in FreeBSD or Linux.
Yes, the point in the end is probably to have the MMC/SD protocol
somewhere else, just like the spi-sd-card driver (SD card access through
SPI interface protocol, at c/src/libchip/i2c/spi-sd-card*).
>
> >> Not sure how to approach this problem, as the logic seems right.
> Will do more testing in the meanwhile.
>
Today I have re-formated the card (under Linux), and the block data read
on RPi checks with the card hexdump on Linux.
So far I tested:
- The block data that is being read, and compared with the same block
data read on Linux (small mismatch (4 bits) at the middle of a 512 byte
block before, no mismatch now)
- The request buffer contents
(http://www.rtems.org/onlinedocs/doxygen/cpukit/html/structrtems__blkdev__sg__buffer.html).
Looking at this I don't know what the User pointer is. I'm using the
buffer pointer to store my readings.
- Reading the partition table from the first block. I can read the first
block and register the card partition as a logical disk, so reading and
registering the partition table is no problem.
- Tried also a busy wait between block readings.
The result is always the same: when mounting the card partition, it
reads the first two partition blocks and then hangs.
> If you get stuck share your sources and let me know.
>
Will try to get the code to github soon.
>
>
> 2014-05-13 14:03 GMT+04:00 Andre Marques
> <andre.lousa.marques at gmail.com <mailto:andre.lousa.marques at gmail.com>>:
>
> On 05/12/14 19:25, Andrey Mozzhuhin wrote:
>> I think you need start with simple tests without file systems and
>> block device driver.
>> Try read and write blocks with known patterns and check it on PC
>> and Raspberry Pi.
>>
>
> I have checked the data read by my emmc driver from the first two
> blocks (the ones it reads) on the RPi, and compared with an
> hexdump of those same two blocks on Linux, and there is a small
> mismatch at the middle of the first block.
>
> Not sure how to approach this problem, as the logic seems right.
> Will do more testing in the meanwhile.
>
>
>> What are you use for MMC/SD protocol? Can I see it and block
>> device driver somewhere?
>
> I'm porting the following code
>
> https://github.com/jncronin/rpi-boot/blob/master/emmc.c
>
> and using the following SD card documentation
>
> Physical Layer Simplified Specification (3.01) -
> https://www.sdcard.org/downloads/pls/simplified_specs/archive/part1_301.pdf
>
> Host Controller Simplified Specification (2.00) -
> https://www.sdcard.org/downloads/pls/simplified_specs/archive/partA2_200.pdf
>
> and the raspberry soc datasheet: Broadcom BCM2835 Peripherals
> Guide (Chapter 5 - EMMC)
>
>>
>>
>> 2014-05-12 20:23 GMT+04:00 Andre Marques
>> <andre.lousa.marques at gmail.com
>> <mailto:andre.lousa.marques at gmail.com>>:
>>
>> Hello,
>>
>> I have used the pc386 BSP to mount the card (before your
>> suggestions) using the fileio sample and it could read the
>> card contents perfectly.
>>
>> Then I filled the card with zeros using dd on Linux, modified
>> the fileio sample to format the card with msdos_format(dev,
>> NULL) and then mounted it on the pc 386 BSP fileio sample and
>> I could write and read the card.
>>
>> On Linux I set the card with the necessary files for
>> Raspberry, and when my driver tries to mount the card on the
>> Raspberry Pi it reads the first 2 blocks (now 0 and 1,
>> because the card has no partition table) and hangs, just as
>> before.
>>
>> I guess my driver is having some reading problems.
>>
>>
>> On 05/05/14 19:30, Andrey Mozzhuhin wrote:
>>> You can try to use SD Card in opposite direction:
>>> 0) fill SD Card with zeroes;
>>> 1) format partition under RTEMS with msdos_format() function;
>>> 2) check that PC can read/write this SD Card;
>>> 3) if PC fails to mount this partition - dump SD Card and
>>> check that all data is on right sectors.
>>>
>>>
>>>
>>> 2014-05-05 22:28 GMT+04:00 Andrey Mozzhuhin
>>> <nopscmn at gmail.com <mailto:nopscmn at gmail.com>>:
>>>
>>> Hi, Andre
>>>
>>> You can try to use SD Card in opposite direction:
>>> 0) fill SD Card with zeroes;
>>> 1) format partition under RTEMS with msdos_format()
>>> function;
>>> 2) check that PC can read/write this SD Card;
>>> 3) if PC fails to mount this partition - dump SD Card
>>> and check that all data is on right sectors.
>>>
>>>
>>>
>>> 2014-05-05 13:52 GMT+04:00 Andre Marques
>>> <andre.lousa.marques at gmail.com
>>> <mailto:andre.lousa.marques at gmail.com>>:
>>>
>>> Hello,
>>>
>>> Following the problem in
>>>
>>> http://www.rtems.org/pipermail/rtems-devel/2014-April/006585.html
>>>
>>> I am now trying to mount the SD card partitions on
>>> RTEMS.
>>>
>>> Summarizing the process:
>>>
>>> 1. rtems_io_register_driver (by calling my driver
>>> with CONFIGURE_APPLICATION_EXTRA_DRIVERS on hello
>>> sample)
>>>
>>> 2. rtems_filesystem_make_dev_t (to get the device file)
>>>
>>> 3. rtems_disk_io_initialize
>>>
>>> 4. rtems_disk_create_phys (to create the disk, at
>>> /dev/sdc0)
>>>
>>> 5. rtems_bdpart_register_from_disk (to read and
>>> register the partitions)
>>>
>>> 6. rtems_fsmount (to mount the partitions)
>>>
>>> For rtems_fsmount I am providing the following fs_table:
>>>
>>> rtems_fstab_entry fs_table [] = {
>>> {
>>> .source = "/dev/sdc0",
>>> .target = "/mnt/p1",
>>> .type = "dosfs",
>>> .options = RTEMS_FILESYSTEM_READ_WRITE,
>>> .report_reasons = RTEMS_FSTAB_ANY,
>>> .abort_reasons = RTEMS_FSTAB_OK
>>> },{
>>> .source = "/dev/sdc01",
>>> .target = "/mnt/p2",
>>> .type = "dosfs",
>>> .options = RTEMS_FILESYSTEM_READ_WRITE,
>>> .report_reasons = RTEMS_FSTAB_ANY,
>>> .abort_reasons = RTEMS_FSTAB_NONE
>>> }
>>> };
>>>
>>> The SD card has only one partition starting at block
>>> number 8192.
>>>
>>> After I call rtems_fsmount it calls my driver to
>>> read block 8192 and 8193 and then hangs.
>>>
>>> I have tested the driver and It seems to have no
>>> problem reading single or multiple blocks.
>>>
>>> Any tips?
>>>
>>> Also I am using the following confdefs configuration
>>> (some values are exaggerated):
>>>
>>> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
>>> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
>>> #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
>>>
>>> #define CONFIGURE_FILESYSTEM_DOSFS
>>> #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
>>>
>>> #define CONFIGURE_APPLICATION_EXTRA_DRIVERS
>>> SD_CARD_DRIVER_TABLE_ENTRY
>>>
>>> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
>>>
>>> #define CONFIGURE_MAXIMUM_TASKS 2
>>> #define CONFIGURE_MAXIMUM_DRIVERS 10
>>>
>>> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
>>>
>>> #define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
>>>
>>> #define CONFIGURE_INITIAL_EXTENSIONS
>>> RTEMS_TEST_INITIAL_EXTENSION
>>>
>>> #define CONFIGURE_INIT
>>>
>>> --André Marques
>>>
>>> _______________________________________________
>>> rtems-devel mailing list
>>> rtems-devel at rtems.org <mailto:rtems-devel at rtems.org>
>>> http://www.rtems.org/mailman/listinfo/rtems-devel
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> rtems-devel mailing list
>>> rtems-devel at rtems.org <mailto:rtems-devel at rtems.org>
>>> http://www.rtems.org/mailman/listinfo/rtems-devel
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20140513/72d16c7f/attachment-0001.html>
More information about the devel
mailing list