[SeaBIOS] Help with struct disk_op_s and block drives

Kevin O'Connor kevin at koconnor.net
Fri Oct 14 01:22:29 CEST 2011

On Thu, Oct 13, 2011 at 09:17:51PM +0900, Daniel Castro wrote:
> Hello,
> I am working on the PV block drivers for Xen.
> I am in the point where I must write to my PV ring the requests and responses.
> I need a little help to understand how this works :)
> The operation comes wrapped in this structure:
> struct disk_op_s {
>     u64 lba;
>     void *buf_fl;
>     struct drive_s *drive_g;
>     u16 count;
> lba is the sector I need to read or write to, right?


> count is how many sectors I am going to move, right?


> buf_fl is the pointer to the buffer where I will put the info in case
> of write, or I will get the info in case of read, right?


> command is either read or write.

Command can be other things as well - see some of the other drivers.

> drive_s contains the descriptor of the drive.


> How does seabios handle more than one drive? My case, right now is
> only one drive but there will be more.

During the initialization phase, your driver should create a drive_s
structure for each available drive and pass it to boot_add_hd().  On
an access request, the disk_op_s struct will point to the drive_s
struct of the requested drive.


More information about the SeaBIOS mailing list