diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-06 22:41:03 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-06 22:41:03 +0000 |
commit | 077b42684177a1c282f302d60e4d274466092d54 (patch) | |
tree | c592a7cd611e1d0f3b71c9127467f04348202265 | |
parent | 33de205fc642281879119f653507277f32f521dd (diff) |
acd.c: Better support for drives that don't set themselves READY at boot;
atapi.h: fix a couple types that I missed.
-rw-r--r-- | sys/dev/atapi/acd.c | 15 | ||||
-rw-r--r-- | sys/dev/atapi/atapi.h | 6 |
2 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c index 20d026705fe..cc7757e17bc 100644 --- a/sys/dev/atapi/acd.c +++ b/sys/dev/atapi/acd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acd.c,v 1.6 1996/07/22 03:35:41 downsj Exp $ */ +/* $OpenBSD: acd.c,v 1.7 1996/08/06 22:41:00 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -85,6 +85,7 @@ struct acd_softc { #define CDF_WANTED 0x02 #define CDF_WLABEL 0x04 /* label is writable */ #define CDF_LABELLING 0x08 /* writing label */ +#define CDF_NOTREADY 0x10 /* not ready at boot */ struct at_dev_link *ad_link; /* contains our drive number, etc ... */ struct atapi_mode_data mode_page; /* drive capabilities */ @@ -190,7 +191,8 @@ acdattach(parent, self, aux) if (atapi_test_unit_ready(sa, A_POLLED | A_SILENT) != 0) { /* To clear media change, etc ...*/ delay(1000); - (void)atapi_test_unit_ready(sa, A_POLLED | A_SILENT); + if (atapi_test_unit_ready(sa, A_POLLED | A_SILENT) != 0) + acd->flags |= CDF_NOTREADY; } if (acd_get_mode(acd, &acd->mode_page, ATAPI_CAP_PAGE, CAPPAGESIZE, @@ -278,7 +280,14 @@ acdopen(dev, flag, fmt) ad_link = acd->ad_link; - if ((error = atapi_test_unit_ready(ad_link, 0)) != 0) { + error = atapi_test_unit_ready(ad_link, A_SILENT); + if ((error != 0) && (acd->flags & CDF_NOTREADY)) { + /* Do it again. */ + delay(1000); + error = atapi_test_unit_ready(ad_link, A_SILENT); + } + + if (error != 0) { if (error != UNIT_ATTENTION) return EIO; if ((ad_link->flags & ADEV_OPEN) != 0) diff --git a/sys/dev/atapi/atapi.h b/sys/dev/atapi/atapi.h index 6ca00f1734e..e565e1a54f3 100644 --- a/sys/dev/atapi/atapi.h +++ b/sys/dev/atapi/atapi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atapi.h,v 1.4 1996/07/22 03:35:42 downsj Exp $ */ +/* $OpenBSD: atapi.h,v 1.5 1996/08/06 22:41:02 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -91,8 +91,8 @@ struct atapi_read_cd_capacity { * Volume size info. */ struct atapi_read_cd_capacity_data { - u_long size; /* Volume size in blocks */ - u_long blksize; /* Block size in bytes */ + u_int32_t size; /* Volume size in blocks */ + u_int32_t blksize; /* Block size in bytes */ }; /* |