Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.
This commit is contained in:
parent
067a8bab8a
commit
241ce89e8c
@ -156,6 +156,8 @@
|
||||
#define ATA_OP_CONTINUES 0
|
||||
#define ATA_OP_FINISHED 1
|
||||
|
||||
#define ATA_MAX_28BIT_LBA 268435455
|
||||
|
||||
/* ATAPI request sense structure */
|
||||
struct atapi_sense {
|
||||
u_int8_t error_code :7; /* current or deferred errors */
|
||||
|
@ -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_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->channel->flags |= ATA_48BIT_ACTIVE;
|
||||
if (command == ATA_READ_DMA)
|
||||
|
@ -114,7 +114,7 @@ ad_attach(struct ata_device *atadev)
|
||||
|
||||
/* use the 48bit LBA size if valid */
|
||||
if ((atadev->param->support.command2 & ATA_SUPPORT_ADDRESS48) &&
|
||||
lbasize48 > 268435455)
|
||||
lbasize48 > ATA_MAX_28BIT_LBA)
|
||||
adp->total_secs = lbasize48;
|
||||
|
||||
/* setup the function ptrs */
|
||||
|
@ -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);
|
||||
|
||||
/* 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) {
|
||||
|
||||
/* translate command into 48bit version */
|
||||
|
Loading…
Reference in New Issue
Block a user