From 57eac7ab6065d6c315fd31e809453e482cf1cf2d Mon Sep 17 00:00:00 2001 From: Christopher Pascoe Date: Tue, 20 Mar 2007 12:31:50 +0000 Subject: Cap the device size we present to 2TB, just in case someone attaches something really big. The SCSI layer isn't yet ready for it. --- sys/dev/ata/atascsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/dev/ata') diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index 19e655a9f4c..e6367d12938 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.24 2007/03/20 12:24:02 pascoe Exp $ */ +/* $OpenBSD: atascsi.c,v 1.25 2007/03/20 12:31:49 pascoe Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -473,7 +473,7 @@ atascsi_disk_capacity_done(struct ata_xfer *xa) struct scsi_xfer *xs = xa->atascsi_private; struct ata_identify id; struct scsi_read_cap_data rcd; - u_int32_t capacity; + u_int64_t capacity; int i; switch (xa->state) { @@ -492,6 +492,10 @@ atascsi_disk_capacity_done(struct ata_xfer *xa) capacity += id.addrsec[0]; } + /* XXX SCSI layer can't handle a device this big yet */ + if (capacity > 0xffffffff) + capacity = 0xffffffff; + _lto4b(capacity - 1, rcd.addr); _lto4b(512, rcd.length); -- cgit v1.2.3