1/*-
2 * Copyright (c) 1998,1999,2000,2001 S�ren Schmidt <sos@FreeBSD.org>
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 84584 2001-10-06 11:07:04Z sos $
29 */
30
31#include "pci.h"
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/ata.h>
35#include <sys/bio.h>
36#include <sys/malloc.h>
--- 61 unchanged lines hidden (view full) ---
98 ata_printf(scp, device, "simplex device, DMA on primary only\n");
99 return;
100 }
101 }
102
103 /* DMA engine address alignment is usually 1 word (2 bytes) */
104 scp->alignment = 0x1;
105
106 if (udmamode > 2 && !ATA_PARAM(scp, device)->hwres_cblid) {
107 ata_printf(scp, device,
108 "DMA limited to UDMA33, non-ATA66 compliant cable\n");
109 udmamode = 2;
110 }
111
112 switch (scp->chiptype) {
113
114 case 0x244a8086: /* Intel ICH2 mobile */
115 case 0x244b8086: /* Intel ICH2 */
116 if (udmamode >= 5) {
117 int32_t mask48, new48;
118 int16_t word54;
119
--- 600 unchanged lines hidden (view full) ---
720 return;
721 }
722 }
723 /* we could set PIO mode timings, but we assume the BIOS did that */
724 break;
725
726 case 0x4d68105a: /* Promise TX2 ATA100 controllers */
727 case 0x6268105a: /* Promise TX2v2 ATA100 controllers */
728 ATA_OUTB(scp->r_bmio, ATA_BMDEVSPEC_0, 0x0b);
729 if (udmamode >= 4 && !(ATA_INB(scp->r_bmio, ATA_BMDEVSPEC_1) & 0x04)) {
730 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
731 ATA_UDMA + max(udmamode, 5), ATA_C_F_SETXFER,
732 ATA_WAIT_READY);
733 if (bootverbose)
734 ata_printf(scp, device, "%s setting %s on Promise chip\n",
735 (error) ? "failed" : "success",
736 ata_mode2str(ATA_UDMA + max(udmamode, 5)));
737 if (!error) {
738 scp->mode[ATA_DEV(device)] = ATA_UDMA + (max(udmamode, 5));
739 return;
740 }
741 }
742 if (udmamode >= 2) {
743 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
744 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
745 if (bootverbose)
746 ata_printf(scp, device, "%s setting %s on Promise chip\n",
--- 423 unchanged lines hidden ---
2 * Copyright (c) 1998,1999,2000,2001 S�ren Schmidt <sos@FreeBSD.org>
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 84584 2001-10-06 11:07:04Z sos $
29 */
30
31#include "pci.h"
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/ata.h>
35#include <sys/bio.h>
36#include <sys/malloc.h>
--- 61 unchanged lines hidden (view full) ---
98 ata_printf(scp, device, "simplex device, DMA on primary only\n");
99 return;
100 }
101 }
102
103 /* DMA engine address alignment is usually 1 word (2 bytes) */
104 scp->alignment = 0x1;
105
106 if (udmamode > 2 && !ATA_PARAM(scp, device)->hwres_cblid) {
107 ata_printf(scp, device,
108 "DMA limited to UDMA33, non-ATA66 compliant cable\n");
109 udmamode = 2;
110 }
111
112 switch (scp->chiptype) {
113
114 case 0x244a8086: /* Intel ICH2 mobile */
115 case 0x244b8086: /* Intel ICH2 */
116 if (udmamode >= 5) {
117 int32_t mask48, new48;
118 int16_t word54;
119
--- 600 unchanged lines hidden (view full) ---
720 return;
721 }
722 }
723 /* we could set PIO mode timings, but we assume the BIOS did that */
724 break;
725
726 case 0x4d68105a: /* Promise TX2 ATA100 controllers */
727 case 0x6268105a: /* Promise TX2v2 ATA100 controllers */
728 ATA_OUTB(scp->r_bmio, ATA_BMDEVSPEC_0, 0x0b);
729 if (udmamode >= 4 && !(ATA_INB(scp->r_bmio, ATA_BMDEVSPEC_1) & 0x04)) {
730 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
731 ATA_UDMA + max(udmamode, 5), ATA_C_F_SETXFER,
732 ATA_WAIT_READY);
733 if (bootverbose)
734 ata_printf(scp, device, "%s setting %s on Promise chip\n",
735 (error) ? "failed" : "success",
736 ata_mode2str(ATA_UDMA + max(udmamode, 5)));
737 if (!error) {
738 scp->mode[ATA_DEV(device)] = ATA_UDMA + (max(udmamode, 5));
739 return;
740 }
741 }
742 if (udmamode >= 2) {
743 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
744 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
745 if (bootverbose)
746 ata_printf(scp, device, "%s setting %s on Promise chip\n",
--- 423 unchanged lines hidden ---