wd.c (f634e456) | wd.c (cec793cf) |
---|---|
1/* $OpenBSD: wd.c,v 1.31 2003/06/25 20:52:57 tedu Exp $ */ | 1/* $OpenBSD: wd.c,v 1.32 2003/07/20 19:57:04 grange Exp $ */ |
2/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ 3 4/* 5 * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 549 unchanged lines hidden (view full) --- 559} 560 561void 562__wdstart(wd, bp) 563 struct wd_softc *wd; 564 struct buf *bp; 565{ 566 daddr_t p_offset; | 2/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ 3 4/* 5 * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 549 unchanged lines hidden (view full) --- 559} 560 561void 562__wdstart(wd, bp) 563 struct wd_softc *wd; 564 struct buf *bp; 565{ 566 daddr_t p_offset; |
567 daddr_t nblks; 568 |
|
567 if (WDPART(bp->b_dev) != RAW_PART) 568 p_offset = 569 wd->sc_dk.dk_label->d_partitions[WDPART(bp->b_dev)].p_offset; 570 else 571 p_offset = 0; 572 wd->sc_wdc_bio.blkno = bp->b_blkno + p_offset; 573 wd->sc_wdc_bio.blkno /= (wd->sc_dk.dk_label->d_secsize / DEV_BSIZE); 574 wd->sc_wdc_bio.blkdone =0; 575 wd->sc_bp = bp; 576 /* 577 * If we're retrying, retry in single-sector mode. This will give us 578 * the sector number of the problem, and will eventually allow the 579 * transfer to succeed. 580 */ 581 if (wd->sc_multi == 1 || wd->retries >= WDIORETRIES_SINGLE) 582 wd->sc_wdc_bio.flags = ATA_SINGLE; 583 else 584 wd->sc_wdc_bio.flags = 0; | 569 if (WDPART(bp->b_dev) != RAW_PART) 570 p_offset = 571 wd->sc_dk.dk_label->d_partitions[WDPART(bp->b_dev)].p_offset; 572 else 573 p_offset = 0; 574 wd->sc_wdc_bio.blkno = bp->b_blkno + p_offset; 575 wd->sc_wdc_bio.blkno /= (wd->sc_dk.dk_label->d_secsize / DEV_BSIZE); 576 wd->sc_wdc_bio.blkdone =0; 577 wd->sc_bp = bp; 578 /* 579 * If we're retrying, retry in single-sector mode. This will give us 580 * the sector number of the problem, and will eventually allow the 581 * transfer to succeed. 582 */ 583 if (wd->sc_multi == 1 || wd->retries >= WDIORETRIES_SINGLE) 584 wd->sc_wdc_bio.flags = ATA_SINGLE; 585 else 586 wd->sc_wdc_bio.flags = 0; |
585 if (wd->sc_flags & WDF_LBA48) | 587 nblks = bp->b_bcount / wd->sc_dk.dk_label->d_secsize; 588 if ((wd->sc_flags & WDF_LBA48) && 589 /* use LBA48 only if really need */ 590 ((wd->sc_wdc_bio.blkno + nblks - 1 > 0xfffffff) || (nblks > 0xff))) |
586 wd->sc_wdc_bio.flags |= ATA_LBA48; 587 if (wd->sc_flags & WDF_LBA) 588 wd->sc_wdc_bio.flags |= ATA_LBA; 589 if (bp->b_flags & B_READ) 590 wd->sc_wdc_bio.flags |= ATA_READ; 591 wd->sc_wdc_bio.bcount = bp->b_bcount; 592 wd->sc_wdc_bio.databuf = bp->b_data; 593 wd->sc_wdc_bio.wd = wd; --- 771 unchanged lines hidden --- | 591 wd->sc_wdc_bio.flags |= ATA_LBA48; 592 if (wd->sc_flags & WDF_LBA) 593 wd->sc_wdc_bio.flags |= ATA_LBA; 594 if (bp->b_flags & B_READ) 595 wd->sc_wdc_bio.flags |= ATA_READ; 596 wd->sc_wdc_bio.bcount = bp->b_bcount; 597 wd->sc_wdc_bio.databuf = bp->b_data; 598 wd->sc_wdc_bio.wd = wd; --- 771 unchanged lines hidden --- |