Menu

[r10367]: / branches / 8.0.2 / patches / freebsd-cam.patch  Maximize  Restore  History

Download this file

105 lines (100 with data), 3.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
Index: sys/cam/ata/ata_xpt.c
===================================================================
--- sys/cam/ata/ata_xpt.c (revision 225217)
+++ sys/cam/ata/ata_xpt.c (working copy)
@@ -727,6 +727,7 @@ probedone(struct cam_periph *periph, union ccb *do
struct ata_params *ident_buf;
probe_softc *softc;
struct cam_path *path;
+ cam_status status;
u_int32_t priority;
u_int caps;
int found = 1;
@@ -751,6 +752,7 @@ probedone(struct cam_periph *periph, union ccb *do
xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,
/*run_queue*/TRUE);
}
+ status = done_ccb->ccb_h.status & CAM_STATUS_MASK;
if (softc->restart) {
softc->faults++;
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) ==
@@ -760,13 +762,33 @@ probedone(struct cam_periph *periph, union ccb *do
goto done;
else
softc->restart = 0;
- } else
+
/* Old PIO2 devices may not support mode setting. */
- if (softc->action == PROBE_SETMODE &&
+ } else if (softc->action == PROBE_SETMODE &&
+ status == CAM_ATA_STATUS_ERROR &&
ata_max_pmode(ident_buf) <= ATA_PIO2 &&
- (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0)
+ (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0) {
goto noerror;
+
/*
+ * Some old WD SATA disks report supported and enabled
+ * device-initiated interface power management, but return
+ * ABORT on attempt to disable it.
+ */
+ } else if (softc->action == PROBE_SETPM &&
+ status == CAM_ATA_STATUS_ERROR) {
+ goto noerror;
+
+ /*
+ * Some HP SATA disks report supported DMA Auto-Activation,
+ * but return ABORT on attempt to enable it.
+ */
+ } else if (softc->action == PROBE_SETDMAAA &&
+ status == CAM_ATA_STATUS_ERROR) {
+ goto noerror;
+ }
+
+ /*
* If we get to this point, we got an error status back
* from the inquiry and the error status doesn't require
* automatically retrying the command. Therefore, the
Index: sys/cam/ata/ata_da.c
===================================================================
--- sys/cam/ata/ata_da.c (revision 225217)
+++ sys/cam/ata/ata_da.c (working copy)
@@ -303,7 +303,8 @@ adaclose(struct disk *dp)
softc = (struct ada_softc *)periph->softc;
/* We only sync the cache if the drive is capable of it. */
- if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) {
+ if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 &&
+ (softc->flags & ADA_FLAG_PACK_INVALID) == 0) {
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
cam_fill_ataio(&ccb->ataio,
@@ -345,12 +346,20 @@ static void
adaschedule(struct cam_periph *periph)
{
struct ada_softc *softc = (struct ada_softc *)periph->softc;
+ uint32_t prio;
+ /* Check if cam_periph_getccb() was called. */
+ prio = periph->immediate_priority;
+
+ /* Check if we have more work to do. */
if (bioq_first(&softc->bio_queue) ||
(!softc->trim_running && bioq_first(&softc->trim_queue))) {
- /* Have more work to do, so ensure we stay scheduled */
- xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+ prio = CAM_PRIORITY_NORMAL;
}
+
+ /* Schedule CCB if any of above is true. */
+ if (prio != CAM_PRIORITY_NONE)
+ xpt_schedule(periph, prio);
}
/*
@@ -1030,7 +1039,8 @@ adadone(struct cam_periph *periph, union ccb *done
return;
}
if (error != 0) {
- if (error == ENXIO) {
+ if (error == ENXIO &&
+ (softc->flags & ADA_FLAG_PACK_INVALID) == 0) {
/*
* Catastrophic error. Mark our pack as
* invalid.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.