ata-dma.c (60041) | ata-dma.c (60829) |
---|---|
1/*- 2 * Copyright (c) 1998,1999,2000 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,2000 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 60041 2000-05-05 09:59:14Z phk $ | 28 * $FreeBSD: head/sys/dev/ata/ata-dma.c 60829 2000-05-23 19:05:56Z sos $ |
29 */ 30 31#include "pci.h" 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bio.h> 35#include <sys/malloc.h> 36#include <sys/bus.h> --- 51 unchanged lines hidden (view full) --- 88 if (((uintptr_t)dmatab >> PAGE_SHIFT) ^ 89 (((uintptr_t)dmatab + PAGE_SIZE - 1) >> PAGE_SHIFT)) { 90 ata_printf(scp, device, "dmatab crosses page boundary, no DMA\n"); 91 free(dmatab, M_DEVBUF); 92 return; 93 } 94 scp->dmatab[ATA_DEV(device)] = dmatab; 95 } | 29 */ 30 31#include "pci.h" 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/bio.h> 35#include <sys/malloc.h> 36#include <sys/bus.h> --- 51 unchanged lines hidden (view full) --- 88 if (((uintptr_t)dmatab >> PAGE_SHIFT) ^ 89 (((uintptr_t)dmatab + PAGE_SIZE - 1) >> PAGE_SHIFT)) { 90 ata_printf(scp, device, "dmatab crosses page boundary, no DMA\n"); 91 free(dmatab, M_DEVBUF); 92 return; 93 } 94 scp->dmatab[ATA_DEV(device)] = dmatab; 95 } |
96 if (udmamode > 2 && !ATA_PARAM(scp, device)->cblid) { 97 ata_printf(scp, device, 98 "DMA limitted to UDMA33, non-ATA66 compliant cable\n"); 99 udmamode = 2; 100 } |
|
96 97 switch (scp->chiptype) { 98 99 case 0x24118086: /* Intel ICH */ 100 if (udmamode >= 4) { 101 int32_t mask48, new48; 102 int16_t word54; 103 --- 141 unchanged lines hidden (view full) --- 245 246 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 247 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 248 if (bootverbose) 249 ata_printf(scp, device, 250 "%s setting up UDMA2 mode on Aladdin chip\n", 251 (error) ? "failed" : "success"); 252 if (!error) { | 101 102 switch (scp->chiptype) { 103 104 case 0x24118086: /* Intel ICH */ 105 if (udmamode >= 4) { 106 int32_t mask48, new48; 107 int16_t word54; 108 --- 141 unchanged lines hidden (view full) --- 250 251 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 252 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 253 if (bootverbose) 254 ata_printf(scp, device, 255 "%s setting up UDMA2 mode on Aladdin chip\n", 256 (error) ? "failed" : "success"); 257 if (!error) { |
253 word54 |= 0x5555; 254 word54 |= (0x0a << (16 + (scp->unit << 3) + (device << 2))); | 258 word54 &= ~(0x000f000f << (devno << 2)); 259 word54 |= (0x000a0005 << (devno << 2)); |
255 pci_write_config(parent, 0x54, word54, 4); 256 pci_write_config(parent, 0x53, 257 pci_read_config(parent, 0x53, 1) | 0x03, 1); 258 scp->flags |= ATA_ATAPI_DMA_RO; 259 scp->mode[ATA_DEV(device)] = ATA_UDMA2; 260 return; 261 } 262 } --- 67 unchanged lines hidden (view full) --- 330 /* 82c596 revision >= 0x12 is like the 82c686 */ 331 if (ata_find_dev(parent, 0x05961106, 0x12)) 332 goto via_82c686; 333 /* FALLTHROUGH */ 334 335 case 0x05861106: /* VIA 82C586 */ 336via_82c586: 337 /* UDMA2 mode only on 82C586 > rev1, 82C596, AMD 756 */ | 260 pci_write_config(parent, 0x54, word54, 4); 261 pci_write_config(parent, 0x53, 262 pci_read_config(parent, 0x53, 1) | 0x03, 1); 263 scp->flags |= ATA_ATAPI_DMA_RO; 264 scp->mode[ATA_DEV(device)] = ATA_UDMA2; 265 return; 266 } 267 } --- 67 unchanged lines hidden (view full) --- 335 /* 82c596 revision >= 0x12 is like the 82c686 */ 336 if (ata_find_dev(parent, 0x05961106, 0x12)) 337 goto via_82c686; 338 /* FALLTHROUGH */ 339 340 case 0x05861106: /* VIA 82C586 */ 341via_82c586: 342 /* UDMA2 mode only on 82C586 > rev1, 82C596, AMD 756 */ |
338 if ((udmamode >= 2 && scp->chiptype == 0x05861106 && 339 pci_read_config(scp->dev, 0x08, 1) >= 0x01) || | 343 if ((udmamode >= 2 && ata_find_dev(parent, 0x05861106, 0x02)) || |
340 (udmamode >= 2 && scp->chiptype == 0x05961106) || 341 (udmamode >= 2 && scp->chiptype == 0x74091022)) { 342 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 343 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 344 if (bootverbose) 345 ata_printf(scp, device, "%s setting up UDMA2 mode on %s chip\n", 346 (error) ? "failed" : "success", 347 (scp->chiptype == 0x74091022) ? "AMD" : "VIA"); --- 458 unchanged lines hidden --- | 344 (udmamode >= 2 && scp->chiptype == 0x05961106) || 345 (udmamode >= 2 && scp->chiptype == 0x74091022)) { 346 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 347 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 348 if (bootverbose) 349 ata_printf(scp, device, "%s setting up UDMA2 mode on %s chip\n", 350 (error) ? "failed" : "success", 351 (scp->chiptype == 0x74091022) ? "AMD" : "VIA"); --- 458 unchanged lines hidden --- |