LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2015, 04:56 AM   #1
ghaddab
LQ Newbie
 
Registered: Feb 2015
Posts: 2

Rep: Reputation: Disabled
Block device drivers


I am new to drivers development under linux kernel. After starting with the simple examples from the book Linux Device Drivers v3, I realised that the block driver API has been totally changed since the kernel 2.6.31 or maybe later versions, and I couldn't find any documentation about the new API and how to use it. There are just some few comments in the source code.

After struggling for one month I almost had something working but few parts are missing or I misunderstood something.

Here is the situation :

After fetching the request with blk_fetch_request(q), I use the macro __rq_for_each_bio for handling the full request
To transfer the segments one by one I use the macro bio_for_each_segment(bvec, bio, i) that loops over all the segments in a bio

My question is :

I need to do some DMA from/to my device (the dma engine is within the device), that's why I need some address that I could use it to DMA from/to
Which buffer should I use ? for the moment I use the buffer returned by char *buffer=bio_data(bio), Does "buffer" corresponds to the physical buffer that I can use for DMA
How to end the request in this case ? using __blk_end_request_cur(req, 0) ? or using __blk_end_request(req, 0, bytes) ?

If you don't have an answer to any of these questions, where can I find a useful documentation for the new API of the block device drivers.
 
Old 02-18-2015, 09:22 AM   #2
ghaddab
LQ Newbie
 
Registered: Feb 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
I found it, I should have mapped the address returned from the bio structure with dma_map_single
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Targetcli on block device looses configuration after reboot (device already in use) dimitrisz Linux - Server 0 10-11-2014 02:45 PM
mknod: does the creation of a block device write data into the device? stf92 Slackware 7 11-20-2013 11:54 AM
Need example programs for Block Device Drivers asprakash Linux - Kernel 4 07-04-2006 01:17 AM
Block device /dev/sda3 is not a valid root device.. rincewind Linux - Hardware 7 06-09-2006 04:47 AM
UL 1.0 GRUB: could not find device for /boot: not found or not a block device cma Linux - General 4 12-12-2005 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration