Deleted Added
full compact
ata-dma.c (86322) ata-dma.c (87198)
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 *
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 86322 2001-11-13 11:37:23Z sos $
28 * $FreeBSD: head/sys/dev/ata/ata-dma.c 87198 2001-12-02 10:48:52Z 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>

--- 479 unchanged lines hidden (view full) ---

516 scp->mode[ATA_DEV(device)] = ATA_WDMA2;
517 return;
518 }
519 }
520 /* we could set PIO mode timings, but we assume the BIOS did that */
521 break;
522
523 case 0x55131039: /* SiS 5591 */
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>

--- 479 unchanged lines hidden (view full) ---

516 scp->mode[ATA_DEV(device)] = ATA_WDMA2;
517 return;
518 }
519 }
520 /* we could set PIO mode timings, but we assume the BIOS did that */
521 break;
522
523 case 0x55131039: /* SiS 5591 */
524 if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) {
525 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
526 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
527 if (bootverbose)
528 ata_printf(scp, device,
529 "%s setting UDMA2 on SiS chip\n",
530 (error) ? "failed" : "success");
531 if (!error) {
532 pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
533 scp->mode[ATA_DEV(device)] = ATA_UDMA2;
534 return;
524 if (ata_find_dev(parent, 0x06301039, 0x30) || /* SiS 630 */
525 ata_find_dev(parent, 0x06331039, 0x00) || /* SiS 633 */
526 ata_find_dev(parent, 0x06351039, 0x00) || /* SiS 635 */
527 ata_find_dev(parent, 0x07301039, 0x00) || /* SiS 730 */
528 ata_find_dev(parent, 0x07331039, 0x00) || /* SiS 733 */
529 ata_find_dev(parent, 0x07351039, 0x00)) { /* SiS 735 */
530 int8_t reg = 0x40 + (devno << 1);
531 int16_t val = pci_read_config(parent, reg, 2) & 0x00ff;
532
533 if (udmamode >= 5) {
534 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
535 ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
536 if (bootverbose)
537 ata_printf(scp, device,
538 "%s setting UDMA5 on SiS chip\n",
539 (error) ? "failed" : "success");
540 if (!error) {
541 pci_write_config(parent, reg, val | 0x8100, 2);
542 scp->mode[ATA_DEV(device)] = ATA_UDMA5;
543 return;
544 }
535 }
545 }
546 if (udmamode >= 4) {
547 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
548 ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
549 if (bootverbose)
550 ata_printf(scp, device,
551 "%s setting UDMA4 on SiS chip\n",
552 (error) ? "failed" : "success");
553 if (!error) {
554 pci_write_config(parent, reg, val | 0x8200, 2);
555 scp->mode[ATA_DEV(device)] = ATA_UDMA4;
556 return;
557 }
558 }
559 if (udmamode >= 2) {
560 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
561 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
562 if (bootverbose)
563 ata_printf(scp, device,
564 "%s setting UDMA2 on SiS chip\n",
565 (error) ? "failed" : "success");
566 if (!error) {
567 pci_write_config(parent, reg, val | 0x8500, 2);
568 scp->mode[ATA_DEV(device)] = ATA_UDMA2;
569 return;
570 }
571 }
572 } else if (ata_find_dev(parent, 0x05301039, 0) || /* SiS 530 */
573 ata_find_dev(parent, 0x05401039, 0) || /* SiS 540 */
574 ata_find_dev(parent, 0x06201039, 0) || /* SiS 620 */
575 ata_find_dev(parent, 0x06301039, 0)) { /* SiS 630 */
576 int8_t reg = 0x40 + (devno << 1);
577 int16_t val = pci_read_config(parent, reg, 2) & 0x0fff;
578
579 if (udmamode >= 4) {
580 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
581 ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
582 if (bootverbose)
583 ata_printf(scp, device,
584 "%s setting UDMA4 on SiS chip\n",
585 (error) ? "failed" : "success");
586 if (!error) {
587 pci_write_config(parent, reg, val | 0x9000, 2);
588 scp->mode[ATA_DEV(device)] = ATA_UDMA4;
589 return;
590 }
591 }
592 if (udmamode >= 2) {
593 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
594 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
595 if (bootverbose)
596 ata_printf(scp, device,
597 "%s setting UDMA2 on SiS chip\n",
598 (error) ? "failed" : "success");
599 if (!error) {
600 pci_write_config(parent, reg, val | 0xb000, 2);
601 scp->mode[ATA_DEV(device)] = ATA_UDMA2;
602 return;
603 }
604 }
605 } else { /* SiS 5591 */
606 if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) {
607 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
608 ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
609 if (bootverbose)
610 ata_printf(scp, device,
611 "%s setting UDMA2 on SiS chip\n",
612 (error) ? "failed" : "success");
613 if (!error) {
614 pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
615 scp->mode[ATA_DEV(device)] = ATA_UDMA2;
616 return;
617 }
618 }
536 }
537 if (wdmamode >=2 && apiomode >= 4) {
538 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
539 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
540 if (bootverbose)
541 ata_printf(scp, device,
542 "%s setting WDMA2 on SiS chip\n",
543 (error) ? "failed" : "success");

--- 664 unchanged lines hidden ---
619 }
620 if (wdmamode >=2 && apiomode >= 4) {
621 error = ata_command(scp, device, ATA_C_SETFEATURES, 0,
622 ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
623 if (bootverbose)
624 ata_printf(scp, device,
625 "%s setting WDMA2 on SiS chip\n",
626 (error) ? "failed" : "success");

--- 664 unchanged lines hidden ---