ata-dma.c (54270) | ata-dma.c (54544) |
---|---|
1/*- 2 * Copyright (c) 1998,1999 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1998,1999 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/dev/ata/ata-dma.c 54270 1999-12-07 22:07:18Z sos $ | 28 * $FreeBSD: head/sys/dev/ata/ata-dma.c 54544 1999-12-13 10:19:39Z sos $ |
29 */ 30 31#include "pci.h" 32#include "apm.h" 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/buf.h> 36#include <sys/malloc.h> --- 138 unchanged lines hidden (view full) --- 175 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 176 return 0; 177 } 178 } 179 /* we could set PIO mode timings, but we assume the BIOS did that */ 180 break; 181 182 case 0x12308086: /* Intel PIIX */ | 29 */ 30 31#include "pci.h" 32#include "apm.h" 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/buf.h> 36#include <sys/malloc.h> --- 138 unchanged lines hidden (view full) --- 175 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 176 return 0; 177 } 178 } 179 /* we could set PIO mode timings, but we assume the BIOS did that */ 180 break; 181 182 case 0x12308086: /* Intel PIIX */ |
183 /* probably not worth the trouble */ | 183 if (wdmamode >= 2 && apiomode >= 4) { 184 int32_t word40; 185 186 word40 = pci_read_config(scp->dev, 0x40, 4); 187 word40 >>= scp->unit * 16; 188 189 /* Check for timing config usable for DMA on controller */ 190 if (!((word40 & 0x3300) == 0x2300 && 191 ((word40 >> (device == ATA_MASTER ? 0 : 4)) & 1) == 1)) 192 break; 193 194 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 195 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 196 if (bootverbose) 197 printf("ata%d: %s: %s setting up WDMA2 mode on PIIX chip\n", 198 scp->lun, (device == ATA_MASTER) ? "master" : "slave", 199 (error) ? "failed" : "success"); 200 if (!error) { 201 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 202 return 0; 203 } 204 } |
184 break; 185 186 case 0x522910b9: /* AcerLabs Aladdin IV/V */ 187 /* the Aladdin doesn't support ATAPI DMA on both master & slave */ 188 if (scp->devices & ATA_ATAPI_MASTER && scp->devices & ATA_ATAPI_SLAVE) { 189 printf("ata%d: Aladdin: two atapi devices on this channel, " 190 "DMA disabled\n", scp->lun); 191 break; --- 100 unchanged lines hidden (view full) --- 292 if (!error) { 293 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 294 return 0; 295 } 296 } 297 /* we could set PIO mode timings, but we assume the BIOS did that */ 298 break; 299 | 205 break; 206 207 case 0x522910b9: /* AcerLabs Aladdin IV/V */ 208 /* the Aladdin doesn't support ATAPI DMA on both master & slave */ 209 if (scp->devices & ATA_ATAPI_MASTER && scp->devices & ATA_ATAPI_SLAVE) { 210 printf("ata%d: Aladdin: two atapi devices on this channel, " 211 "DMA disabled\n", scp->lun); 212 break; --- 100 unchanged lines hidden (view full) --- 313 if (!error) { 314 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 315 return 0; 316 } 317 } 318 /* we could set PIO mode timings, but we assume the BIOS did that */ 319 break; 320 |
321 case 0x55131039: /* SiS 5591 */ 322 devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1); 323 if (udmamode >= 2) { 324 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 325 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 326 if (bootverbose) 327 printf("ata%d: %s: %s setting up UDMA2 mode on SiS chip\n", 328 scp->lun, (device == ATA_MASTER) ? "master" : "slave", 329 (error) ? "failed" : "success"); 330 if (!error) { 331 pci_write_config(scp->dev, 0x40 + (devno << 1), 0xa301, 2); 332 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_UDMA2; 333 return 0; 334 } 335 } 336 if (wdmamode >=2 && apiomode >= 4) { 337 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 338 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 339 if (bootverbose) 340 printf("ata%d: %s: %s setting up WDMA2 mode on SiS chip\n", 341 scp->lun, (device == ATA_MASTER) ? "master" : "slave", 342 (error) ? "failed" : "success"); 343 if (!error) { 344 pci_write_config(scp->dev, 0x40 + (devno << 1), 0x0301, 2); 345 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; 346 return 0; 347 } 348 } 349 /* we could set PIO mode timings, but we assume the BIOS did that */ 350 break; 351 |
|
300 case 0x4d33105a: /* Promise Ultra33 / FastTrak33 controllers */ 301 case 0x4d38105a: /* Promise Ultra66 / FastTrak66 controllers */ 302 /* the Promise can only do DMA on ATA disks not on ATAPI devices */ 303 if ((device == ATA_MASTER && scp->devices & ATA_ATAPI_MASTER) || 304 (device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE)) 305 break; 306 307 devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1); --- 114 unchanged lines hidden (view full) --- 422 if ((device == ATA_MASTER && scp->devices & ATA_ATAPI_MASTER) || 423 (device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE)) 424 break; 425 426 /* well, we have no support for this, but try anyways */ 427 if (((wdmamode >= 2 && apiomode >= 4) || udmamode >= 2) && 428 (inb(scp->bmaddr + ATA_BMSTAT_PORT) & 429 ((device == ATA_MASTER) ? | 352 case 0x4d33105a: /* Promise Ultra33 / FastTrak33 controllers */ 353 case 0x4d38105a: /* Promise Ultra66 / FastTrak66 controllers */ 354 /* the Promise can only do DMA on ATA disks not on ATAPI devices */ 355 if ((device == ATA_MASTER && scp->devices & ATA_ATAPI_MASTER) || 356 (device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE)) 357 break; 358 359 devno = (scp->unit << 1) + ((device == ATA_MASTER) ? 0 : 1); --- 114 unchanged lines hidden (view full) --- 474 if ((device == ATA_MASTER && scp->devices & ATA_ATAPI_MASTER) || 475 (device == ATA_SLAVE && scp->devices & ATA_ATAPI_SLAVE)) 476 break; 477 478 /* well, we have no support for this, but try anyways */ 479 if (((wdmamode >= 2 && apiomode >= 4) || udmamode >= 2) && 480 (inb(scp->bmaddr + ATA_BMSTAT_PORT) & 481 ((device == ATA_MASTER) ? |
430 ATA_BMSTAT_DMA_SLAVE : ATA_BMSTAT_DMA_MASTER))) { | 482 ATA_BMSTAT_DMA_MASTER : ATA_BMSTAT_DMA_SLAVE))) { |
431 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 432 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 433 if (bootverbose) 434 printf("ata%d: %s: %s setting up WDMA2 mode on generic chip\n", 435 scp->lun, (device == ATA_MASTER) ? "master" : "slave", 436 (error) ? "failed" : "success"); 437 if (!error) { 438 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; --- 173 unchanged lines hidden --- | 483 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 484 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 485 if (bootverbose) 486 printf("ata%d: %s: %s setting up WDMA2 mode on generic chip\n", 487 scp->lun, (device == ATA_MASTER) ? "master" : "slave", 488 (error) ? "failed" : "success"); 489 if (!error) { 490 scp->mode[(device == ATA_MASTER) ? 0 : 1] = ATA_MODE_WDMA2; --- 173 unchanged lines hidden --- |