why calculate sector and cylinder when using lba? - Minix

This is a discussion on why calculate sector and cylinder when using lba? - Minix ; hi please look at these lines in the code: 12826 if (wn->ldhpref & LDH_LBA) { 12827 cmd.sector = (sector >> 0) & 0xFF; 12828 cmd.cyl_lo = (sector >> 8) & 0xFF; 12829 cmd.cyl_hi = (sector >> 16) & 0xFF; 12830 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: why calculate sector and cylinder when using lba?

  1. why calculate sector and cylinder when using lba?

    hi
    please look at these lines in the code:

    12826 if (wn->ldhpref & LDH_LBA) {
    12827 cmd.sector = (sector >> 0) & 0xFF;
    12828 cmd.cyl_lo = (sector >> 8) & 0xFF;
    12829 cmd.cyl_hi = (sector >> 16) & 0xFF;
    12830 cmd.ldh = wn->ldhpref | ((sector >> 24) &
    0xF);
    12831 }

    the book says, this is actually executed when we CAN use lba, so what
    I dont understand here is why at all we calculate the sector and
    cylinder. I would have thought that in lba you just enter the linear
    sector number into the command and pass it on to the drive...
    also, what's cmd.ldh on line cmd.ldh?

    thanks very much

    Martin


  2. Re: why calculate sector and cylinder when using lba?

    On 2007-02-19, sancho1980 wrote:
    > hi
    > please look at these lines in the code:
    >
    > 12826 if (wn->ldhpref & LDH_LBA) {
    > 12827 cmd.sector = (sector >> 0) & 0xFF;
    > 12828 cmd.cyl_lo = (sector >> 8) & 0xFF;
    > 12829 cmd.cyl_hi = (sector >> 16) & 0xFF;
    > 12830 cmd.ldh = wn->ldhpref | ((sector >> 24) &
    > 0xF);
    > 12831 }
    >
    > the book says, this is actually executed when we CAN use lba, so what
    > I dont understand here is why at all we calculate the sector and
    > cylinder. I would have thought that in lba you just enter the linear
    > sector number into the command and pass it on to the drive...


    That's what this code is doing; the drive decodes the sector number
    from these fields.

    =Ben



+ Reply to Thread