From c0dbf19c1e3c4924afd090a22474fc51e1ff2294 Mon Sep 17 00:00:00 2001 From: reinoud Date: Sat, 4 Feb 2006 21:26:15 +0000 Subject: [PATCH] Add support for SCSI MMC feature 0x0024: hardware assisted defect management to be passed in mmc_discinfo's device capabilities. When a device reports support for this the hardware will automatically remap sectors on read- or write-errors. CD-MRW, DVD+MRW, DVD-RAM and BR-RE support these. --- sys/dev/scsipi/cd.c | 7 +++++-- sys/sys/cdio.h | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index b9b704c57746..471cd57be378 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.238 2006/02/02 14:48:02 reinoud Exp $ */ +/* $NetBSD: cd.c,v 1.239 2006/02/04 21:26:15 reinoud Exp $ */ /*- * Copyright (c) 1998, 2001, 2003, 2004, 2005 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.238 2006/02/02 14:48:02 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.239 2006/02/04 21:26:15 reinoud Exp $"); #include "rnd.h" @@ -2646,6 +2646,9 @@ mmc_process_feature(struct mmc_discinfo *mmc_discinfo, flags |= MMC_CAP_RECORDABLE; flags |= MMC_CAP_FORMATTABLE; break; + case 0x0024 : + flags |= MMC_CAP_HW_DEFECTFREE; + break; case 0x0025 : /* write once */ flags |= MMC_CAP_RECORDABLE; break; diff --git a/sys/sys/cdio.h b/sys/sys/cdio.h index dc357253a902..8b5782505062 100644 --- a/sys/sys/cdio.h +++ b/sys/sys/cdio.h @@ -1,4 +1,4 @@ -/* $NetBSD: cdio.h,v 1.24 2006/02/02 14:48:02 reinoud Exp $ */ +/* $NetBSD: cdio.h,v 1.25 2006/02/04 21:26:15 reinoud Exp $ */ #ifndef _SYS_CDIO_H_ #define _SYS_CDIO_H_ @@ -311,11 +311,12 @@ struct mmc_discinfo { #define MMC_CAP_STRICTOVERWRITE (1 << 8) /* only writes a packet at a time */ #define MMC_CAP_PSEUDOOVERWRITE (1 << 9) /* overwrite through replacement */ #define MMC_CAP_ZEROLINKBLK (1 << 10) /* zero link block length capable */ +#define MMC_CAP_HW_DEFECTFREE (1 << 11) /* hardware defect management */ #define MMC_CAP_FLAGBITS \ "\10\1SEQUENTIAL\2RECORDABLE\3ERASABLE\4BLANKABLE\5FORMATTABLE" \ "\6REWRITABLE\7MRW\10PACKET\11STRICTOVERWRITE\12PSEUDOOVERWRITE" \ - "\13ZEROLINKBLK" + "\13ZEROLINKBLK\14HW_DEFECTFREE" #define MMC_STATE_EMPTY 0 #define MMC_STATE_INCOMPLETE 1