summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1999-12-21 20:18:56 +0000
committersos <sos@FreeBSD.org>1999-12-21 20:18:56 +0000
commita237f531eaddd03c6537a1ed6f9942cb84bfd925 (patch)
tree79403cbc3af44087bc03f664b132d6ba67263bed
parentcef06dff8305c528a20e19f7d485a8cad5a9d401 (diff)
downloadFreeBSD-src-a237f531eaddd03c6537a1ed6f9942cb84bfd925.zip
FreeBSD-src-a237f531eaddd03c6537a1ed6f9942cb84bfd925.tar.gz
Yet another cleanup of the VIA code, this time it should work
on all combinations (I hope)... Add DMA support for the AMD 756 chip (K7 chipset) this is actually the same as the VIA 82C686 chip (the ATA part that is). Treat the intel MX chipset PIIX as a PIIX4 Allow UDMA on all disks that say they can handle it. Cleanup probe printf's a bit Remove alot of the old #ifdef DEBUG crap.
-rw-r--r--sys/dev/ata/ata-all.c26
-rw-r--r--sys/dev/ata/ata-disk.c37
-rw-r--r--sys/dev/ata/ata-disk.h1
-rw-r--r--sys/dev/ata/ata-dma.c138
-rw-r--r--sys/dev/ata/atapi-all.c24
-rw-r--r--sys/dev/ata/atapi-cd.c7
-rw-r--r--sys/dev/ata/atapi-fd.c3
-rw-r--r--sys/dev/ata/atapi-tape.c11
8 files changed, 61 insertions, 186 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 10c1c73..53714da 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -192,6 +192,7 @@ ata_pcimatch(device_t dev)
case 0x70108086:
return "Intel PIIX3 ATA controller";
case 0x71118086:
+ case 0x71998086:
return "Intel PIIX4 ATA controller";
case 0x522910b9:
return "AcerLabs Aladdin ATA controller";
@@ -203,6 +204,8 @@ ata_pcimatch(device_t dev)
return "VIA Apollo ATA controller";
case 0x55131039:
return "SiS 5591 ATA controller";
+ case 0x74091022:
+ return "AMD 756 ATA controller";
case 0x4d33105a:
return "Promise Ultra/33 ATA controller";
case 0x4d38105a:
@@ -331,7 +334,8 @@ ata_pciattach(device_t dev)
break;
case 0x05711106:
- /* the VIA Apollo needs some sensible defaults */
+ case 0x74091022:
+ /* the VIA 82C586, VIA 82C686 & AMD 756 needs some sensible defaults */
/* set prefetch, postwrite */
pci_write_config(dev, 0x41, pci_read_config(dev, 0x41, 1) | 0xf0, 1);
@@ -478,14 +482,14 @@ ata_probe(int32_t ioaddr, int32_t altioaddr, int32_t bmaddr,
scp->ioaddr = ioaddr;
scp->altioaddr = altioaddr;
+ scp->bmaddr = bmaddr;
scp->lun = lun;
scp->unit = *unit;
scp->active = ATA_IDLE;
if (bootverbose)
- printf("ata%d: iobase=0x%04x altiobase=0x%04x\n",
- scp->lun, scp->ioaddr, scp->altioaddr);
-
+ printf("ata%d: iobase=0x%04x altiobase=0x%04x bmaddr=0x%04x\n",
+ scp->lun, scp->ioaddr, scp->altioaddr, scp->bmaddr);
/* do we have any signs of ATA/ATAPI HW being present ? */
outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
@@ -557,8 +561,6 @@ ata_probe(int32_t ioaddr, int32_t altioaddr, int32_t bmaddr,
TAILQ_INIT(&scp->atapi_queue);
*unit = scp->lun;
scp->dev = dev;
- if (bmaddr)
- scp->bmaddr = bmaddr;
atadevices[scp->lun] = scp;
#if NAPM > 0
scp->resume_hook.ah_fun = (void *)ata_reinit;
@@ -634,9 +636,6 @@ ata_start(struct ata_softc *scp)
struct ad_request *ad_request;
struct atapi_request *atapi_request;
-#ifdef ATA_DEBUG
- printf("ata_start: entered\n");
-#endif
if (scp->active != ATA_IDLE)
return;
@@ -647,9 +646,6 @@ ata_start(struct ata_softc *scp)
scp->active = ATA_ACTIVE_ATA;
scp->running = ad_request;
ad_transfer(ad_request);
-#ifdef ATA_DEBUG
- printf("ata_start: started ata, leaving\n");
-#endif
return;
}
#endif
@@ -693,9 +689,6 @@ ata_start(struct ata_softc *scp)
scp->active = ATA_ACTIVE_ATAPI;
scp->running = atapi_request;
atapi_transfer(atapi_request);
-#ifdef ATA_DEBUG
- printf("ata_start: started atapi, leaving\n");
-#endif
return;
}
#endif
@@ -883,9 +876,6 @@ ata_command(struct ata_softc *scp, int32_t device, u_int32_t command,
default:
printf("DANGER: illegal interrupt flag=%s\n", active2str(flags));
}
-#ifdef ATA_DEBUG
- printf("ata_command: leaving\n");
-#endif
return 0;
}
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index ec25bf3..1361d94 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -96,7 +96,7 @@ MALLOC_DEFINE(M_AD, "AD driver", "ATA disk driver");
static __inline int
apiomode(struct ata_params *ap)
{
- if (ap->atavalid & 2) {
+ if (ap->atavalid & ATA_FLAG_64_70) {
if (ap->apiomodes & 2) return 4;
if (ap->apiomodes & 1) return 3;
}
@@ -106,7 +106,7 @@ apiomode(struct ata_params *ap)
static __inline int
wdmamode(struct ata_params *ap)
{
- if (ap->atavalid & 2) {
+ if (ap->atavalid & ATA_FLAG_64_70) {
if (ap->wdmamodes & 4) return 2;
if (ap->wdmamodes & 2) return 1;
if (ap->wdmamodes & 1) return 0;
@@ -117,7 +117,7 @@ wdmamode(struct ata_params *ap)
static __inline int
udmamode(struct ata_params *ap)
{
- if ((ap->atavalid & 4) && ad_version(ap->versmajor) >= 3) {
+ if (ap->atavalid & ATA_FLAG_88) {
if (ap->udmamodes & 0x10) return (ap->cblid ? 4 : 2);
if (ap->udmamodes & 0x08) return (ap->cblid ? 3 : 2);
if (ap->udmamodes & 0x04) return 2;
@@ -301,16 +301,10 @@ adstrategy(struct buf *bp)
struct ad_softc *adp = bp->b_dev->si_drv1;
int32_t s;
-#ifdef AD_DEBUG
- printf("adstrategy: entered count=%d\n", bp->b_bcount);
-#endif
s = splbio();
bufqdisksort(&adp->queue, bp);
ad_start(adp);
splx(s);
-#ifdef AD_DEBUG
- printf("adstrategy: leaving\n");
-#endif
}
int
@@ -381,9 +375,6 @@ ad_start(struct ad_softc *adp)
struct buf *bp = bufq_first(&adp->queue);
struct ad_request *request;
-#ifdef AD_DEBUG
- printf("ad_start:\n");
-#endif
if (!bp)
return;
@@ -425,9 +416,6 @@ ad_transfer(struct ad_request *request)
/* calculate transfer details */
blkno = request->blockaddr + (request->donecount / DEV_BSIZE);
-#ifdef AD_DEBUG
- printf("ad_transfer: blkno=%d\n", blkno);
-#endif
if (request->donecount == 0) {
/* start timeout for this transfer */
@@ -485,9 +473,6 @@ ad_transfer(struct ad_request *request)
/* if this is a DMA transaction start it, return and wait for interrupt */
if (request->flags & AR_F_DMA_USED) {
ata_dmastart(adp->controller);
-#ifdef AD_DEBUG
- printf("ad_transfer: return waiting for DMA interrupt\n");
-#endif
return;
}
@@ -496,9 +481,6 @@ ad_transfer(struct ad_request *request)
/* if this is a PIO read operation, return and wait for interrupt */
if (request->flags & AR_F_READ) {
-#ifdef AD_DEBUG
- printf("ad_transfer: return waiting for PIO read interrupt\n");
-#endif
return;
}
@@ -518,9 +500,6 @@ ad_transfer(struct ad_request *request)
request->currentsize / sizeof(int32_t));
#endif
request->bytecount -= request->currentsize;
-#ifdef AD_DEBUG
- printf("ad_transfer: return wrote data\n");
-#endif
}
int32_t
@@ -612,9 +591,6 @@ oops:
request->currentsize / sizeof(int32_t));
#endif
request->bytecount -= request->currentsize;
-#ifdef AD_DEBUG
- printf("ad_interrupt: read in data\n");
-#endif
}
/* if this was a DMA operation finish up */
@@ -629,10 +605,6 @@ oops:
}
else {
request->donecount += request->currentsize;
-#ifdef AD_DEBUG
- printf("ad_interrupt: %s cmd OK\n",
- (request->flags & AR_F_READ) ? "read" : "write");
-#endif
if (request->bytecount > 0) {
ad_transfer(request);
return ATA_OP_CONTINUES;
@@ -648,9 +620,6 @@ oops:
free(request, M_AD);
ad_start(adp);
-#ifdef AD_DEBUG
- printf("ad_interrupt: completed\n");
-#endif
return ATA_OP_FINISHED;
}
diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h
index 359b83a..ce101bf 100644
--- a/sys/dev/ata/ata-disk.h
+++ b/sys/dev/ata/ata-disk.h
@@ -71,6 +71,7 @@ struct ata_params {
int16_t atavalid; /* fields valid */
#define ATA_FLAG_54_58 1 /* words 54-58 valid */
#define ATA_FLAG_64_70 2 /* words 64-70 valid */
+#define ATA_FLAG_88 4 /* word 88 valid */
int16_t currcyls;
int16_t currheads;
diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c
index dbf7560..500fd1a 100644
--- a/sys/dev/ata/ata-dma.c
+++ b/sys/dev/ata/ata-dma.c
@@ -64,15 +64,12 @@ int32_t
ata_dmainit(struct ata_softc *scp, int32_t device,
int32_t apiomode, int32_t wdmamode, int32_t udmamode)
{
- int32_t type, devno, error;
+ int32_t type, error;
+ int32_t devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1);
void *dmatab;
if (!scp->bmaddr)
return -1;
-#ifdef ATA_DMADEBUG
- printf("ata%d: dmainit: ioaddr=0x%x altioaddr=0x%x, bmaddr=0x%x\n",
- scp->lun, scp->ioaddr, scp->altioaddr, scp->bmaddr);
-#endif
/* if simplex controller, only allow DMA on primary channel */
if (scp->unit == 1) {
@@ -90,7 +87,8 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
if (((uintptr_t)dmatab >> PAGE_SHIFT) ^
(((uintptr_t)dmatab + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
- printf("ata_dmainit: dmatab crosses page boundary, no DMA\n");
+ printf("ata%d-%s: dmatab crosses page boundary, no DMA\n",
+ scp->lun, (device == ATA_MASTER) ? "master" : "slave");
free(dmatab, M_DEVBUF);
return -1;
}
@@ -99,17 +97,17 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
switch (type = pci_get_devid(scp->dev)) {
case 0x71118086: /* Intel PIIX4 */
+ case 0x71998086: /* Intel PIIX4 */
if (udmamode >= 2) {
int32_t mask48, new48;
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA2 mode on PIIX4 chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on PIIX4 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
- devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1);
mask48 = (1 << devno) + (3 << (16 + (devno << 2)));
new48 = (1 << devno) + (2 << (16 + (devno << 2)));
pci_write_config(scp->dev, 0x48,
@@ -144,9 +142,10 @@ 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)
- printf("ata%d: %s: %s setting up WDMA2 mode on PIIX4 chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on PIIX%s chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
- (error) ? "failed" : "success");
+ (error) ? "failed" : "success",
+ (type == 0x70108086) ? "3" : "4");
if (!error) {
if (device == ATA_MASTER) {
mask40 = 0x0000330f;
@@ -194,7 +193,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on PIIX chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on PIIX chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -217,7 +216,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)
- printf("ata%d: %s: %s setting up UDMA2 mode on Aladdin chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on Aladdin chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -235,7 +234,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on Aladdin chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on Aladdin chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -250,69 +249,55 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
break;
case 0x05711106: /* VIA Apollo 82C571 / 82C586 / 82C686 */
- devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1);
-
- /* UDMA4 mode only on VT82C686 hardware */
- if (udmamode >= 4 && ata_find_dev(scp->dev, 0x06861106)) {
- int8_t byte = pci_read_config(scp->dev, 0x53 - devno, 1);
-
- /* enable UDMA transfer modes setting by SETFEATURES cmd */
- pci_write_config(scp->dev, 0x53 - devno, (byte & 0x1c) | 0x40, 1);
+ case 0x74091022: /* AMD 756 */
+ /* UDMA4 mode only on 82C686 / AMD 756 hardware */
+ if ((udmamode >= 4 && ata_find_dev(scp->dev, 0x06861106)) ||
+ (udmamode >= 4 && type == 0x74091022)) {
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA4 mode on VIA chip\n",
+ printf("ata%d-%s: %s setting up UDMA4 mode on %s chip\n",
scp->lun, (device == ATA_MASTER) ? "master":"slave",
- (error) ? "failed" : "success");
+ (error) ? "failed" : "success",
+ (type == 0x74091022) ? "AMD" : "VIA");
if (!error) {
+ pci_write_config(scp->dev, 0x53 - devno, 0xc3, 1);
scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_UDMA4;
return 0;
}
- pci_write_config(scp->dev, 0x53 - devno, byte, 1);
}
- /* UDMA2 mode only on rev 1 and better 82C586 & 82C586 chips */
- if (udmamode >= 2 && pci_read_config(scp->dev, 0x08, 1) >= 0x01 &&
- (ata_find_dev(scp->dev, 0x05861106) ||
- ata_find_dev(scp->dev, 0x06861106))) {
- int8_t byte = pci_read_config(scp->dev, 0x53 - devno, 1);
-
- /* enable UDMA transfer modes setting by SETFEATURES cmd */
- pci_write_config(scp->dev, 0x53 - devno, (byte & 0x1c) | 0x40, 1);
+ /* UDMA2 mode only on 82C686 and AMD 756 and rev 1 and better 82C586 */
+ if ((udmamode >= 2 && ata_find_dev(scp->dev, 0x06861106)) ||
+ (udmamode >= 2 && type == 0x74091022) ||
+ (udmamode >= 2 && ata_find_dev(scp->dev, 0x05861106) &&
+ pci_read_config(scp->dev, 0x08, 1) >= 0x01)) {
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA2 mode on VIA chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on %s chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
- (error) ? "failed" : "success");
+ (error) ? "failed" : "success",
+ (type == 0x74091022) ? "AMD" : "VIA");
if (!error) {
- if ((device == ATA_MASTER && scp->devices & ATA_ATA_MASTER) ||
- (device == ATA_SLAVE && scp->devices & ATA_ATA_SLAVE)) {
- struct ata_params *ap = ((struct ad_softc *)
- (scp->dev_softc[(device==ATA_MASTER)?0:1]))->ata_parm;
-
- if (ata_find_dev(scp->dev, 0x06861106) &&
- (ap->udmamodes & 0x10) && !ap->cblid) {
- pci_write_config(scp->dev, 0x53 - devno,
- (byte & 0x1c) | 0x42, 1);
- }
- }
+ pci_write_config(scp->dev, 0x53 - devno, 0xc0, 1);
scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_UDMA2;
return 0;
}
- pci_write_config(scp->dev, 0x53 - devno, byte, 1);
}
if (wdmamode >= 2 && apiomode >= 4) {
/* set WDMA2 mode timing */
- pci_write_config(scp->dev, 0x4b - devno, 0x31 , 1);
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up WDMA2 mode on VIA chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on %s chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
- (error) ? "failed" : "success");
+ (error) ? "failed" : "success",
+ (type == 0x74091022) ? "AMD" : "VIA");
if (!error) {
+ pci_write_config(scp->dev, 0x53 - devno, 0x82, 1);
+ pci_write_config(scp->dev, 0x4b - devno, 0x31, 1);
scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2;
return 0;
}
@@ -321,12 +306,11 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
break;
case 0x55131039: /* SiS 5591 */
- devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1);
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)
- printf("ata%d: %s: %s setting up UDMA2 mode on SiS chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on SiS chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -339,7 +323,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on SiS chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on SiS chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -358,13 +342,12 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
(device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE))
break;
- devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1);
if (udmamode >=4 && type == 0x4d38105a &&
!(pci_read_config(scp->dev, 0x50, 2)&(scp->unit ? 1<<11 : 1<<10))) {
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA4 mode on Promise chip\n",
+ printf("ata%d-%s: %s setting up UDMA4 mode on Promise chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -378,7 +361,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)
- printf("ata%d: %s: %s setting up UDMA2 mode on Promise chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on Promise chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -391,7 +374,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on Promise chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on Promise chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -401,7 +384,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
}
}
if (bootverbose)
- printf("ata%d: %s: setting PIO mode on Promise chip\n",
+ printf("ata%d-%s: setting PIO mode on Promise chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave");
pci_write_config(scp->dev, 0x60 + (devno << 2), 0x004fe924, 4);
break;
@@ -412,12 +395,11 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
(device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE))
break;
- devno = (device == ATA_MASTER) ? 0 : 1;
if (udmamode >=4 && !(pci_read_config(scp->dev, 0x5a, 1) & 0x2)) {
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA4 mode on HPT366 chip\n",
+ printf("ata%d-%s: %s setting up UDMA4 mode on HPT366 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -430,7 +412,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
ATA_UDMA3, ATA_C_F_SETXFER, ATA_WAIT_READY);
if (bootverbose)
- printf("ata%d: %s: %s setting up UDMA3 mode on HPT366 chip\n",
+ printf("ata%d-%s: %s setting up UDMA3 mode on HPT366 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -443,7 +425,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)
- printf("ata%d: %s: %s setting up UDMA2 mode on HPT366 chip\n",
+ printf("ata%d-%s: %s setting up UDMA2 mode on HPT366 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -456,7 +438,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on HPT366 chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on HPT366 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -466,7 +448,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
}
}
if (bootverbose)
- printf("ata%d: %s: setting PIO mode on HPT366 chip\n",
+ printf("ata%d-%s: setting PIO mode on HPT366 chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave");
hpt366_timing(scp, device, ATA_MODE_PIO);
break;
@@ -487,7 +469,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)
- printf("ata%d: %s: %s setting up WDMA2 mode on generic chip\n",
+ printf("ata%d-%s: %s setting up WDMA2 mode on generic chip\n",
scp->lun, (device == ATA_MASTER) ? "master" : "slave",
(error) ? "failed" : "success");
if (!error) {
@@ -508,17 +490,12 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
u_int32_t dma_count, dma_base;
int32_t i = 0;
-#ifdef ATA_DMADEBUG
- printf("ata%d: dmasetup\n", scp->lun);
-#endif
if (((uintptr_t)data & 1) || (count & 1))
return -1;
if (!count) {
-#ifdef ATA_DMADEBUG
- printf("ata%d: zero length DMA transfer attempt on %s\n",
+ printf("ata%d-%s: zero length DMA transfer attempted\n",
scp->lun, ((device == ATA_MASTER) ? "master" : "slave"));
-#endif
return -1;
}
@@ -533,7 +510,7 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
dmatab[i].count = (dma_count & 0xffff);
i++;
if (i >= ATA_DMA_ENTRIES) {
- printf("ata%d: too many segments in DMA table for %s\n",
+ printf("ata%d-%s: too many segments in DMA table\n",
scp->lun, (device ? "slave" : "master"));
return -1;
}
@@ -542,17 +519,9 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
data += MIN(count, PAGE_SIZE);
count -= MIN(count, PAGE_SIZE);
}
-#ifdef ATA_DMADEBUG
- printf("ata_dmasetup: base=%08x count%08x\n", dma_base, dma_count);
-#endif
dmatab[i].base = dma_base;
dmatab[i].count = (dma_count & 0xffff) | ATA_DMA_EOT;
-
outl(scp->bmaddr + ATA_BMDTP_PORT, vtophys(dmatab));
-#ifdef ATA_DMADEBUG
- printf("dmatab=%08x %08x\n",
- vtophys(dmatab), inl(scp->bmaddr+ATA_BMDTP_PORT));
-#endif
outb(scp->bmaddr + ATA_BMCMD_PORT, flags ? ATA_BMCMD_WRITE_READ:0);
outb(scp->bmaddr + ATA_BMSTAT_PORT, (inb(scp->bmaddr + ATA_BMSTAT_PORT) |
(ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR)));
@@ -562,9 +531,6 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
void
ata_dmastart(struct ata_softc *scp)
{
-#ifdef ATA_DMADEBUG
- printf("ata%d: dmastart\n", scp->lun);
-#endif
scp->flags |= ATA_DMA_ACTIVE;
outb(scp->bmaddr + ATA_BMCMD_PORT,
inb(scp->bmaddr + ATA_BMCMD_PORT) | ATA_BMCMD_START_STOP);
@@ -573,9 +539,6 @@ ata_dmastart(struct ata_softc *scp)
int32_t
ata_dmadone(struct ata_softc *scp)
{
-#ifdef ATA_DMADEBUG
- printf("ata%d: dmadone\n", scp->lun);
-#endif
outb(scp->bmaddr + ATA_BMCMD_PORT,
inb(scp->bmaddr + ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP);
scp->flags &= ~ATA_DMA_ACTIVE;
@@ -585,9 +548,6 @@ ata_dmadone(struct ata_softc *scp)
int32_t
ata_dmastatus(struct ata_softc *scp)
{
-#ifdef ATA_DMADEBUG
- printf("ata%d: dmastatus\n", scp->lun);
-#endif
return inb(scp->bmaddr + ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK;
}
@@ -628,7 +588,7 @@ hpt366_timing(struct ata_softc *scp, int32_t device, int32_t mode)
default: timing = 0x0120d9d9;
}
}
- pci_write_config(scp->dev, 0x40 + (device==ATA_MASTER ? 0 : 4), timing, 4);
+ pci_write_config(scp->dev, (device==ATA_MASTER ? 0x40 : 0x44), timing, 4);
}
#else /* NPCI > 0 */
diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c
index 0014b99..e641019 100644
--- a/sys/dev/ata/atapi-all.c
+++ b/sys/dev/ata/atapi-all.c
@@ -261,10 +261,6 @@ atapi_queue_cmd(struct atapi_softc *atp, int8_t *ccb, void *data,
/* wait for request to complete */
tsleep((caddr_t)request, PRIBIO, "atprq", 0);
splx(s);
-
-#ifdef ATAPI_DEBUG
- printf("%s: phew, got back from tsleep\n", request->device->devname);
-#endif
error = request->error;
free(request, M_ATAPI);
return error;
@@ -356,9 +352,6 @@ atapi_interrupt(struct atapi_request *request)
if (request->ccb[0] == ATAPI_REQUEST_SENSE)
*buffer = (int8_t *)&request->sense;
-#ifdef ATAPI_DEBUG
- printf("%s: atapi_interrupt: enter\n", atp->devname);
-#endif
reason = (inb(atp->controller->ioaddr+ATA_IREASON) & (ATA_I_CMD|ATA_I_IN)) |
(atp->controller->status & ATA_S_DRQ);
@@ -399,9 +392,6 @@ atapi_interrupt(struct atapi_request *request)
length = inb(atp->controller->ioaddr + ATA_CYL_LSB);
length |= inb(atp->controller->ioaddr + ATA_CYL_MSB) << 8;
-#ifdef ATAPI_DEBUG
- printf("%s: length=%d reason=0x%02x\n", atp->devname, length, reason);
-#endif
switch (reason) {
case ATAPI_P_WRITE:
@@ -439,14 +429,6 @@ atapi_interrupt(struct atapi_request *request)
else
if (request->ccb[0] != ATAPI_REQUEST_SENSE)
request->result = 0;
-
-#ifdef ATAPI_DEBUG
- if (request->bytecount > 0) {
- printf("%s: %s size problem, %d bytes residue\n",
- atp->devname, (request->flags & A_READ) ? "read" : "write",
- request->bytecount);
- }
-#endif
goto op_finished;
default:
printf("%s: unknown transfer phase %d\n", atp->devname, reason);
@@ -511,9 +493,6 @@ op_finished:
else
wakeup((caddr_t)request);
}
-#ifdef ATAPI_DEBUG
- printf("%s: error=0x%02x\n", request->device->devname, request->result);
-#endif
return ATA_OP_FINISHED;
}
@@ -629,9 +608,6 @@ atapi_timeout(struct atapi_request *request)
atp->controller->running = NULL;
printf("%s: atapi_timeout: cmd=%s - resetting\n",
atp->devname, atapi_cmd2str(request->ccb[0]));
-#ifdef ATAPI_DEBUG
- atapi_dump("ccb = ", &request->ccb[0], sizeof(request->ccb));
-#endif
if (request->flags & ATAPI_F_DMA_USED)
ata_dmadone(atp->controller);
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 9f39185..e60d1ad 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -155,10 +155,6 @@ acdattach(struct atapi_softc *atp)
bzero(chp, sizeof(struct changer));
error = atapi_queue_cmd(cdp->atp, ccb, chp, sizeof(struct changer),
A_READ, 60, NULL, NULL, NULL);
-#ifdef ACD_DEBUG
- printf("error=%02x curr=%02x slots=%d len=%d\n",
- error, chp->current_slot, chp->slots, htons(chp->table_length));
-#endif
if (!error) {
struct acd_softc *tmpcdp = cdp;
@@ -1114,9 +1110,6 @@ acd_start(struct acd_softc *cdp)
}
count = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size;
-#ifdef ACD_DEBUG
- printf("acd%d: lba=%d, count=%d\n", cdp->lun, lba, count);
-#endif
ccb[1] = 0;
ccb[2] = lba>>24;
ccb[3] = lba>>16;
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index 7710ba5..fa4506f 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -139,9 +139,6 @@ afd_sense(struct afd_softc *fdp)
A_READ, 30, NULL, NULL, NULL)))
break;
}
-#ifdef AFD_DEBUG
- atapi_dump("afd: sense", buffer, sizeof(buffer));
-#endif
if (error)
return error;
bcopy(buffer, &fdp->header, sizeof(struct afd_header));
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 5574da3..984fa18 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.c
@@ -124,12 +124,6 @@ astattach(struct atapi_softc *atp)
bzero(&transfer, sizeof(struct ast_transferpage));
ast_mode_sense(stp, ATAPI_TAPE_TRANSFER_PAGE,
&transfer, sizeof(transfer));
-#ifdef AST_DEBUG
- printf("ast: rd32k=%d rd32k5=%d wr32k=%d wr32k5=%d stream=%d\n",
- transfer.read32k, transfer.read32k5,
- transfer.write32k, transfer.write32k5, transfer.streaming);
-#endif
-
bzero(&identify, sizeof(struct ast_identifypage));
ast_mode_sense(stp, ATAPI_TAPE_IDENTIFY_PAGE,
&identify, sizeof(identify));
@@ -558,11 +552,6 @@ ast_read_position(struct ast_softc *stp, int32_t hard,
NULL, NULL, NULL);
position->tape = ntohl(position->tape);
position->host = ntohl(position->host);
-#ifdef AST_DEBUG
- printf("ast%d: BOP=%d EOP=%d host=%ld tape=%ld in buf=%d error=%02x\n",
- stp->lun, position->bop, position->eop, ntohl(position->host),
- ntohl(position->tape), position->blks_in_buf, error);
-#endif
return error;
}
OpenPOWER on IntegriCloud