aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Schmidt <sos@FreeBSD.org>2000-08-16 07:09:04 +0000
committerSøren Schmidt <sos@FreeBSD.org>2000-08-16 07:09:04 +0000
commitb0bb0aeb95c06983727b7469d5df46782e0bd636 (patch)
treeed5566ae9381a94d1c38a57ecd01300a198f3ed6
parent2c15efcfb5882670c84e21533a778d32bfeb25cc (diff)
downloadsrc-b0bb0aeb95c06983727b7469d5df46782e0bd636.tar.gz
src-b0bb0aeb95c06983727b7469d5df46782e0bd636.zip
Rearrange the probe a bit, hopefully this will help to eleminate
some of the fake devices sometimes seen on single device ATA channels. Proberly fail on failures in ata-disk.c, retry instead of hang. Cleanup the VIA probe/init code a bit. Fix a couble of missing free's in atapi-cd.c in the changer code.
Notes
Notes: svn path=/head/; revision=64695
-rw-r--r--sys/dev/ata/ata-all.c116
-rw-r--r--sys/dev/ata/ata-disk.c23
-rw-r--r--sys/dev/ata/ata-dma.c144
-rw-r--r--sys/dev/ata/atapi-cd.c7
4 files changed, 145 insertions, 145 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 6343110bd2a1..cbb5a347cee2 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -270,7 +270,7 @@ ata_pci_match(device_t dev)
if (ata_find_dev(dev, 0x05861106, 0))
return "VIA 82C586 ATA33 controller";
if (ata_find_dev(dev, 0x05961106, 0x12))
- return "VIA 82C596B ATA66 controller";
+ return "VIA 82C596 ATA66 controller";
if (ata_find_dev(dev, 0x05961106, 0))
return "VIA 82C596 ATA33 controller";
if (ata_find_dev(dev, 0x06861106, 0))
@@ -416,7 +416,7 @@ ata_pci_attach(device_t dev)
break;
case 0x4d38105a: /* Promise 66's need their clock changed */
- case 0x4d30105a: /* Promise 100 too */
+ case 0x4d30105a: /* Promise 100's too */
outb(rman_get_start(sc->bmio) + 0x11,
inb(rman_get_start(sc->bmio) + 0x11) | 0x0a);
/* FALLTHROUGH */
@@ -735,16 +735,7 @@ ata_pcisub_probe(device_t dev)
/* kids of pci ata chipsets has their physical unit number in ivars */
scp->unit = (uintptr_t) device_get_ivars(dev);
-
- /* set the chiptype to the hostchip ID, makes life easier */
- if (ata_find_dev(device_get_parent(dev), 0x05861106, 0))
- scp->chiptype = 0x05861106;
- else if (ata_find_dev(device_get_parent(dev), 0x05961106, 0))
- scp->chiptype = 0x05961106;
- else if (ata_find_dev(device_get_parent(dev), 0x06861106, 0))
- scp->chiptype = 0x06861106;
- else
- scp->chiptype = pci_get_devid(device_get_parent(dev));
+ scp->chiptype = pci_get_devid(device_get_parent(dev));
return ata_probe(dev);
}
@@ -837,50 +828,13 @@ ata_probe(device_t dev)
goto failure;
ata_reset(scp, &mask);
- if (!mask)
- goto failure;
- /*
- * OK, we have at least one device on the chain, check for ATAPI
- * signatures, if none check if its a good old ATA device.
- */
- outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_MASTER));
- DELAY(1);
- if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB &&
- inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB) {
- scp->devices |= ATA_ATAPI_MASTER;
- }
- outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_SLAVE));
- DELAY(1);
- if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB &&
- inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB) {
- scp->devices |= ATA_ATAPI_SLAVE;
- }
- if (status0 != 0x00 && !(scp->devices & ATA_ATAPI_MASTER)) {
- outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_MASTER));
- DELAY(1);
- outb(scp->ioaddr + ATA_ERROR, 0x58);
- outb(scp->ioaddr + ATA_CYL_LSB, 0xa5);
- if (inb(scp->ioaddr + ATA_ERROR) != 0x58 &&
- inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5) {
- scp->devices |= ATA_ATA_MASTER;
- }
- }
- if (status1 != 0x00 && !(scp->devices & ATA_ATAPI_SLAVE)) {
- outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_SLAVE));
- DELAY(1);
- outb(scp->ioaddr + ATA_ERROR, 0x58);
- outb(scp->ioaddr + ATA_CYL_LSB, 0xa5);
- if (inb(scp->ioaddr + ATA_ERROR) != 0x58 &&
- inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5) {
- scp->devices |= ATA_ATA_SLAVE;
- }
- }
if (bootverbose)
ata_printf(scp, -1, "devices = 0x%x\n", scp->devices);
- if (!scp->devices) {
+
+ if (!mask)
goto failure;
- }
+
TAILQ_INIT(&scp->ata_queue);
TAILQ_INIT(&scp->atapi_queue);
return 0;
@@ -1251,7 +1205,7 @@ void
ata_reset(struct ata_softc *scp, int32_t *mask)
{
int32_t timeout;
- u_int8_t status0 = 0, status1 = 0;
+ u_int8_t status0 = ATA_S_BUSY, status1 = ATA_S_BUSY;
/* reset channel */
outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
@@ -1266,12 +1220,28 @@ ata_reset(struct ata_softc *scp, int32_t *mask)
/* wait for BUSY to go inactive */
for (timeout = 0; timeout < 310000; timeout++) {
- outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
- DELAY(1);
- status0 = inb(scp->ioaddr + ATA_STATUS);
- outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
- DELAY(1);
- status1 = inb(scp->ioaddr + ATA_STATUS);
+ if (status0 & ATA_S_BUSY) {
+ outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
+ DELAY(1);
+ status0 = inb(scp->ioaddr + ATA_STATUS);
+ if (!(status0 & ATA_S_BUSY)) {
+ /* check for ATAPI signature while its still there */
+ if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB &&
+ inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB)
+ scp->devices |= ATA_ATAPI_MASTER;
+ }
+ }
+ if (status1 & ATA_S_BUSY) {
+ outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
+ DELAY(1);
+ status1 = inb(scp->ioaddr + ATA_STATUS);
+ if (!(status1 & ATA_S_BUSY)) {
+ /* check for ATAPI signature while its still there */
+ if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB &&
+ inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB)
+ scp->devices |= ATA_ATAPI_SLAVE;
+ }
+ }
if (*mask == 0x01) /* wait for master only */
if (!(status0 & ATA_S_BUSY))
break;
@@ -1292,6 +1262,34 @@ ata_reset(struct ata_softc *scp, int32_t *mask)
if (bootverbose)
ata_printf(scp, -1, "mask=%02x status0=%02x status1=%02x\n",
*mask, status0, status1);
+ if (!mask) {
+ scp->devices = 0;
+ return;
+ }
+ /*
+ * OK, we have at least one device on the chain, checks for ATAPI
+ * already done, if none check if its a good old ATA device.
+ */
+ if (status0 != 0x00 && !(scp->devices & ATA_ATAPI_MASTER)) {
+ outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_MASTER));
+ DELAY(1);
+ outb(scp->ioaddr + ATA_ERROR, 0x58);
+ outb(scp->ioaddr + ATA_CYL_LSB, 0xa5);
+ if (inb(scp->ioaddr + ATA_ERROR) != 0x58 &&
+ inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5) {
+ scp->devices |= ATA_ATA_MASTER;
+ }
+ }
+ if (status1 != 0x00 && !(scp->devices & ATA_ATAPI_SLAVE)) {
+ outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_SLAVE));
+ DELAY(1);
+ outb(scp->ioaddr + ATA_ERROR, 0x58);
+ outb(scp->ioaddr + ATA_CYL_LSB, 0xa5);
+ if (inb(scp->ioaddr + ATA_ERROR) != 0x58 &&
+ inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5) {
+ scp->devices |= ATA_ATA_SLAVE;
+ }
+ }
}
int32_t
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index cd09f8329b6c..e0f89c688df5 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -391,7 +391,7 @@ ad_transfer(struct ad_request *request)
if (ata_command(adp->controller, adp->unit, cmd,
cylinder, head, sector, count, 0, ATA_IMMEDIATE)) {
- printf("ad%d: error executing command\n", adp->lun);
+ printf("ad%d: error executing command", adp->lun);
goto transfer_failed;
}
@@ -429,12 +429,21 @@ ad_transfer(struct ad_request *request)
transfer_failed:
untimeout((timeout_t *)ad_timeout, request, request->timeout_handle);
- request->bp->bio_error = EIO;
- request->bp->bio_flags |= BIO_ERROR;
- request->bp->bio_resid = request->bytecount;
- devstat_end_transaction_bio(&adp->stats, request->bp);
- biodone(request->bp);
- free(request, M_AD);
+ printf(" - resetting\n");
+
+ /* if retries still permit, reinject this request */
+ if (request->retries++ < AD_MAX_RETRIES)
+ TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain);
+ else {
+ /* retries all used up, return error */
+ request->bp->bio_error = EIO;
+ request->bp->bio_flags |= BIO_ERROR;
+ request->bp->bio_resid = request->bytecount;
+ devstat_end_transaction_bio(&adp->stats, request->bp);
+ biodone(request->bp);
+ free(request, M_AD);
+ }
+ ata_reinit(adp->controller);
}
int32_t
diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c
index 9b6b266c823b..ad542024b0a1 100644
--- a/sys/dev/ata/ata-dma.c
+++ b/sys/dev/ata/ata-dma.c
@@ -112,7 +112,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_UDMA5, ATA_C_F_SETXFER,ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA5 mode on ICH2 chip\n",
+ "%s setting UDMA5 on ICH2 chip\n",
(error) ? "failed" : "success");
if (!error) {
mask48 = (1 << devno) + (3 << (16 + (devno << 2)));
@@ -142,7 +142,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_UDMA4, ATA_C_F_SETXFER,ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA4 mode on ICH%s chip\n",
+ "%s setting UDMA4 on ICH%s chip\n",
(error) ? "failed" : "success",
(scp->chiptype == 0x244b8086) ? "2" : "");
if (!error) {
@@ -171,7 +171,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- ata_printf(scp, device, "%s setting up UDMA2 mode on %s chip\n",
+ ata_printf(scp, device, "%s setting UDMA2 on %s chip\n",
(error) ? "failed" : "success",
(scp->chiptype == 0x244b8086) ? "ICH2" :
(scp->chiptype == 0x24118086) ? "ICH" :
@@ -214,7 +214,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- ata_printf(scp, device, "%s setting up WDMA2 mode on %s chip\n",
+ ata_printf(scp, device, "%s setting WDMA2 on %s chip\n",
(error) ? "failed" : "success",
(scp->chiptype == 0x244b8086) ? "ICH2" :
(scp->chiptype == 0x24118086) ? "ICH" :
@@ -268,7 +268,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on PIIX chip\n",
+ "%s setting WDMA2 on PIIX chip\n",
(error) ? "failed" : "success");
if (!error) {
scp->mode[ATA_DEV(device)] = ATA_WDMA2;
@@ -291,7 +291,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA2 mode on Aladdin chip\n",
+ "%s setting UDMA2 on Aladdin chip\n",
(error) ? "failed" : "success");
if (!error) {
word54 &= ~(0x000f000f << (devno << 2));
@@ -309,7 +309,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on Aladdin chip\n",
+ "%s setting WDMA2 on Aladdin chip\n",
(error) ? "failed" : "success");
if (!error) {
pci_write_config(parent, 0x53,
@@ -330,7 +330,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA4 mode on AMD chip\n",
+ "%s setting UDMA4 on AMD chip\n",
(error) ? "failed" : "success");
if (!error) {
pci_write_config(parent, 0x53 - devno, 0xc3, 1);
@@ -340,69 +340,59 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
}
goto via_82c586;
- case 0x06861106: /* VIA 82C686 */
-via_82c686:
- if (udmamode >= 4) {
- error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
- ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
- if (bootverbose)
- ata_printf(scp, device,
- "%s setting up UDMA4 mode on VIA chip\n",
- (error) ? "failed" : "success");
- if (!error) {
- pci_write_config(parent, 0x53 - devno, 0xe8, 1);
- scp->mode[ATA_DEV(device)] = ATA_UDMA4;
- return;
+ case 0x05711106: /* VIA 82C571, 82C586, 82C596, 82C686 */
+ if (ata_find_dev(parent, 0x06861106, 0) || /* 82C686a */
+ ata_find_dev(parent, 0x05961106, 0x12)) { /* 82C596b */
+
+ if (udmamode >= 4) {
+ error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+ ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
+ if (bootverbose)
+ ata_printf(scp, device,
+ "%s setting UDMA4 on VIA chip\n",
+ (error) ? "failed" : "success");
+ if (!error) {
+ pci_write_config(parent, 0x53 - devno, 0xe8, 1);
+ scp->mode[ATA_DEV(device)] = ATA_UDMA4;
+ return;
+ }
}
- }
- if (udmamode >= 2) {
- error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
- ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
- if (bootverbose)
- ata_printf(scp, device,
- "%s setting up UDMA2 mode on VIA chip\n",
- (error) ? "failed" : "success");
- if (!error) {
- pci_write_config(parent, 0x53 - devno, 0xea, 1);
- scp->mode[ATA_DEV(device)] = ATA_UDMA2;
- return;
+ if (udmamode >= 2) {
+ error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+ ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+ if (bootverbose)
+ ata_printf(scp, device,
+ "%s setting UDMA2 on VIA chip\n",
+ (error) ? "failed" : "success");
+ if (!error) {
+ pci_write_config(parent, 0x53 - devno, 0xea, 1);
+ scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+ return;
+ }
}
}
- goto via_generic;
-
- case 0x05961106: /* VIA 82C596 */
- /* 82c596 revision >= 0x12 is like the 82c686 */
- if (ata_find_dev(parent, 0x05961106, 0x12))
- goto via_82c686;
- /* FALLTHROUGH */
-
- case 0x05861106: /* VIA 82C586 */
+ else if (ata_find_dev(parent, 0x05961106, 0) || /* 82C596a */
+ ata_find_dev(parent, 0x05861106, 0x02)) { /* 82C586b */
via_82c586:
- /* UDMA2 mode only on 82C586 > rev1, 82C596, AMD 756 */
- if ((udmamode >= 2 && ata_find_dev(parent, 0x05861106, 0x02)) ||
- (udmamode >= 2 && scp->chiptype == 0x05961106) ||
- (udmamode >= 2 && scp->chiptype == 0x74091022)) {
- error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
- ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
- if (bootverbose)
- ata_printf(scp, device, "%s setting up UDMA2 mode on %s chip\n",
- (error) ? "failed" : "success",
- (scp->chiptype == 0x74091022) ? "AMD" : "VIA");
- if (!error) {
- pci_write_config(parent, 0x53 - devno, 0xc0, 1);
- scp->mode[ATA_DEV(device)] = ATA_UDMA2;
- return;
+ if (udmamode >= 2) {
+ error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+ ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+ if (bootverbose)
+ ata_printf(scp, device, "%s setting UDMA2 on %s chip\n",
+ (error) ? "failed" : "success",
+ (scp->chiptype == 0x74091022) ? "AMD" : "VIA");
+ if (!error) {
+ pci_write_config(parent, 0x53 - devno, 0xc0, 1);
+ scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+ return;
+ }
}
}
- /* FALLTHROUGH */
-
- case 0x05711106: /* VIA 82C571 */
-via_generic:
if (wdmamode >= 2 && apiomode >= 4) {
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- ata_printf(scp, device, "%s setting up WDMA2 mode on %s chip\n",
+ ata_printf(scp, device, "%s setting WDMA2 on %s chip\n",
(error) ? "failed" : "success",
(scp->chiptype == 0x74091022) ? "AMD" : "VIA");
if (!error) {
@@ -421,7 +411,7 @@ via_generic:
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA2 mode on SiS chip\n",
+ "%s setting UDMA2 on SiS chip\n",
(error) ? "failed" : "success");
if (!error) {
pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
@@ -434,7 +424,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on SiS chip\n",
+ "%s setting WDMA2 on SiS chip\n",
(error) ? "failed" : "success");
if (!error) {
pci_write_config(parent, 0x40 + (devno << 1), 0x0301, 2);
@@ -451,7 +441,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on CMD646 chip\n",
+ "%s setting WDMA2 on CMD646 chip\n",
error ? "failed" : "success");
if (!error) {
int32_t offset = (devno < 3) ? (devno << 1) : 7;
@@ -470,7 +460,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on Cypress chip\n",
+ "%s setting WDMA2 on Cypress chip\n",
error ? "failed" : "success");
if (!error) {
pci_write_config(scp->dev, scp->unit ? 0x4e : 0x4c, 0x2020, 2);
@@ -495,7 +485,7 @@ via_generic:
ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA5 mode on Promise chip\n",
+ "%s setting UDMA5 on Promise chip\n",
(error) ? "failed" : "success");
if (!error) {
promise_timing(scp, devno, ATA_UDMA5);
@@ -510,7 +500,7 @@ via_generic:
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA4 mode on Promise chip\n",
+ "%s setting UDMA4 on Promise chip\n",
(error) ? "failed" : "success");
if (!error) {
promise_timing(scp, devno, ATA_UDMA4);
@@ -523,7 +513,7 @@ via_generic:
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA2 mode on Promise chip\n",
+ "%s setting UDMA2 on Promise chip\n",
(error) ? "failed" : "success");
if (!error) {
promise_timing(scp, devno, ATA_UDMA2);
@@ -536,7 +526,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on Promise chip\n",
+ "%s setting WDMA2 on Promise chip\n",
(error) ? "failed" : "success");
if (!error) {
promise_timing(scp, devno, ATA_WDMA2);
@@ -549,7 +539,7 @@ via_generic:
ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up PIO%d mode on Promise chip\n",
+ "%s setting PIO%d on Promise chip\n",
(error) ? "failed" : "success",
(apiomode >= 0) ? apiomode : 0);
promise_timing(scp, devno, ata_pio2mode(apiomode));
@@ -568,7 +558,7 @@ via_generic:
ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA5 mode on HPT370 chip\n",
+ "%s setting UDMA5 on HPT370 chip\n",
(error) ? "failed" : "success");
if (!error) {
hpt_timing(scp, devno, ATA_UDMA5);
@@ -583,7 +573,7 @@ via_generic:
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA4 mode on HPT366 chip\n",
+ "%s setting UDMA4 on HPT366 chip\n",
(error) ? "failed" : "success");
if (!error) {
hpt_timing(scp, devno, ATA_UDMA4);
@@ -596,7 +586,7 @@ via_generic:
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up UDMA2 mode on HPT366 chip\n",
+ "%s setting UDMA2 on HPT366 chip\n",
(error) ? "failed" : "success");
if (!error) {
hpt_timing(scp, devno, ATA_UDMA2);
@@ -609,7 +599,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on HPT366 chip\n",
+ "%s setting WDMA2 on HPT366 chip\n",
(error) ? "failed" : "success");
if (!error) {
hpt_timing(scp, devno, ATA_WDMA2);
@@ -621,7 +611,7 @@ via_generic:
ata_pio2mode(apiomode),
ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- ata_printf(scp, device, "%s setting up PIO%d mode on HPT366 chip\n",
+ ata_printf(scp, device, "%s setting PIO%d on HPT366 chip\n",
(error) ? "failed" : "success",
(apiomode >= 0) ? apiomode : 0);
hpt_timing(scp, devno, ata_pio2mode(apiomode));
@@ -650,7 +640,7 @@ via_generic:
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
ata_printf(scp, device,
- "%s setting up WDMA2 mode on generic chip\n",
+ "%s setting WDMA2 on generic chip\n",
(error) ? "failed" : "success");
if (!error) {
scp->mode[ATA_DEV(device)] = ATA_WDMA2;
@@ -661,7 +651,7 @@ via_generic:
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ata_pio2mode(apiomode), ATA_C_F_SETXFER,ATA_WAIT_READY);
if (bootverbose)
- ata_printf(scp, device, "%s setting up PIO%d mode on generic chip\n",
+ ata_printf(scp, device, "%s setting PIO%d on generic chip\n",
(error) ? "failed" : "success", apiomode < 0 ? 0 : apiomode);
if (!error)
scp->mode[ATA_DEV(device)] = ata_pio2mode(apiomode);
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 64325060eebe..6970e70fcb5e 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -145,7 +145,8 @@ acdattach(struct atapi_softc *atp)
chp = malloc(sizeof(struct changer), M_ACD, M_NOWAIT);
if (chp == NULL) {
printf("acd: out of memory\n");
- return 0;
+ free(cdp, M_ACD);
+ return -1;
}
bzero(chp, sizeof(struct changer));
error = atapi_queue_cmd(cdp->atp, ccb, chp, sizeof(struct changer),
@@ -161,6 +162,8 @@ acdattach(struct atapi_softc *atp)
if (!(cdparr = malloc(sizeof(struct acd_softc) * chp->slots,
M_ACD, M_NOWAIT))) {
printf("acd: out of memory\n");
+ free(chp, M_ACD);
+ free(cdp, M_ACD);
return -1;
}
for (count = 0; count < chp->slots; count++) {
@@ -168,7 +171,7 @@ acdattach(struct atapi_softc *atp)
tmpcdp = acd_init_lun(atp, cdp->stats);
if (!tmpcdp) {
printf("acd: out of memory\n");
- return -1;
+ break;
}
}
cdparr[count] = tmpcdp;