summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2004-12-09 07:31:06 +0000
committersos <sos@FreeBSD.org>2004-12-09 07:31:06 +0000
commitc6a934b3e019c2b33ed814adc3c80e8d9866dfff (patch)
tree0c8fae06f7a15be30367b201179bf418562a21da /sys
parent489aa3c57e340840fa857d6c217c2458b335114f (diff)
downloadFreeBSD-src-c6a934b3e019c2b33ed814adc3c80e8d9866dfff.zip
FreeBSD-src-c6a934b3e019c2b33ed814adc3c80e8d9866dfff.tar.gz
Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-all.h2
-rw-r--r--sys/dev/ata/ata-chipset.c2
-rw-r--r--sys/dev/ata/ata-disk.c2
-rw-r--r--sys/dev/ata/ata-lowlevel.c2
4 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h
index 28d36c8..6a9d099 100644
--- a/sys/dev/ata/ata-all.h
+++ b/sys/dev/ata/ata-all.h
@@ -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 */
diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c
index 6c20240..09f8715 100644
--- a/sys/dev/ata/ata-chipset.c
+++ b/sys/dev/ata/ata-chipset.c
@@ -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)
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index ccba1de..eebde22 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -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 */
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c
index 3bc4c48..2a08bd0 100644
--- a/sys/dev/ata/ata-lowlevel.c
+++ b/sys/dev/ata/ata-lowlevel.c
@@ -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 */
OpenPOWER on IntegriCloud