Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.

This commit is contained in:
sos 2004-12-09 07:31:06 +00:00
parent 489aa3c57e
commit c6a934b3e0
4 changed files with 5 additions and 3 deletions

View File

@ -156,6 +156,8 @@
#define ATA_OP_CONTINUES 0 #define ATA_OP_CONTINUES 0
#define ATA_OP_FINISHED 1 #define ATA_OP_FINISHED 1
#define ATA_MAX_28BIT_LBA 268435455
/* ATAPI request sense structure */ /* ATAPI request sense structure */
struct atapi_sense { struct atapi_sense {
u_int8_t error_code :7; /* current or deferred errors */ u_int8_t error_code :7; /* current or deferred errors */

View File

@ -1815,7 +1815,7 @@ ata_promise_apkt(u_int8_t *bytep, struct ata_device *atadev, u_int8_t command,
bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_CTL; bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_CTL;
bytep[i++] = ATA_A_4BIT; bytep[i++] = ATA_A_4BIT;
if ((lba > 268435455 || count > 256) && atadev->param && if ((lba >= ATA_MAX_28BIT_LBA || count > 256) && atadev->param &&
(atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48)) { (atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48)) {
atadev->channel->flags |= ATA_48BIT_ACTIVE; atadev->channel->flags |= ATA_48BIT_ACTIVE;
if (command == ATA_READ_DMA) if (command == ATA_READ_DMA)

View File

@ -114,7 +114,7 @@ ad_attach(struct ata_device *atadev)
/* use the 48bit LBA size if valid */ /* use the 48bit LBA size if valid */
if ((atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48) && if ((atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48) &&
lbasize48 > 268435455) lbasize48 > ATA_MAX_28BIT_LBA)
adp->total_secs = lbasize48; adp->total_secs = lbasize48;
/* setup the function ptrs */ /* setup the function ptrs */

View File

@ -701,7 +701,7 @@ ata_generic_command(struct ata_device *atadev, u_int8_t command,
ATA_IDX_OUTB(atadev->channel, ATA_ALTSTAT, ATA_A_4BIT); ATA_IDX_OUTB(atadev->channel, ATA_ALTSTAT, ATA_A_4BIT);
/* only use 48bit addressing if needed (avoid bugs and overhead) */ /* only use 48bit addressing if needed (avoid bugs and overhead) */
if ((lba > 268435455 || count > 256) && atadev->param && if ((lba >= ATA_MAX_28BIT_LBA || count > 256) && atadev->param &&
atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48) { atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48) {
/* translate command into 48bit version */ /* translate command into 48bit version */