[SeaBIOS] block device process_op question

Kevin O'Connor kevin at koconnor.net
Thu Oct 20 02:14:52 CEST 2011

On Wed, Oct 19, 2011 at 09:17:29PM +0900, Daniel Castro wrote:
> Hello,
> When the process_op is called and passed to the appropriate handling
> function, how can I differentiate which drive the operation is
> directed to? Inside my function xen_process_op called by process_op
> with the drive_op as a parameter I use GET_GLOBAL(drive_s) to get the
> block device, how can I be sure I am getting the correct drive, and
> not another one?

I'm not sure I understand the question.  During the init phase, you
should create a drive_s struct for every drive and then register that
drive.  If a user attempts to access a drive, the disk_op_s will be
populated with a pointer to the drive_s that you created during the
init phase for the particular drive that the user wishes to access.

If you're asking how you can distinguish between multiple drives -
create a local struct that includes a drive_s struct and use the
container_of macros (as the other drivers do).

> If my question sounds confusing, maybe I am misunderstanding the use
> of the structures... sorry about that... could someone help me with
> this little bit.
> Who calls process_op? who receives the answer from process_op?

A read call will take (roughly) the following path:
romlayout.S:entry_13(), disk.c:handle_13(), disk.c:disk_13(),
disk.c:disk_1302(), block.c:send_disk_op(), block.c:__send_disk_op(),


More information about the SeaBIOS mailing list