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 70186 2000-12-19 10:37:03Z 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> --- 269 unchanged lines hidden (view full) --- 306 pci_write_config(parent, 0x54, word54, 4); 307 pci_write_config(parent, 0x53, 308 pci_read_config(parent, 0x53, 1) | 0x03, 1); 309 scp->flags |= ATA_ATAPI_DMA_RO; 310 scp->mode[ATA_DEV(device)] = ATA_UDMA2; 311 return; 312 } 313 } |
314 315 /* make sure eventual UDMA mode from the BIOS is disabled */ 316 pci_write_config(parent, 0x54, 317 pci_read_config(parent, 0x54, 4) & ~0x88880000, 4); 318 |
319 if (wdmamode >= 2 && apiomode >= 4) { 320 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 321 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 322 if (bootverbose) 323 ata_printf(scp, device, 324 "%s setting WDMA2 on Aladdin chip\n", 325 (error) ? "failed" : "success"); 326 if (!error) { --- 250 unchanged lines hidden (view full) --- 577 (error) ? "failed" : "success", 578 ata_mode2str(ata_pio2mode(apiomode))); 579 cyrix_timing(scp, devno, ata_pio2mode(apiomode)); 580 scp->mode[ATA_DEV(device)] = ata_pio2mode(apiomode); 581 return; 582 583 case 0x02111166: /* ServerWorks ROSB4 ATA33 controller */ 584 if (udmamode >= 2) { |
585 error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, 586 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); 587 if (bootverbose) 588 ata_printf(scp, device, 589 "%s setting UDMA2 on ServerWorks chip\n", 590 (error) ? "failed" : "success"); 591 if (!error) { |
592 u_int16_t reg56; 593 |
594 pci_write_config(parent, 0x54, 595 pci_read_config(parent, 0x54, 1) | 596 (0x01 << devno), 1); 597 reg56 = pci_read_config(parent, 0x56, 2); 598 reg56 &= ~(0xf << (devno * 4)); 599 reg56 |= (0x2 << (devno * 4)); 600 pci_write_config(parent, 0x56, reg56, 2); 601 scp->mode[ATA_DEV(device)] = ATA_UDMA2; --- 295 unchanged lines hidden (view full) --- 897 case ATA_PIO0: reg20 = 0x0000e132; break; 898 case ATA_PIO1: reg20 = 0x00018121; break; 899 case ATA_PIO2: reg20 = 0x00024020; break; 900 case ATA_PIO3: reg20 = 0x00032010; break; 901 case ATA_PIO4: reg20 = 0x00040010; break; 902 case ATA_WDMA2: reg24 = 0x00002020; break; 903 case ATA_UDMA2: reg24 = 0x00911030; break; 904 } |
905 outl(scp->bmaddr + (devno << 3) + 0x20, reg20); 906 outl(scp->bmaddr + (devno << 3) + 0x24, reg24); |
907} 908 909static void 910promise_timing(struct ata_softc *scp, int devno, int mode) 911{ 912 u_int32_t timing = 0; 913 struct promise_timing { 914 u_int8_t pa:4; --- 161 unchanged lines hidden --- |