Make CAM ATA honor old hw.ata.ata_dma and hw.ata.atapi_dma tunables.

Even having more specific hint.ata.X.mode controls, global ones are
still could be useful from some points, including compatibility.

PR:		kern/164651
MFC after:	1 week
This commit is contained in:
Alexander Motin 2012-02-02 14:17:58 +00:00
parent fc2e7eec24
commit 2121d8a585
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230912

View File

@ -186,6 +186,12 @@ static void ata_dev_async(u_int32_t async_code,
static void ata_action(union ccb *start_ccb);
static void ata_announce_periph(struct cam_periph *periph);
static int ata_dma = 1;
static int atapi_dma = 1;
TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
static struct xpt_xport ata_xport = {
.alloc_device = ata_alloc_device,
.action = ata_action,
@ -356,6 +362,13 @@ probestart(struct cam_periph *periph, union ccb *start_ccb)
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE)
mode = cts.xport_specific.sata.mode;
}
if (periph->path->device->protocol == PROTO_ATA) {
if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
mode = ATA_PIO_MAX;
} else {
if (atapi_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX))
mode = ATA_PIO_MAX;
}
negotiate:
/* Honor device capabilities. */
wantmode = mode = ata_max_mode(ident_buf, mode);